28#ifndef __NILOREA_GUI__
29#define __NILOREA_GUI__
85#define N_GUI_ID_MAX 128
87#define N_GUI_TEXT_MAX 4096
91#define N_GUI_TYPE_BUTTON 1
93#define N_GUI_TYPE_SLIDER 2
95#define N_GUI_TYPE_TEXTAREA 3
97#define N_GUI_TYPE_CHECKBOX 4
99#define N_GUI_TYPE_SCROLLBAR 5
101#define N_GUI_TYPE_LISTBOX 6
103#define N_GUI_TYPE_RADIOLIST 7
105#define N_GUI_TYPE_COMBOBOX 8
107#define N_GUI_TYPE_IMAGE 9
109#define N_GUI_TYPE_LABEL 10
111#define N_GUI_TYPE_DROPMENU 11
113#define N_GUI_TYPE_SPLITPANE 12
115#define N_GUI_TYPE_HEXVIEW 13
117#define N_GUI_TYPE_SYNTAXVIEW 14
119#define N_GUI_TYPE_DATAGRID 15
122#define N_GUI_TYPE_PROGRESSBAR 16
125#define N_GUI_TYPE_CUSTOM 17
128#define N_GUI_SPLIT_VERTICAL 0
130#define N_GUI_SPLIT_HORIZONTAL 1
133#define N_GUI_SYNTAX_PLAIN 0
135#define N_GUI_SYNTAX_HTTP 1
137#define N_GUI_SYNTAX_JSON 2
139#define N_GUI_SYNTAX_XML 3
141#define N_GUI_SYNTAX_YAML 4
143#define N_GUI_SYNTAX_JS 5
147#define N_GUI_SHAPE_RECT 0
149#define N_GUI_SHAPE_ROUNDED 1
151#define N_GUI_SHAPE_BITMAP 2
155#define N_GUI_SLIDER_VALUE 0
157#define N_GUI_SLIDER_PERCENT 1
161#define N_GUI_SLIDER_H 0
163#define N_GUI_SLIDER_V 1
167#define N_GUI_SCROLLBAR_H 0
169#define N_GUI_SCROLLBAR_V 1
173#define N_GUI_SELECT_NONE 0
175#define N_GUI_SELECT_SINGLE 1
177#define N_GUI_SELECT_MULTIPLE 2
181#define N_GUI_IMAGE_FIT 0
183#define N_GUI_IMAGE_STRETCH 1
185#define N_GUI_IMAGE_CENTER 2
189#define N_GUI_ALIGN_LEFT 0
191#define N_GUI_ALIGN_CENTER 1
193#define N_GUI_ALIGN_RIGHT 2
195#define N_GUI_ALIGN_JUSTIFIED 3
199#define N_GUI_STATE_IDLE 0
201#define N_GUI_STATE_HOVER 1
203#define N_GUI_STATE_ACTIVE 2
205#define N_GUI_STATE_FOCUSED 4
207#define N_GUI_STATE_SCROLLBAR_DRAG 8
211#define N_GUI_WIN_OPEN 1
213#define N_GUI_WIN_MINIMISED 2
215#define N_GUI_WIN_DRAGGING 4
217#define N_GUI_WIN_RESIZING 8
219#define N_GUI_WIN_VSCROLL_DRAG 16
221#define N_GUI_WIN_HSCROLL_DRAG 32
223#define N_GUI_WIN_MAXIMISED 64
227#define N_GUI_WIN_AUTO_SCROLLBAR 16
229#define N_GUI_WIN_RESIZABLE 32
231#define N_GUI_WIN_FIXED_POSITION 64
233#define N_GUI_WIN_FRAMELESS 128
235#define N_GUI_WIN_BTN_MINIMIZE 256
237#define N_GUI_WIN_BTN_MAXIMIZE 512
239#define N_GUI_WIN_BTN_CLOSE 1024
241#define N_GUI_WIN_BTN_ALL (N_GUI_WIN_BTN_MINIMIZE | N_GUI_WIN_BTN_MAXIMIZE | N_GUI_WIN_BTN_CLOSE)
244#define N_GUI_WIN_NO_HSCROLL 2048
248#define N_GUI_DETACH_NONE 0
250#define N_GUI_DETACH_RESIZABLE 1
256#define N_GUI_DETACH_SCALE_CONTENT 2
266#define N_GUI_DETACH_OWN_CHROME 4
270#define N_GUI_TB_BTN_NONE 0
272#define N_GUI_TB_BTN_MINIMIZE 1
274#define N_GUI_TB_BTN_MAXIMIZE 2
276#define N_GUI_TB_BTN_CLOSE 3
280#define N_GUI_RESIZE_VIRTUAL 0
282#define N_GUI_RESIZE_ADAPTIVE 1
286#define N_GUI_WIN_RESIZE_NONE 0
288#define N_GUI_WIN_RESIZE_MOVE 1
290#define N_GUI_WIN_RESIZE_SCALE 2
294#define N_GUI_AUTOFIT_W 1
296#define N_GUI_AUTOFIT_H 2
298#define N_GUI_AUTOFIT_WH 3
300#define N_GUI_AUTOFIT_EXPAND_LEFT 4
302#define N_GUI_AUTOFIT_EXPAND_UP 8
304#define N_GUI_AUTOFIT_CENTER 16
308#define N_GUI_ZORDER_NORMAL 0
310#define N_GUI_ZORDER_ALWAYS_ON_TOP 1
312#define N_GUI_ZORDER_ALWAYS_BEHIND 2
319#define N_GUI_ZORDER_FIXED 3
326#define N_GUI_ZORDER_POPUP 4
372#define N_GUI_KEY_MOD_MASK (ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL | ALLEGRO_KEYMOD_ALT | ALLEGRO_KEYMOD_ALTGR)
375#define N_GUI_KEY_SOURCES_MAX 8
738#define N_GUI_COMBOBOX_AUTO_WIDTH 1
743#define N_GUI_COMBOBOX_EXPAND_UP 2
840#define N_GUI_DROPMENU_EXPAND_UP 1
872 void (*
on_open)(
int widget_id,
void* user_data);
1335#define N_GUI_PERSIST_MAX_COLS 64
1502 ALLEGRO_COLOR bg_hover,
1503 ALLEGRO_COLOR bg_active,
1504 ALLEGRO_COLOR border,
1505 ALLEGRO_COLOR border_hover,
1506 ALLEGRO_COLOR border_active,
1508 ALLEGRO_COLOR text_hover,
1509 ALLEGRO_COLOR text_active,
1510 float border_thickness,
1738int 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);
1741int 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);
1744int 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);
1791int 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);
1794int 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);
1797int 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);
1800int 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);
1803int 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);
1875int 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);
1900int n_gui_add_splitpane(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
int orientation,
float ratio,
void (*on_change)(
int,
float,
void*),
void* user_data);
1943int n_gui_add_datagrid(
N_GUI_CTX* ctx,
int window_id,
float x,
float y,
float w,
float h,
void (*on_select)(
int,
int,
void*),
void* user_data);
2074int 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);
2087int 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);
2105int 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);
2112int n_gui_add_label(
N_GUI_CTX* ctx,
int window_id,
const char* text,
float x,
float y,
float w,
float h,
int align);
2114int 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);
2133int 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);
2173void 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);
2363#define N_GUI_TAB_MAX 16
2395#define N_GUI_SECTIONLIST_MAX 16
2398#define N_GUI_SECTION_WIDGETS_MAX 48
2430N_GUI_SECTIONLIST*
n_gui_sectionlist_create(
N_GUI_CTX* ctx,
int window_id,
float x,
float y0,
float width,
float header_h,
float gap,
void (*on_toggle)(
int,
int,
void*),
void* user_data);
2451#define N_GUI_TREE_MAX 2048
2464#define N_GUI_DROP_BEFORE 0
2465#define N_GUI_DROP_INTO 1
2466#define N_GUI_DROP_AFTER 2
2549#define N_GUI_KV_MAX 128
2594 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]
column header title
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)
int saved_flags
embedded feature flags saved by n_gui_window_detach (a detached window is forced frameless because th...
char * text
owned copy of the text, or NULL
size_t * col_order
display order: display_pos -> physical column index (sized cols_cap), or NULL when the display order ...
ALLEGRO_BITMAP * handle_hover_bitmap
optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)
int window_id
owning window for coord math
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 native_drag_wx
native window x at the drag grab, the move is native_drag_wx plus the desktop cursor travel since the...
float gap
vertical gap between rows
int open_combobox_id
id of the combobox whose dropdown is currently open, or -1
ALLEGRO_COLOR scrollbar_track_color
scrollbar track colour
int folded
1 = collapsed (members hidden), 0 = expanded
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
ALLEGRO_BITMAP * minimize_active_bitmap
optional bitmap for minimize button active state
int sort_col
column index used for sorting, or -1
int scroll_offset
first visible row
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 bytes_per_row
bytes shown per row
int selected_row
selected data row (the primary / last-clicked row), or -1
float widget_dy[48]
each member's y offset from the section content top, captured at add time
int parent_index
parent node index, or -1 for root
int shape
shape type: N_GUI_SHAPE_RECT or N_GUI_SHAPE_ROUNDED
float x
saved x (already display-scaled)
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
N_GUI_TREE_NODE nodes[2048]
node storage
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
void(* on_change)(int widget_id, float ratio, void *user_data)
callback fired while the divider is dragged (widget_id, ratio, user_data)
int nb_widgets
number of member widgets
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)
char ** cells
row-major cell strings (nb_rows * nb_cols owned char*)
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)
int selected_syntaxview_id
id of the syntax-view widget with the most recent text selection, or -1
float top_offset
unscaled y offset of the header row from the window top (default 0), to reserve space above the table...
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)
int sel_start
selection start byte offset into text, or -1 when nothing is selected
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
int multiselect
1 = multi-row selection enabled (Ctrl/Shift-click), 0 = single-select
double anim_until
deadline (al_get_time seconds) until which a transient animation is in progress (button key-press fla...
size_t rows_cap
allocated row capacity (in rows)
int want_native
1 when the window should live in a native OS window: set by n_gui_window_detach and by a loaded layou...
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)
int flags
bitmask of N_GUI_DROPMENU_* flags
float saved_y
embedded y saved by n_gui_window_detach, restored by n_gui_window_attach
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
ALLEGRO_COLOR tooltip_fg
tooltip text color
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
ALLEGRO_COLOR text_normal
text normal
int remove_id
button widget ID for the remove action
int pressed
which button is currently pressed (N_GUI_TB_BTN_*)
void * on_maximize_user_data
user data for on_maximize callback
int drop_position
N_GUI_DROP_BEFORE / INTO / AFTER.
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
int sel_dragging
1 while a mouse drag is extending the selection, 0 otherwise
void(* on_open)(int widget_id, void *user_data)
callback to rebuild dynamic entries each time the menu is opened.
size_t cols_cap
allocated column capacity
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)
int drag_hover_node
current hover node, or -1
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 h_scroll_dragging
1 while the user is dragging the horizontal scrollbar thumb (so the shared scrollbar-drag handler rou...
int pending_layout_count
number of valid entries in pending_layout
int state
saved minimised/maximised bits, applied on create
float tooltip_delay
inner padding
int key_focus_only
if 1, keycode fires only when the button itself or a source widget has focus.
int value_visible
draw the built-in value label next to/below the handle.
int ncols
column count (kind == DATAGRID)
N_GUI_KV_ROW rows[128]
row storage
char * tooltip
owned tooltip text shown after the pointer rests on the widget (NULL = none); heap-allocated with no ...
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 lines_valid
0 when cached_nb_lines / cached_headers_end are stale (rebuild on next use).
int key_id
textarea widget ID for the key
ALLEGRO_BITMAP * bitmap_hover
optional bitmap for hover state
int kind
N_GUI_TYPE_SPLITPANE or N_GUI_TYPE_DATAGRID.
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)
double key_press_until
absolute al_get_time() deadline until which the button is rendered in its pressed (N_GUI_STATE_ACTIVE...
float x
position x relative to parent window
float drag_press_x
mouse x at press time
float global_scrollbar_size
global scrollbar track width/height
int highlight_index
open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).
void(* on_toggle)(int, int, void *)
callback(section_index, folded, user_data) on a header click (may be NULL)
float textarea_cursor_width
cursor width in pixels
char text[4096]
text to display
void * user_data
user data for callback
char title[128]
owning window title to match on
float tb_btn_size
titlebar button size (0 = auto: titlebar_h - 4)
float norm_h
normalized height (fraction of reference display height, used in SCALE mode)
char value_format[32]
printf-style format string applied to the numeric value when the built-in readout draws.
float min_win_w
minimum window width (for resize)
ALLEGRO_BITMAP * bg_bitmap
optional bitmap for the combobox background (NULL = color theme)
ALLEGRO_BITMAP * maximize_bitmap
optional bitmap for maximize button normal state (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
int native_drag_wy
native window y at the drag grab (see native_drag_wx)
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
unscaled row height in pixels
int expanded
1 if expanded
N_GUI_LISTITEM * items
dynamic array of items
char label[128]
display text
int mode
highlighting mode: N_GUI_SYNTAX_*
int drag_armed_node
pressed-but-not-yet-dragging
ALLEGRO_BITMAP * close_hover_bitmap
optional bitmap for close button hover state
int show_enabled
1 to show the enabled-checkbox column (default 1)
N_GUI_THEME theme
color theme for this window chrome
int sel_end
selection end byte offset (tracks the cursor while a drag is in progress)
int native_close_pending
1 when the native window must be released at the next safe point (an ALLEGRO_EVENT_DISPLAY_CLOSE arri...
int sort_dir
sort direction: 1 ascending, -1 descending
float saved_w
embedded width saved by n_gui_window_detach, restored by n_gui_window_attach
char title[64]
section title (header label minus the fold glyph)
int desc_id
textarea widget ID for the description
int widget_ids[48]
member widget ids
float width
column width in pixels
int next_window_id
next window id to assign
float item_selection_inset
item highlight inset from left/right edges
int header_id
clickable header button widget id
float saved_h
embedded height saved by n_gui_window_detach, restored by n_gui_window_attach
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)
N_GUI_SECTION sections[16]
section storage
void(* on_content_draw)(int window_id, void *user_data)
optional callback invoked during n_gui_draw immediately after this window's own content is drawn,...
float init_win_w
parent window width at create time
int has_children
1 if node has children
N_GUI_THEME close_theme
theme for close button (defaults to red hover/active)
void * user_data
user data for callback
float value
progress fraction, clamped to 0.0 .
int scroll_offset
scroll offset
ALLEGRO_COLOR tooltip_bg
tooltip bubble background color
ALLEGRO_COLOR text_hover
text hover
float restore_x
saved x position before maximise (for restore)
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)
int highlight_index
open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).
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 window_id
window holding the headers and members
int lbl_key
label widget ID for "Key" header
char key[128]
widget persist key to match on
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
N_GUI_THEME default_tb_close_theme
default theme for titlebar close button
size_t nb_items
number of items
char persist_key[128]
optional stable key for persisting this widget's user-adjustable state (splitpane divider ratio,...
int native_drag_cx
desktop x of the mouse cursor when a native (N_GUI_DETACH_OWN_CHROME) title bar drag started.
void(* on_close)(int window_id, void *user_data)
callback on close button click (NULL = default: clear N_GUI_WIN_OPEN)
char title[128]
window title to match on
void * user_data
user data for callback
float first_inset
content-local left inset applied to the FIRST header only, so a button can sit before it on the same ...
int cached_nb_lines
cached line count (matches _text_line_count), valid when lines_valid
float padding
unscaled padding in pixels
unsigned char * data
owned copy of the bytes, or NULL
int detach_flags
options the window was detached with (N_GUI_DETACH_*), remembered so a close/open cycle and a restore...
n_gui_tree_on_drop_t on_drop
drag-reorder state (managed by n_gui_tree_tick)
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)
float max_ratio
upper clamp applied to ratio
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)
int nb_sections
number of sections
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
void * user_data
opaque user pointer handed back to the callback (not owned by n_gui)
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)
void * drop_user_data
user data for on_drop
float saved_x
embedded x saved by n_gui_window_detach, restored by n_gui_window_attach
float norm_w
normalized width (fraction of reference display width, used in SCALE mode)
float content_w
total content width computed from widgets (internal)
N_GUI_PENDING_WIDGET * pending_widgets
saved widget state for keyed widgets that did NOT exist when the layout was loaded; n_gui_widget_set_...
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
float min_ratio
lower clamp applied to ratio
unsigned char * row_sel
per-row selection flags (1 = selected), sized rows_cap; NULL until needed
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
N_GUI_TB_BUTTONS tb_buttons
titlebar button state (minimize, maximize, close)
int order[64]
display position -> physical column
ALLEGRO_COLOR scrollbar_thumb_color
scrollbar thumb colour
int active_tab
currently active tab index
float native_h
last known native window height (see native_w)
float checkbox_max_size
maximum box size
size_t nb_entries
number of entries
int visible_map[2048]
visible row to node index
int tooltip_anchor_x
pointer x when the tooltip was last armed (movement re-arms)
float checkbox_mark_thickness
checkmark line thickness
unsigned char * row_has_color
per-row tint flags (1 = row_color[row] is painted), sized rows_cap; NULL until a row color is set
ALLEGRO_BITMAP * close_bitmap
optional bitmap for close button normal state (NULL = color theme)
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)
ALLEGRO_COLOR tooltip_border
tooltip bubble border color
void * on_close_user_data
user data for on_close callback
N_GUI_THEME default_tb_btn_theme
default theme for titlebar minimize/maximize buttons
int tooltip_widget_id
widget the pointer is resting on for tooltip purposes (-1 = none)
float header_height
unscaled column-header row height
float global_scroll_step
pixels per mouse wheel notch for global scroll
float item_height
item height in dropdown
int hover_row
index of the row the mouse is currently over, or -1.
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)
N_GUI_DATAGRID_COL * cols
column definitions (physical/storage order; cells are indexed by these)
int scroll_offset
scroll offset in items
int native_drag_cy
desktop y of the mouse cursor at the drag grab (see native_drag_cx)
size_t len
number of bytes
int selected
selection state (for listbox)
ALLEGRO_BITMAP * minimize_hover_bitmap
optional bitmap for minimize button hover state
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)
int drag_active
1 once past threshold
float y0
content-local y of the first header
N_GUI_CTX * ctx
GUI context.
int shape_mode
global widget shape override: N_GUI_SHAPE_ROUNDED forces a rounded GUI, N_GUI_SHAPE_RECT forces a squ...
int visible
1 = drawn, 0 = hidden (kept in storage, skipped in the header and rows)
float global_scroll_x
global horizontal scroll offset (when GUI exceeds display)
int cached_headers_end
cached first blank-line index (HTTP headers end), or INT_MAX; valid when lines_valid
int native_pos_x
last known native window position on the desktop, applied when the native window is re-created.
float init_win_h
parent window height at create time
float checkbox_mark_margin
checkmark inset from box edge
ALLEGRO_BITMAP * track_bitmap
optional bitmap for the scrollbar track background (NULL = color theme)
ALLEGRO_DISPLAY * native
native OS window backing this pseudo-window, or NULL (the default) when the window is drawn as a pop-...
float checkbox_label_offset
horizontal offset from box edge to label text
N_GUI_CUSTOM_DRAW draw
paint callback invoked during n_gui_draw (NULL = draw nothing)
void(* on_columns_changed)(int widget_id, void *user_data)
callback fired after the user resizes a column by dragging its header border (widget_id,...
ALLEGRO_BITMAP * maximize_active_bitmap
optional bitmap for maximize button active state
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.
int mouse_b1_prev
previous frame's b1 state
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 pending_widgets_count
number of valid entries in pending_widgets
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
float restore_h
saved height before maximise (for restore)
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)
float x
content-local x of every header and the layout origin
int show_value
1 to show the Value column (default 1)
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 drag_press_y
mouse y at press time
int show_desc
1 to show the Description column (default 1)
float y
y origin of tab button row
float divider
divider thickness in pixels
float dropdown_arrow_reserve
horizontal space reserved for the arrow on the right
ALLEGRO_BITMAP * close_active_bitmap
optional bitmap for close button active state
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 visible[64]
per-physical-column visibility
int flags
feature flags (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, etc.)
int orientation
N_GUI_SPLIT_VERTICAL or N_GUI_SPLIT_HORIZONTAL.
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)
unsigned char consumed
1 once applied to a created window
float ratio
divider position as a fraction of the widget extent (0..1)
int drag_source_node
node being dragged, or -1
N_GUI_STYLE style
configurable style (sizes, colours, paddings)
ALLEGRO_FONT * font
font for the title bar
float col_resize_x0
cursor x at the start of a column-resize drag
char * key_placeholder
owned hint shown in each key textarea, or NULL
void * user_data
user data for callback
N_GUI_THEME btn_theme
theme for minimize and maximize buttons
ALLEGRO_COLOR text_active
text active
float ref_display_w
reference display width at the time normalized values were last captured
float restore_w
saved width before maximise (for restore)
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
ALLEGRO_BITMAP * maximize_hover_bitmap
optional bitmap for maximize button hover state
float min_h
minimum height
float listbox_default_item_height
default item height for listbox
void * user_data
user data for callback
size_t nb_cols
number of columns
ALLEGRO_COLOR global_scrollbar_thumb_border_color
global scrollbar thumb border colour
float tb_btn_spacing
gap between titlebar buttons
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
ALLEGRO_EVENT_QUEUE * event_queue
event queue the context registers native window event sources into (set via n_gui_set_event_queue).
float ratio
divider ratio (kind == SPLITPANE)
float gui_offset_y
vertical letterbox offset for virtual canvas
int hovered
which button is currently hovered (N_GUI_TB_BTN_*)
ALLEGRO_BITMAP * item_selected_bitmap
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
N_GUI_PENDING_GEOM * pending_layout
layout entries for windows that did NOT exist when the saved layout was loaded (lazily-created panels...
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 natural_h
stacked height of the members when expanded
int scroll_offset
first visible line
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
float h_scroll
horizontal scroll offset in pixels: how far the columns are scrolled to the left when their total wid...
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
size_t len
text length in bytes
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)
float width[64]
per-physical-column width
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_DISPLAY * pass_display
display the pass currently being processed or drawn belongs to: NULL for the host's main display (and...
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
void * user_data
user data for the callback
void(* on_minimize)(int window_id, void *user_data)
callback on minimize button click (NULL = default: toggle N_GUI_WIN_MINIMISED)
char label[128]
label displayed next to the checkbox
float slider_value_label_offset
gap between slider end and value label
void(* on_context)(int widget_id, int row, int x, int y, void *user_data)
callback on right-click over a data row, for a context menu (widget_id, row, x, y,...
size_t nb_items
number of items
int depth
depth in tree (0 = root)
float tb_btn_glyph_thickness
line thickness for titlebar button glyphs
ALLEGRO_COLOR bg_active
background active/pressed
char mask_char
mask character for password fields (0 = no masking, e.g.
ALLEGRO_BITMAP * minimize_bitmap
optional bitmap for minimize button normal state (NULL = color theme)
int global_hscroll_drag
1 if global scrollbar horizontal thumb is being dragged
float w
saved width (display-scaled), 0 when absent
LIST * windows
ordered list of N_GUI_WINDOW* (back to front)
char text[128]
display text
int scroll_y
scroll offset for long text
char text[4096]
optional centered overlay text (empty string = none)
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
int cursor_shape
system mouse cursor currently applied to the display (an ALLEGRO_SYSTEM_MOUSE_CURSOR_* value),...
void * on_content_draw_data
user data passed to on_content_draw
float dropdown_arrow_thickness
arrow stroke thickness
float tb_btn_right_margin
right margin from window edge to rightmost button
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
char * value_placeholder
owned hint shown in each value textarea, or NULL
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
int anchor_row
anchor row for Shift-click range selection, or -1
int native_drag_anchored
1 when the four native_drag_* fields hold a usable grab, that is when al_get_mouse_cursor_position wo...
size_t cursor_pos
cursor position in text
float restore_y
saved y position before maximise (for restore)
int scroll_offset
first visible data row
void * user_data
user data for callback
int mode
mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT
int dirty
non-zero when the GUI's appearance may have changed since the last n_gui_draw.
size_t char_limit
maximum character limit (0 = N_GUI_TEXT_MAX)
void(* on_select)(int widget_id, int row, void *user_data)
callback on row selection (widget_id, row, user_data)
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
N_GUI_CTX * ctx
GUI context.
void * on_minimize_user_data
user data for on_minimize callback
float scrollbar_thumb_min
minimum thumb dimension
int native_halted
1 while the native window's drawing is halted.
int native_pos_y
last known native window y position (see native_pos_x)
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
int prev_over_win
whether the pointer was over a window on the previous motion event, so a motion that leaves the GUI s...
float native_w
last known native window width, 0 until the window is first detached.
size_t nb_rows
number of rows
void(* on_maximize)(int window_id, void *user_data)
callback on maximize button click (NULL = default: toggle N_GUI_WIN_MAXIMISED)
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
int col_resize_col
physical column being resized by a header-border drag, or -1
unsigned char consumed
1 once applied
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
float h
saved height (display-scaled), 0 when absent
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 ...
ALLEGRO_COLOR * row_color
per-row background tint, sized rows_cap; NULL until a row color is set
float header_h
header button height
LIST * widgets
list of N_GUI_WIDGET* contained in this window
void * user_data
user data for callback
float y
position y on screen
ALLEGRO_BITMAP * bitmap_active
optional bitmap for active/pressed state
int tooltip_anchor_y
pointer y when the tooltip was last armed
double tooltip_armed_at
time the tooltip hover was (re)armed, from al_get_time()
char * placeholder
optional placeholder/hint text drawn dimmed while the field is empty (NULL = none); cleared from view...
int enabled
enabled flag (1 = enabled, 0 = disabled: drawn dimmed and ignores input)
float radio_circle_border_thickness
outer circle border thickness
float col_resize_w0
original width of the column at the start of a resize drag
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)
ALLEGRO_DISPLAY * active_display
display that last received input, used to pick the display for clipboard and mouse-cursor calls.
float scroll_x
horizontal scroll offset for auto-scrollbar (pixels)
float slider_handle_border_thickness
handle border thickness
const char * n_gui_syntaxview_get_text(N_GUI_CTX *ctx, int widget_id)
get the text shown by a syntax view (borrowed pointer, do not free; NULL if empty)
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_sectionlist_set_folded(N_GUI_SECTIONLIST *sl, int section_index, int folded)
set a section's folded state and relayout; does NOT fire on_toggle (for programmatic restore)
void n_gui_update_transform(N_GUI_CTX *ctx)
recalculate scale and offset from virtual canvas to display.
int n_gui_add_hexview(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h)
add a read-only hex viewer; returns the widget id or -1
int n_gui_button_is_toggled(N_GUI_CTX *ctx, int widget_id)
check if button is toggled
void n_gui_datagrid_sort(N_GUI_CTX *ctx, int widget_id, int col, int dir)
sort the rows by a column (dir 1 ascending, -1 descending)
float n_gui_detect_dpi_scale(N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
detect and apply DPI scale from the given allegro display.
float n_gui_splitpane_get_ratio(N_GUI_CTX *ctx, int widget_id)
get the current divider ratio (0..1), or 0.5 if the widget is invalid
void n_gui_toggle_window(N_GUI_CTX *ctx, int window_id)
toggle window visibility (show/hide)
void n_gui_datagrid_set_on_columns_changed(N_GUI_CTX *ctx, int widget_id, void(*cb)(int, void *))
set the callback fired after the user drags a column border to resize it, so the host can persist the...
void n_gui_datagrid_set_selected(N_GUI_CTX *ctx, int widget_id, int row)
set the selected row index (fires the on_select callback)
void n_gui_hexview_set_data(N_GUI_CTX *ctx, int widget_id, const unsigned char *data, size_t len)
set (copy) the bytes shown by a hex viewer; data may be NULL to clear
#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)
void n_gui_datagrid_clear_row_color(N_GUI_CTX *ctx, int widget_id, int row)
remove the background tint of data row row (it draws untinted again)
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_kvtable_set_top_offset(N_GUI_KVTABLE *table, float top_offset)
reserve top_offset unscaled pixels above the header row so other widgets (a toolbar,...
int n_gui_needs_redraw(N_GUI_CTX *ctx)
Return non-zero if the GUI must be redrawn this frame, i.e.
int n_gui_datagrid_get_row_count(N_GUI_CTX *ctx, int widget_id)
get the number of rows in a data grid
void n_gui_textarea_set_text(N_GUI_CTX *ctx, int widget_id, const char *text)
set text area content
void n_gui_kvtable_relayout(N_GUI_KVTABLE *table)
re-apply layout to all KV table widgets (positions, sizes, normalized coords).
int n_gui_save_layout_json(N_GUI_CTX *ctx, const char *filepath)
Save the geometry + persistent state of every window in the context to a JSON file.
int n_gui_window_detach(N_GUI_CTX *ctx, int window_id, int detach_flags)
promote a pop-up window to a native OS window
int n_gui_kvtable_get_count(const N_GUI_KVTABLE *table)
get the number of active rows
double n_gui_scrollbar_get_pos(N_GUI_CTX *ctx, int widget_id)
get scrollbar position
void n_gui_tree_set_label(N_GUI_TREE *tree, int node_index, const char *new_label)
change the display label of a node
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
#define N_GUI_SECTIONLIST_MAX
maximum number of foldable sections in a section list
const char * n_gui_datagrid_get_cell(N_GUI_CTX *ctx, int widget_id, int row, int col)
get a cell string by row and column, or NULL if out of range
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_set_widget_tooltip(N_GUI_CTX *ctx, int widget_id, const char *text)
set (or clear with "" / NULL) the tooltip text shown after the pointer rests on a widget
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_window_native_is_hidden(N_GUI_CTX *ctx, int window_id)
check whether a detached window's drawing is currently halted by the OS (Android surface loss) or the...
size_t n_gui_datagrid_get_column_count(N_GUI_CTX *ctx, int widget_id)
number of columns in a data grid (physical), or 0
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_PERSIST_MAX_COLS
Maximum datagrid columns whose layout is persisted per widget.
float n_gui_datagrid_get_h_scroll(N_GUI_CTX *ctx, int widget_id)
horizontal scroll offset in pixels (how far the columns are scrolled left when their total width exce...
void n_gui_datagrid_set_row_color(N_GUI_CTX *ctx, int widget_id, int row, ALLEGRO_COLOR color)
paint data row row with a background tint (a per-row highlight, e.g.
void n_gui_datagrid_set_scroll_offset(N_GUI_CTX *ctx, int widget_id, int offset)
set the first visible data row (clamped to the row count); the draw path re-clamps to the live viewpo...
size_t n_gui_datagrid_get_selected_rows(N_GUI_CTX *ctx, int widget_id, int *out, size_t max)
fill out with the indices of the selected rows (ascending), up to max, and return the total number of...
int n_gui_datagrid_get_scroll_offset(N_GUI_CTX *ctx, int widget_id)
first visible data row (the vertical scroll position), or 0.
void n_gui_window_set_tb_button_bitmaps(N_GUI_CTX *ctx, int window_id, int btn_type, ALLEGRO_BITMAP *normal, ALLEGRO_BITMAP *hover, ALLEGRO_BITMAP *active)
set optional bitmap overlays on a titlebar button
void n_gui_focus_window(N_GUI_CTX *ctx, int window_id)
give a window keyboard focus: raise it within its z-order group and focus its first focusable 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_maximize_window(N_GUI_CTX *ctx, int window_id)
toggle maximised state (full display or restore to previous size)
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_datagrid_set_on_context(N_GUI_CTX *ctx, int widget_id, void(*on_context)(int, int, int, int, void *))
set the right-click context callback; fired (with the cursor x/y in GUI coordinates) when a data row ...
ALLEGRO_EVENT_QUEUE * n_gui_get_event_queue(N_GUI_CTX *ctx)
get the event queue previously given to n_gui_set_event_queue (NULL if none)
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_kvtable_clear(N_GUI_KVTABLE *table)
remove every row at once.
void n_gui_slider_set_value_format(N_GUI_CTX *ctx, int widget_id, const char *fmt)
Override the built-in value readout's printf format string.
void n_gui_listbox_set_selected(N_GUI_CTX *ctx, int widget_id, int index, int selected)
set item selection state
int(* n_gui_tree_on_drop_t)(int src_node, int dst_node, int position, void *user_data)
drag-reorder drop callback.
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...
void n_gui_syntaxview_set_selection(N_GUI_CTX *ctx, int widget_id, int start, int end)
set the selection range (byte offsets into the text, clamped to its length); pass start == end to cle...
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
N_GUI_THEME n_gui_default_tb_btn_theme(void)
return the built-in default theme for titlebar minimize/maximize buttons
void n_gui_set_virtual_size(N_GUI_CTX *ctx, float w, float h)
set the virtual canvas size for resolution-independent scaling.
int n_gui_tooltip_pending(N_GUI_CTX *ctx)
tooltip phase: 0 = none (or tooltips disabled via style.tooltip_delay <= 0), 1 = arming (hosts with c...
int n_gui_datagrid_is_row_selected(N_GUI_CTX *ctx, int widget_id, int row)
report whether a given data row is selected (1) or not (0)
float n_gui_get_dpi_scale(const N_GUI_CTX *ctx)
get current DPI scale factor
void n_gui_tree_clear(N_GUI_TREE *tree)
remove all nodes and clear the backing listbox; tree object remains valid
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
void n_gui_button_set_label(N_GUI_CTX *ctx, int widget_id, const char *label)
replace the label text drawn on a button
void n_gui_button_set_state_bitmaps(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *normal, ALLEGRO_BITMAP *hover, ALLEGRO_BITMAP *active)
skin a button or toggle button with caller-owned per-state bitmaps (switches its shape to N_GUI_SHAPE...
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_kvtable_set_placeholders(N_GUI_KVTABLE *table, const char *key_hint, const char *value_hint)
set the placeholder/hint text shown in each row's key (and value) textarea while it is empty.
float n_gui_sectionlist_content_height(const N_GUI_SECTIONLIST *sl)
total content height in pixels under the current fold state, for sizing/scrolling the host window
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
int n_gui_syntaxview_get_line_count(N_GUI_CTX *ctx, int widget_id)
get the number of text lines in a syntax view
#define N_GUI_SECTION_WIDGETS_MAX
maximum number of member widgets per section
void n_gui_window_set_minimize_callback(N_GUI_CTX *ctx, int window_id, void(*on_minimize)(int, void *), void *user_data)
set the minimize button callback for a window (NULL = default: toggle minimised)
int n_gui_add_splitpane(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int orientation, float ratio, void(*on_change)(int, float, void *), void *user_data)
add a split pane (draggable divider); returns the widget id or -1
const char * n_gui_widget_get_persist_key(N_GUI_CTX *ctx, int widget_id)
Get a widget's persist key ("" when unset), or NULL when the widget is invalid.
int n_gui_datagrid_add_column(N_GUI_CTX *ctx, int widget_id, const char *title, float width)
append a column with a header title and pixel width; returns the column index or -1
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_datagrid_set_h_scroll(N_GUI_CTX *ctx, int widget_id, float px)
set the horizontal scroll offset in pixels (clamped to >= 0; the draw path re-clamps to the live cont...
void n_gui_datagrid_set_multiselect(N_GUI_CTX *ctx, int widget_id, int enabled)
enable (1) or disable (0) multi-row selection.
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.
void n_gui_set_shape_mode(N_GUI_CTX *ctx, int shape_mode)
set the global widget shape (N_GUI_SHAPE_ROUNDED for a round GUI, else square)
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_syntaxview_set_mode(N_GUI_CTX *ctx, int widget_id, int mode)
set the highlighting mode (N_GUI_SYNTAX_*) of a syntax view
void n_gui_button_set_toggled(N_GUI_CTX *ctx, int widget_id, int toggled)
set button toggled state
void n_gui_progressbar_set_text(N_GUI_CTX *ctx, int widget_id, const char *text)
set the centered overlay text (NULL or "" clears it)
void n_gui_tab_set_active(N_GUI_TAB_PANEL *panel, int index)
set the active tab (toggles buttons, opens/closes content windows)
int n_gui_window_is_detached(N_GUI_CTX *ctx, int window_id)
check whether a window currently lives in a native OS window
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)
int n_gui_get_topmost_open_window(const N_GUI_CTX *ctx)
get the id of the frontmost open, non-minimized window (the last one in draw order),...
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.
void n_gui_window_set_tb_close_theme(N_GUI_CTX *ctx, int window_id, N_GUI_THEME theme)
set the theme for the titlebar close button on a specific window
void n_gui_window_set_tb_btn_theme(N_GUI_CTX *ctx, int window_id, N_GUI_THEME theme)
set the theme for titlebar minimize/maximize buttons on a specific window
int n_gui_add_progressbar(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h)
add a horizontal progress bar (display only); returns the widget id or -1
int n_gui_tab_get_active(const N_GUI_TAB_PANEL *panel)
get the active tab index
size_t n_gui_hexview_get_length(N_GUI_CTX *ctx, int widget_id)
get the number of bytes currently held by a hex viewer
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_widget_set_persist_key(N_GUI_CTX *ctx, int widget_id, const char *key)
Give a widget a stable key so its user-adjustable state (a splitpane's divider ratio,...
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
void n_gui_progressbar_set_value(N_GUI_CTX *ctx, int widget_id, float value)
set the progress fraction (clamped to 0.0 .
int n_gui_tree_find_by_user_data(const N_GUI_TREE *tree, const void *ptr)
find the first node whose user_data pointer equals ptr, or -1.
void n_gui_tree_set_selection(N_GUI_TREE *tree, int node_index)
programmatically select a node; ancestors are expanded so the node is visible, and the listbox scroll...
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_tree_set_on_drop(N_GUI_TREE *tree, n_gui_tree_on_drop_t on_drop, void *user_data)
install (or clear, with NULL) a drag-reorder drop callback.
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)
N_GUI_SECTIONLIST * n_gui_sectionlist_create(N_GUI_CTX *ctx, int window_id, float x, float y0, float width, float header_h, float gap, void(*on_toggle)(int, int, void *), void *user_data)
create an empty section list anchored at (x,y0) in window_id; sections stack downward from y0
void n_gui_datagrid_move_column(N_GUI_CTX *ctx, int widget_id, int from, int to)
move the column at display position from to display position to, shifting the columns in between (reo...
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_tree_get_selection(N_GUI_TREE *tree)
get the index of the currently selected node, or -1 when nothing is selected or the selection points ...
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.
N_GUI_THEME n_gui_default_tb_close_theme(void)
return the built-in default theme for the titlebar close button (red hover/active)
char * n_gui_syntaxview_get_selected_text(N_GUI_CTX *ctx, int widget_id)
copy of the currently selected text in a syntax view, or NULL when nothing is selected.
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
int n_gui_datagrid_get_row_color(N_GUI_CTX *ctx, int widget_id, int row, ALLEGRO_COLOR *out)
report whether data row row carries a background tint (1) or not (0), and copy the tint into out when...
N_GUI_WINDOW * n_gui_get_window(N_GUI_CTX *ctx, int window_id)
get a window by id
int n_gui_add_syntaxview(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int mode)
add a read-only syntax-highlighted text view; returns the widget id or -1
void n_gui_datagrid_clear_selection(N_GUI_CTX *ctx, int widget_id)
clear the entire selection (no row selected)
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
void n_gui_slider_set_value_visible(N_GUI_CTX *ctx, int widget_id, int visible)
Toggle the built-in value label.
int n_gui_window_attach(N_GUI_CTX *ctx, int window_id)
return a detached window to being an in-display pop-up
void n_gui_datagrid_select_row(N_GUI_CTX *ctx, int widget_id, int row, int selected)
select (1) or deselect (0) a single row in a multi-select grid programmatically (e....
void n_gui_draw_detached(N_GUI_CTX *ctx)
render and flip every detached window, and release the ones whose native window was closed.
N_GUI_CTX * n_gui_new_ctx(ALLEGRO_FONT *default_font)
create a new GUI context
void n_gui_datagrid_clear_rows(N_GUI_CTX *ctx, int widget_id)
remove all rows from a data grid (columns are kept)
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_window_set_close_callback(N_GUI_CTX *ctx, int window_id, void(*on_close)(int, void *), void *user_data)
set the close button callback for a window (NULL = default: hide window)
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
int n_gui_datagrid_display_to_physical(N_GUI_CTX *ctx, int widget_id, int display_pos)
physical column shown at display position display_pos, or -1 if out of range
float n_gui_datagrid_get_column_width(N_GUI_CTX *ctx, int widget_id, int col)
current pixel width of physical column col, or 0 if out of range
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_kvtable_set_columns(N_GUI_KVTABLE *table, int show_value, int show_desc, int show_enabled)
choose which optional columns are shown: Value, Description, and the enabled checkbox.
const char * n_gui_datagrid_get_column_title(N_GUI_CTX *ctx, int widget_id, int col)
header title of physical column col, or "" if out of range
void(* N_GUI_CUSTOM_DRAW)(N_GUI_WIDGET *widget, float x, float y, ALLEGRO_FONT *font, void *user_data)
Owner-draw callback for a custom widget (N_GUI_TYPE_CUSTOM).
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
float n_gui_dropmenu_panel_width(N_GUI_CTX *ctx, int widget_id)
width the open panel needs to show its entries without truncation: the larger of the collapsed button...
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.
void n_gui_destroy_ctx(N_GUI_CTX **ctx)
destroy a GUI context and free all resources
int n_gui_window_is_minimised(N_GUI_CTX *ctx, int window_id)
check if a window is currently minimised
void n_gui_restore_window(N_GUI_CTX *ctx, int window_id)
restore a minimised window to its full size
const char * n_gui_textarea_get_text(N_GUI_CTX *ctx, int widget_id)
get text area content
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
int n_gui_get_shape_mode(N_GUI_CTX *ctx)
get the global widget shape (N_GUI_SHAPE_ROUNDED or N_GUI_SHAPE_RECT)
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
float n_gui_progressbar_get_value(N_GUI_CTX *ctx, int widget_id)
get the current progress fraction (0.0 on an invalid widget)
int n_gui_sectionlist_get_count(const N_GUI_SECTIONLIST *sl)
number of sections in the list
#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)
ALLEGRO_DISPLAY * n_gui_window_get_display(N_GUI_CTX *ctx, int window_id)
get the native display backing a window, or NULL when it is a pop-up
int n_gui_sectionlist_add_section(N_GUI_SECTIONLIST *sl, const char *title, float header_y, int folded)
add a section with a header button at header_y (members added next are captured relative to it); retu...
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
void n_gui_window_set_content_draw_callback(N_GUI_CTX *ctx, int window_id, void(*on_content_draw)(int, void *), void *user_data)
set a content-draw callback for a window, invoked during n_gui_draw right after the window's own cont...
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_window_set_native_icons(N_GUI_CTX *ctx, int window_id, ALLEGRO_BITMAP **icons, int num_icons)
give a detached window's OS window a taskbar / title bar icon
void n_gui_dropmenu_set_label(N_GUI_CTX *ctx, int widget_id, const char *label)
replace the button label shown on a dropmenu (NULL clears it)
void n_gui_tree_draw_overlay(N_GUI_TREE *tree)
per-frame overlay drawing: draws the active drop-indicator on top of the listbox.
const char * n_gui_combobox_get_item_text(N_GUI_CTX *ctx, int widget_id, int index)
get the text of the combobox item at index ("" if out of range / not a combobox)
int n_gui_count_detached(N_GUI_CTX *ctx)
count the windows currently detached into native OS windows
void n_gui_dropmenu_set_flags(N_GUI_CTX *ctx, int widget_id, int flags)
set dropmenu feature flags (bitmask of N_GUI_DROPMENU_* values)
void n_gui_splitpane_set_ratio(N_GUI_CTX *ctx, int widget_id, float ratio)
set the divider ratio (clamped to the configured min/max)
int n_gui_checkbox_is_checked(N_GUI_CTX *ctx, int widget_id)
check if checkbox is checked
void n_gui_splitpane_set_limits(N_GUI_CTX *ctx, int widget_id, float min_ratio, float max_ratio)
set the minimum and maximum allowed divider ratio
void n_gui_set_default_theme(N_GUI_CTX *ctx, N_GUI_THEME theme)
Set the default theme on a context and sync scrollbar style colors.
int n_gui_combobox_get_selected(N_GUI_CTX *ctx, int widget_id)
get the selected item index
void n_gui_tree_remove_node(N_GUI_TREE *tree, int node_index)
remove a node and its entire subtree; remaining node indices are compacted (callers holding indices a...
void n_gui_image_set_bitmap(N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bitmap)
set the bitmap on an image widget
int n_gui_load_layout_json(N_GUI_CTX *ctx, const char *filepath)
Load a JSON window layout file and apply it to matching windows in the context.
int n_gui_window_is_maximised(N_GUI_CTX *ctx, int window_id)
check if a window is currently maximised
int n_gui_datagrid_add_row(N_GUI_CTX *ctx, int widget_id, const char **values)
append a row of cell strings (values must have one entry per column); returns the row index or -1
void n_gui_syntaxview_set_text(N_GUI_CTX *ctx, int widget_id, const char *text)
set (copy) the text shown by a syntax view; text may be NULL to clear
void n_gui_slider_set_value(N_GUI_CTX *ctx, int widget_id, double value)
set slider value
int n_gui_sectionlist_is_folded(const N_GUI_SECTIONLIST *sl, int section_index)
query a section's folded state (1 = folded, 0 = expanded)
void n_gui_datagrid_set_column_width(N_GUI_CTX *ctx, int widget_id, int col, float width)
set the pixel width of physical column col (clamped to a small minimum)
void n_gui_syntaxview_scroll_to_offset(N_GUI_CTX *ctx, int widget_id, int byte_offset)
scroll a syntax view so the line holding the given byte offset is vertically centered
void n_gui_sectionlist_add_widget(N_GUI_SECTIONLIST *sl, int section_index, int widget_id)
register an existing widget as a member of a section (captures its current y as the fold offset)
void n_gui_datagrid_set_column_visible(N_GUI_CTX *ctx, int widget_id, int col, int visible)
show (1) or hide (0) physical column col; hidden columns keep their cells but are skipped in the head...
void n_gui_sectionlist_set_first_inset(N_GUI_SECTIONLIST *sl, float inset)
set a left inset applied to the FIRST section's header only, so a caller can place a button before it...
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
void n_gui_syntaxview_select_all(N_GUI_CTX *ctx, int widget_id)
select the entire text of a syntax view
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
void n_gui_mark_dirty(N_GUI_CTX *ctx)
Mark the GUI as needing a redraw.
#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_datagrid_clear_row_colors(N_GUI_CTX *ctx, int widget_id)
remove every row background tint (the rows and cells are kept)
void n_gui_window_set_maximize_callback(N_GUI_CTX *ctx, int window_id, void(*on_maximize)(int, void *), void *user_data)
set the maximize button callback for a window (NULL = default: toggle maximised)
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_window_from_display(N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
find the window detached into a given display
void n_gui_textarea_set_placeholder(N_GUI_CTX *ctx, int widget_id, const char *text)
set placeholder/hint text for a textarea, shown dimmed while the field is empty and cleared from view...
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
void n_gui_sectionlist_free(N_GUI_SECTIONLIST **sl)
free the section list (does not destroy the N_GUI widgets or window)
int n_gui_datagrid_get_selected(N_GUI_CTX *ctx, int widget_id)
get the selected row index, or -1 if none
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_sectionlist_relayout(N_GUI_SECTIONLIST *sl)
re-stack all sections from y0 by current fold state: hide folded members, show and reposition expande...
int n_gui_datagrid_get_column_visible(N_GUI_CTX *ctx, int widget_id, int col)
whether physical column col is visible (1) or hidden (0); 0 if out of range
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)
int n_gui_add_datagrid(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 sortable data grid; returns the widget id or -1
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
void n_gui_set_event_queue(N_GUI_CTX *ctx, ALLEGRO_EVENT_QUEUE *queue)
give the context the event queue it registers native window event sources into
int n_gui_add_custom(N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, N_GUI_CUSTOM_DRAW draw, void *user_data)
Add an owner-draw custom widget to a window.
#define N_GUI_KEY_SOURCES_MAX
maximum number of source widgets for a focused key binding
void n_gui_tree_tick(N_GUI_TREE *tree)
per-frame poll: reads ctx->mouse_* to track drag state and fires the on_drop callback on release.
void n_gui_reset_all_widget_themes(N_GUI_CTX *ctx)
reset all widget and window themes to ctx->default_theme
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.
Owner-draw custom widget data: a paint callback plus its user pointer.
one data grid column definition
data grid specific data: a sortable column table
dropdown menu specific data
A single entry in a dropdown menu (static or dynamic)
hex viewer specific data: a read-only byte dump
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
A saved window position retained for a window not yet created at load time (see N_GUI_CTX::pending_la...
Saved user-adjustable state for a keyed widget that did not exist when the layout was loaded (a lazil...
Progress-bar widget data (display only).
a single foldable section: a clickable header plus the member widgets it shows/hides
a vertical accordion of foldable sections inside one window; folding hides a section's widgets and re...
split pane specific data: a draggable divider between two regions
Global style holding every configurable layout constant.
syntax view specific data: read-only highlighted text
tab panel built from toggle buttons with content window management
Titlebar button state for a window (minimize, maximize, close)
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.