Jazz2::UI::Windows::PopupMenu class

Menu shown over the interface.

Up and Down go through its items, Enter runs one, a letter goes to the next item starting with it. An item with a submenu opens it when it's pointed at for a while, clicked, or by Enter or Right, Left or Esc closes it again.

Base classes

class Panel
A stack with a background.

Public static functions

static auto Show(Surface& surface, SmallVectorImpl<MenuEntry>&& entries, Vector2f pos, Function<void()>&& onClosed = {}) -> PopupMenu*
Shows a menu at a position.

Constructors, destructors, conversion operators

PopupMenu(SmallVectorImpl<MenuEntry>&& entries) explicit
Creates a menu of entries.

Public functions

void HighlightFirst()
Highlights the item Enter runs, the one shown checked or the first one that can be used.
void OpenSubmenu(MenuRow* row, bool fromKeyboard)
Opens the submenu of a row of this menu next to it, fromKeyboard highlights its first item.
void CloseSubmenu()
Closes the submenu shown from this menu, if any.
void Arrange(const Context& context, const Rectf& bounds) override
Places the element and its children.
void Update(float timeMult) override
Advances animations of the element and its children.
auto OnWheel(const PointerEvent& event) -> bool override
Scrolls a menu taller than the screen, anywhere over it.
auto OnKeyPressed(const KeyboardEvent& event) -> bool override
Called when a key is pressed while the element has the focus, returns true if it was used.
auto OnTextInput(const TextInputEvent& event) -> bool override
Called when text is typed while the element has the focus.

Public variables

Function<void(std::int32_t)> OnSwitchMenu
Called with -1 or 1 when Left or Right asks for the menu next to this one, as on the menu bar.