Constructor
new MenuPanel(act, ps, $divopt)
MenuPanel constructor
| Name | Type | Attributes | Description | 
|---|---|---|---|
act | module:Activity. | The   | |
ps | module:JClicPlayer. | Any object implementing the methods defined in the  | |
$div | external:jQuery | <optional> | The jQuery DOM element where this Panel will deploy  | 
- Source
 
Extends
Members
$animatedBg :external:jQuery
Background element (currently a span) used to place animated GIFs when needed
- Source
 
$animatedBgB :external:jQuery
Additional background element for animated GIFs, used in associations
- Source
 
$canvas :external:jQuery
The jQuery main canvas element used by this panel
- Source
 
$div :external:jQuery
The jQuery div element used by this panel
- Overrides
 - Source
 
accessibleCanvas :boolean
Always true, since canvas hit regions have been deprecated!
See: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility
- boolean
 
- Source
 
act :module:Activity.Activity
The Activity this panel is related to
- Overrides
 - Source
 
bc :module:boxes/BoxConnector.BoxConnector
The object used to connect cells and other elements in some types of activity
- Overrides
 - Source
 
bgImage :external:HTMLImageElement
The realized image used as a background
- Source
 
currentItem :number
Currently selected item. Used in some types of activities.
- number
 
- Source
 
dim :module:AWT.Dimension
The Dimension of the Rectangle
- Overrides
 
events :Array.<string>
List of events intercepted by this ActivityPanel. Current events are: 'keydown', 'keyup',
'keypress', 'mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', 'mouseenter',
'mouseleave', 'mouseover', 'mouseout', 'touchstart', 'touchend', 'touchmove' and 'touchcancel'.
- Array.<string>
 
- Overrides
 - Source
 
firstRun :boolean
true if the activity is running for first time (not due to a click on the replay button)
- boolean
 
- Source
 
invalidatedRect :module:AWT.Rectangle
The currently "invalidated" area
minimumSize :module:AWT.Dimension
The minimum size of this kind of ActivityPanel
- Source
 
playing :boolean
true while the activity is playing
- boolean
 
- Source
 
pos :module:AWT.Point
The current position of the shape
- Overrides
 
preferredSize :module:AWT.Dimension
The preferred size of this kind of ActivityPanel
- Source
 
ps :module:JClicPlayer.JClicPlayer
The PlayStation used to realize media objects and communicate with the player services
(usually a JClicPlayer
- Overrides
 - Source
 
skin :module:skins/Skin.Skin
The realized current Skin
- Overrides
 - Source
 
solved :boolean
true when the activity is solved, false otherwise
- boolean
 
- Overrides
 - Source
 
type :string
Shape type id
- string
 
- Overrides
 
(static) icons :object
Default icons used in buttons, inherited from JClic
- object
 
Methods
activityReady()
Called by JClicPlayer when this activity panel is fully visible, just after the
initialization process.
- Source
 
add(shape) → {module:AWT.Rectangle}
Adds the boundaries of another shape to the current one
| Name | Type | Description | 
|---|---|---|
shape | module:AWT. | The   | 
- Overrides
 
- Type:
 - module:AWT.
Rectangle  
attachEvent($obj, evt)
Attaches a single event to the specified object
| Name | Type | Description | 
|---|---|---|
$obj | external:jQuery | The object to which the event will be attached  | 
evt | string | The event name  | 
- Source
 
attachEvents()
Attaches the events specified in the events member to the $div member
- Source
 
buildAccessibleComponents()
Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.
- Source
 
buildVisualComponents()
Prepares the visual components of the activity
- Source
 
clear()
Miscellaneous cleaning operations
- Overrides
 - Source
 
clip(ctx, fillRuleopt) → {external:CanvasRenderingContext2D}
Creates a clipping region on the specified HTML canvas 2D rendering context
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
ctx | external:CanvasRenderingContext2D | The rendering context  | ||
fillRule | string | <optional> | 'nonzero' | Can be 'nonzero' (default when not set) or 'evenodd'  | 
- Overrides
 
- The provided rendering context
 
clone() → {module:AWT.Rectangle}
Clones this Rectangle
- Overrides
 
- Type:
 - module:AWT.
Rectangle  
contains(_p) → {boolean}
Checks if the provided module:AWT.Point is inside this shape.
| Name | Type | Description | 
|---|---|---|
_p | module:AWT. | The point to check  | 
- Type:
 - boolean
 
enableCounters(eTime, eScore, eActions)
Enables or disables the three counters (time, score and actions)
| Name | Type | Description | 
|---|---|---|
eTime | boolean | Whether to enable or disable the time counter  | 
eScore | boolean | Whether to enable or disable the score counter  | 
eActions | boolean | Whether to enable or disable the actions counter  | 
- Source
 
end()
Ends the activity
- Overrides
 - Source
 
equals(r) → {boolean}
Checks if two shapes are equivalent.
| Name | Type | Description | 
|---|---|---|
r | module:AWT. | The Shape to compare against  | 
- Overrides
 
- Type:
 - boolean
 
fill(ctx, dirtyRegionopt) → {external:CanvasRenderingContext2D}
Fills the Shape with the current style in the provided HTML canvas context
| Name | Type | Attributes | Description | 
|---|---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas 2D rendering context where to fill this shape.  | |
dirtyRegion | module:AWT. | <optional> | The context region to be updated. Used as clipping  | 
- Overrides
 
- The provided rendering context
 
finishActivity(result)
Ordinary ending of the activity, usually called form processEvent
| Name | Type | Description | 
|---|---|---|
result | boolean | 
  | 
- Source
 
fitTo(proposed, bounds)
Fits the panel within the proposed rectangle. The panel can occupy more space, but always
not surpassing the bounds rectangle.
| Name | Type | Description | 
|---|---|---|
proposed | module:AWT. | The proposed rectangle  | 
bounds | module:AWT. | The maximum allowed bounds  | 
- Overrides
 - Source
 
forceFinishActivity()
Forces the ending of the activity.
- Source
 
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- The resulting object, with minimal attrributes
 
- Type:
 - object
 
getBounds() → {module:AWT.Rectangle}
Gets the enclosing Rectangle of this Shape.
- Type:
 - module:AWT.
Rectangle  
getCoords() → {string}
Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
(with values rounded to int)
- Type:
 - string
 
getOppositeVertex() → {module:AWT.Point}
Gets the module:AWT.Point corresponding to the lower-right vertex of the Rectangle.
- Type:
 - module:AWT.
Point  
getShape(rect) → {module:AWT.Shape}
Gets a clone of this shape moved to the pos component of the rectangle and scaled
by its dim value.
| Name | Type | Description | 
|---|---|---|
rect | module:AWT. | The rectangle to be taken as a base for moving and scaling  | 
- Type:
 - module:AWT.
Shape  
grow(dx, dy) → {module:AWT.Rectangle}
Expands the boundaries of this shape. This affects the current position and dimension.
| Name | Type | Description | 
|---|---|---|
dx | number | The amount to grow (or decrease) in horizontal direction  | 
dy | number | The amount to grow (or decrease) in vertical direction  | 
- Overrides
 
- Type:
 - module:AWT.
Rectangle  
initActivity()
Basic initialization procedure
intersects(_r) → {boolean}
Checks if the provided Rectangle r intersects with this shape.
| Name | Type | Description | 
|---|---|---|
_r | module:AWT. | 
- Type:
 - boolean
 
invalidate(rect)
Adds the provided rectangle to the invalidated area.
| Name | Type | Description | 
|---|---|---|
rect | module:AWT. | 
isRect() → {boolean}
Shorthand method for determining if a Shape is an Rectangle
- Overrides
 
- Type:
 - boolean
 
moveBy(delta) → {module:AWT.Shape}
Shifts the shape a specified amount in horizontal and vertical directions
| Name | Type | Description | 
|---|---|---|
delta | Point | | The amount to shift the Shape  | 
- Overrides
 
- Type:
 - module:AWT.
Shape  
moveTo(newPos) → {module:AWT.Shape}
Moves this shape to a new position
| Name | Type | Description | 
|---|---|---|
newPos | module:AWT. | The new position of the shape  | 
- Overrides
 
- Type:
 - module:AWT.
Shape  
playEvent(event)
Plays the specified event sound
| Name | Type | Description | 
|---|---|---|
event | string | The type of event to be performed  | 
- Source
 
preparePath(ctx) → {external:CanvasRenderingContext2D}
Prepares an HTML canvas 2D rendering context with a path that can be used to stroke a line,
to fill a surface or to define a clipping region.
| Name | Type | Description | 
|---|---|---|
ctx | external:CanvasRenderingContext2D | 
- The provided rendering context
 
processEvent(event) → {boolean}
Main handler used to process mouse, touch, keyboard and edit events.
| Name | Type | Description | 
|---|---|---|
event | external:Event | The HTML event to be processed  | 
- Source
 
- When this event handler returns 
false, jQuery will stop its
propagation through the DOM tree. See: http://api.jquery.com/on 
- Type:
 - boolean
 
scaleBy(delta) → {module:AWT.Rectangle}
Multiplies the dimension of the Shape by the specified delta amount.
| Name | Type | Description | 
|---|---|---|
delta | Point | | Object containing the X and Y ratio to be scaled.  | 
- Type:
 - module:AWT.
Rectangle  
setAndPlayMsg(msgCode, eventSoundsCodeopt)
Sets the message to be displayed in the skin message box and optionally plays a sound event.
| Name | Type | Attributes | Description | 
|---|---|---|---|
msgCode | string | Type of message (initial, final, finalError...)  | |
eventSoundsCode | string | <optional> | Optional name of the event sound to be played.  | 
- Source
 
setAttributes(data) → {module:AWT.Rectangle}
Reads the properties of this Rectangle from a data object
| Name | Type | Description | 
|---|---|---|
data | object | The data object to be parsed  | 
- Type:
 - module:AWT.
Rectangle  
setBounds(rect)
Sets the size and position of this activity panel
| Name | Type | Description | 
|---|---|---|
rect | module:AWT. | 
- Source
 
setDimension(preferredMaxSize) → {module:AWT.Dimension}
Sets the real dimension of this panel.
| Name | Type | Description | 
|---|---|---|
preferredMaxSize | module:AWT. | The maximum surface available for the activity panel  | 
- Type:
 - module:AWT.
Dimension  
showHelp()
Displays help about the activity
- Source
 
shuffle(bg, visible, fitInArea)
Shuffles the contents of the activity
| Name | Type | Description | 
|---|---|---|
bg | Array.<module:boxes/ActiveBoxBag.ActiveBoxBag> | The sets of boxes to be shuffled  | 
visible | boolean | The shuffle process must be animated on the screen (not yet implemented!)  | 
fitInArea | boolean | Shuffled pieces cannot go out of the current area  | 
- Source
 
startActivity()
Called when the activity starts playing
- Source
 
stroke(ctx) → {external:CanvasRenderingContext2D}
Draws this shape in the provided HTML canvas 2D rendering context.
| Name | Type | Description | 
|---|---|---|
ctx | external:CanvasRenderingContext2D | The canvas 2D rendering context where to draw the shape.  | 
- Overrides
 
- The provided rendering context
 
toString() → {string}
Overwrites the original 'Object.toString' method with a more descriptive text
- Type:
 - string
 
update()
Updates the invalidated area
- Overrides
 
updateContent(dirtyRegion)
Activities should implement this method to update the graphic content of its panel. The method
will be called from module:AWT.Container#update when needed.
| Name | Type | Description | 
|---|---|---|
dirtyRegion | module:AWT. | Specifies the area to be updated. When   | 
- Source