Table of Contents
N_GUI_BUTTON_DATA
Module: GUI: allegro5 widget system with pseudo-windows
button specific data
#include "n_gui.h"
Public Attributes
| Name | |
|---|---|
| void * | user_data user data for callback |
| int | toggled toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1) |
| int | toggle_mode toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked) |
| int | shape shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP |
| void(*)(int widget_id, void *user_data) | on_click callback on click (widget_id passed) |
| char[128] | label label displayed on the button |
| int | keycode bound keyboard keycode (0 = none). |
| int[8] | key_sources widget IDs that can trigger this focused key binding. |
| double | key_press_until absolute al_get_time() deadline until which the button is rendered in its pressed (N_GUI_STATE_ACTIVE) visual state after a keybind trigger. |
| int | key_modifiers required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state for backward compatibility). |
| int | key_focus_only if 1, keycode fires only when the button itself or a source widget has focus. |
| int | glyph N_GUI_GLYPH_* icon drawn centred in the button's text colour instead of the label (N_GUI_GLYPH_NONE, the default, draws the label). |
| ALLEGRO_BITMAP * | bitmap_hover optional bitmap for hover state |
| ALLEGRO_BITMAP * | bitmap_active optional bitmap for active/pressed state |
| ALLEGRO_BITMAP * | bitmap optional bitmap for the button (NULL = color theme) |
Public Attributes Documentation
variable user_data
void * user_data;
user data for callback
variable toggled
int toggled;
toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1)
variable toggle_mode
int toggle_mode;
toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked)
variable shape
int shape;
shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP
variable on_click
void(*)(int widget_id, void *user_data) on_click;
callback on click (widget_id passed)
variable label
char[128] label;
label displayed on the button
variable keycode
int keycode;
bound keyboard keycode (0 = none).
When this key is pressed and no text input widget has focus, the button's on_click callback is triggered.
variable key_sources
int[8] key_sources;
widget IDs that can trigger this focused key binding.
Terminated by -1. Only used when key_focus_only == 1. Up to N_GUI_KEY_SOURCES_MAX entries.
variable key_press_until
double key_press_until;
absolute al_get_time() deadline until which the button is rendered in its pressed (N_GUI_STATE_ACTIVE) visual state after a keybind trigger.
0.0 = no pending key-press flash.
variable key_modifiers
int key_modifiers;
required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state for backward compatibility).
Use ALLEGRO_KEYMOD_SHIFT, ALLEGRO_KEYMOD_CTRL, ALLEGRO_KEYMOD_ALT, ALLEGRO_KEYMOD_ALTGR ORed together. When non-zero, only the specified modifier combination triggers the keybind (exact match on N_GUI_KEY_MOD_MASK bits).
variable key_focus_only
int key_focus_only;
if 1, keycode fires only when the button itself or a source widget has focus.
if 0 (default), keycode fires globally when no interactive widget has focus.
variable glyph
int glyph;
N_GUI_GLYPH_* icon drawn centred in the button's text colour instead of the label (N_GUI_GLYPH_NONE, the default, draws the label).
Set with n_gui_button_set_glyph. The label is kept and is still a good place for a tooltip-free accessible name.
variable bitmap_hover
ALLEGRO_BITMAP * bitmap_hover;
optional bitmap for hover state
variable bitmap_active
ALLEGRO_BITMAP * bitmap_active;
optional bitmap for active/pressed state
variable bitmap
ALLEGRO_BITMAP * bitmap;
optional bitmap for the button (NULL = color theme)
Modules
- AABB3D
- ACCEPT_POOL
- ALLEGRO4
- ALLEGRO5
- ANIM_LIB
- ASTAR
- ATLAS_LIB
- AVRO
- CLOCK_SYNC
- COMMONS
- CONFIGFILE
- CYPHER_BASE64
- CYPHER_VIGENERE
- DEAD_RECKONING
- ENUMS
- EXCEPTIONS
- GAME_ENV
- GIT
- GUI
- HASH_TABLE
- ISOMETRIC_ENGINE
- LIST
- LOG
- LOGNODUP
- LZ4
- NETWORKING
- NETWORK_MSG
- N_COOKIES
- N_DIFF
- N_DIGEST
- N_DISK_CACHE
- N_DNS
- N_ECC
- N_ENTROPY
- N_FILES
- N_FLUIDS
- N_GUI_COLOR
- N_GUI_COLORWHEEL
- N_GUI_CURVE
- N_GUI_GRID
- N_GUI_POPUP
- N_HEX
- N_HTTP3
- N_HTTP_COOKIE
- N_HTTP_FORM
- N_HTTP_MIME
- N_HTTP_REQ
- N_HTTP_RESP
- N_HTTP_ROUTER
- N_HTTP_SERVER
- N_ICC
- N_JSON
- N_KAFKA
- N_LINALG
- N_MODULE
- N_OPENSSL_COMPAT
- N_PRETTY
- N_PTH
- N_QUERY
- N_RANDOM
- N_SHA256
- N_STR
- N_TIFF
- N_TIME
- N_USER
- N_X509
- N_ZIP
- PARTICLES
- PCRE
- PHYSICS
- SIGNALS
- STACK
- THREADS
- TRAJECTORY
- TREE
- ZLIB