Button

Native button, can also be used as checkbox and radio button.

Header#include "nativeui/button.h"
Namespacenamespace nu
Typeclass (RefCounted)
InheritsView

Constructors

Button(const std::string& title, Button::Type type)

Create a new button.

Parameters

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

std::string GetTitle() const

Return the button title.

Return

std::string

void SetChecked(bool checked)

Set checked state of checkbox or radio.

Parameters

bool IsChecked() const

Return whether checkbox or radio is checked.

Return

bool

void SetImage(scoped_refptr<Image> image)

Set the image of button.

Parameters

Image* GetImage() const

Return the image of button.

Return

Image*

void SetButtonStyle(Button::Style style) macOS

Set the visual style of the button.

Parameters

void SetControlSize(ControlSize size) macOS

Set the control size of the button.

Parameters

void SetHasBorder(bool yes) macOS

Set whether the button has a border.

Parameters

bool HasBorder() const macOS

Return whether the button has a border.

Return

bool

Events

void on_click(Button* self)

Emitted when button is clicked.

Parameters

Preventable

No.