Class GSMenuItem

A UI control providing a single menu item in a menu.

Class Summary
Constructor Attributes Constructor Name and Description
 
GSMenuItem(options)
Method Summary
Method Attributes Method Name and Description
 
addEventHandler(eventType, func)
Adds an event handler function to this menu item Any DOM Level 2 mouse event type may be specified for the eventType argument:
  • click - the click event occurs when the mouse button is clicked over the feature.
 
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified type occurring on the component's target element.
 
Gets this menu item's height
 
Gets this menu item's padding
 
Gets this menu item's width
 
Returns true if this menu item should be able to receive focus
 
Removes this menu item from it's parent menu
 
Removes the event handler function represented by the token parameter from this menu item
 
Removes the event listener function represented by the token parameter from this feature
 
Removes all registered event listeners from the component's target element
 
setEnabled(enabled)
Sets the enabled property of the menu item
 
setLabel(label)
Sets the menu items label
 
Sets the specified styles for this button
Class Detail
GSMenuItem(options)
Parameters:
{Object} options Optional
an object literal specifying the menu item options to set:
{boolean} options.enabled
when true the menu item is enabled and will respond to user events. Defaults to true
{String} options.type
the type of the menu item. Valid values are separator and check. If not specified a normal menu item will be created.
{int} options.width
the width of this menu item
{int} options.width
the height of this menu item
{String} options.padding
the menu item's padding
{String} options.icon
the URL of an icon to use with the label text. Icons are rendered to the left of the label text.
{Function} options.action
a function to be invoked when this menu item is clicked. If this menu item is not enabled the action will not be executed
Method Detail
{Object} addEventHandler(eventType, func)
Adds an event handler function to this menu item Any DOM Level 2 mouse event type may be specified for the eventType argument:
Parameters:
{String} eventType
the event that should trigger the handler function
{Function} func
the function to be invoked when the event is triggered
Deprecated:
use GSMenuItem#addEventListener instead
Returns:
{Object} a token that can be passed to the GSMenuItem.removeEventHandler() method to remove the event handler

{Object} addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified type occurring on the component's target element. This function returns a token that can be passed to the #removeEventListener to remove the event listener. If the scope argument is not passed the function will execute in the context of this object
Parameters:
{String} eventType
the event type to add the listener for. Can be one of: click, mousedown, mouseup, mouseover, mouseout
{Function} func
The function to invoke when the event is triggered
{Object} scope Optional
the scope (this reference) in which the function is executed
Throws:
{Error}
if this component does not define a reference to its DOM element
Returns:
{Object} a token that can be passed to the GSEventManager#removeEventListener to remove the event listener.

{int} getHeight()
Gets this menu item's height
Returns:
{int} the width of this menu item

{String} getPadding()
Gets this menu item's padding
Returns:
{String} the menu item's padding

{int} getWidth()
Gets this menu item's width
Returns:
{int} the width of this menu item

{boolean} isFocusTraversable()
Returns true if this menu item should be able to receive focus
Returns:
{boolean} true if the menu item is able to receive focus

remove()
Removes this menu item from it's parent menu

removeEventHandler(token)
Removes the event handler function represented by the token parameter from this menu item
Parameters:
{Object} token
a token identifying the event handler to be removed
Deprecated:
use GSMenuItem#removeEventListener instead

removeEventListener(token)
Removes the event listener function represented by the token parameter from this feature
Parameters:
{Object} token
a token identifying the event handler to be removed

removeEventListeners()
Removes all registered event listeners from the component's target element

setEnabled(enabled)
Sets the enabled property of the menu item
Parameters:
{boolean} enabled
true if the menu item should be enabled

setLabel(label)
Sets the menu items label
Parameters:
{String} label
the label to set

setStyles(an)
Sets the specified styles for this button
Parameters:
{Object} an
object literal specifying the styles to set

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Mar 07 2012 11:47:29 GMT+1300 (NZDT)