libui/docs/uiButton.md

40 lines
1.1 KiB
Markdown
Raw Normal View History

2015-04-20 14:16:31 -05:00
# uiButton
uiButton is a control which represents a clickable button.
Windows | Unix | OS X
-----|-----|-----
![Button on Windows](images/uiButton_windows.png)|![Button on Unix](images/uiButton_unix.png)|![Button on OS X](images/uiButton_darwin.png)
2015-04-20 14:25:46 -05:00
uiButton derives from [uiControl](uiControl.md).
# uiNewButton()
```c
uiButton *uiNewButton(const char *text);
```
Creates a new uiButton with the specifed text.
# func Text()
```c
char *uiButtonText(uiButton *b);
```
Returns the text shown on the uiButton. Free the returned string with `uiTextFree()`.
# func SetText()
```c
void uiButtonSetText(uiButton *b, const char *text);
```
Changes the text shown on the uiButton to the given text string.
# func OnClicked
```c
void uiButtonOnClicked(uiButton *b void (*handler)(uiButton *, void *), void *data);
```
Sets the function that is called when the user clicks the uiButton. The `data` parameter is passed as the second argument to this function. If a handler was previous assigned, this call replaces the old handler with the given one.
The default handler does nothing.
TODO allow NULL to return to default?