5 Struct N_GUI_WIDGET
gullradriel edited this page 2026-10-09 00:55:18 +02:00

N_GUI_WIDGET

Module: GUI: allegro5 widget system with pseudo-windows

A single GUI widget.

#include "n_gui.h"

Public Attributes

Name
float y
position y relative to parent window
float x
position x relative to parent window
float w
width
int visible
visibility flag
int type
widget type (N_GUI_TYPE_*)
char * tooltip
owned tooltip text shown after the pointer rests on the widget (NULL = none); heap-allocated with no length cap so long tooltips are not truncated
N_GUI_THEME theme
color theme for this widget
int state
current state flags (N_GUI_STATE_*)
N_GUI_SB_TRACK sb_v
the vertical scrollbar this widget draws inside itself, if it draws one, so the pointer can be tested against the bar rather than against the whole widget
N_GUI_SB_TRACK sb_h
and the horizontal one
char[128] persist_key
optional stable key for persisting this widget's user-adjustable state (splitpane divider ratio, datagrid column order/visibility/width) across sessions inside the layout JSON.
float norm_y
normalized position y (fraction of parent window h, used for SCALE resize)
float norm_x
normalized position x (fraction of parent window w, used for SCALE resize)
float norm_w
normalized width (fraction of parent window w)
float norm_h
normalized height (fraction of parent window h)
int id
unique widget id
float h
height
ALLEGRO_FONT * font
font used by this widget (NULL = context default)
int enabled
enabled flag (1 = enabled, 0 = disabled: drawn dimmed and ignores input)
void * data
widget-specific data (union via void pointer)

Public Attributes Documentation

variable y

float y;

position y relative to parent window

variable x

float x;

position x relative to parent window

variable w

float w;

width

variable visible

int visible;

visibility flag

variable type

int type;

widget type (N_GUI_TYPE_*)

variable tooltip

char * tooltip;

owned tooltip text shown after the pointer rests on the widget (NULL = none); heap-allocated with no length cap so long tooltips are not truncated

variable theme

N_GUI_THEME theme;

color theme for this widget

variable state

int state;

current state flags (N_GUI_STATE_*)

variable sb_v

N_GUI_SB_TRACK sb_v;

the vertical scrollbar this widget draws inside itself, if it draws one, so the pointer can be tested against the bar rather than against the whole widget

variable sb_h

N_GUI_SB_TRACK sb_h;

and the horizontal one

variable persist_key

char[128] persist_key;

optional stable key for persisting this widget's user-adjustable state (splitpane divider ratio, datagrid column order/visibility/width) across sessions inside the layout JSON.

"" (the default) = not persisted. Set with n_gui_widget_set_persist_key.

variable norm_y

float norm_y;

normalized position y (fraction of parent window h, used for SCALE resize)

variable norm_x

float norm_x;

normalized position x (fraction of parent window w, used for SCALE resize)

variable norm_w

float norm_w;

normalized width (fraction of parent window w)

variable norm_h

float norm_h;

normalized height (fraction of parent window h)

variable id

int id;

unique widget id

variable h

float h;

height

variable font

ALLEGRO_FONT * font;

font used by this widget (NULL = context default)

variable enabled

int enabled;

enabled flag (1 = enabled, 0 = disabled: drawn dimmed and ignores input)

variable data

void * data;

widget-specific data (union via void pointer)