Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_gui.h File Reference

GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <nilorea/n_allegro5.h>
#include <nilorea/n_common.h>
#include <nilorea/n_str.h>
#include <nilorea/n_log.h>
#include <nilorea/n_gui_md.h>
#include <nilorea/n_list.h>
#include <nilorea/n_hash.h>
Include dependency graph for n_gui.h:

Go to the source code of this file.

Data Structures

struct  N_GUI_BUTTON_DATA
 button specific data More...
struct  N_GUI_CHECKBOX_DATA
 checkbox specific data More...
struct  N_GUI_COMBOBOX_DATA
 combo box specific data More...
struct  N_GUI_CTX
 The top-level GUI context that holds all windows. More...
struct  N_GUI_CUSTOM_DATA
 Owner-draw custom widget data: a paint callback, an optional mouse callback, and their user pointers. More...
struct  N_GUI_DATAGRID_COL
 one data grid column definition More...
struct  N_GUI_DATAGRID_DATA
 data grid specific data: a sortable column table More...
struct  N_GUI_DROPMENU_DATA
 dropdown menu specific data More...
struct  N_GUI_DROPMENU_ENTRY
 A single entry in a dropdown menu (static or dynamic). More...
struct  N_GUI_HEXVIEW_DATA
 hex viewer specific data: a read-only byte dump More...
struct  N_GUI_IMAGE_DATA
 image widget specific data More...
struct  N_GUI_KV_ROW
 a single row in the KV table More...
struct  N_GUI_KVTABLE
 key-value table built from textareas, checkboxes, and buttons. More...
struct  N_GUI_LABEL_DATA
 static text label specific data More...
struct  N_GUI_LISTBOX_DATA
 listbox specific data More...
struct  N_GUI_LISTITEM
 a single item in a list/radio/combo widget More...
struct  N_GUI_MARKDOWNVIEW_DATA
 markdownview specific data. More...
struct  N_GUI_MOUSE_EVENT
 A mouse event handed to a custom widget, in the widget's own coordinates. More...
struct  N_GUI_PENDING_GEOM
 A saved window position retained for a window not yet created at load time (see N_GUI_CTX::pending_layout). More...
struct  N_GUI_PENDING_WIDGET
 Saved user-adjustable state for a keyed widget that did not exist when the layout was loaded (a lazily-created splitpane/datagrid). More...
struct  N_GUI_PROGRESSBAR_DATA
 Progress-bar widget data (display only). More...
struct  N_GUI_RADIOLIST_DATA
 radio list specific data More...
struct  N_GUI_SB_TRACK
 Where a scrollbar a widget draws inside itself was last painted, and whether the pointer is on it. More...
struct  N_GUI_SCROLLBAR_DATA
 scrollbar specific data More...
struct  N_GUI_SECTION
 a single foldable section: a clickable header plus the member widgets it shows/hides More...
struct  N_GUI_SECTIONLIST
 a vertical accordion of foldable sections inside one window; folding hides a section's widgets and re-stacks the rest, leaving the window's N_GUI_WIN_AUTO_SCROLLBAR to absorb any overflow More...
struct  N_GUI_SLIDER_DATA
 slider specific data More...
struct  N_GUI_SPLITPANE_DATA
 split pane specific data: a draggable divider between two regions More...
struct  N_GUI_STYLE
 Global style holding every configurable layout constant. More...
struct  N_GUI_SYNTAXVIEW_DATA
 syntax view specific data: read-only highlighted text More...
struct  N_GUI_TAB_PANEL
 tab panel built from toggle buttons with content window management More...
struct  N_GUI_TB_BUTTONS
 Titlebar button state for a window (minimize, maximize, close). More...
struct  N_GUI_TEXT_DIMS
 bounding box dimensions returned by n_gui_get_text_dims() More...
struct  N_GUI_TEXTAREA_DATA
 text area specific data More...
struct  N_GUI_THEME
 Color theme for a widget. More...
struct  N_GUI_TREE
 tree view built from an N_GUI listbox More...
struct  N_GUI_TREE_NODE
 a single node in the tree view More...
struct  N_GUI_TREE_STATE
 A tree's view state, captured by path so it survives a rebuild that replaces every node (a reloaded model has new pointers and new indices). More...
struct  N_GUI_WIDGET
 A single GUI widget. More...
struct  N_GUI_WINDOW
 A pseudo window that contains widgets. More...

Macros

#define N_GUI_ALIGN_CENTER   1
 center aligned text
#define N_GUI_ALIGN_JUSTIFIED   3
 justified text (spread words to fill width)
#define N_GUI_ALIGN_LEFT   0
 left aligned text
#define N_GUI_ALIGN_RIGHT   2
 right aligned text
#define N_GUI_AUTOFIT_CENTER   16
 center the window on its insertion point after auto-fit (overrides EXPAND_LEFT/EXPAND_UP for centering)
#define N_GUI_AUTOFIT_EXPAND_LEFT   4
 expand leftward instead of rightward when adjusting width
#define N_GUI_AUTOFIT_EXPAND_UP   8
 expand upward instead of downward when adjusting height
#define N_GUI_AUTOFIT_H   2
 auto-adjust window height to content
#define N_GUI_AUTOFIT_W   1
 auto-adjust window width to content
#define N_GUI_AUTOFIT_WH   3
 auto-adjust both width and height (convenience: W|H)
#define N_GUI_COMBOBOX_AUTO_WIDTH   1
 dropdown panel expands to fit the longest item text
#define N_GUI_COMBOBOX_EXPAND_UP   2
 dropdown panel opens upward (above the widget) instead of downward.
#define N_GUI_DETACH_NONE   0
 no option
#define N_GUI_DETACH_OWN_CHROME   4
 keep N_GUI's own window chrome instead of the window manager's: the native window is created frameless and the window keeps drawing its own title bar, so a detached window looks and skins exactly like the pop-up it came from.
#define N_GUI_DETACH_RESIZABLE   1
 the native window can be resized by the user through the OS window manager
#define N_GUI_DETACH_SCALE_CONTENT   2
 scale the window's widgets when the native window is resized by the user.
#define N_GUI_DROP_AFTER   2
#define N_GUI_DROP_BEFORE   0
 drop position relative to a tree row (drag-and-drop)
#define N_GUI_DROP_INTO   1
#define N_GUI_DROPMENU_EXPAND_UP   1
 dropdown panel opens upward (above the button) instead of downward.
#define N_GUI_GLOBAL_SCROLL_SLACK   0.5f
 how far, in pixels, the open windows may reach past the display before the global scrollbars appear: under half a pixel is a rounding error of a layout computed in floats, and hides nothing
#define N_GUI_GLYPH_ARROW_DOWN   2
 filled triangle pointing down
#define N_GUI_GLYPH_ARROW_LEFT   3
 filled triangle pointing left
#define N_GUI_GLYPH_ARROW_RIGHT   4
 filled triangle pointing right
#define N_GUI_GLYPH_ARROW_UP   1
 filled triangle pointing up
#define N_GUI_GLYPH_COPY   8
 two offset sheets: duplicate / copy
#define N_GUI_GLYPH_COUNT   9
 number of defined glyphs, for range checks
#define N_GUI_GLYPH_CROSS   7
 diagonal cross
#define N_GUI_GLYPH_MINUS   6
 minus sign
#define N_GUI_GLYPH_NONE   0
 no glyph: the button draws its text label (default)
#define N_GUI_GLYPH_PLUS   5
 plus sign
#define N_GUI_ID_MAX   128
 maximum length for widget id/name strings
#define N_GUI_IMAGE_CENTER   2
 draw at original size, centered
#define N_GUI_IMAGE_FIT   0
 scale to fit within bounds, keep aspect ratio
#define N_GUI_IMAGE_STRETCH   1
 stretch to fill bounds
#define N_GUI_KEY_MOD_MASK   (ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL | ALLEGRO_KEYMOD_ALT | ALLEGRO_KEYMOD_ALTGR)
 mask of supported modifier flags for button keybind matching
#define N_GUI_KEY_SOURCES_MAX   8
 maximum number of source widgets for a focused key binding
#define N_GUI_KV_MAX   128
 maximum number of rows in a KV table
#define N_GUI_MOUSE_DOWN   1
 custom widget mouse event: a press inside it, button 1 or 2
#define N_GUI_MOUSE_DRAG   4
 custom widget mouse event: the pointer moved with button 1 held after a press in it; reported outside the widget too, as a slider's drag is
#define N_GUI_MOUSE_MOVE   3
 custom widget mouse event: the pointer moved over it with no button held
#define N_GUI_MOUSE_UP   2
 custom widget mouse event: the release of a button 1 press that began in it, wherever the pointer is now
#define N_GUI_MOUSE_WHEEL   5
 custom widget mouse event: the wheel turned over it
#define N_GUI_PERSIST_MAX_COLS   64
 Maximum datagrid columns whose layout is persisted per widget.
#define N_GUI_RESIZE_ADAPTIVE   1
 virtual size tracks display; windows adapt per their resize_policy
#define N_GUI_RESIZE_VIRTUAL   0
 fixed virtual canvas with uniform scaling (default/existing behavior)
#define N_GUI_SCROLLBAR_H   0
 horizontal scrollbar
#define N_GUI_SCROLLBAR_V   1
 vertical scrollbar
#define N_GUI_SECTION_WIDGETS_MAX   96
 maximum number of member widgets per section.
#define N_GUI_SECTIONLIST_MAX   16
 maximum number of foldable sections in a section list
#define N_GUI_SELECT_MULTIPLE   2
 multiple item selection
#define N_GUI_SELECT_NONE   0
 no selection allowed (display only)
#define N_GUI_SELECT_SINGLE   1
 single item selection
#define N_GUI_SHAPE_BITMAP   2
 bitmap-based rendering
#define N_GUI_SHAPE_RECT   0
 rectangle shape (default)
#define N_GUI_SHAPE_ROUNDED   1
 rounded rectangle shape
#define N_GUI_SLIDER_H   0
 horizontal slider (default)
#define N_GUI_SLIDER_PERCENT   1
 slider uses 0-100 percentage
#define N_GUI_SLIDER_V   1
 vertical slider
#define N_GUI_SLIDER_VALUE   0
 slider uses raw start/end values
#define N_GUI_SPLIT_HORIZONTAL   1
 split pane: horizontal divider, regions are top and bottom
#define N_GUI_SPLIT_VERTICAL   0
 split pane: vertical divider, regions are left and right
#define N_GUI_STATE_ACTIVE   2
 widget is being pressed / dragged
#define N_GUI_STATE_FOCUSED   4
 widget has keyboard focus
#define N_GUI_STATE_HOVER   1
 mouse is hovering the widget
#define N_GUI_STATE_IDLE   0
 widget is idle / normal state
#define N_GUI_STATE_SCROLLBAR_DRAG   8
 widget scrollbar is being dragged
#define N_GUI_SUGGEST_MAX   64
 most completions a textarea's suggestion list keeps for one prefix.
#define N_GUI_SUGGEST_SEP_MAX   8
 longest separator set a suggestion-aware textarea takes, including the terminator
#define N_GUI_SUGGEST_VISIBLE   8
 most completions a suggestion panel shows at once.
#define N_GUI_SYNTAX_DIFF   6
 syntax view: unified diff highlighting (added, removed and hunk header lines, as produced by n_diff_to_unified).
#define N_GUI_SYNTAX_HTTP   1
 syntax view: HTTP message highlighting (request/status line and headers)
#define N_GUI_SYNTAX_JS   5
 syntax view: JavaScript highlighting (keywords, strings, numbers, comments)
#define N_GUI_SYNTAX_JSON   2
 syntax view: JSON highlighting (keys, strings, numbers, punctuation)
#define N_GUI_SYNTAX_PLAIN   0
 syntax view: no highlighting
#define N_GUI_SYNTAX_XML   3
 syntax view: XML/HTML highlighting (tags, attributes, quoted values, comments)
#define N_GUI_SYNTAX_YAML   4
 syntax view: YAML highlighting (keys, quoted values, list markers, comments)
#define N_GUI_TAB_MAX   16
 maximum number of tabs in a single tab panel
#define N_GUI_TB_BTN_CLOSE   3
 close titlebar button
#define N_GUI_TB_BTN_MAXIMIZE   2
 maximize/restore titlebar button
#define N_GUI_TB_BTN_MINIMIZE   1
 minimize titlebar button
#define N_GUI_TB_BTN_NONE   0
 no titlebar button
#define N_GUI_TEXT_MAX   4096
 maximum length for textarea content
#define N_GUI_TREE_MAX   2048
 maximum number of nodes in a tree view
#define N_GUI_TREE_PATH_MAX   1024
 maximum length of a node path (labels from the root, joined)
#define N_GUI_TREE_PATH_SEP   '\x1f'
 separator joining the labels of a node path.
#define N_GUI_TREE_STATE_MAX   512
 maximum number of expanded paths remembered by an N_GUI_TREE_STATE
#define N_GUI_TRUNCATE_END   0
 text too wide for its box is cut at the end, "Long senten...": the default, right for a sentence
#define N_GUI_TRUNCATE_PATH   2
 a path too wide for its box loses whole leading components, ".../photos/IMG_0001.CR3", and the file name only if it is wider than the box on its own; both '/' and '\' separate components
#define N_GUI_TRUNCATE_START   1
 text too wide for its box is cut at the start, "...ong sentence": for anything whose end is what tells it apart
#define N_GUI_TYPE_BUTTON   1
 widget type: button
#define N_GUI_TYPE_CHECKBOX   4
 widget type: checkbox
#define N_GUI_TYPE_COMBOBOX   8
 widget type: combo box (dropdown)
#define N_GUI_TYPE_CUSTOM   17
 widget type: owner-draw custom widget (rendering delegated to a callback)
#define N_GUI_TYPE_DATAGRID   15
 widget type: sortable column data grid
#define N_GUI_TYPE_DROPMENU   11
 widget type: dropdown menu with static and dynamic entries
#define N_GUI_TYPE_HEXVIEW   13
 widget type: read-only hexadecimal byte viewer
#define N_GUI_TYPE_IMAGE   9
 widget type: image display
#define N_GUI_TYPE_LABEL   10
 widget type: static text label (with optional hyperlink)
#define N_GUI_TYPE_LISTBOX   6
 widget type: listbox (selectable list)
#define N_GUI_TYPE_MARKDOWNVIEW   18
 widget type: read-only scrolling Markdown view
#define N_GUI_TYPE_PROGRESSBAR   16
 widget type: horizontal progress bar (display only)
#define N_GUI_TYPE_RADIOLIST   7
 widget type: radio list (single select radio buttons)
#define N_GUI_TYPE_SCROLLBAR   5
 widget type: scrollbar
#define N_GUI_TYPE_SLIDER   2
 widget type: slider
#define N_GUI_TYPE_SPLITPANE   12
 widget type: split pane with a draggable divider between two regions
#define N_GUI_TYPE_SYNTAXVIEW   14
 widget type: read-only syntax-highlighted text view
#define N_GUI_TYPE_TEXTAREA   3
 widget type: text area
#define N_GUI_WIN_AUTO_SCROLLBAR   16
 enable automatic scrollbars when content exceeds window size
#define N_GUI_WIN_BTN_ALL   (N_GUI_WIN_BTN_MINIMIZE | N_GUI_WIN_BTN_MAXIMIZE | N_GUI_WIN_BTN_CLOSE)
 enable all three title bar buttons (minimize + maximize + close)
#define N_GUI_WIN_BTN_CLOSE   1024
 enable close button on the title bar
#define N_GUI_WIN_BTN_MAXIMIZE   512
 enable maximize/restore button on the title bar
#define N_GUI_WIN_BTN_MINIMIZE   256
 enable minimize button on the title bar
#define N_GUI_WIN_DRAGGING   4
 window is being dragged
#define N_GUI_WIN_FIXED_POSITION   64
 disable window dragging (default:enable)
#define N_GUI_WIN_FRAMELESS   128
 frameless window: no title bar drawn, drag via window body unless N_GUI_WIN_FIXED_POSITION is also set
#define N_GUI_WIN_HSCROLL_DRAG   32
 window horizontal auto-scrollbar is being dragged
#define N_GUI_WIN_HSCROLL_HOVER   256
 pointer is over the window's horizontal auto-scrollbar
#define N_GUI_WIN_MAXIMISED   64
 window is maximised (full display size)
#define N_GUI_WIN_MINIMISED   2
 window is minimised (title bar only)
#define N_GUI_WIN_NO_HSCROLL   2048
 with N_GUI_WIN_AUTO_SCROLLBAR, never show the horizontal scrollbar (vertical-only scrolling): content wider than the window is clipped instead of horizontally scrolled
#define N_GUI_WIN_OPEN   1
 window is visible
#define N_GUI_WIN_RESIZABLE   32
 enable user-resizable window with a drag handle at bottom-right
#define N_GUI_WIN_RESIZE_MOVE   1
 reposition proportionally, keep pixel size
#define N_GUI_WIN_RESIZE_NONE   0
 no adaptation: absolute position and size unchanged
#define N_GUI_WIN_RESIZE_SCALE   2
 reposition AND resize proportionally, child widgets scale too
#define N_GUI_WIN_RESIZING   8
 window is being resized
#define N_GUI_WIN_VSCROLL_DRAG   16
 window vertical auto-scrollbar is being dragged
#define N_GUI_WIN_VSCROLL_HOVER   128
 pointer is over the window's vertical auto-scrollbar
#define N_GUI_ZORDER_ALWAYS_BEHIND   2
 always drawn behind normal windows, cannot be raised above them
#define N_GUI_ZORDER_ALWAYS_ON_TOP   1
 always drawn on top of normal windows, cannot be lowered behind them
#define N_GUI_ZORDER_FIXED   3
 fixed z-value: window is sorted within a dedicated group between ALWAYS_BEHIND and NORMAL windows.
#define N_GUI_ZORDER_NORMAL   0
 default z-order: window participates in normal raise/lower ordering
#define N_GUI_ZORDER_POPUP   4
 popup/modal dialogs: drawn above EVERYTHING including ALWAYS_ON_TOP windows.

Typedefs

typedef 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).
typedef int(* N_GUI_CUSTOM_MOUSE) (int widget_id, const N_GUI_MOUSE_EVENT *ev, void *user_data)
 Mouse callback for a custom widget, set with n_gui_custom_set_mouse().
typedef void(* N_GUI_SUGGEST_FN) (const char *prefix, N_GUI_SUGGEST_SINK *sink, void *user_data)
 asked for the completions of what has been typed so far
typedef int(* n_gui_tree_on_drop_t) (int src_node, int dst_node, int position, void *user_data)
 drag-reorder drop callback.

Functions

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
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
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.
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
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.
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
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_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_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
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
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
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
int n_gui_add_markdownview (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, const N_GUI_MD_FONTS *fonts)
 add a read-only scrolling Markdown view.
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_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
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
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
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
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
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_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_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)
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
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 adding all widgets)
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 dimensions.
int n_gui_button_get_glyph (N_GUI_CTX *ctx, int widget_id)
 current glyph of a button, or N_GUI_GLYPH_NONE when it draws its label (also for a non-button widget)
const char * n_gui_button_get_label (N_GUI_CTX *ctx, int widget_id)
 What a button says.
int n_gui_button_is_toggled (N_GUI_CTX *ctx, int widget_id)
 check if button is toggled
void n_gui_button_set_glyph (N_GUI_CTX *ctx, int widget_id, int glyph)
 draw an N_GUI_GLYPH_* icon (primitives, in the button's text colour) instead of the label; N_GUI_GLYPH_NONE restores the label.
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.
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_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_BITMAP; toggled-on renders active)
void n_gui_button_set_toggle_mode (N_GUI_CTX *ctx, int widget_id, int toggle_mode)
 set button toggle mode
void n_gui_button_set_toggled (N_GUI_CTX *ctx, int widget_id, int toggled)
 set button toggled state
const char * n_gui_checkbox_get_label (N_GUI_CTX *ctx, int widget_id)
 What a checkbox says.
int n_gui_checkbox_is_checked (N_GUI_CTX *ctx, int widget_id)
 check if checkbox is checked
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_checkbox_set_checked (N_GUI_CTX *ctx, int widget_id, int checked)
 set checkbox checked state
void n_gui_checkbox_set_label (N_GUI_CTX *ctx, int widget_id, const char *label)
 Replace the text drawn beside a checkbox.
void n_gui_close_menus (N_GUI_CTX *ctx)
 Put away any open combo box list or drop menu panel.
void n_gui_close_window (N_GUI_CTX *ctx, int window_id)
 close (hide) a window
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_combobox_clear (N_GUI_CTX *ctx, int widget_id)
 remove all items from a combobox
int n_gui_combobox_get_count (N_GUI_CTX *ctx, int widget_id)
 get the number of items in a combobox (0 if not a combobox).
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_combobox_get_selected (N_GUI_CTX *ctx, int widget_id)
 get the selected item index
int n_gui_combobox_remove_item (N_GUI_CTX *ctx, int widget_id, int index)
 remove the item at index from a combobox.
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.
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_combobox_set_selected (N_GUI_CTX *ctx, int widget_id, int index)
 set the selected item index
int n_gui_count_detached (N_GUI_CTX *ctx)
 count the windows currently detached into native OS windows
void n_gui_custom_set_destroy (N_GUI_CTX *ctx, int widget_id, void(*destroy)(void *user_data))
 hand a custom widget's paint user pointer to the widget
void n_gui_custom_set_mouse (N_GUI_CTX *ctx, int widget_id, N_GUI_CUSTOM_MOUSE on_mouse, void *user_data)
 give a custom widget mouse input
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
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_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)
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_datagrid_clear_rows (N_GUI_CTX *ctx, int widget_id)
 remove all rows from a data grid (columns are kept)
void n_gui_datagrid_clear_selection (N_GUI_CTX *ctx, int widget_id)
 clear the entire selection (no row selected)
float n_gui_datagrid_columns_width (N_GUI_CTX *ctx, int widget_id)
 horizontal scroll offset in pixels (how far the columns are scrolled left when their total width exceeds the widget's pane), or 0.
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
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
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
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
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
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
float n_gui_datagrid_get_h_scroll (N_GUI_CTX *ctx, int widget_id)
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 it does.
int n_gui_datagrid_get_row_count (N_GUI_CTX *ctx, int widget_id)
 get the number of rows in a data grid
int n_gui_datagrid_get_scroll_offset (N_GUI_CTX *ctx, int widget_id)
 first visible data row (the vertical scroll position), or 0.
int n_gui_datagrid_get_selected (N_GUI_CTX *ctx, int widget_id)
 get the selected row index, or -1 if none
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 selected rows.
int n_gui_datagrid_get_sort (N_GUI_CTX *ctx, int widget_id, int *col, int *dir)
 read back the sort a datagrid is currently showing.
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)
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 (reorders how columns are laid out; the cells and physical indices are unchanged)
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.g.
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 header and rows and closed up so no gap remains
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_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 content width each frame, so a stale value after a rebuild is harmless).
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_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 layout.
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 is right-clicked, after selecting that row.
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 viewport each frame, so a stale offset after a rebuild is harmless.
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_datagrid_sort (N_GUI_CTX *ctx, int widget_id, int col, int dir)
 sort the rows by a column (dir 1 ascending, -1 descending)
N_GUI_STYLE n_gui_default_style (void)
 return the built-in default style
N_GUI_THEME n_gui_default_tb_btn_theme (void)
 return the built-in default theme for titlebar minimize/maximize buttons
N_GUI_THEME n_gui_default_tb_close_theme (void)
 return the built-in default theme for the titlebar close button (red hover/active)
N_GUI_THEME n_gui_default_theme (void)
 return the built-in default theme
void n_gui_destroy_ctx (N_GUI_CTX **ctx)
 destroy a GUI context and free all resources
float n_gui_detect_dpi_scale (N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
 detect and apply DPI scale from the given allegro display.
int n_gui_double_clicked_widget (const N_GUI_CTX *ctx)
 id of the widget the primary press just processed double clicked, or -1.
void n_gui_draw (N_GUI_CTX *ctx)
 draw all visible GUI windows and widgets
void n_gui_draw_detached (N_GUI_CTX *ctx)
 render and flip every detached window, and release the ones whose native window was closed.
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)
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
void n_gui_dropmenu_clear (N_GUI_CTX *ctx, int widget_id)
 remove all entries
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)
int n_gui_dropmenu_get_count (N_GUI_CTX *ctx, int widget_id)
 get number of entries
int n_gui_dropmenu_is_open (N_GUI_CTX *ctx, int widget_id)
 is a dropdown menu's panel showing
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 width and the widest entry text (plus item padding on both sides and the scrollbar width when the entry count overflows the visible window).
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.
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_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_dropmenu_set_label (N_GUI_CTX *ctx, int widget_id, const char *label)
 replace the button label shown on a dropmenu (NULL clears it)
int n_gui_dropmenu_set_open (N_GUI_CTX *ctx, int widget_id, int open)
 open or close a dropdown menu without anybody clicking its button.
int n_gui_focus_takes_key (const N_GUI_CTX *ctx, int keycode)
 Would the focused widget do something with this particular key.
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 (clears focus if it has none)
int n_gui_get_cursor (N_GUI_CTX *ctx, ALLEGRO_MOUSE_CURSOR **custom)
 The cursor the GUI last applied to the display.
float n_gui_get_dpi_scale (const N_GUI_CTX *ctx)
 get current DPI scale factor
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)
int n_gui_get_focus (const N_GUI_CTX *ctx)
 Which widget has the keyboard, or -1 when none has.
int n_gui_get_key_modifiers (const N_GUI_CTX *ctx)
 the modifier keys held down now, as the GUI has seen them
int n_gui_get_resize_mode (N_GUI_CTX *ctx)
 get current resize mode
int n_gui_get_shape_mode (N_GUI_CTX *ctx)
 get the global widget shape (N_GUI_SHAPE_ROUNDED or N_GUI_SHAPE_RECT)
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_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), or -1 if no window is open.
N_GUI_WIDGET * n_gui_get_widget (N_GUI_CTX *ctx, int widget_id)
 get a widget by id
N_GUI_WINDOW * n_gui_get_window (N_GUI_CTX *ctx, int window_id)
 get a window by id
size_t n_gui_hexview_get_cursor (N_GUI_CTX *ctx, int widget_id)
 the byte offset the edit cursor sits on
const unsigned char * n_gui_hexview_get_data (N_GUI_CTX *ctx, int widget_id, size_t *len)
 borrow the bytes a hex view holds (valid until the next edit or set_data); *len receives the count.
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
void n_gui_hexview_set_cursor (N_GUI_CTX *ctx, int widget_id, size_t offset)
 move the edit cursor to a byte offset (clamped to the data length)
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
void n_gui_hexview_set_editable (N_GUI_CTX *ctx, int widget_id, int editable)
 make a hex view editable (or read-only again)
void n_gui_hexview_set_on_change (N_GUI_CTX *ctx, int widget_id, void(*on_change)(int, const unsigned char *, size_t, void *), void *user_data)
 set the callback fired after each edit (NULL to clear)
int n_gui_hovered_widget (const N_GUI_CTX *ctx)
 id of the widget currently under the mouse pointer (hover/active flag, maintained by n_gui_process_event; front-most open window wins), or -1.
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_is_widget_enabled (N_GUI_CTX *ctx, int widget_id)
 check if a widget is enabled
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_kvtable_clear (N_GUI_KVTABLE *table)
 remove every row at once.
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_kvtable_duplicate_row (N_GUI_KVTABLE *table, int row_index)
 insert a copy of the row at row_index directly after it.
void n_gui_kvtable_free (N_GUI_KVTABLE **table)
 free a KV table (does not destroy the N_GUI widgets)
int n_gui_kvtable_get_count (const N_GUI_KVTABLE *table)
 get the number of active rows
int n_gui_kvtable_move_row (N_GUI_KVTABLE *table, int row_index, int direction)
 move the row at row_index one position up (direction < 0) or down (direction > 0) among the ACTIVE rows, by swapping their contents.
void n_gui_kvtable_relayout (N_GUI_KVTABLE *table)
 re-apply layout to all KV table widgets (positions, sizes, normalized coords).
void n_gui_kvtable_remove_row (N_GUI_KVTABLE *table, int row_index)
 remove a row by index (hides widgets, marks inactive)
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.
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.
void n_gui_kvtable_set_row_actions (N_GUI_KVTABLE *table, int enabled)
 show (1) or hide (0, the default) the per-row action buttons: move up, move down and duplicate, drawn as glyphs next to the remove button.
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, a heading) can share the table's window without overlapping it.
int n_gui_label_fits (N_GUI_CTX *ctx, int widget_id, float *needed_w, float *needed_h)
 report whether a label's text is drawn in full inside its own box, and how big it would have to be to show all of it (out-params may be NULL)
const char * n_gui_label_get_text (N_GUI_CTX *ctx, int widget_id)
 What a label says now.
int n_gui_label_get_truncate (N_GUI_CTX *ctx, int widget_id)
 the label's truncate mode, N_GUI_TRUNCATE_END when it is not a label
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_label_set_link (N_GUI_CTX *ctx, int widget_id, const char *link)
 set label hyperlink URL
void n_gui_label_set_text (N_GUI_CTX *ctx, int widget_id, const char *text)
 set label text content
void n_gui_label_set_truncate (N_GUI_CTX *ctx, int widget_id, int mode)
 choose where a label's text is shortened when it does not fit: N_GUI_TRUNCATE_END (the default), N_GUI_TRUNCATE_START or N_GUI_TRUNCATE_PATH.
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_listbox_clear (N_GUI_CTX *ctx, int widget_id)
 clear all items from a listbox
float n_gui_listbox_content_width (N_GUI_CTX *ctx, int widget_id)
 width in pixels the widest item needs to be drawn in full (text padding included), or 0 for an empty list / non-listbox widget.
int n_gui_listbox_get_count (N_GUI_CTX *ctx, int widget_id)
 get number of items in a listbox
float n_gui_listbox_get_h_scroll (N_GUI_CTX *ctx, int widget_id)
 current horizontal scroll offset in pixels (0 = leftmost)
const char * n_gui_listbox_get_item_text (N_GUI_CTX *ctx, int widget_id, int index)
 get item text by index
int n_gui_listbox_get_scroll_offset (N_GUI_CTX *ctx, int widget_id)
 get the current scroll offset (in items)
int n_gui_listbox_get_selected (N_GUI_CTX *ctx, int widget_id)
 get the first selected item index
int n_gui_listbox_is_selected (N_GUI_CTX *ctx, int widget_id, int index)
 check if an item is selected
int n_gui_listbox_remove_item (N_GUI_CTX *ctx, int widget_id, int index)
 remove an item from a listbox by index
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_listbox_set_h_scroll (N_GUI_CTX *ctx, int widget_id, float px)
 set the horizontal scroll offset in pixels; clamped to >= 0 here and to the live content width by the draw path, so a stale value after a refill is harmless
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
void n_gui_listbox_set_selected (N_GUI_CTX *ctx, int widget_id, int index, int selected)
 set item selection state
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_load_theme_json (N_GUI_CTX *ctx, const char *filepath)
 Load a JSON theme file and apply it to the context.
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)
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
void n_gui_mark_dirty (N_GUI_CTX *ctx)
 Mark the GUI as needing a redraw.
float n_gui_markdownview_content_height (N_GUI_CTX *ctx, int widget_id)
 the height of the whole document at the width it was last drawn at, or 0 before the first draw
float n_gui_markdownview_get_scroll (N_GUI_CTX *ctx, int widget_id)
 how far down the content the view is, in pixels
const char * n_gui_markdownview_get_text (N_GUI_CTX *ctx, int widget_id)
 the Markdown source, owned by the widget, or NULL
void n_gui_markdownview_scroll_to (N_GUI_CTX *ctx, int widget_id, float y)
 scroll to y pixels down the content, clamped to what there is
void n_gui_markdownview_set_fonts (N_GUI_CTX *ctx, int widget_id, const N_GUI_MD_FONTS *fonts)
 replace the faces; the new ones are borrowed on the same terms
void n_gui_markdownview_set_on_link (N_GUI_CTX *ctx, int widget_id, void(*on_link)(int widget_id, const char *url, void *user_data), void *user_data)
 call on_link when a link in the view is clicked (NULL to stop).
void n_gui_markdownview_set_text (N_GUI_CTX *ctx, int widget_id, const char *text)
 set the Markdown source (copied; NULL clears it).
N_GUI_MD_STYLE * n_gui_markdownview_style (N_GUI_CTX *ctx, int widget_id)
 the view's style, to read or to change in place, or NULL if there is no such widget.
void n_gui_maximize_window (N_GUI_CTX *ctx, int window_id)
 toggle maximised state (full display or restore to previous size)
int n_gui_menu_is_open (const N_GUI_CTX *ctx)
 Is a combo box's list or a drop menu's panel currently open.
void n_gui_minimize_window (N_GUI_CTX *ctx, int window_id)
 minimize a window (title bar only)
int n_gui_needs_redraw (N_GUI_CTX *ctx)
 Return non-zero if the GUI must be redrawn this frame, i.e.
N_GUI_CTX * n_gui_new_ctx (ALLEGRO_FONT *default_font)
 create a new GUI context
void n_gui_open_window (N_GUI_CTX *ctx, int window_id)
 open (show) a window
int n_gui_process_event (N_GUI_CTX *ctx, ALLEGRO_EVENT event)
 process an allegro event for the GUI
float n_gui_progressbar_get_value (N_GUI_CTX *ctx, int widget_id)
 get the current progress fraction (0.0 on an invalid widget)
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_progressbar_set_value (N_GUI_CTX *ctx, int widget_id, float value)
 set the progress fraction (clamped to 0.0 .
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_radiolist_clear (N_GUI_CTX *ctx, int widget_id)
 remove all items from a radio list
int n_gui_radiolist_get_selected (N_GUI_CTX *ctx, int widget_id)
 get the selected item 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.
void n_gui_radiolist_set_selected (N_GUI_CTX *ctx, int widget_id, int index)
 set the selected item index
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_reset_all_widget_themes (N_GUI_CTX *ctx)
 reset all widget and window themes to ctx->default_theme
void n_gui_restore_window (N_GUI_CTX *ctx, int window_id)
 restore a minimised window to its full size
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_save_theme_json (N_GUI_CTX *ctx, const char *filepath)
 Save the full theme (default_theme + style) to a JSON file.
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.
double n_gui_scrollbar_get_pos (N_GUI_CTX *ctx, int widget_id)
 get scrollbar position
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_scrollbar_set_pos (N_GUI_CTX *ctx, int widget_id, double pos)
 set scrollbar position
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
void n_gui_scrollbar_set_wheel_step (N_GUI_CTX *ctx, int widget_id, double step)
 set how far one wheel notch moves a scrollbar, in its content units: 1 for a list whose content is counted in rows moves it a row a notch.
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); returns the section index or -1
int 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).
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
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_sectionlist_free (N_GUI_SECTIONLIST **sl)
 free the section list (does not destroy the N_GUI widgets or window)
int n_gui_sectionlist_get_count (const N_GUI_SECTIONLIST *sl)
 number of sections in the list
int n_gui_sectionlist_get_order (const N_GUI_SECTIONLIST *sl, int position)
 The section stacked at a position.
int n_gui_sectionlist_is_folded (const N_GUI_SECTIONLIST *sl, int section_index)
 query a section's folded state (1 = folded, 0 = expanded)
int n_gui_sectionlist_is_section_hidden (const N_GUI_SECTIONLIST *sl, int section_index)
 Is a section left out of the stack.
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 expanded ones
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 on the same row; relayout re-applies it
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_sectionlist_set_geometry (N_GUI_SECTIONLIST *sl, float x, float y0, float width, float header_h, float gap)
 restate where the list stacks from, how wide its headers are and the two heights it stacks with, for a caller whose window is resized or whose interface scale changes after the list was made.
void n_gui_sectionlist_set_order (N_GUI_SECTIONLIST *sl, const int *order, int count)
 Stack the sections in another order.
void n_gui_sectionlist_set_section_hidden (N_GUI_SECTIONLIST *sl, int section_index, int hidden)
 Leave a whole section out of the stack, header and members, or put it back.
void n_gui_sectionlist_set_widget_hidden (N_GUI_SECTIONLIST *sl, int section_index, int widget_id, int hidden)
 keep a member hidden whatever the fold state, and leave it out of the section's height.
void n_gui_sectionlist_set_widget_offset (N_GUI_SECTIONLIST *sl, int section_index, int widget_id, float dy)
 state a member's y offset from the section's content top, for a caller that computes its own layout and recomputes it when the window is resized.
void n_gui_set_cursor (N_GUI_CTX *ctx, int system_shape, ALLEGRO_MOUSE_CURSOR *custom)
 Say which mouse cursor the application wants.
int n_gui_set_default_font (N_GUI_CTX *ctx, ALLEGRO_FONT *font)
 Replace the context's default font, keeping every widget and its state.
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.
void n_gui_set_display (N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
 set the display pointer for clipboard operations (copy/paste)
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_set_double_click_radius (N_GUI_CTX *ctx, int pixels)
 how far the pointer may move between the two presses, in pixels (default 4)
void n_gui_set_double_click_time (N_GUI_CTX *ctx, double seconds)
 how long after a press a second one still counts, in seconds (default 0.4)
void n_gui_set_dpi_scale (N_GUI_CTX *ctx, float scale)
 set DPI scale factor manually (default is 1.0).
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
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_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_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)
void n_gui_set_virtual_size (N_GUI_CTX *ctx, float w, float h)
 set the virtual canvas size for resolution-independent scaling.
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)
void n_gui_set_widget_theme (N_GUI_CTX *ctx, int widget_id, N_GUI_THEME theme)
 set the theme on a widget
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_set_widget_visible (N_GUI_CTX *ctx, int widget_id, int visible)
 set widget visibility
int n_gui_slider_get_default (N_GUI_CTX *ctx, int widget_id, double *value)
 A slider's default, as n_gui_slider_set_default() gave it.
double n_gui_slider_get_key_step (N_GUI_CTX *ctx, int widget_id)
 get the arrow key and wheel increment actually in use for a slider
double n_gui_slider_get_value (N_GUI_CTX *ctx, int widget_id)
 get slider current value
int n_gui_slider_handle_pos (N_GUI_CTX *ctx, int widget_id, float *pos, float *radius)
 Where a slider's handle is drawn and how big it is.
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.
void n_gui_slider_set_default (N_GUI_CTX *ctx, int widget_id, double value)
 Give a slider a default value, which a double click on it puts back.
void n_gui_slider_set_key_step (N_GUI_CTX *ctx, int widget_id, double step)
 set how far one arrow key press or wheel notch moves a slider, without snapping its drag
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
void n_gui_slider_set_step (N_GUI_CTX *ctx, int widget_id, double step)
 set slider step increment (0 is treated as 1).
void n_gui_slider_set_value (N_GUI_CTX *ctx, int widget_id, double value)
 set slider value
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_slider_set_value_visible (N_GUI_CTX *ctx, int widget_id, int visible)
 Toggle the built-in value label.
float n_gui_slider_value_width (N_GUI_CTX *ctx, int widget_id)
 width in pixels a slider's built-in readout needs beside it, the gap between track and text included.
int n_gui_splitpane_at (N_GUI_CTX *ctx, float x, float y)
 report the split pane whose divider band is under a point, or -1.
float n_gui_splitpane_band (N_GUI_CTX *ctx, int widget_id)
 How far either side of a split pane's divider a press still counts as the divider's.
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_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_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_suggest_add (N_GUI_SUGGEST_SINK *sink, const char *text)
 add one completion to a suggestion sink
float n_gui_syntaxview_content_width (N_GUI_CTX *ctx, int widget_id)
 pixel width the widest line of a syntax view needs, padding included
float n_gui_syntaxview_get_h_scroll (N_GUI_CTX *ctx, int widget_id)
 current horizontal scroll offset of a syntax view, in pixels.
int n_gui_syntaxview_get_line_count (N_GUI_CTX *ctx, int widget_id)
 get the number of text lines in a syntax view
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.
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_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, and horizontally so the offset itself is inside the visible width
void n_gui_syntaxview_select_all (N_GUI_CTX *ctx, int widget_id)
 select the entire text of a syntax view
void n_gui_syntaxview_set_h_scroll (N_GUI_CTX *ctx, int widget_id, float px)
 set the horizontal scroll offset of a syntax view, in pixels (clamped to the content width by the draw path)
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_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 clear the selection
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
int n_gui_tab_add (N_GUI_TAB_PANEL *panel, const char *label)
 add a tab to the panel, returns tab index
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_tab_free (N_GUI_TAB_PANEL **panel)
 free a tab panel (does not destroy the N_GUI widgets)
int n_gui_tab_get_active (const N_GUI_TAB_PANEL *panel)
 get the active tab index
void n_gui_tab_relayout (N_GUI_TAB_PANEL *panel, float x, float y, float button_w, float button_h)
 move/resize the button row after creation (a host-owned or resizable layout); pass <= 0 for button_w / button_h to keep the current value.
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_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_text_shorten (ALLEGRO_FONT *font, const char *text, float max_w, int mode, char *out, size_t out_len)
 shorten text to fit max_w pixels in font, the way a label with truncate mode mode shows it: unchanged when it fits, otherwise with "..." at the end, at the start, or in place of whole leading path components (N_GUI_TRUNCATE_END, _START, _PATH).
const char * n_gui_textarea_get_text (N_GUI_CTX *ctx, int widget_id)
 get text area content
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)
int n_gui_textarea_has_selection (N_GUI_CTX *ctx, int widget_id)
 is any text selected in a text area (0 for no selection or a bad id)
void n_gui_textarea_scroll_to_bottom (N_GUI_CTX *ctx, int widget_id)
 scroll a multiline textarea to the bottom
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_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_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 as soon as the user types.
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_textarea_set_suggest (N_GUI_CTX *ctx, int widget_id, N_GUI_SUGGEST_FN fn, const char *separators, void *user_data)
 offer completions in a textarea
void n_gui_textarea_set_text (N_GUI_CTX *ctx, int widget_id, const char *text)
 set text area content
void n_gui_textarea_suggest_close (N_GUI_CTX *ctx, int widget_id)
 put a textarea's completion panel away
int n_gui_textarea_suggest_is_open (N_GUI_CTX *ctx, int widget_id)
 is a textarea's completion panel up
void n_gui_toggle_window (N_GUI_CTX *ctx, int window_id)
 toggle window visibility (show/hide)
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 cached GUI renders must keep redrawing so the bubble can appear on time), 2 = shown (static - re-render once on the transition, then stop)
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
void n_gui_tree_clear (N_GUI_TREE *tree)
 remove all nodes and clear the backing listbox; tree object remains valid
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
void n_gui_tree_draw_overlay (N_GUI_TREE *tree)
 per-frame overlay drawing: draws the active drop-indicator on top of the listbox.
void n_gui_tree_expand (N_GUI_TREE *tree, int node_index)
 open a node, filling it first through the expand callback if it has not been; a node already open stays open.
int n_gui_tree_find_by_path (const N_GUI_TREE *tree, const char *path)
 index of the first node with the given path, or -1.
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_free (N_GUI_TREE **tree)
 free a tree view (does not destroy the N_GUI listbox)
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 at a hidden row
int n_gui_tree_node_path (const N_GUI_TREE *tree, int node_index, char *buf, size_t bufsz)
 write the path of a node (its label and its ancestors', joined by N_GUI_TREE_PATH_SEP) into buf.
void n_gui_tree_rebuild (N_GUI_TREE *tree)
 rebuild the listbox to reflect current tree state
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 across the call must discard or re-resolve them)
void n_gui_tree_set_expand_callback (N_GUI_TREE *tree, void(*on_expand)(int node_index, void *user_data), void *user_data)
 set the callback that fills a node the first time it is opened, for a tree too large to build before it is shown: a folder tree reads a directory only when somebody opens it.
void n_gui_tree_set_expandable (N_GUI_TREE *tree, int node_index, int expandable)
 mark a node as openable before it has children, so it shows an expander and the expand callback fills it when it is opened
void n_gui_tree_set_label (N_GUI_TREE *tree, int node_index, const char *new_label)
 change the display label of a node
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_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 scrolls to reveal it.
void n_gui_tree_state_apply (N_GUI_TREE *tree, const N_GUI_TREE_STATE *state)
 re-expand, re-select and re-scroll a rebuilt tree from a saved state.
void n_gui_tree_state_free (N_GUI_TREE_STATE *state)
 release the strings owned by a saved state (safe on a zeroed struct)
int n_gui_tree_state_save (const N_GUI_TREE *tree, N_GUI_TREE_STATE *out)
 capture which nodes are expanded, which one is selected, and where the view is scrolled, all by path.
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_tree_toggle_expand (N_GUI_TREE *tree, int node_index)
 toggle expand/collapse of a node.
void n_gui_update_transform (N_GUI_CTX *ctx)
 recalculate scale and offset from virtual canvas to display.
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 world)
int n_gui_was_double_click (const N_GUI_CTX *ctx, int widget_id)
 whether the press just processed double clicked this particular widget
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_widget_is_visible (N_GUI_CTX *ctx, int widget_id)
 Is a widget currently shown.
int n_gui_widget_screen_rect (N_GUI_CTX *ctx, int widget_id, float *x, float *y, float *w, float *h)
 Where a widget is on screen, rather than inside its window.
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, or a datagrid's column order/visibility/width) is persisted by n_gui_save_layout_json and restored by n_gui_load_layout_json.
void n_gui_widget_set_rect (N_GUI_CTX *ctx, int widget_id, float x, float y, float w, float h)
 move/resize a widget after creation, refreshing the normalized coordinates the resize passes read.
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)
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_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_window_button_rect (N_GUI_CTX *ctx, int window_id, int btn_type, float *x, float *y, float *w, float *h)
 Where one of a window's title bar buttons is, on screen.
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_window_find_button (N_GUI_CTX *ctx, int window_id, const char *label)
 Find the button in a window whose label is exactly this.
int n_gui_window_from_display (N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display)
 find the window detached into a given display
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_window_get_flags (N_GUI_CTX *ctx, int window_id)
 get feature flags of a window
int n_gui_window_get_resize_policy (N_GUI_CTX *ctx, int window_id)
 get per-window resize policy
int n_gui_window_get_zorder (N_GUI_CTX *ctx, int window_id)
 get window z-order mode
int n_gui_window_get_zvalue (N_GUI_CTX *ctx, int window_id)
 get window z-value (for N_GUI_ZORDER_FIXED mode)
int n_gui_window_is_detached (N_GUI_CTX *ctx, int window_id)
 check whether a window currently lives in a native OS window
int n_gui_window_is_maximised (N_GUI_CTX *ctx, int window_id)
 check if a window is currently maximised
int n_gui_window_is_minimised (N_GUI_CTX *ctx, int window_id)
 check if a window is currently minimised
int n_gui_window_is_open (N_GUI_CTX *ctx, int window_id)
 check if window is visible
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 window manager has iconified it.
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_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_window_set_caption (N_GUI_CTX *ctx, int window_id, const char *caption)
 show a caption in a window's title bar in place of its title, for a title that carries live state ("Export - 3 photographs").
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_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 content is drawn (at the window's z-order)
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_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_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_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_window_set_rect (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h)
 move and resize a window at runtime, rescaling its child widgets from their normalized coordinates (what a split-pane divider drag or a collapsing panel needs, since the adaptive pass only runs on a display resize).
void n_gui_window_set_rect_axes (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int scale_x, int scale_y)
 n_gui_window_set_rect with per-axis reflow control.
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_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
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_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_wheel_scrollbar (N_GUI_CTX *ctx, int window_id, int scrollbar_id)
 make the wheel anywhere over a window move one of its scrollbars, for a window that scrolls its own rows with a scrollbar widget rather than with N_GUI_WIN_AUTO_SCROLLBAR (a fixed set of rows refilled from an offset).
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
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.

Detailed Description

GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.

Author
Castagnier Mickael
Version
3.0
Date
02/03/2026

Definition in file n_gui.h.