Class ComboBox

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class ComboBox : public nanogui::PopupButton

Simple combo box widget based on a popup button.

Subclassed by nanogui::detail::FormWidget< T, typename std::is_enum< T >::type >

Public Functions

ComboBox(Widget *parent)

Create an empty combo box.

ComboBox(Widget *parent, const std::vector<std::string> &items)

Create a new combo box with the given items.

ComboBox(Widget *parent, const std::vector<std::string> &items, const std::vector<std::string> &itemsShort)

Create a new combo box with the given items, providing both short and long descriptive labels for each item.

std::function<void(int)> callback() const

The callback to execute for this ComboBox.

void setCallback(const std::function<void(int)> &callback)

Sets the callback to execute for this ComboBox.

int selectedIndex() const

The current index this ComboBox has selected.

void setSelectedIndex(int idx)

Sets the current index this ComboBox has selected.

void setItems(const std::vector<std::string> &items, const std::vector<std::string> &itemsShort)

Sets the items for this ComboBox, providing both short and long descriptive lables for each item.

void setItems(const std::vector<std::string> &items)

Sets the items for this ComboBox.

const std::vector<std::string> &items() const

The items associated with this ComboBox.

const std::vector<std::string> &itemsShort() const

The short descriptions associated with this ComboBox.

virtual bool scrollEvent(const Vector2i &p, const Vector2f &rel)

Handles mouse scrolling events for this ComboBox.

virtual void save(Serializer &s) const

Saves the state of this ComboBox to the specified Serializer.

virtual bool load(Serializer &s)

Sets the state of this ComboBox from the specified Serializer.

Protected Attributes

std::vector<std::string> mItems

The items associated with this ComboBox.

std::vector<std::string> mItemsShort

The short descriptions of items associated with this ComboBox.

std::function<void(int)> mCallback

The callback for this ComboBox.

int mSelectedIndex

The current index this ComboBox has selected.