Skip to content

finite_button_create

The finite_button_create function allocates and initializes a new FiniteBtn and adds it to a FiniteShell.

FiniteBtn *finite_button_create(
FiniteShell *shell,
void (*on_select_callback)(FiniteBtn *self, int id, void *data),
void (*on_focus_callback)(FiniteBtn *self, int id, void *data),
void (*on_unfocus_callback)(FiniteBtn *self, int id, void *data),
void *data
);
TypeDescription
FiniteShell *shellThe FiniteShell to which this button will be added.
void (*on_select_callback)(FiniteBtn *self, int id, void *data)Function called when the button is activated or selected.
void (*on_focus_callback)(FiniteBtn *self, int id, void *data)Function called when the button gains focus.
void (*on_unfocus_callback)(FiniteBtn *self, int id, void *data)Function called when the button loses focus.
void *dataCustom data passed to all callbacks.
void select_cb(FiniteBtn *self, int id, void *data) {
FINITE_LOG("Button %d selected!\n", id);
}
FiniteBtn *btn = finite_button_create(shell, select_cb, NULL, NULL, NULL);

isActive for the first button is set to true for the first button.

self is set to the newly created button pointer for safe callback usage.

Buttons must be created with a valid FiniteShell.

Callbacks should not block the main compositor loop.

Use FiniteDirectionType values in FiniteBtn.relations for navigation. Do not use FINITE_DIRECTION_DONE.