Class Popup

Inheritance Relationships

Base Type

Class Documentation

class Popup : public nanogui::Window

Popup window for combo boxes, popup buttons, nested dialogs etc.

Usually the Popup instance is constructed by another widget (e.g. PopupButton) and does not need to be created by hand.

Public Types

enum Side

Values:

Left = 0
Right

Public Functions

Popup(Widget *parent, Window *parentWindow)

Create a new popup parented to a screen (first argument) and a parent window.

void setAnchorPos(const Vector2i &anchorPos)

Return the anchor position in the parent window; the placement of the popup is relative to it.

const Vector2i &anchorPos() const

Set the anchor position in the parent window; the placement of the popup is relative to it.

void setAnchorHeight(int anchorHeight)

Set the anchor height; this determines the vertical shift relative to the anchor position.

int anchorHeight() const

Return the anchor height; this determines the vertical shift relative to the anchor position.

void setSide(Side popupSide)

Set the side of the parent window at which popup will appear.

Side side() const

Return the side of the parent window at which popup will appear.

Window *parentWindow()

Return the parent window of the popup.

const Window *parentWindow() const

Return the parent window of the popup.

virtual void performLayout(NVGcontext *ctx)

Invoke the associated layout generator to properly place child widgets, if any.

virtual void draw(NVGcontext *ctx)

Draw the popup window.

virtual void save(Serializer &s) const

Save the state of the widget into the given Serializer instance.

virtual bool load(Serializer &s)

Restore the state of the widget from the given Serializer instance.

Protected Functions

virtual void refreshRelativePlacement()

Internal helper function to maintain nested window position values.

Protected Attributes

Window *mParentWindow
Vector2i mAnchorPos
int mAnchorHeight
Side mSide