|
GUI Control which displays a horizontal bar with individual drop-down menu items. Each menu item may also have submenu items. More...
Public Member Functions | |
void | addMenu (string menuText, int menuId) |
Adds a new menu to the menu bar. | |
void | addMenuItem (string targetMenu="", string menuItemText="", int menuItemId=0, string accelerator=NULL, int checkGroup=-1) |
Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id. | |
void | addSubmenuItem (string menuTarget, string menuItem, string submenuItemText, int submenuItemId, string accelerator, int checkGroup) |
Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id. | |
void | clearMenuItems (string menuTarget) |
Removes all the menu items from the specified menu. | |
void | clearMenus (int param1, int param2) |
Clears all the menus from the menu bar. | |
void | clearSubmenuItems (string menuTarget, string menuItem) |
Removes all the menu items from the specified submenu. | |
void | removeMenu (string menuTarget) |
Removes the specified menu from the menu bar. | |
void | removeMenuItem (string menuTarget, string menuItemTarget) |
Removes the specified menu item from the menu. | |
void | setCheckmarkBitmapIndex (int bitmapindex) |
Sets the menu bitmap index for the check mark image. | |
void | setMenuBitmapIndex (string menuTarget, int bitmapindex, bool bitmaponly, bool drawborder) |
Sets the bitmap index for the menu and toggles rendering only the bitmap. | |
void | setMenuItemBitmap (string menuTarget, string menuItemTarget, int bitmapIndex) |
Sets the specified menu item bitmap index in the bitmap array. Setting the item's index to -1 will remove any bitmap. | |
void | setMenuItemChecked (string menuTarget, string menuItemTarget, bool checked) |
Sets the menu item bitmap to a check mark, which by default is the first element in the bitmap array (although this may be changed with setCheckmarkBitmapIndex()). Any other menu items in the menu with the same check group become unchecked if they are checked. | |
void | setMenuItemEnable (string menuTarget, string menuItemTarget, bool enabled) |
sets the menu item to enabled or disabled based on the enable parameter. The specified menu and menu item can either be text or ids. | |
void | setMenuItemSubmenuState (string menuTarget, string menuItem, bool isSubmenu) |
Sets the given menu item to be a submenu. | |
void | setMenuItemText (string menuTarget, string menuItemTarget, string newMenuItemText) |
Sets the text of the specified menu item to the new string. | |
void | setMenuItemVisible (string menuTarget, string menuItemTarget, bool isVisible) |
Brief Description. | |
void | setMenuMargins (int horizontalMargin, int verticalMargin, int bitmapToTextSpacing) |
Sets the menu rendering margins: horizontal, vertical, bitmap spacing. | |
void | setMenuText (string menuTarget, string newMenuText) |
Sets the text of the specified menu to the new string. | |
void | setMenuVisible (string menuTarget, bool visible) |
Sets the whether or not to display the specified menu. | |
void | setSubmenuItemChecked (string menuTarget, string menuItemTarget, string submenuItemText, bool checked) |
Sets the menu item bitmap to a check mark, which by default is the first element in the bitmap array (although this may be changed with setCheckmarkBitmapIndex()). Any other menu items in the menu with the same check group become unchecked if they are checked. | |
Callbacks | |
void | onMenuItemSelect (string menuId, string menuText, string menuItemId, string menuItemText) |
Called whenever an item in a menu is selected. | |
void | onMenuSelect (string menuId, string menuText) |
Called whenever a menu is selected. | |
void | onMouseInMenu (bool isInMenu) |
Called whenever the mouse enters, or persists is in the menu. | |
void | onSubmenuSelect (string submenuId, string submenuText) |
Called whenever a submenu is selected. | |
Public Attributes | |
int | padding |
Extra padding to add to the bounds of the control. |
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);
void GuiMenuBar::addMenu | ( | string | menuText, | |
int | menuId | |||
) |
Adds a new menu to the menu bar.
menuText | Text to display for the new menu item. | |
menuId | ID for the new menu item. |
// Define the menu text %menuText = "New Menu"; // Define the menu ID. %menuId = "2"; // Inform the GuiMenuBar control to add the new menu %thisGuiMenuBar.addMenu(%menuText,%menuId);
void GuiMenuBar::addMenuItem | ( | string | targetMenu = "" , |
|
string | menuItemText = "" , |
|||
int | menuItemId = 0 , |
|||
string | accelerator = NULL , |
|||
int | checkGroup = -1 | |||
) |
Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.
menu | Menu name or menu Id to add the new item to. | |
menuItemText | Text for the new menu item. | |
menuItemId | Id for the new menu item. | |
accelerator | Accelerator key for the new menu item. | |
checkGroup | Check group to include this menu item in. |
// Define the menu we wish to add the item to %targetMenu = "New Menu"; or %menu = "4"; // Define the text for the new menu item %menuItemText = "Menu Item"; // Define the id for the new menu item %menuItemId = "3"; // Set the accelerator key to toggle this menu item with %accelerator = "n"; // Define the Check Group that this menu item will be in, if we want it to be in a check group. -1 sets it in no check group. %checkGroup = "4"; // Inform the GuiMenuBar control to add the new menu item with the defined fields %thisGuiMenuBar.addMenuItem(%menu,%menuItemText,%menuItemId,%accelerator,%checkGroup);
void GuiMenuBar::addSubmenuItem | ( | string | menuTarget, | |
string | menuItem, | |||
string | submenuItemText, | |||
int | submenuItemId, | |||
string | accelerator, | |||
int | checkGroup | |||
) |
Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.
menuTarget | Menu to affect a submenu in | |
menuItem | Menu item to affect | |
submenuItemText | Text to show for the new submenu | |
submenuItemId | Id for the new submenu | |
accelerator | Accelerator key for the new submenu | |
checkGroup | Which check group the new submenu should be in, or -1 for none. |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "5"; // Define the text for the new submenu %submenuItemText = "New Submenu Item"; // Define the id for the new submenu %submenuItemId = "4"; // Define the accelerator key for the new submenu %accelerator = "n"; // Define the checkgroup for the new submenu %checkgroup = "7"; // Request the GuiMenuBar control to add the new submenu with the defined information %thisGuiMenuBar.addSubmenuItem(%menuTarget,%menuItem,%submenuItemText,%submenuItemId,%accelerator,%checkgroup);
void GuiMenuBar::clearMenuItems | ( | string | menuTarget | ) |
Removes all the menu items from the specified menu.
menuTarget | Menu to remove all items from |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Inform the GuiMenuBar control to clear all menu items from the defined menu %thisGuiMenuBar.clearMenuItems(%menuTarget);
void GuiMenuBar::clearMenus | ( | int | param1, | |
int | param2 | |||
) |
Clears all the menus from the menu bar.
// Inform the GuiMenuBar control to clear all menus from itself.
%thisGuiMenuBar.clearMenus();
void GuiMenuBar::clearSubmenuItems | ( | string | menuTarget, | |
string | menuItem | |||
) |
Removes all the menu items from the specified submenu.
menuTarget | Menu to affect a submenu in | |
menuItem | Menu item to affect |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "5"; // Inform the GuiMenuBar to remove all submenu items from the defined menu item %thisGuiMenuBar.clearSubmenuItems(%menuTarget,%menuItem);
void GuiMenuBar::onMenuItemSelect | ( | string | menuId, | |
string | menuText, | |||
string | menuItemId, | |||
string | menuItemText | |||
) |
Called whenever an item in a menu is selected.
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 }
void GuiMenuBar::onMenuSelect | ( | string | menuId, | |
string | menuText | |||
) |
Called whenever a menu is selected.
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 }
void GuiMenuBar::onMouseInMenu | ( | bool | isInMenu | ) |
Called whenever the mouse enters, or persists is in the menu.
isInMenu | True if the mouse has entered the menu, otherwise is false. |
// Mouse enters or persists within the menu, causing the callback to occur. GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu) { // Code to run when the callback occurs }
void GuiMenuBar::onSubmenuSelect | ( | string | submenuId, | |
string | submenuText | |||
) |
Called whenever a submenu is selected.
submenuId | Id of the selected submenu | |
submenuText | Text of the selected submenu |
GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText) { // Code to run when the callback occurs }
void GuiMenuBar::removeMenu | ( | string | menuTarget | ) |
Removes the specified menu from the menu bar.
menuTarget | Menu to remove from the menu bar |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Inform the GuiMenuBar to remove the defined menu from the menu bar %thisGuiMenuBar.removeMenu(%menuTarget);
void GuiMenuBar::removeMenuItem | ( | string | menuTarget, | |
string | menuItemTarget | |||
) |
Removes the specified menu item from the menu.
menuTarget | Menu to affect the menu item in | |
menuItem | Menu item to affect |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "5"; // Request the GuiMenuBar control to remove the define menu item %thisGuiMenuBar.removeMenuItem(%menuTarget,%menuItem);
void GuiMenuBar::setCheckmarkBitmapIndex | ( | int | bitmapindex | ) |
Sets the menu bitmap index for the check mark image.
bitmapIndex | Bitmap index for the check mark image. |
// Define the bitmap index %bitmapIndex = "2"; // Inform the GuiMenuBar control of the proper bitmap index for the check mark image %thisGuiMenuBar.setCheckmarkBitmapIndex(%bitmapIndex);
void GuiMenuBar::setMenuBitmapIndex | ( | string | menuTarget, | |
int | bitmapindex, | |||
bool | bitmaponly, | |||
bool | drawborder | |||
) |
Sets the bitmap index for the menu and toggles rendering only the bitmap.
menuTarget | Menu to affect | |
bitmapindex | Bitmap index to set for the menu | |
bitmaponly | If true, only the bitmap will be rendered | |
drawborder | If true, a border will be drawn around the menu. |
// Define the menuTarget to affect %menuTarget = "New Menu"; or %menuTarget = "3"; // Set the bitmap index %bitmapIndex = "5"; // Set if we are only to render the bitmap or not %bitmaponly = "true"; // Set if we are rendering a border or not %drawborder = "true"; // Inform the GuiMenuBar of the bitmap and rendering changes %thisGuiMenuBar.setMenuBitmapIndex(%menuTarget,%bitmapIndex,%bitmapOnly,%drawBorder);
void GuiMenuBar::setMenuItemBitmap | ( | string | menuTarget, | |
string | menuItemTarget, | |||
int | bitmapIndex | |||
) |
Sets the specified menu item bitmap index in the bitmap array. Setting the item's index to -1 will remove any bitmap.
menuTarget | Menu to affect the menuItem in | |
menuItem | Menu item to affect | |
bitmapIndex | Bitmap index to set the menu item to |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem" %menuItem = "New Menu Item"; or %menuItem = "2"; // Define the bitmapIndex %bitmapIndex = "6"; // Inform the GuiMenuBar control to set the menu item to the defined bitmap %thisGuiMenuBar.setMenuItemBitmap(%menuTarget,%menuItem,%bitmapIndex);
void GuiMenuBar::setMenuItemChecked | ( | string | menuTarget, | |
string | menuItemTarget, | |||
bool | checked | |||
) |
Sets the menu item bitmap to a check mark, which by default is the first element in the bitmap array (although this may be changed with setCheckmarkBitmapIndex()). Any other menu items in the menu with the same check group become unchecked if they are checked.
menuTarget | Menu to work in | |
menuItem | Menu item to affect | |
checked | Whether we are setting it to checked or not |
void GuiMenuBar::setMenuItemEnable | ( | string | menuTarget, | |
string | menuItemTarget, | |||
bool | enabled | |||
) |
sets the menu item to enabled or disabled based on the enable parameter. The specified menu and menu item can either be text or ids.
Detailed description
menuTarget | Menu to work in | |
menuItemTarget | The menu item inside of the menu to enable or disable | |
enabled | Boolean enable / disable value. |
// Define the menu %menu = "New Menu"; or %menu = "4"; // Define the menu item %menuItem = "New Menu Item"; or %menuItem = "2"; // Define the enabled state %enabled = "true"; // Inform the GuiMenuBar control to set the enabled state of the requested menu item %thisGuiMenuBar.setMenuItemEnable(%menu,%menuItme,%enabled);
void GuiMenuBar::setMenuItemSubmenuState | ( | string | menuTarget, | |
string | menuItem, | |||
bool | isSubmenu | |||
) |
Sets the given menu item to be a submenu.
menuTarget | Menu to affect a submenu in | |
menuItem | Menu item to affect | |
isSubmenu | Whether or not the menuItem will become a subMenu or not |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "5"; // Define whether or not the Menu Item is a sub menu or not %isSubmenu = "true"; // Inform the GuiMenuBar control to set the defined menu item to be a submenu or not. %thisGuiMenuBar.setMenuItemSubmenuState(%menuTarget,%menuItem,%isSubmenu);
void GuiMenuBar::setMenuItemText | ( | string | menuTarget, | |
string | menuItemTarget, | |||
string | newMenuItemText | |||
) |
Sets the text of the specified menu item to the new string.
menuTarget | Menu to affect | |
menuItem | Menu item in the menu to change the text at | |
newMenuItemText | New menu text |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "4"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "2"; // Define the new text for the menu item %newMenuItemText = "Very New Menu Item"; // Inform the GuiMenuBar control to change the defined menu item with the new text %thisGuiMenuBar.setMenuItemText(%menuTarget,%menuItem,%newMenuItemText);
void GuiMenuBar::setMenuItemVisible | ( | string | menuTarget, | |
string | menuItemTarget, | |||
bool | isVisible | |||
) |
Brief Description.
Detailed description
menuTarget | Menu to affect the menu item in | |
menuItem | Menu item to affect | |
isVisible | Visible state to set the menu item to. |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "2"; // Define the visibility state %isVisible = "true"; // Inform the GuiMenuBarControl of the visibility state of the defined menu item %thisGuiMenuBar.setMenuItemVisible(%menuTarget,%menuItem,%isVisible);
void GuiMenuBar::setMenuMargins | ( | int | horizontalMargin, | |
int | verticalMargin, | |||
int | bitmapToTextSpacing | |||
) |
Sets the menu rendering margins: horizontal, vertical, bitmap spacing.
Detailed description
horizontalMargin | Number of pixels on the left and right side of a menu's text. | |
verticalMargin | Number of pixels on the top and bottom of a menu's text. | |
bitmapToTextSpacing | Number of pixels between a menu's bitmap and text. |
// Define the horizontalMargin %horizontalMargin = "5"; // Define the verticalMargin %verticalMargin = "5"; // Define the bitmapToTextSpacing %bitmapToTextSpacing = "12"; // Inform the GuiMenuBar control to set its margins based on the defined values. %thisGuiMenuBar.setMenuMargins(%horizontalMargin,%verticalMargin,%bitmapToTextSpacing);
void GuiMenuBar::setMenuText | ( | string | menuTarget, | |
string | newMenuText | |||
) |
Sets the text of the specified menu to the new string.
menuTarget | Menu to affect | |
newMenuText | New menu text |
// Define the menu to affect%menu = "New Menu"; or %menu = "3"; // Define the text to change the menu to %newMenuText = "Still a New Menu"; // Inform the GuiMenuBar control to change the defined menu to the defined text %thisGuiMenuBar.setMenuText(%menu,%newMenuText);
void GuiMenuBar::setMenuVisible | ( | string | menuTarget, | |
bool | visible | |||
) |
Sets the whether or not to display the specified menu.
menuTarget | Menu item to affect | |
visible | Whether the menu item will be visible or not |
void GuiMenuBar::setSubmenuItemChecked | ( | string | menuTarget, | |
string | menuItemTarget, | |||
string | submenuItemText, | |||
bool | checked | |||
) |
Sets the menu item bitmap to a check mark, which by default is the first element in the bitmap array (although this may be changed with setCheckmarkBitmapIndex()). Any other menu items in the menu with the same check group become unchecked if they are checked.
menuTarget | Menu to affect a submenu in | |
menuItem | Menu item to affect | |
submenuItemText | Text to show for submenu | |
checked | Whether or not this submenu item will be checked. |
// Define the menuTarget %menuTarget = "New Menu"; or %menuTarget = "3"; // Define the menuItem %menuItem = "New Menu Item"; or %menuItem = "5"; // Define the text for the new submenu %submenuItemText = "Submenu Item"; // Define if this submenu item should be checked or not %checked = "true"; // Inform the GuiMenuBar control to set the checked state of the defined submenu item %thisGuiMenuBar.setSubmenuItemChecked(%menuTarget,%menuItem,%submenuItemText,%checked);
Extra padding to add to the bounds of the control.