libui-ng
A portable GUI library for C
uiButton Struct Reference

A control that visually represents a button to be clicked by the user to trigger an action. More...

#include <ui.h>

Inheritance diagram for uiButton:
uiControl

Public Member Functions

char * uiButtonText (uiButton *b)
 Returns the button label text. More...
 
void uiButtonSetText (uiButton *b, const char *text)
 Sets the button label text. More...
 
void uiButtonOnClicked (uiButton *b, void(*f)(uiButton *sender, void *senderData), void *data)
 Registers a callback for when the button is clicked. More...
 
uiButtonuiNewButton (const char *text)
 Creates a new button. More...
 
- Public Member Functions inherited from uiControl
void uiControlDestroy (uiControl *c)
 Dispose and free all allocated resources. More...
 
uintptr_t uiControlHandle (uiControl *c)
 Returns the control's OS-level handle. More...
 
uiControluiControlParent (uiControl *c)
 Returns the parent control. More...
 
void uiControlSetParent (uiControl *c, uiControl *parent)
 Sets the control's parent. More...
 
int uiControlToplevel (uiControl *c)
 Returns whether or not the control is a top level control. More...
 
int uiControlVisible (uiControl *c)
 Returns whether or not the control is visible. More...
 
void uiControlShow (uiControl *c)
 Shows the control. More...
 
void uiControlHide (uiControl *c)
 Hides the control. More...
 
int uiControlEnabled (uiControl *c)
 Returns whether or not the control is enabled. More...
 
void uiControlEnable (uiControl *c)
 Enables the control. More...
 
void uiControlDisable (uiControl *c)
 Disables the control. More...
 
uiControluiAllocControl (size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
 Allocates a uiControl. More...
 
void uiFreeControl (uiControl *c)
 Frees the memory associated with the control reference. More...
 
void uiControlVerifySetParent (uiControl *c, uiControl *parent)
 Makes sure the control's parent can be set to parent. More...
 
int uiControlEnabledToUser (uiControl *c)
 Returns whether or not the control can be interacted with by the user. More...
 

Additional Inherited Members

- Public Attributes inherited from uiControl
uint32_t Signature
 
uint32_t OSSignature
 
uint32_t TypeSignature
 
void(* Destroy )(uiControl *)
 
uintptr_t(* Handle )(uiControl *)
 
uiControl *(* Parent )(uiControl *)
 
void(* SetParent )(uiControl *, uiControl *)
 
int(* Toplevel )(uiControl *)
 
int(* Visible )(uiControl *)
 
void(* Show )(uiControl *)
 
void(* Hide )(uiControl *)
 
int(* Enabled )(uiControl *)
 
void(* Enable )(uiControl *)
 
void(* Disable )(uiControl *)
 

Detailed Description

A control that visually represents a button to be clicked by the user to trigger an action.

Member Function Documentation

◆ uiButtonOnClicked()

void uiButtonOnClicked ( uiButton b,
void(*)(uiButton *sender, void *senderData)  f,
void *  data 
)

Registers a callback for when the button is clicked.

Parameters
buiButton instance.
fCallback function.
sender Back reference to the instance that triggered the callback.
senderData User data registered with the sender instance.
dataUser data to be passed to the callback.
Note
Only one callback can be registered at a time.

◆ uiButtonSetText()

void uiButtonSetText ( uiButton b,
const char *  text 
)

Sets the button label text.

Parameters
buiButton instance.
textLabel text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.

◆ uiButtonText()

char * uiButtonText ( uiButton b)

Returns the button label text.

Parameters
buiButton instance.
Returns
The text of the label.
A NUL terminated UTF-8 string.
Caller is responsible for freeing the data with uiFreeText().

◆ uiNewButton()

uiButton * uiNewButton ( const char *  text)

Creates a new button.

Parameters
textLabel text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
Returns
A new uiButton instance.

The documentation for this struct was generated from the following file: