Buttons

EsButtonCreate

EsButton *EsButtonCreate(EsElement *parent, EsButtonFlags flags = ES_FLAGS_DEFAULT, EsStyleID style = 0, STRING label = BLANK_STRING);

Creates a button as a child of parent. Returns ES_NULL on failure.
With style 0, the style is selected from the flags (push button, checkbox, or toolbar button).

EsButtonSetLabel

void EsButtonSetLabel(EsButton *button, STRING label = BLANK_STRING);

Replaces the button's label and repaints the button. Must run on the message thread.

EsButtonSetIcon

void EsButtonSetIcon(EsButton *button, uint32_t iconID);

Sets the button's icon from the icon database. Removes any image set with EsButtonSetIconFromBits.
Must run on the message thread.

EsButtonSetIconFromBits

void EsButtonSetIconFromBits(EsButton *button, const uint32_t *bits, size_t width, size_t height, size_t stride);

Sets the button's icon from raw pixel data. stride is the byte size of one pixel row.
Must run on the message thread.

EsButtonSetCheck

void EsButtonSetCheck(EsButton *button, EsCheckState checkState = ES_CHECK_CHECKED, bool sendUpdatedMessage = true);

Sets the button's check state. With sendUpdatedMessage true, sends ES_MSG_CHECK_UPDATED and runs the command callback.
Does nothing if the state is unchanged. Must run on the message thread.

EsButtonGetCheck

EsCheckState EsButtonGetCheck(EsButton *button);

Returns the button's current check state. Must run on the message thread.

EsButtonOnCommand

void EsButtonOnCommand(EsButton *button, EsCommandCallback callback);

Sets the callback that runs when the button is activated or its check state changes.
Must run on the message thread.

EsButtonSetCheckBuddy

void EsButtonSetCheckBuddy(EsButton *button, EsElement *checkBuddy);

The buddy element is enabled/disabled when the button is checked/unchecked.

EsButtonGetCheckBuddy

EsElement *EsButtonGetCheckBuddy(EsButton *button);

Returns the button's check buddy element, or ES_NULL if none. Must run on the message thread.