ContextMenu class reference


Interactive widget - displays context menu. This widget is activated with the help of callbacks (responding to right-click) and can be used as an area and limited to individual widgets (see guides).

Functions documentation

ContextMenu(Window* window, Dimension<size_t> dimension, ContextMenuTheme theme);

Constructor.


ContextMenu(Window* window, Dimension<size_t> dimension, Theme theme);

Delegating constructor with theme application.


ContextMenuItem* AddItem(std::wstring text, Texture* texture = nullptr);

Adds entry to the context menu.


void AddDivider(Color dividerColor);

Adds divider to the context menu.


void SetPosition(Point<int> newPos) override;

Sets the widget in a specific position. If the widget does not fit in the physical window, it is moved accordingly.


void Resize(Dimension<size_t> newSize, int heightShift);

Helper function, used internally for resizing widget when new entry is pushed.


void SetupButton();

Helper funciton, used internally to create a way (button & callback) to disable ContextMenu widget, when user dont want to choose an option.


Variables documentation

Stores widget theme.


Button created by SetupButton() function. This allows to disable widget.


int m_TotalHeight;

Tracks widget height (after pushing entry).