class
GUIMenuBar
A menu bar GUI element that contains a horizontal list of elements that can each be expanded into a hierarchical sub-menus, as well as a list of tool bar buttons.
Contents of the menu and tool bar are customizable.
The menu bar also displays the minimize, maximize and close buttons for the window.
Public
Constructors
GUIMenuBar
Constructs a new menu bar.
- parent
- Parent GUI widget the menu bar will be docked in.
- parentWindow
- Window to trigger the min/max/close events on.
Methods
staticGetLogoStyleType
Returns the style type for the menu bar logo.
staticGetToolBarButtonStyleType
Returns the style type for tool bar buttons.
~GUIMenuBar
SetArea
Sets the area of the menu bar, in pixels relative to the parent GUI widget.
AddMenuItem
Adds a new menu item to the menu bar.
- path
- Path to the menu item. Each element of the path must be separated using "/". First element of the path will create the top level menu, and any further element will create a new sub-menu. Last element will be the interactable element.
- callback
- Callback to trigger when user click on the interactable element (last element in the provided path). Can be null.
- priority
- Determines where is the element positioned compared to other elements in the same sub-menu. Higher priority elements get placed higher up in the sub-menu. This only applies to the last element. If you need to customize its parent element priority call this method with with their specific paths.
- shortcut
- Keyboard shortcut key to display next to the interactable element, and register with the global shortcut manager.
AddMenuItemSeparator
Adds a menu item separator element at the specified path.
The separator is added as a child of the path.
- path
- Parent path of the sub-menu to add the separator.
- priority
- Determines where is the separator positioned compared to other elements in the same sub-menu. Higher priority elements get placed higher up in the sub-menu.
GetMenuItem
Returns an existing menu item at the specified path, or null if one cannot be found.
RemoveMenuItem
Removes a menu item from the specified path.
If this path points to a sub-menu entire sub-menu will be removed.
AddToolBarButton
Adds a new button to the tool bar.
- name
- Unique name of the button that can be used for identifiying it.
- content
- Content to display on the button.
- callback
- Callback to trigger when the button is pressed.
- priority
- Determines where is the button positioned compared to other elements on the tool bar. Higher priority elements get placed before lower priority ones.
ToggleToolbarButton
Toggles an existing toolbar button into an on or off state which changes the visuals of the button.
- name
- Name of the existing button to toggle.
- on
- True to toggle on, false to toggle off (default).
AddToolBarSeparator
Adds a new separator element to the tool bar.
- name
- Unique name of the separator that can be used for identifiying it.
- priority
- Determines where is the separator positioned compared to other elements on the tool bar. Higher priority elements get placed before lower priority ones.
RemoveToolBarButton
Removes an element from the tool bar.
- name
- Unique name of the element to remove.
Private
Methods
GetSubMenu
Finds a top level sub-menu with the specified name.
AddNewButton
Adds a new top level sub-menu button.
StripPath
Attempts to remove the first element from the specified path.
First element returned in specified in , and original is modified so it no longer includes the first element.
Returns: False if first element doesn't exist, true otherwise.
RegisterShortcut
Registers a shortcut with the global shortcut manager.
Pressing the shortcut will trigger the provided callback.
UnregisterShortcut
Unregisters a shortcut assigned to the provided path from the global shortcut manager.
OpenSubMenu
Opens a top level sub-menu with the provided name.
CloseSubMenu
Closes any currently active sub-menu.
OnSubMenuHover
Triggered when a sub-menu is open and a user hovers over another top level sub-menu button.
- name
- Name of the sub-menu the user is hovering over.
OnSubMenuClosed
Triggered when a sub-menu is closed.
OnMinimizeClicked
Triggered when the minimize button is clicked.
Minimizes the attached window.
OnMaximizeClicked
Triggered when the maximize button is clicked.
Maximizes the attached window.
OnCloseClicked
Triggered when the close button is clicked.
Closes the attached window.
RefreshNonClientAreas
Refreshes the OS client area that allow the window to be dragged by dragging the empty areas on the menu bar.
Should be called when top level button configuration changes or menu bar area changes.