GuiMenuBar

consoledoc.h

GUI Control which displays a horizontal bar with individual drop-down menu items. Each menu item may also have submenu items.

More...

Callbacks

void
onMouseInMenu(bool isInMenu)

Called whenever the mouse enters, or persists is in the menu.

void
onMenuSelect(int menuId, string menuText)

Called whenever a menu is selected.

void
onMenuItemSelect(int menuId, string menuText, int menuItemId, string menuItemText)

Called whenever an item in a menu is selected.

Public Attributes

int

Sets the height of the menubar when attached to the canvas.

int

Extra padding to add to the bounds of the control.

Public Functions

void
attachToCanvas(string canvas, int pos)
int
findMenu(string barTitle)
int
getMenu(int index)
void
insert(SimObject pObject, int pos)

insert object at position

Detailed Description

GUI Control which displays a horizontal bar with individual drop-down menu items. Each menu item may also have submenu items.

new GuiMenuBar(newMenuBar)
{
  Padding = "0";
  //Properties not specific to this control have been omitted from this example.
};

// Add a menu to the menu bar
newMenuBar.addMenu(0,"New Menu");

// Add a menu item to the New Menu
newMenuBar.addMenuItem(0,"New Menu Item",0,"n",-1);

// Add a submenu item to the New Menu Item
newMenuBar.addSubmenuItem(0,1,"New Submenu Item",0,"s",-1);

Callbacks

onMouseInMenu(bool isInMenu)

Called whenever the mouse enters, or persists is in the menu.

Parameters:

isInMenu

True if the mouse has entered the menu, otherwise is false.

note:

To receive this callback, call setProcessTicks(true) on the menu bar.

// Mouse enters or persists within the menu, causing the callback to occur.
GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu)
{
  // Code to run when the callback occurs
}

onMenuSelect(int menuId, string menuText)

Called whenever a menu is selected.

Parameters:

menuId

Index id of the clicked menu

menuText

Text of the clicked menu

// A menu has been selected, causing the callback to occur.
GuiMenuBar::onMenuSelect(%this,%menuId,%menuText)
{
  // Code to run when the callback occurs
}

onMenuItemSelect(int menuId, string menuText, int menuItemId, string menuItemText)

Called whenever an item in a menu is selected.

Parameters:

menuId

Index id of the menu which contains the selected menu item

menuText

Text of the menu which contains the selected menu item

menuItemId

Index id of the selected menu item

menuItemText

Text of the selected menu item

// A menu item has been selected, causing the callback to occur.
GuiMenuBar::onMenuItemSelect(%this,%menuId,%menuText,%menuItemId,%menuItemText)
{
  // Code to run when the callback occurs
}

Public Attributes

int menubarHeight 

Sets the height of the menubar when attached to the canvas.

int padding 

Extra padding to add to the bounds of the control.

Public Functions

attachToCanvas(string canvas, int pos)

findMenu(string barTitle)

getMenu(int index)

getMenuCount()

insert(SimObject pObject, int pos)

insert object at position

removeFromCanvas()