27#ifndef __NILOREA_GUI__
28#define __NILOREA_GUI__
84#define N_GUI_ID_MAX 128
86#define N_GUI_TEXT_MAX 4096
90#define N_GUI_TYPE_BUTTON 1
92#define N_GUI_TYPE_SLIDER 2
94#define N_GUI_TYPE_TEXTAREA 3
96#define N_GUI_TYPE_CHECKBOX 4
98#define N_GUI_TYPE_SCROLLBAR 5
100#define N_GUI_TYPE_LISTBOX 6
102#define N_GUI_TYPE_RADIOLIST 7
104#define N_GUI_TYPE_COMBOBOX 8
106#define N_GUI_TYPE_IMAGE 9
108#define N_GUI_TYPE_LABEL 10
110#define N_GUI_TYPE_DROPMENU 11
114#define N_GUI_SHAPE_RECT 0
116#define N_GUI_SHAPE_ROUNDED 1
118#define N_GUI_SHAPE_BITMAP 2
122#define N_GUI_SLIDER_VALUE 0
124#define N_GUI_SLIDER_PERCENT 1
128#define N_GUI_SLIDER_H 0
130#define N_GUI_SLIDER_V 1
134#define N_GUI_SCROLLBAR_H 0
136#define N_GUI_SCROLLBAR_V 1
140#define N_GUI_SELECT_NONE 0
142#define N_GUI_SELECT_SINGLE 1
144#define N_GUI_SELECT_MULTIPLE 2
148#define N_GUI_IMAGE_FIT 0
150#define N_GUI_IMAGE_STRETCH 1
152#define N_GUI_IMAGE_CENTER 2
156#define N_GUI_ALIGN_LEFT 0
158#define N_GUI_ALIGN_CENTER 1
160#define N_GUI_ALIGN_RIGHT 2
162#define N_GUI_ALIGN_JUSTIFIED 3
166#define N_GUI_STATE_IDLE 0
168#define N_GUI_STATE_HOVER 1
170#define N_GUI_STATE_ACTIVE 2
172#define N_GUI_STATE_FOCUSED 4
174#define N_GUI_STATE_SCROLLBAR_DRAG 8
178#define N_GUI_WIN_OPEN 1
180#define N_GUI_WIN_MINIMISED 2
182#define N_GUI_WIN_DRAGGING 4
184#define N_GUI_WIN_RESIZING 8
186#define N_GUI_WIN_VSCROLL_DRAG 16
188#define N_GUI_WIN_HSCROLL_DRAG 32
192#define N_GUI_WIN_AUTO_SCROLLBAR 16
194#define N_GUI_WIN_RESIZABLE 32
196#define N_GUI_WIN_FIXED_POSITION 64
198#define N_GUI_WIN_FRAMELESS 128
202#define N_GUI_RESIZE_VIRTUAL 0
204#define N_GUI_RESIZE_ADAPTIVE 1
208#define N_GUI_WIN_RESIZE_NONE 0
210#define N_GUI_WIN_RESIZE_MOVE 1
212#define N_GUI_WIN_RESIZE_SCALE 2
216#define N_GUI_AUTOFIT_W 1
218#define N_GUI_AUTOFIT_H 2
220#define N_GUI_AUTOFIT_WH 3
222#define N_GUI_AUTOFIT_EXPAND_LEFT 4
224#define N_GUI_AUTOFIT_EXPAND_UP 8
226#define N_GUI_AUTOFIT_CENTER 16
230#define N_GUI_ZORDER_NORMAL 0
232#define N_GUI_ZORDER_ALWAYS_ON_TOP 1
234#define N_GUI_ZORDER_ALWAYS_BEHIND 2
241#define N_GUI_ZORDER_FIXED 3
287#define N_GUI_KEY_MOD_MASK (ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL | ALLEGRO_KEYMOD_ALT | ALLEGRO_KEYMOD_ALTGR)
290#define N_GUI_KEY_SOURCES_MAX 8
504#define N_GUI_COMBOBOX_AUTO_WIDTH 1
609 void (*
on_open)(
int widget_id,
void* user_data);
967 ALLEGRO_COLOR bg_hover,
968 ALLEGRO_COLOR bg_active,
969 ALLEGRO_COLOR border,
970 ALLEGRO_COLOR border_hover,
971 ALLEGRO_COLOR border_active,
973 ALLEGRO_COLOR text_hover,
974 ALLEGRO_COLOR text_active,
975 float border_thickness,
1074int n_gui_add_button(
N_GUI_CTX* ctx,
int window_id,
const char* label,
float x,
float y,
float w,
float h,
int shape,
void (*on_click)(
int,
void*),
void* user_data);
1077int n_gui_add_button_bitmap(
N_GUI_CTX* ctx,
int window_id,
const char* label,
float x,
float y,
float w,
float h, ALLEGRO_BITMAP* normal, ALLEGRO_BITMAP* hover, ALLEGRO_BITMAP* active,
void (*on_click)(
int,
void*),
void* user_data);
1080int n_gui_add_toggle_button(
N_GUI_CTX* ctx,
int window_id,
const char* label,
float x,
float y,
float w,
float h,
int shape,
int initial_state,
void (*on_click)(
int,
void*),
void* user_data);
1118int n_gui_add_slider(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
double min_val,
double max_val,
double initial,
int mode,
void (*on_change)(
int,
double,
void*),
void* user_data);
1121int n_gui_add_vslider(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
double min_val,
double max_val,
double initial,
int mode,
void (*on_change)(
int,
double,
void*),
void* user_data);
1124int n_gui_add_textarea(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
int multiline,
size_t char_limit,
void (*on_change)(
int,
const char*,
void*),
void* user_data);
1127int n_gui_add_checkbox(
N_GUI_CTX* ctx,
int window_id,
const char* label,
float x,
float y,
float w,
float h,
int initial_checked,
void (*on_toggle)(
int,
int,
void*),
void* user_data);
1130int n_gui_add_scrollbar(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
int orientation,
int shape,
double content_size,
double viewport_size,
void (*
on_scroll)(
int,
double,
void*),
void* user_data);
1190int n_gui_add_listbox(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
int selection_mode,
void (*on_select)(
int,
int,
int,
void*),
void* user_data);
1215int n_gui_add_radiolist(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
void (*on_select)(
int,
int,
void*),
void* user_data);
1228int n_gui_add_combobox(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
void (*on_select)(
int,
int,
void*),
void* user_data);
1244int n_gui_add_image(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h, ALLEGRO_BITMAP* bitmap,
int scale_mode);
1251int n_gui_add_label(
N_GUI_CTX* ctx,
int window_id,
const char* text,
float x,
float y,
float w,
float h,
int align);
1253int n_gui_add_label_link(
N_GUI_CTX* ctx,
int window_id,
const char* text,
const char* link,
float x,
float y,
float w,
float h,
int align,
void (*
on_link_click)(
int,
const char*,
void*),
void* user_data);
1272int n_gui_add_dropmenu(
N_GUI_CTX* ctx,
int window_id,
const char* label,
float x,
float y,
float w,
float h,
void (*on_open)(
int,
void*),
void* on_open_user_data);
1303void n_gui_slider_set_bitmaps(
N_GUI_CTX* ctx,
int widget_id, ALLEGRO_BITMAP* track, ALLEGRO_BITMAP* fill, ALLEGRO_BITMAP* handle, ALLEGRO_BITMAP* handle_hover, ALLEGRO_BITMAP* handle_active);
1421#define N_GUI_TAB_MAX 16
1453#define N_GUI_TREE_MAX 512
1489#define N_GUI_KV_MAX 128
1526 const char* description,
ALLEGRO_DISPLAY * display
void on_link_click(int widget_id, const char *link, void *user_data)
void on_scroll(int widget_id, double pos, void *user_data)
char title[128]
window title
ALLEGRO_BITMAP * thumb_bitmap
optional bitmap for the thumb/handle, normal state (NULL = color theme)
float scroll_y
vertical scroll offset for overflowing text (pixels)
float scroll_y
vertical scroll offset for auto-scrollbar (pixels)
int visible
visibility flag
ALLEGRO_BITMAP * panel_bitmap
optional bitmap for the dropdown panel background (NULL = color theme)
ALLEGRO_BITMAP * handle_hover_bitmap
optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)
float button_h
height of each tab button
int is_open
is dropdown currently open
int content_window_ids[16]
content window IDs (-1 = none)
int w
bounding box width in pixels
int open_combobox_id
id of the combobox whose dropdown is currently open, or -1
ALLEGRO_COLOR scrollbar_track_color
scrollbar track colour
int max_visible
max visible items in dropdown
int selected_index
currently selected index (-1 = none)
void(* on_remove)(int, void *)
callback on row removal
size_t items_capacity
allocated capacity
ALLEGRO_COLOR grip_color
grip line colour
float dropdown_border_thickness
dropdown panel border thickness
char * text
text content (dynamically allocated, text_alloc bytes)
int nb_rows
total rows (including removed)
float slider_handle_edge_offset
handle circle offset from edge
int parent_index
parent node index, or -1 for root
int shape
shape type: N_GUI_SHAPE_RECT or N_GUI_SHAPE_ROUNDED
float content_h
total content height computed from widgets (internal)
float global_scrollbar_thumb_padding
global thumb inset from track edge
char label[128]
menu label (shown on the button)
size_t items_capacity
allocated capacity
float x
position x on screen
float scrollbar_size
scrollbar track width/height
float norm_y
normalized position y (0.0–1.0 fraction of reference display height)
void(* on_select)(int widget_id, int index, void *user_data)
callback on selection change (widget_id, selected_index, user_data)
float scrollbar_thumb_corner_r
thumb corner radius
int is_dynamic
is this entry dynamic (rebuilt via callback each time menu opens)
float title_padding
padding left of title text
float min_win_h
minimum window height (for resize)
float dropdown_arrow_half_w
horizontal half-extent of the arrow chevron
int toggled
toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1)
int lbl_enabled
label widget ID for "On" header
ALLEGRO_BITMAP * item_bg_bitmap
optional bitmap for per-item background, normal state (NULL = color theme)
int scroll_offset
scroll offset in items
float ref_display_h
reference display height at the time normalized values were last captured
float slider_track_corner_r
track corner radius
int y
bounding box y offset from draw origin
float titlebar_h
title bar height
ALLEGRO_BITMAP * handle_active_bitmap
optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap)
void(* on_tab_change)(int, void *)
callback on tab switch (may be NULL)
float norm_y
normalized position y (fraction of parent window h, used for SCALE resize)
int dropmenu_max_visible
default max visible items for dropmenu panel
float norm_x
normalized position x (0.0–1.0 fraction of reference display width)
float textarea_padding
inner padding
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the label background (NULL = no background)
float item_height
item height
N_GUI_THEME theme
color theme for this widget
float title_max_w_reserve
pixels reserved right of title for truncation
char text[128]
item display text
int nb_tabs
number of tabs
int key_sources[8]
widget IDs that can trigger this focused key binding.
float checkbox_label_gap
gap between box and label text
int open_dropmenu_id
id of the dropdown menu whose panel is currently open, or -1
float global_scrollbar_thumb_corner_r
global thumb corner radius
N_GUI_THEME default_theme
default theme (applied to new widgets/windows)
float dpi_scale
DPI scale factor (1.0 = normal, 1.25 = 125%, 2.0 = HiDPI, etc.)
void * user_data
user data for callback
int scroll_from_wheel
set to 1 when scroll was changed by mouse wheel, cleared on key input
int btn_add
button widget ID for "+" add row
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the window body background (NULL = color fill)
float scrollbar_thumb_padding
thumb inset from track edge
int visible_map[512]
visible row to node index
ALLEGRO_COLOR text_normal
text normal
int remove_id
button widget ID for the remove action
int combobox_max_visible
default max visible items for combobox dropdown
ALLEGRO_BITMAP * item_bg_bitmap
optional bitmap for per-item background, normal state (NULL = color theme)
float norm_h
normalized height (fraction of parent window h)
void * user_data
user data for callback
void(* on_open)(int widget_id, void *user_data)
callback to rebuild dynamic entries each time the menu is opened.
int mouse_b1_prev
previous mouse button 1 state
int listbox_id
listbox widget ID
float corner_rx
corner radius for rounded shapes
ALLEGRO_COLOR selection_color
text selection highlight colour (semi-transparent recommended)
ALLEGRO_BITMAP * bitmap
optional bitmap for the button (NULL = color theme)
int flags
bitmask of N_GUI_COMBOBOX_* flags
float gui_offset_x
horizontal letterbox offset for virtual canvas
int key_focus_only
if 1, keycode fires only when the button itself or a source widget has focus.
N_GUI_KV_ROW rows[128]
row storage
int type
widget type (N_GUI_TYPE_*)
int state
current state flags (N_GUI_STATE_*)
float scroll_step
pixels per mouse wheel notch for window auto-scroll
int multiline
0 = single line, 1 = multiline
int key_id
textarea widget ID for the key
ALLEGRO_BITMAP * bitmap_hover
optional bitmap for hover state
int button_ids[16]
toggle button widget IDs
int max_visible
max visible items
float gui_bounds_w
total bounding box width of all windows (computed internally)
float x
position x relative to parent window
float global_scrollbar_size
global scrollbar track width/height
float textarea_cursor_width
cursor width in pixels
char text[4096]
text to display
void * user_data
user data for callback
float norm_h
normalized height (fraction of reference display height, used in SCALE mode)
float min_win_w
minimum window width (for resize)
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the combobox background (NULL = color theme)
void(* on_change)(int widget_id, double value, void *user_data)
callback on value change
float item_height
item height in pixels
float drag_ox
drag offset x (internal)
void(* on_click)(int widget_id, void *user_data)
callback on click (widget_id passed)
float row_height
height of each row in pixels
int expanded
1 if expanded
N_GUI_LISTITEM * items
dynamic array of items
char label[128]
display text
N_GUI_THEME theme
color theme for this window chrome
int desc_id
textarea widget ID for the description
int next_window_id
next window id to assign
float item_selection_inset
item highlight inset from left/right edges
ALLEGRO_COLOR border_normal
border normal
void(* on_click)(int widget_id, int entry_index, int tag, void *user_data)
callback when this entry is clicked (widget_id, entry_index, tag, user_data)
int has_children
1 if node has children
void * user_data
user data for callback
int scroll_offset
scroll offset
ALLEGRO_COLOR text_hover
text hover
float dropdown_arrow_half_h
vertical half-extent of the arrow chevron
int z_value
z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top)
ALLEGRO_BITMAP * item_bg_bitmap
optional bitmap for per-item background, normal state (NULL = color theme)
double cursor_time
timestamp of last cursor activity (for blink reset)
size_t entries_capacity
allocated capacity
int mouse_y
mouse state tracking
float grip_line_thickness
grip line thickness
int lbl_key
label widget ID for "Key" header
size_t sel_end
selection end position (tracks cursor during selection)
int resize_policy
per-window resize policy: N_GUI_WIN_RESIZE_NONE, _MOVE, or _SCALE
size_t nb_items
number of items
void * user_data
user data for callback
float padding
horizontal padding
void(* on_select)(int, void *)
selection callback
int shape
shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP
int z_order
z-order mode (N_GUI_ZORDER_NORMAL, _ALWAYS_ON_TOP, _ALWAYS_BEHIND, _FIXED)
int tag
user-defined tag for the entry (e.g.
int mouse_b1
mouse button 1 state
float button_w
width of each tab button
float display_w
display/viewport width (set via n_gui_set_display_size)
N_GUI_LISTITEM * items
dynamic array of items
ALLEGRO_BITMAP * box_hover_bitmap
optional bitmap for the checkbox square on hover (NULL = fallback to box_bitmap/box_checked_bitmap)
int h
bounding box height in pixels
float grip_size
grip area size
float radio_label_gap
gap between circle and label text
N_GUI_CTX * ctx
GUI context.
ALLEGRO_DISPLAY * display
display pointer for clipboard operations (set via n_gui_set_display)
float norm_w
normalized width (fraction of reference display width, used in SCALE mode)
float content_w
total content width computed from widgets (internal)
void * user_data
user data for this node
float norm_x
normalized position x (fraction of parent window w, used for SCALE resize)
ALLEGRO_COLOR global_scrollbar_thumb_color
global scrollbar thumb colour
int selected_label_id
id of the label widget with the most recent text selection, or -1
float radio_inner_offset
inner filled circle shrink from outer
int selected_index
currently selected index (-1 = none)
ALLEGRO_BITMAP * track_bitmap
optional bitmap for the track/rail background (NULL = color theme)
int mouse_x
mouse state tracking
ALLEGRO_COLOR scrollbar_thumb_color
scrollbar thumb colour
int active_tab
currently active tab index
float checkbox_max_size
maximum box size
size_t nb_entries
number of entries
float checkbox_mark_thickness
checkmark line thickness
int sel_start
selection start byte offset (-1 = no selection)
ALLEGRO_BITMAP * bitmap
bitmap to display (not owned, not freed)
ALLEGRO_BITMAP * fill_bitmap
optional bitmap for the filled portion of the track (NULL = color theme)
float header_height
height of the column header row
float global_scroll_step
pixels per mouse wheel notch for global scroll
float item_height
item height in dropdown
void * user_data
user data for callback
double scroll_pos
current scroll position
void(* on_change)(int widget_id, const char *text, void *user_data)
callback on text change
ALLEGRO_BITMAP * item_selected_bitmap
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
void * user_data
user data for callback
float autofit_origin_y
original insertion point y for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)
int scroll_offset
scroll offset in items
int selected
selection state (for listbox)
ALLEGRO_BITMAP * item_hover_bitmap
optional bitmap for the hovered entry background (NULL = color theme)
float virtual_h
virtual canvas height (0 = disabled / identity transform)
N_GUI_CTX * ctx
GUI context.
float global_scroll_x
global horizontal scroll offset (when GUI exceeds display)
float checkbox_mark_margin
checkmark inset from box edge
ALLEGRO_BITMAP * track_bitmap
optional bitmap for the scrollbar track background (NULL = color theme)
float checkbox_label_offset
horizontal offset from box edge to label text
ALLEGRO_BITMAP * titlebar_bitmap
optional bitmap for the titlebar background (NULL = color fill)
int scroll_offset
scroll offset in dropdown
N_GUI_CTX * ctx
GUI context.
void * data
widget-specific data (union via void pointer)
double value
current value (always snapped to step)
N_GUI_DROPMENU_ENTRY * entries
dynamic array of entries
float drag_oy
drag offset y (internal)
float slider_track_border_thickness
track outline thickness
int nb_active
active row count
ALLEGRO_COLOR link_color_normal
link colour (normal)
float slider_handle_min_r
minimum handle circle radius
int scale_mode
scale mode: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, N_GUI_IMAGE_CENTER
ALLEGRO_BITMAP * item_selected_bitmap
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the radiolist background (NULL = color theme)
N_GUI_TREE_NODE nodes[512]
node storage
ALLEGRO_BITMAP * box_bitmap
optional bitmap for the checkbox square, unchecked state (NULL = color theme)
void * on_open_user_data
user data for on_open callback
float y
y origin of tab button row
float dropdown_arrow_reserve
horizontal space reserved for the arrow on the right
float y
position y relative to parent window
int lbl_desc
label widget ID for "Description" header
int orientation
orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V
float global_scrollbar_border_thickness
global thumb border thickness
int state
state flags (N_GUI_WIN_*)
int flags
feature flags (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, etc.)
void * user_data
user data for callback
int active
1 if active, 0 if removed
double max_val
maximum value
HASH_TABLE * widgets_by_id
hash table for fast widget lookup by id
float border_thickness
border thickness
float link_underline_thickness
link underline thickness
ALLEGRO_BITMAP * box_checked_bitmap
optional bitmap for the checkbox square, checked state (NULL = color theme)
int autofit_flags
bitmask of N_GUI_AUTOFIT_* flags (0 = no auto-fitting)
N_GUI_STYLE style
configurable style (sizes, colours, paddings)
ALLEGRO_FONT * font
font for the title bar
void * user_data
user data for callback
ALLEGRO_COLOR text_active
text active
float ref_display_w
reference display width at the time normalized values were last captured
int nb_nodes
number of nodes
size_t items_capacity
allocated capacity
int parent_window_id
parent window for tab buttons
double content_size
total content size
float autofit_origin_x
original insertion point x for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)
void * user_data
user data for callback
double step
step increment (0 is treated as 1).
float global_scroll_y
global vertical scroll offset (when GUI exceeds display)
int scrollbar_drag_widget_id
id of the widget whose scrollbar is being dragged, or -1
float min_h
minimum height
float listbox_default_item_height
default item height for listbox
ALLEGRO_COLOR global_scrollbar_thumb_border_color
global scrollbar thumb border colour
ALLEGRO_COLOR border_active
border active
float scroll_x
horizontal scroll offset for single-line text (pixels)
float label_padding
horizontal padding each side
float titlebar_h
title bar height
float gui_offset_y
vertical letterbox offset for virtual canvas
ALLEGRO_BITMAP * item_selected_bitmap
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
void(* on_select)(int widget_id, int index, int selected, void *user_data)
callback on selection change (widget_id, item_index, selected, user_data)
float item_height
item height in pixels
void(* on_select)(int widget_id, int index, void *user_data)
callback on selection change (widget_id, selected_index, user_data)
int focused_widget_id
id of the widget that currently has focus, or -1
int global_vscroll_drag
1 if global scrollbar vertical thumb is being dragged
int sel_dragging
1 if mouse is actively dragging to select text
int nb_visible
number of visible rows
ALLEGRO_COLOR global_scrollbar_track_color
global scrollbar track colour
float item_height_pad
min padding added to font height for item height
float display_h
display/viewport height
N_GUI_LISTITEM * items
dynamic array of items
void * user_data
user data for callback
float corner_ry
corner radius Y for rounded shapes
int sel_end
selection end byte offset (-1 = no selection)
int bg_scale_mode
scale mode for bg_bitmap: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER
size_t text_alloc
allocated buffer size (char_limit + 1)
ALLEGRO_COLOR bg_normal
background normal
ALLEGRO_BITMAP * handle_bitmap
optional bitmap for the draggable handle, normal state (NULL = color theme)
ALLEGRO_FONT * font
font used by this widget (NULL = context default)
float norm_w
normalized width (fraction of parent window w)
int resize_mode
context resize mode: N_GUI_RESIZE_VIRTUAL or N_GUI_RESIZE_ADAPTIVE
float virtual_w
virtual canvas width (0 = disabled / identity transform)
float radiolist_default_item_height
default item height for radiolist
char label[128]
label displayed next to the checkbox
float slider_value_label_offset
gap between slider end and value label
size_t nb_items
number of items
int depth
depth in tree (0 = root)
ALLEGRO_COLOR bg_active
background active/pressed
char mask_char
mask character for password fields (0 = no masking, e.g.
int global_hscroll_drag
1 if global scrollbar horizontal thumb is being dragged
LIST * windows
ordered list of N_GUI_WINDOW* (back to front)
char text[128]
display text
int scroll_y
scroll offset for long text
void(* on_scroll)(int widget_id, double scroll_pos, void *user_data)
callback on scroll
int x
bounding box x offset from draw origin
float gui_bounds_h
total bounding box height of all windows (computed internally)
double min_val
minimum value
float textarea_cursor_blink_period
cursor blink period in seconds (full cycle on+off)
int lbl_value
label widget ID for "Value" header
void(* on_toggle)(int widget_id, int checked, void *user_data)
callback on toggle
ALLEGRO_COLOR bg_hover
background hover
size_t sel_start
selection anchor position (where shift-click/shift-arrow started).
int window_id
parent window
float dropdown_arrow_thickness
arrow stroke thickness
void * user_data
user data for callback
ALLEGRO_COLOR link_color_hover
link colour (hover)
float radio_circle_min_r
minimum outer circle radius
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the listbox background (NULL = color theme)
float item_text_padding
text padding inside list/combo/dropmenu items
int next_widget_id
next widget id to assign
int enabled_id
checkbox widget ID for the enabled toggle
float autofit_border
padding/border around content for auto-fit (pixels, applied on each side)
float gui_scale
computed uniform scale factor for virtual canvas
size_t cursor_pos
cursor position in text
void * user_data
user data for callback
int mode
mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT
size_t char_limit
maximum character limit (0 = N_GUI_TEXT_MAX)
int toggle_mode
toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked)
int is_open
is the menu currently open
ALLEGRO_COLOR border_hover
border hover
float scrollbar_thumb_min
minimum thumb dimension
float x
x origin of first tab button
ALLEGRO_BITMAP * thumb_hover_bitmap
optional bitmap for the thumb on hover (NULL = fallback to thumb_bitmap)
int value_id
textarea widget ID for the value
char label[128]
label displayed on the button
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the text area background (NULL = color theme)
int align
text alignment: N_GUI_ALIGN_LEFT, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_RIGHT
size_t text_len
current text length
char link[4096]
optional hyperlink URL (empty string = no link)
int orientation
orientation: N_GUI_SCROLLBAR_H or N_GUI_SCROLLBAR_V
float global_scrollbar_thumb_min
global minimum thumb dimension
double viewport_size
visible viewport size
void(* on_link_click)(int widget_id, const char *link, void *user_data)
callback when link is clicked (widget_id, link_url, user_data)
ALLEGRO_FONT * default_font
default font (must be set before adding widgets)
float combobox_max_dropdown_width
maximum dropdown width for N_GUI_COMBOBOX_AUTO_WIDTH (0 = display width)
int selection_mode
selection mode: N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, N_GUI_SELECT_MULTIPLE
size_t nb_items
number of items
int key_modifiers
required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state ...
LIST * widgets
list of N_GUI_WIDGET* contained in this window
float y
position y on screen
ALLEGRO_BITMAP * bitmap_active
optional bitmap for active/pressed state
int enabled
enabled flag (1 = enabled, 0 = disabled: drawn dimmed and ignores input)
float radio_circle_border_thickness
outer circle border thickness
int keycode
bound keyboard keycode (0 = none).
ALLEGRO_BITMAP * thumb_active_bitmap
optional bitmap for the thumb while dragging (NULL = fallback to thumb_bitmap)
float slider_track_size
track width (vertical) or height (horizontal)
float scroll_x
horizontal scroll offset for auto-scrollbar (pixels)
float slider_handle_border_thickness
handle border thickness
void n_gui_set_display_size(N_GUI_CTX *ctx, float w, float h)
set the display (viewport) size so global scrollbars can be computed.
void n_gui_combobox_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *item_bg, ALLEGRO_BITMAP *item_selected)
set optional bitmap overlays on a combobox widget.
int n_gui_load_theme_json(N_GUI_CTX *ctx, const char *filepath)
Load a JSON theme file and apply it to the context.
int n_gui_listbox_get_scroll_offset(N_GUI_CTX *ctx, int widget_id)
get the current scroll offset (in items)
void n_gui_dropmenu_clear(N_GUI_CTX *ctx, int widget_id)
remove all entries
void n_gui_update_transform(N_GUI_CTX *ctx)
recalculate scale and offset from virtual canvas to display.
int n_gui_button_is_toggled(N_GUI_CTX *ctx, int widget_id)
check if button is toggled
float n_gui_detect_dpi_scale(N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
detect and apply DPI scale from the given allegro display.
void n_gui_toggle_window(N_GUI_CTX *ctx, int window_id)
toggle window visibility (show/hide)
#define N_GUI_TREE_MAX
maximum number of nodes in a tree view
void n_gui_raise_window(N_GUI_CTX *ctx, int window_id)
raise a window to the top of the stack (respects z-order constraints)
int n_gui_add_slider(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, double min_val, double max_val, double initial, int mode, void(*on_change)(int, double, void *), void *user_data)
add a horizontal slider widget
void n_gui_combobox_set_flags(N_GUI_CTX *ctx, int widget_id, int flags)
set combobox feature flags (bitmask of N_GUI_COMBOBOX_* values)
void n_gui_window_apply_autofit(N_GUI_CTX *ctx, int window_id)
trigger auto-fit recalculation for a window (call after adding/removing/resizing widgets)
void n_gui_textarea_set_text(N_GUI_CTX *ctx, int widget_id, const char *text)
set text area content
double n_gui_scrollbar_get_pos(N_GUI_CTX *ctx, int widget_id)
get scrollbar position
N_GUI_KVTABLE * n_gui_kvtable_create(N_GUI_CTX *ctx, int window_id, float row_height, float padding, void(*on_remove)(int, void *), void *user_data)
create a KV table in an existing window
int n_gui_add_vslider(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, double min_val, double max_val, double initial, int mode, void(*on_change)(int, double, void *), void *user_data)
add a vertical slider (same as n_gui_add_slider but oriented vertically)
void n_gui_set_display(N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
set the display pointer for clipboard operations (copy/paste)
void n_gui_window_set_bitmaps(N_GUI_CTX *ctx, int window_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *titlebar, int bg_scale_mode)
set optional bitmap overlays on a window's body and titlebar.
void n_gui_set_widget_theme(N_GUI_CTX *ctx, int widget_id, N_GUI_THEME theme)
set the theme on a widget
int n_gui_wants_mouse(N_GUI_CTX *ctx)
check if the mouse is currently over any open GUI window (use to prevent click-through to the game wo...
int n_gui_dropmenu_get_count(N_GUI_CTX *ctx, int widget_id)
get number of entries
int n_gui_radiolist_add_item(N_GUI_CTX *ctx, int widget_id, const char *text)
add an item to a radio list
void n_gui_lower_window(N_GUI_CTX *ctx, int window_id)
lower a window to the bottom of the stack (respects z-order constraints)
void n_gui_label_set_text(N_GUI_CTX *ctx, int widget_id, const char *text)
set label text content
int n_gui_add_listbox(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int selection_mode, void(*on_select)(int, int, int, void *), void *user_data)
add a listbox widget
#define N_GUI_KV_MAX
maximum number of rows in a KV table
int n_gui_process_event(N_GUI_CTX *ctx, ALLEGRO_EVENT event)
process an allegro event for the GUI
int n_gui_window_get_flags(N_GUI_CTX *ctx, int window_id)
get feature flags of a window
void n_gui_minimize_window(N_GUI_CTX *ctx, int window_id)
minimize a window (title bar only)
int n_gui_add_label(N_GUI_CTX *ctx, int window_id, const char *text, float x, float y, float w, float h, int align)
add a text label widget
void n_gui_set_widget_enabled(N_GUI_CTX *ctx, int widget_id, int enabled)
set widget enabled state (0 = disabled: drawn dimmed and ignores all input)
int n_gui_add_radiolist(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, void(*on_select)(int, int, void *), void *user_data)
add a radio list widget
void n_gui_tab_free(N_GUI_TAB_PANEL **panel)
free a tab panel (does not destroy the N_GUI widgets)
void n_gui_close_window(N_GUI_CTX *ctx, int window_id)
close (hide) a window
void n_gui_listbox_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *item_bg, ALLEGRO_BITMAP *item_selected)
set optional bitmap overlays on a listbox widget.
void n_gui_label_set_link(N_GUI_CTX *ctx, int widget_id, const char *link)
set label hyperlink URL
void n_gui_kvtable_free(N_GUI_KVTABLE **table)
free a KV table (does not destroy the N_GUI widgets)
void n_gui_window_set_resize_policy(N_GUI_CTX *ctx, int window_id, int policy)
set per-window resize policy (N_GUI_WIN_RESIZE_NONE / _MOVE / _SCALE).
void n_gui_button_set_keycode_focused(N_GUI_CTX *ctx, int widget_id, int keycode, int modifiers, const int *sources, int source_count)
bind a keyboard key to a button that fires only when specific widgets have focus.
void n_gui_radiolist_clear(N_GUI_CTX *ctx, int widget_id)
remove all items from a radio list
void n_gui_listbox_set_selected(N_GUI_CTX *ctx, int widget_id, int index, int selected)
set item selection state
int n_gui_add_window_auto(N_GUI_CTX *ctx, const char *title, float x, float y)
add a window that sizes itself automatically to fit its widgets (call n_gui_window_autosize after add...
double n_gui_slider_get_value(N_GUI_CTX *ctx, int widget_id)
get slider current value
int n_gui_listbox_add_item(N_GUI_CTX *ctx, int widget_id, const char *text)
add an item to a listbox
void n_gui_set_virtual_size(N_GUI_CTX *ctx, float w, float h)
set the virtual canvas size for resolution-independent scaling.
float n_gui_get_dpi_scale(const N_GUI_CTX *ctx)
get current DPI scale factor
N_GUI_THEME n_gui_default_theme(void)
return the built-in default theme
void n_gui_window_set_zorder(N_GUI_CTX *ctx, int window_id, int z_mode, int z_value)
set window z-order mode and value
int n_gui_radiolist_get_selected(N_GUI_CTX *ctx, int widget_id)
get the selected item index
void n_gui_tab_set_content_window(N_GUI_TAB_PANEL *panel, int tab_index, int window_id)
associate a content window with a tab
int n_gui_save_theme_json(N_GUI_CTX *ctx, const char *filepath)
Save the full theme (default_theme + style) to a JSON file.
int n_gui_combobox_add_item(N_GUI_CTX *ctx, int widget_id, const char *text)
add an item to a combo box
void n_gui_window_autosize(N_GUI_CTX *ctx, int window_id)
recompute and apply minimum-fit size for a window based on its current widgets
void n_gui_set_focus(N_GUI_CTX *ctx, int widget_id)
set keyboard focus to a specific widget (-1 to clear focus)
void n_gui_tree_rebuild(N_GUI_TREE *tree)
rebuild the listbox to reflect current tree state
void n_gui_textarea_set_selection(N_GUI_CTX *ctx, int widget_id, size_t start, size_t end)
set the text selection range (byte offsets into text content)
void n_gui_scrollbar_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *track, ALLEGRO_BITMAP *thumb, ALLEGRO_BITMAP *thumb_hover, ALLEGRO_BITMAP *thumb_active)
set optional bitmap overlays on a scrollbar widget.
int n_gui_add_combobox(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, void(*on_select)(int, int, void *), void *user_data)
add a combo box widget
void n_gui_button_set_toggled(N_GUI_CTX *ctx, int widget_id, int toggled)
set button toggled state
void n_gui_tab_set_active(N_GUI_TAB_PANEL *panel, int index)
set the active tab (toggles buttons, opens/closes content windows)
void n_gui_slider_set_step(N_GUI_CTX *ctx, int widget_id, double step)
set slider step increment (0 is treated as 1).
int n_gui_add_toggle_button(N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, int shape, int initial_state, void(*on_click)(int, void *), void *user_data)
toggle button creation (returns widget id)
void n_gui_kvtable_remove_row(N_GUI_KVTABLE *table, int row_index)
remove a row by index (hides widgets, marks inactive)
int n_gui_add_label_link(N_GUI_CTX *ctx, int window_id, const char *text, const char *link, float x, float y, float w, float h, int align, void(*on_link_click)(int, const char *, void *), void *user_data)
add a text label with hyperlink
void n_gui_textarea_set_mask_char(N_GUI_CTX *ctx, int widget_id, char mask)
set a mask character for password-style input (e.g.
int n_gui_listbox_get_selected(N_GUI_CTX *ctx, int widget_id)
get the first selected item index
int n_gui_add_image(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, ALLEGRO_BITMAP *bitmap, int scale_mode)
add an image widget
void n_gui_label_set_bitmap(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg)
set optional background bitmap on a label widget.
void n_gui_draw(N_GUI_CTX *ctx)
draw all visible GUI windows and widgets
int n_gui_tab_add(N_GUI_TAB_PANEL *panel, const char *label)
add a tab to the panel, returns tab index
void n_gui_slider_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *track, ALLEGRO_BITMAP *fill, ALLEGRO_BITMAP *handle, ALLEGRO_BITMAP *handle_hover, ALLEGRO_BITMAP *handle_active)
set optional bitmap overlays on a slider widget.
int n_gui_window_get_zorder(N_GUI_CTX *ctx, int window_id)
get window z-order mode
void n_gui_tree_free(N_GUI_TREE **tree)
free a tree view (does not destroy the N_GUI listbox)
int n_gui_window_get_resize_policy(N_GUI_CTX *ctx, int window_id)
get per-window resize policy
void n_gui_checkbox_set_checked(N_GUI_CTX *ctx, int widget_id, int checked)
set checkbox checked state
int n_gui_dropmenu_add_dynamic_entry(N_GUI_CTX *ctx, int widget_id, const char *text, int tag, void(*on_click)(int, int, int, void *), void *user_data)
add a dynamic entry (rebuilt each time menu opens)
void n_gui_apply_adaptive_resize(N_GUI_CTX *ctx, float new_w, float new_h)
apply adaptive resize: reposition/resize all windows according to their policies for the new display ...
int n_gui_is_widget_enabled(N_GUI_CTX *ctx, int widget_id)
check if a widget is enabled
void n_gui_button_set_keycode(N_GUI_CTX *ctx, int widget_id, int keycode, int modifiers)
bind a keyboard key with optional modifier requirements to a button.
int n_gui_window_is_open(N_GUI_CTX *ctx, int window_id)
check if window is visible
void n_gui_set_dpi_scale(N_GUI_CTX *ctx, float scale)
set DPI scale factor manually (default is 1.0).
int n_gui_get_resize_mode(N_GUI_CTX *ctx)
get current resize mode
N_GUI_WIDGET * n_gui_get_widget(N_GUI_CTX *ctx, int widget_id)
get a widget by id
int n_gui_dropmenu_add_entry(N_GUI_CTX *ctx, int widget_id, const char *text, int tag, void(*on_click)(int, int, int, void *), void *user_data)
add a static entry to a dropdown menu
N_GUI_WINDOW * n_gui_get_window(N_GUI_CTX *ctx, int window_id)
get a window by id
void n_gui_dropmenu_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *panel, ALLEGRO_BITMAP *item_hover)
set optional bitmap overlays on a dropmenu widget.
int n_gui_add_window(N_GUI_CTX *ctx, const char *title, float x, float y, float w, float h)
add a window to the GUI context
N_GUI_CTX * n_gui_new_ctx(ALLEGRO_FONT *default_font)
create a new GUI context
void n_gui_slider_set_range(N_GUI_CTX *ctx, int widget_id, double min_val, double max_val)
set slider min/max range, clamping the current value if needed
const char * n_gui_listbox_get_item_text(N_GUI_CTX *ctx, int widget_id, int index)
get item text by index
void n_gui_radiolist_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *item_bg, ALLEGRO_BITMAP *item_selected)
set optional bitmap overlays on a radiolist widget.
N_GUI_TREE * n_gui_tree_create(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, void(*on_select)(int, void *), void *user_data)
create a tree view in an existing window
int n_gui_add_button_bitmap(N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, ALLEGRO_BITMAP *normal, ALLEGRO_BITMAP *hover, ALLEGRO_BITMAP *active, void(*on_click)(int, void *), void *user_data)
add a bitmap-based button widget
void n_gui_set_resize_mode(N_GUI_CTX *ctx, int mode)
set context-level resize mode: N_GUI_RESIZE_VIRTUAL (default) or N_GUI_RESIZE_ADAPTIVE
void n_gui_button_set_toggle_mode(N_GUI_CTX *ctx, int widget_id, int toggle_mode)
set button toggle mode
void n_gui_tree_toggle_expand(N_GUI_TREE *tree, int node_index)
toggle expand/collapse of a node
void n_gui_textarea_scroll_to_offset(N_GUI_CTX *ctx, int widget_id, size_t byte_offset)
scroll a multiline textarea so that the given byte offset is vertically centered
void n_gui_textarea_set_bitmap(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg)
set optional background bitmap on a textarea widget.
void n_gui_listbox_clear(N_GUI_CTX *ctx, int widget_id)
clear all items from a listbox
int n_gui_add_scrollbar(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int orientation, int shape, double content_size, double viewport_size, void(*on_scroll)(int, double, void *), void *user_data)
add a scrollbar widget
N_GUI_TEXT_DIMS n_gui_get_text_dims(ALLEGRO_FONT *font, const char *text)
get the bounding box dimensions of text rendered with the given font.
int n_gui_kvtable_get_count(N_GUI_KVTABLE *table)
get the number of active rows
void n_gui_destroy_ctx(N_GUI_CTX **ctx)
destroy a GUI context and free all resources
const char * n_gui_textarea_get_text(N_GUI_CTX *ctx, int widget_id)
get text area content
int n_gui_tab_get_active(N_GUI_TAB_PANEL *panel)
get the active tab index
int n_gui_kvtable_add_row(N_GUI_KVTABLE *table, const char *key, const char *value, const char *description, int enabled)
add a row to the KV table
void n_gui_checkbox_set_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *box, ALLEGRO_BITMAP *box_checked, ALLEGRO_BITMAP *box_hover)
set optional bitmap overlays on a checkbox widget.
void n_gui_listbox_set_scroll_offset(N_GUI_CTX *ctx, int widget_id, int offset)
set the scroll offset (in items) — clamps to valid range
#define N_GUI_TEXT_MAX
maximum length for textarea content
void n_gui_textarea_scroll_to_bottom(N_GUI_CTX *ctx, int widget_id)
scroll a multiline textarea to the bottom
size_t n_gui_textarea_get_text_length(N_GUI_CTX *ctx, int widget_id)
return the current text length in bytes (0 if widget is invalid)
void n_gui_open_window(N_GUI_CTX *ctx, int window_id)
open (show) a window
int n_gui_window_get_zvalue(N_GUI_CTX *ctx, int window_id)
get window z-value (for N_GUI_ZORDER_FIXED mode)
void n_gui_dropmenu_set_entry_text(N_GUI_CTX *ctx, int widget_id, int index, const char *text)
update text of an existing entry by index
int n_gui_tree_add_node(N_GUI_TREE *tree, const char *label, int parent_index, void *user_data)
add a node to the tree
int n_gui_listbox_get_count(N_GUI_CTX *ctx, int widget_id)
get number of items in a listbox
int n_gui_checkbox_is_checked(N_GUI_CTX *ctx, int widget_id)
check if checkbox is checked
int n_gui_combobox_get_selected(N_GUI_CTX *ctx, int widget_id)
get the selected item index
void n_gui_image_set_bitmap(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bitmap)
set the bitmap on an image widget
void n_gui_slider_set_value(N_GUI_CTX *ctx, int widget_id, double value)
set slider value
void n_gui_radiolist_set_selected(N_GUI_CTX *ctx, int widget_id, int index)
set the selected item index
void n_gui_window_set_flags(N_GUI_CTX *ctx, int window_id, int flags)
set feature flags on a window (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, ...)
void n_gui_set_widget_visible(N_GUI_CTX *ctx, int widget_id, int visible)
set widget visibility
N_GUI_TAB_PANEL * n_gui_tab_create(N_GUI_CTX *ctx, int window_id, float x, float y, float button_w, float button_h, void(*on_tab_change)(int, void *), void *user_data)
create a tab panel in an existing window
#define N_GUI_ID_MAX
maximum length for widget id/name strings
N_GUI_STYLE n_gui_default_style(void)
return the built-in default style
#define N_GUI_TAB_MAX
maximum number of tabs in a single tab panel
void n_gui_scrollbar_set_sizes(N_GUI_CTX *ctx, int widget_id, double content_size, double viewport_size)
set scrollbar content and viewport sizes
int n_gui_add_textarea(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int multiline, size_t char_limit, void(*on_change)(int, const char *, void *), void *user_data)
add a text area widget
int n_gui_listbox_is_selected(N_GUI_CTX *ctx, int widget_id, int index)
check if an item is selected
void n_gui_window_update_normalized(N_GUI_CTX *ctx, int window_id)
recapture normalized coordinates for a window from its current absolute position/size.
int n_gui_add_checkbox(N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, int initial_checked, void(*on_toggle)(int, int, void *), void *user_data)
add a checkbox widget
void n_gui_combobox_clear(N_GUI_CTX *ctx, int widget_id)
remove all items from a combobox
void n_gui_combobox_set_selected(N_GUI_CTX *ctx, int widget_id, int index)
set the selected item index
int n_gui_listbox_remove_item(N_GUI_CTX *ctx, int widget_id, int index)
remove an item from a listbox by index
N_GUI_THEME n_gui_make_theme(ALLEGRO_COLOR bg, ALLEGRO_COLOR bg_hover, ALLEGRO_COLOR bg_active, ALLEGRO_COLOR border, ALLEGRO_COLOR border_hover, ALLEGRO_COLOR border_active, ALLEGRO_COLOR text, ALLEGRO_COLOR text_hover, ALLEGRO_COLOR text_active, float border_thickness, float corner_rx, float corner_ry)
create a custom theme from individual colors and properties
int n_gui_add_dropmenu(N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, void(*on_open)(int, void *), void *on_open_user_data)
add a dropdown menu widget (button that opens a menu panel with entries)
void n_gui_screen_to_virtual(const N_GUI_CTX *ctx, float sx, float sy, float *vx, float *vy)
convert physical screen coordinates to virtual canvas coordinates.
int n_gui_add_button(N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, int shape, void(*on_click)(int, void *), void *user_data)
add a button widget
#define N_GUI_KEY_SOURCES_MAX
maximum number of source widgets for a focused key binding
void n_gui_window_set_autofit(N_GUI_CTX *ctx, int window_id, int autofit_flags, float border)
configure auto-fit behavior for a dialog window
void n_gui_scrollbar_set_pos(N_GUI_CTX *ctx, int widget_id, double pos)
set scrollbar position
void n_gui_dropmenu_clear_dynamic(N_GUI_CTX *ctx, int widget_id)
remove all dynamic entries (call from on_open callback before re-adding)
The top-level GUI context that holds all windows.
dropdown menu specific data
A single entry in a dropdown menu (static or dynamic)
image widget specific data
a single row in the KV table
key-value table built from textareas, checkboxes, and buttons
static text label specific data
a single item in a list/radio/combo widget
Global style holding every configurable layout constant.
tab panel built from toggle buttons with content window management
bounding box dimensions returned by n_gui_get_text_dims()
Color theme for a widget.
tree view built from an N_GUI listbox
a single node in the tree view
A pseudo window that contains widgets.
structure of a hash table
Structure of a generic LIST container.
Common headers and low-level functions & define.
Hash functions and table.
List structures and definitions.
N_STR and string function declaration.