libui/docs/uiButton.md

1.3 KiB

uiButton

uiButton is a control which represents a clickable button.

Windows Unix OS X
Button on Windows Button on Unix Button on OS X

uiButton derives from uiControl.

constructor NewButton()

uiButton *uiNewButton(const char *text);

Creates a new uiButton with the specifed text.

func Text()

char *uiButtonText(uiButton *b);

Returns the text shown on the uiButton. Free the returned string with uiTextFree().

func SetText()

void uiButtonSetText(uiButton *b, const char *text);

Changes the text shown on the uiButton to the given text string.

func OnClicked()

void uiButtonOnClicked(uiButton *b, void (*handler)(void *sender, void *data), void *data);

Sets the function that is called when the user clicks the uiButton. If a handler was previously assigned, this call replaces the old handler with the given one.

The sender argument to the callback is the b argument to uiButtonOnClicked(). It is of type void * to allow uiMenuItems to use the same callback functions.

The data argument to the callback is the data argument to uiButtonOnClicked().

The default handler does nothing.

TODO allow NULL to return to default?