Class Button¶
Defined in File button.h
Page Contents
Inheritance Relationships¶
Base Type¶
public nanogui::Widget
(Class Widget)
Derived Types¶
public nanogui::PopupButton
(Class PopupButton)public nanogui::ToolButton
(Class ToolButton)
Class Documentation¶
-
class
Button
: public nanogui::Widget¶ [Normal/Toggle/Radio/Popup] Button widget.
Subclassed by nanogui::PopupButton, nanogui::ToolButton
Public Types
-
enum
Flags
¶ Flags to specify the button behavior (can be combined with binary OR)
Values:
Public Functions
-
Button
(Widget *parent, const std::string &caption = "Untitled", int icon = 0)¶ Creates a button attached to the specified parent.
- Parameters
parent
: The nanogui::Widget this Button will be attached to.caption
: The name of the button (default"Untitled"
).icon
: The icon to display with this Button. See nanogui::Button::mIcon.
Returns the caption of this Button.
-
int
icon
() const¶ Returns the icon of this Button. See nanogui::Button::mIcon.
-
void
setIcon
(int icon)¶ Sets the icon of this Button. See nanogui::Button::mIcon.
-
int
flags
() const¶ The current flags of this Button (see nanogui::Button::Flags for options).
-
void
setFlags
(int buttonFlags)¶ Sets the flags of this Button (see nanogui::Button::Flags for options).
-
IconPosition
iconPosition
() const¶ The position of the icon for this Button.
-
void
setIconPosition
(IconPosition iconPosition)¶ Sets the position of the icon for this Button.
-
std::function<void()>
callback
() const¶ The current callback to execute (for any type of button).
-
void
setCallback
(const std::function<void()> &callback)¶ Set the push callback (for any type of button).
-
std::function<void(bool)>
changeCallback
() const¶ The current callback to execute (for toggle buttons).
-
void
setChangeCallback
(const std::function<void(bool)> &callback)¶ Set the change callback (for toggle buttons).
-
void
setButtonGroup
(const std::vector<Button *> &buttonGroup)¶ Set the button group (for radio buttons).
The current button group (for radio buttons).
-
virtual bool
mouseButtonEvent
(const Vector2i &p, int button, bool down, int modifiers)¶ The callback that is called when any type of mouse button event is issued to this Button.
-
virtual void
save
(Serializer &s) const¶ Saves the state of this Button provided the given Serializer.
-
virtual bool
load
(Serializer &s)¶ Sets the state of this Button provided the given Serializer.
Protected Attributes
-
int
mIcon
¶ The icon of this Button (
0
means no icon).The icon to display with this Button. If not
0
, may either be a picture icon, or one of the icons enumerated in File entypo.h. The kind of icon (image or Entypo) is determined by the functionsnanogui::nvgIsImageIcon()
and its reciprocal counterpartnanogui::nvgIsFontIcon()
.
-
IconPosition
mIconPosition
¶ The position to draw the icon at.
-
int
mFlags
¶ The current flags of this button (see nanogui::Button::Flags for options).
-
std::function<void()>
mCallback
¶ The callback issued for all types of buttons.
-
std::function<void(bool)>
mChangeCallback
¶ The callback issued for toggle buttons.
-
enum