vegui. menu. class.jsSummary | | | | | | | | | | | | | | | | | These child elements are all accessable over *this.[child_name] even though they may not all be direct children of this element | | These flags are enabled by default for this element | | When an item is added via the add_item method then it will also be added to the Items property of the menu. | | | | | | | | | | | | | | | | Befriends several menues, making sure only one of them can be open at the same time | | | | Close this menu and all open sub menues | | | | | | Clears the menu of all items | | | | | | Starts a timer that will close the menu in this.<closeTime> ms. | | Checks if this or any of the child menues of this menu is active | | Links another VegUIMenu element as a subment to this menu. | | | | Sets the most common template properties of this menu | | | | | | | | | | | | These flags are turned on for this element by default | | | | | | | | | | | | Sets the most common template properties for the menu item |
VegUIMenuThe popup menu widget. Summary | | | | | | | These child elements are all accessable over *this.[child_name] even though they may not all be direct children of this element | | These flags are enabled by default for this element | | When an item is added via the add_item method then it will also be added to the Items property of the menu. | | | | | | | | | | | | | | | | Befriends several menues, making sure only one of them can be open at the same time | | | | Close this menu and all open sub menues | | | | | | Clears the menu of all items | | | | | | Starts a timer that will close the menu in this.<closeTime> ms. | | Checks if this or any of the child menues of this menu is active | | Links another VegUIMenu element as a subment to this menu. | | | | Sets the most common template properties of this menu |
Hierarchyextends VegUINode Inherits all properties and methods from VegUINode VegUINode | +-- VegUIMenu
Child ElementsThese child elements are all accessable over *this.[child_name] even though they may not all be direct children of this element | Skin | VegUINode, the skin node of the menu | | Table | VegUINode, the table that holds the items | | Tbody | VegUINode, controlls the tbody node in the table | | TRow | VegUIMenuItem, Template row, all rows added will be cloned from this template |
Item Index ExplanationWhen an item is added via the add_item method then it will also be added to the Items property of the menu. myMenu.add_item('item 1'); // index 0 myMenu.add_item('item 2'); // index 1 myMenu.add_item('item 3'); // index 2
So item1 could be accessed by myMenu.Items[0]
Object Properties| Items | Array , holds the VegUIMenuItem objects in this menu | | RootMenu | VegUIMenu, holds a pointer to the root menu of this menu | | ParentMenu | VegUIMenu, holds a pointer to the parent menu of this menu | | ChildMenu | Array, holds all the sub menues of this menu | | FriendMenu | Array, holds all the befriended menues of this menu | | closeTime | int, time it takes before the menu is closed after the mouse cursor has left it | | arrowImg | string, path of the image to use for the arrow that indicates a nested menu | | nestedSpace | int, space between this menu and its child menu | | fxNoFade | bool, if true there will be no fade effects even if init_fx was called on the manager | | fxFadeTime | int, time of fade effect (ms) | | fxFadeLimitIn | int, limit of fade in effect, if set the fade effect will be halted at the selected value (0-100) | | noCorrection | bool if true the menu will be allowed to go outside of the manager node’s proportions. If false (default) then it will auto correct it’s position on popup should it be positioned outside of the manager’s borders. |
add_item| this.add_item = function( | content, | | script, | | lIcon | ) |
|
Adds an item to the menu Parameters| string content | text of the item | | <function script> | function to execute when the item is clicked | | string lIcon | path of the image that is to be displayed on the left side of the item |
Returns| VegUIMenuItem | returns the created item |
See alsoflush ExampleMenu.add_item('Item Description', function() { alert('clicked'); }, 'icon.gif');
befriend| this.befriend = function( | FMArr, | | noSpread | ) |
|
Befriends several menues, making sure only one of them can be open at the same time Parameters| Array FMArr | array holding menues to be friend, this array also needs to hold a pointer to this menu for it to work correctly |
NoteThe befriend method only needs to be called on one menu, it will call the befriend method on the other menues automatically See alsoclose_friends Example Menu1.befriend([Menu1,Menu2]);
build_menu| this.build = this.build_menu = function( | toNode | ) |
|
Builds the menu private function You should always use VegUIManager::build_element to build VegUI elements Aliasbuild() Parameters| <HTMLNode toNode> | if submitted the created HTML node will be appended to toNode |
Returns| null | on failure | | int | 1 on success |
See ParentVegUINode::build_node
close_children| this.close_children = function() |
Closes all child menues See alsoclose_friends, popup
flushClears the menu of all items See alsoadd_item
get_open| this.get_open = function() |
Returns| VegUIMenu | the child menu (sub menu) that is currently open for this menu | | null | if no child menu is open |
See alsoget_tail
get_tail| this.get_tail = function() |
Best function name EVER Returns| VegUIMenu | The child menu on the end of the open child menu chain | | VegUIMenu | this, if no child menues are open |
init_close| this.init_close = function() |
Starts a timer that will close the menu in this.<closeTime> ms. If the mouse enters the menu before the timer has run out the process is interrupted. See alsoclose, popup
is_active| this.is_active = function() |
Checks if this or any of the child menues of this menu is active
link_menu| this.link_menu = function( | itemIdx, | | Menu | ) |
|
Links another VegUIMenu element as a subment to this menu. If the mouse hovers over the item that links to the submenu it is opened. Parameters| int itemIdx | item index of the item that shall link to the sub menu. Item Index Explanation | | VegUIMenu Menu | the menu that shall be the submenu |
See alsobefriend Example Menu.add_item('Item 1');
Menu.link_menu(0, Menu2);
popup| this.popup = function( | x, | | y | ) |
|
Shows the menu. If coordinates are submitted the menu will be moved to those coordinates first. If no coordinates are submitted and the manu is a submenu of another menu then it will be moved to be besides the menu item that links to it. Parameters| <int x> | x position (pixels) | | <int y> | y position (pixels) |
See alsoclose, init_close
set_menu| this.set = this.set_menu = function( | x, | | y, | | w, | | closeTime, | | cN, | | arrowImg, | | nSpace | ) |
|
Sets the most common template properties of this menu Aliasset() Parameters| int x | x position (pixels) | | int y | y position (pixels) | | int w | width (pixels) | | int closeTime | the time it takes for the menu to close after the mouse cursor has left it (ms) | | string cN | Css class to use for the menu | | string arrowImg | path of the image to use for the icon that indicates a sub menu | | int nSpace | space between a parent menu and a submenu |
See ParentVegUINode::set_node
VegUIMenuItemAn item in VegUIMenu object Summary | | | | | | | | | These flags are turned on for this element by default | | | | | | | | | | | | Sets the most common template properties for the menu item |
Hierarchyextends VegUIButton Inherits all properties and methods from VegUIButton VegUINode | +-- VegUIButton | +-- VegUIMenuItem
Template Properties| T.label | string, text of the item | | T.rIconImg | string, path of the right icon image | | T.lIconImg | string, path of the left icon image | | T.lIconW | int, width of the left cell | | T.rIconW | int, width of the right cell |
build_mnuitem| this.build = this.build_mnuitem = function( | toNode | ) |
|
Builds the menu item Aliasbuild() Parameters| <HTMLNode toNode> | if submitted the created html node will be appended to toNode |
Returns| null | on failure | | int | 1 on success |
See ParentVegUIButton::build_button, VegUINode::build_node
set_mnuitem| this.set = this.set_mnuitem = function( | content, | | script, | | lIcon, | | rIcon, | | h, | | lIconW, | | rIconW, | | nClass, | | hClass | ) |
|
Sets the most common template properties for the menu item Aliasset() Parameters| string content | text of the item | | function script | script to be executed when the item is clicked | | string lIcon | path of the image to use for the left icon graphic | | string rIcon | path of the image to use for the right icon graphic | | int h | height (pixels) | | int lIconW | width of the left cell (pixels) | | int rIconW | width of the right cell (pixels) | | string nClass | CSS class to use for item when mouse is not touching it | | string hClass | CSS class to use for item when mouse is touching it |
See ParentVegUIButton::set_button, VegUINode::set_node
|