Class · aurore

aurore::ContextMenu

On this page
aurore/views/context_menu.hpp
#include <aurore/views/context_menu.hpp>

class aurore::ContextMenu : public aurore::Box

Constructors 1

explicit ContextMenu(View *anchor)

Functions 10

ContextMenuItem * addItem(const std::string &label,std::function< void()> action,const std::string &icon = "")
ContextMenuItem * addItem(const std::string &label,std::function< void()> action,View *icon)
void addSeparator()
void setTitle(const std::string &title)
void open()
void close(std::function< void()> then = nullptr)
virtual bool isTranslucent() override

Is this view translucent?

If you override it please return

|| View::isTranslucent() to keep the fadeIn transition

Overrides aurore::View::isTranslucent

context_menu.hpp:80
virtual View * getDefaultFocus() override

Returns the default view to focus when focusing this view Typically the view itself or one of its children.

Returning nullptr means that the view is not focusable (and neither are its children)

By default, a view is focusable if the flag is set to true with setFocusable() and if the view is visible.

When pressing a key, the flow is :

  1. starting from the currently focused view's parent, traverse the tree upwards and repeatedly call getNextFocus() on every view until we find a next view to focus or meet the end of the tree
  2. if a view is found, getNextFocus() will internally call getDefaultFocus() for the selected child
  3. give focus to the result, if it exists

Overrides aurore::Box::getDefaultFocus

context_menu.hpp:81
virtual void draw(NVGcontext *vg,float x,float y,float width,float height,Style style,FrameContext *ctx) override

Called by frame() to draw the view onscreen. Views should not draw outside of their bounds (they may be clipped if they do so).

Overrides aurore::Box::draw

context_menu.hpp:82
virtual void onThemeChanged() override

Called on every view of the screens when the theme changes (Application::getThemeChangedEvent): the colours given by key (setThemeColor) take their new values, the state styles read their "@theme/" values again. A view that keeps other colours of its own looks them up again here, then calls the base. A Box goes on to its children.

Overrides aurore::Box::onThemeChanged

context_menu.hpp:83

Also the functions of aurore::Box (53), aurore::View (221).

Static functions 1

static void attach(View *view,std::function< void(ContextMenu *menu)> fill,ControllerButton button = BUTTON_X,const std::string &hint = "",bool longPress = true)

Read from Aurore's headers by Doxygen at each build · library/include