class
GUIMenuItem
Holds information about a single element in a GUI menu.
Public
Constructors
GUIMenuItem
GUIMenuItem(GUIMenuItem *parent, const String &name, std::function<void ()> callback, i32 priority, u32 sequentialIndex, const ShortcutKey &key)
Constructs a new non-separator menu item.
- parent
- Parent item, if any.
- name
- Name of the item to be displayed.
- callback
- Callback to be triggered when menu items is selected.
- priority
- Priority that determines the order of this element compared to its siblings.
- sequentialIndex
- Sequential index of the menu item that specifies in what order was it added to the menu compared to other items.
- key
- Keyboard shortcut that can be used for triggering the menu item.
GUIMenuItem
GUIMenuItem(GUIMenuItem *parent, i32 priority, u32 sequentialIndex)
Constructs a new separator menu item.
- parent
- Parent item, if any.
- priority
- Priority that determines the order of this element compared to its siblings.
- sequentialIndex
- Sequential index of the menu item that specifies in what order was it added to the menu compared to other items.
Methods
~GUIMenuItem
~GUIMenuItem() noexcept
GetNumChildren
u32 GetNumChildren() const
Returns number of child menu items.
GetName
const String &GetName() const
Returns name of the menu item.
Empty if separator.
GetCallback
std::function<void ()> GetCallback() const
Returns callback that will trigger when menu item is selected.
Null for separators.
GetShortcut
Returns a keyboard shortcut that may be used for triggering the menu item callback.
IsSeparator
bool IsSeparator() const
Checks is the menu item a separator or a normal named menu item.
FindChild
Attempts to find a child menu item with the specified name.
Only direct descendants are searched.
RemoveChild
void RemoveChild(const String &name)
Removes the first child with the specified name.
Private
Methods
FindChild
GUIMenuItem *FindChild(const String &name)
Attempts to find a child menu item with the specified name.
Only direct descendants are searched.
Fields
mParent
GUIMenuItem * mParent
mIsSeparator
bool mIsSeparator
mName
String mName
mCallback
std::function<void ()> mCallback
mPriority
i32 mPriority
mShortcut
ShortcutKey mShortcut
mSeqIdx
u32 mSeqIdx
mChildren
Set<GUIMenuItem *, GUIMenuItemComparer> mChildren