Button
Native button, can also be used as checkbox and radio button.
| Header | #include "nativeui/button.h" |
| Namespace | namespace nu |
| Type | class (RefCounted) |
| Inherits | View |
Constructors
Button(const std::string& title, Button::Type type)
Create a new button.
Parameters
const std::string&titleButton::Typetype
Class properties
const char* kClassName
The class name of this view.
Methods
void MakeDefault()
Mark this button as default button.
void SetTitle(const std::string& title)
Set button title.
Parameters
const std::string&title
std::string GetTitle() const
Return the button title.
Return
std::stringvoid SetChecked(bool checked)
Set checked state of checkbox or radio.
Parameters
boolchecked
bool IsChecked() const
Return whether checkbox or radio is checked.
Return
boolvoid SetImage(scoped_refptr<Image> image)
Set the image of button.
Parameters
scoped_refptr<Image>image
Image* GetImage() const
Return the image of button.
Return
Image*void SetButtonStyle(Button::Style style) macOS
Set the visual style of the button.
Parameters
Button::Stylestyle
void SetControlSize(ControlSize size) macOS
Set the control size of the button.
Parameters
ControlSizesize
void SetHasBorder(bool yes) macOS
Set whether the button has a border.
Parameters
boolyes
bool HasBorder() const macOS
Return whether the button has a border.
Return
boolEvents
void on_click(Button* self)
Emitted when button is clicked.
Parameters
Button*self