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::Type
type
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::string
void SetChecked(bool checked)
Set checked
state of checkbox or radio.
Parameters
bool
checked
bool IsChecked() const
Return whether checkbox or radio is checked.
Return
bool
void 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*
macOS
void SetButtonStyle(Button::Style style)Set the visual style of the button.
Parameters
Button::Style
style
macOS
void SetHasBorder(bool yes)Set whether the button has a border.
Parameters
bool
yes
macOS
bool HasBorder() constReturn whether the button has a border.
Return
bool
Events
void on_click(Button* self)
Emitted when button is clicked.
Parameters
Button*
self