Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
GUI: allegro5 widget system with pseudo-windows

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 plus its user pointer. 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_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_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_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_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_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   48
 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_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_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_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_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_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_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_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_is_toggled (N_GUI_CTX *ctx, int widget_id)
 check if button is toggled
 
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
 
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_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
 
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
 
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
 
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)
 
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)
 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_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_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.
 
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
 
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)
 
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)
 
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_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_WIDGETn_gui_get_widget (N_GUI_CTX *ctx, int widget_id)
 get a widget by id
 
N_GUI_WINDOWn_gui_get_window (N_GUI_CTX *ctx, int window_id)
 get a window by id
 
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_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_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_KVTABLEn_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
 
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
 
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_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.
 
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
 
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
 
int n_gui_listbox_get_count (N_GUI_CTX *ctx, int widget_id)
 get number of items in a listbox
 
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_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.
 
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_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_CTXn_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
 
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
 
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)
 
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_SECTIONLISTn_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_is_folded (const N_GUI_SECTIONLIST *sl, int section_index)
 query a section's folded state (1 = folded, 0 = expanded)
 
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_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_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
 
double n_gui_slider_get_value (N_GUI_CTX *ctx, int widget_id)
 get slider current value
 
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_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_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_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
 
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_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_PANELn_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_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
 
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)
 
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_text (N_GUI_CTX *ctx, int widget_id, const char *text)
 set text area content
 
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_TREEn_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.
 
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
 
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_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_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)
 
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.
 
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_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_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_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_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_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_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

Bitmap Skinning

All widgets support optional bitmap overlays for visual customization. By default, every bitmap pointer is NULL and the standard color theme is used. To skin a widget element, call the corresponding _set_bitmaps() function after widget creation.

Bitmaps are NOT owned by N_GUI, the caller is responsible for loading and destroying them. N_GUI only stores the pointer.

Fallback Chain

For widgets with per-state bitmaps (normal/hover/active):

Supported Widgets

JSON Theme

Bitmap assignments are programmatic (via setter functions), not part of the JSON theme file. The JSON theme remains the color/layout fallback.


Data Structure Documentation

◆ N_GUI_BUTTON_DATA

struct N_GUI_BUTTON_DATA

button specific data

Definition at line 380 of file n_gui.h.

+ Collaboration diagram for N_GUI_BUTTON_DATA:

Data Fields

ALLEGRO_BITMAP * bitmap
 optional bitmap for the button (NULL = color theme)
 
ALLEGRO_BITMAP * bitmap_active
 optional bitmap for active/pressed state
 
ALLEGRO_BITMAP * bitmap_hover
 optional bitmap for hover state
 
int key_focus_only
 if 1, keycode fires only when the button itself or a source widget has focus.
 
int key_modifiers
 required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state for backward compatibility).
 
double key_press_until
 absolute al_get_time() deadline until which the button is rendered in its pressed (N_GUI_STATE_ACTIVE) visual state after a keybind trigger.
 
int key_sources [8]
 widget IDs that can trigger this focused key binding.
 
int keycode
 bound keyboard keycode (0 = none).
 
char label [128]
 label displayed on the button
 
void(* on_click )(int widget_id, void *user_data)
 callback on click (widget_id passed)
 
int shape
 shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP
 
int toggle_mode
 toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked)
 
int toggled
 toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1)
 
void * user_data
 user data for callback
 

Field Documentation

◆ bitmap

ALLEGRO_BITMAP* N_GUI_BUTTON_DATA::bitmap

optional bitmap for the button (NULL = color theme)

Definition at line 384 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), n_gui_add_button_bitmap(), and n_gui_button_set_state_bitmaps().

◆ bitmap_active

ALLEGRO_BITMAP* N_GUI_BUTTON_DATA::bitmap_active

optional bitmap for active/pressed state

Definition at line 388 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), n_gui_add_button_bitmap(), and n_gui_button_set_state_bitmaps().

◆ bitmap_hover

ALLEGRO_BITMAP* N_GUI_BUTTON_DATA::bitmap_hover

optional bitmap for hover state

Definition at line 386 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), n_gui_add_button_bitmap(), and n_gui_button_set_state_bitmaps().

◆ key_focus_only

int N_GUI_BUTTON_DATA::key_focus_only

if 1, keycode fires only when the button itself or a source widget has focus.

if 0 (default), keycode fires globally when no interactive widget has focus.

Definition at line 406 of file n_gui.h.

Referenced by n_gui_button_set_keycode_focused(), and n_gui_process_event().

◆ key_modifiers

int N_GUI_BUTTON_DATA::key_modifiers

required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state for backward compatibility).

Use ALLEGRO_KEYMOD_SHIFT, ALLEGRO_KEYMOD_CTRL, ALLEGRO_KEYMOD_ALT, ALLEGRO_KEYMOD_ALTGR ORed together. When non-zero, only the specified modifier combination triggers the keybind (exact match on N_GUI_KEY_MOD_MASK bits).

Definition at line 403 of file n_gui.h.

Referenced by n_gui_add_button(), n_gui_button_set_keycode(), n_gui_button_set_keycode_focused(), and n_gui_process_event().

◆ key_press_until

double N_GUI_BUTTON_DATA::key_press_until

absolute al_get_time() deadline until which the button is rendered in its pressed (N_GUI_STATE_ACTIVE) visual state after a keybind trigger.

0.0 = no pending key-press flash.

Definition at line 413 of file n_gui.h.

Referenced by _draw_button(), and n_gui_process_event().

◆ key_sources

int N_GUI_BUTTON_DATA::key_sources[8]

widget IDs that can trigger this focused key binding.

Terminated by -1. Only used when key_focus_only == 1. Up to N_GUI_KEY_SOURCES_MAX entries.

Definition at line 409 of file n_gui.h.

Referenced by n_gui_button_set_keycode_focused(), and n_gui_process_event().

◆ keycode

int N_GUI_BUTTON_DATA::keycode

bound keyboard keycode (0 = none).

When this key is pressed and no text input widget has focus, the button's on_click callback is triggered.

Definition at line 397 of file n_gui.h.

Referenced by n_gui_add_button(), n_gui_button_set_keycode(), n_gui_button_set_keycode_focused(), and n_gui_process_event().

◆ label

char N_GUI_BUTTON_DATA::label[128]

label displayed on the button

Definition at line 382 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), and n_gui_button_set_label().

◆ on_click

void(* N_GUI_BUTTON_DATA::on_click) (int widget_id, void *user_data)

callback on click (widget_id passed)

Definition at line 415 of file n_gui.h.

Referenced by n_gui_add_button(), and n_gui_process_event().

◆ shape

int N_GUI_BUTTON_DATA::shape

shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP

Definition at line 390 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), and n_gui_button_set_state_bitmaps().

◆ toggle_mode

int N_GUI_BUTTON_DATA::toggle_mode

toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked)

Definition at line 392 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), n_gui_add_toggle_button(), n_gui_button_set_toggle_mode(), and n_gui_process_event().

◆ toggled

int N_GUI_BUTTON_DATA::toggled

toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1)

Definition at line 394 of file n_gui.h.

Referenced by _draw_button(), n_gui_add_button(), n_gui_add_toggle_button(), n_gui_button_set_toggle_mode(), and n_gui_process_event().

◆ user_data

void* N_GUI_BUTTON_DATA::user_data

user data for callback

Definition at line 417 of file n_gui.h.

Referenced by n_gui_add_button(), and n_gui_process_event().

◆ N_GUI_CHECKBOX_DATA

struct N_GUI_CHECKBOX_DATA

checkbox specific data

Definition at line 501 of file n_gui.h.

+ Collaboration diagram for N_GUI_CHECKBOX_DATA:

Data Fields

ALLEGRO_BITMAP * box_bitmap
 optional bitmap for the checkbox square, unchecked state (NULL = color theme)
 
ALLEGRO_BITMAP * box_checked_bitmap
 optional bitmap for the checkbox square, checked state (NULL = color theme)
 
ALLEGRO_BITMAP * box_hover_bitmap
 optional bitmap for the checkbox square on hover (NULL = fallback to box_bitmap/box_checked_bitmap)
 
int checked
 checked state
 
char label [128]
 label displayed next to the checkbox
 
void(* on_toggle )(int widget_id, int checked, void *user_data)
 callback on toggle
 
void * user_data
 user data for callback
 

Field Documentation

◆ box_bitmap

ALLEGRO_BITMAP* N_GUI_CHECKBOX_DATA::box_bitmap

optional bitmap for the checkbox square, unchecked state (NULL = color theme)

Definition at line 507 of file n_gui.h.

Referenced by _draw_checkbox(), and n_gui_checkbox_set_bitmaps().

◆ box_checked_bitmap

ALLEGRO_BITMAP* N_GUI_CHECKBOX_DATA::box_checked_bitmap

optional bitmap for the checkbox square, checked state (NULL = color theme)

Definition at line 509 of file n_gui.h.

Referenced by _draw_checkbox(), and n_gui_checkbox_set_bitmaps().

◆ box_hover_bitmap

ALLEGRO_BITMAP* N_GUI_CHECKBOX_DATA::box_hover_bitmap

optional bitmap for the checkbox square on hover (NULL = fallback to box_bitmap/box_checked_bitmap)

Definition at line 511 of file n_gui.h.

Referenced by _draw_checkbox(), and n_gui_checkbox_set_bitmaps().

◆ checked

int N_GUI_CHECKBOX_DATA::checked

checked state

Definition at line 505 of file n_gui.h.

Referenced by _draw_checkbox(), n_gui_add_checkbox(), and n_gui_process_event().

◆ label

char N_GUI_CHECKBOX_DATA::label[128]

label displayed next to the checkbox

Definition at line 503 of file n_gui.h.

Referenced by _draw_checkbox(), and n_gui_add_checkbox().

◆ on_toggle

void(* N_GUI_CHECKBOX_DATA::on_toggle) (int widget_id, int checked, void *user_data)

callback on toggle

Definition at line 513 of file n_gui.h.

Referenced by n_gui_add_checkbox(), and n_gui_process_event().

◆ user_data

void* N_GUI_CHECKBOX_DATA::user_data

user data for callback

Definition at line 515 of file n_gui.h.

Referenced by n_gui_add_checkbox(), and n_gui_process_event().

◆ N_GUI_COMBOBOX_DATA

struct N_GUI_COMBOBOX_DATA

combo box specific data

Examples
ex_gui_dropmenu.c.

Definition at line 746 of file n_gui.h.

+ Collaboration diagram for N_GUI_COMBOBOX_DATA:

Data Fields

ALLEGRO_BITMAP * bg_bitmap
 optional bitmap for the combobox background (NULL = color theme)
 
int flags
 bitmask of N_GUI_COMBOBOX_* flags
 
int highlight_index
 open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).
 
int is_open
 is dropdown currently open
 
ALLEGRO_BITMAP * item_bg_bitmap
 optional bitmap for per-item background, normal state (NULL = color theme)
 
float item_height
 item height in dropdown
 
ALLEGRO_BITMAP * item_selected_bitmap
 optional bitmap for per-item background, selected/highlighted (NULL = color theme)
 
N_GUI_LISTITEMitems
 dynamic array of items
 
size_t items_capacity
 allocated capacity
 
int max_visible
 max visible items in dropdown
 
size_t nb_items
 number of items
 
void(* on_select )(int widget_id, int index, void *user_data)
 callback on selection change (widget_id, selected_index, user_data)
 
int scroll_offset
 scroll offset in dropdown
 
int selected_index
 currently selected index (-1 = none)
 
void * user_data
 user data for callback
 

Field Documentation

◆ bg_bitmap

ALLEGRO_BITMAP* N_GUI_COMBOBOX_DATA::bg_bitmap

optional bitmap for the combobox background (NULL = color theme)

Definition at line 769 of file n_gui.h.

Referenced by _draw_combobox(), _draw_combobox_dropdown(), and n_gui_combobox_set_bitmaps().

◆ flags

int N_GUI_COMBOBOX_DATA::flags

bitmask of N_GUI_COMBOBOX_* flags

Definition at line 779 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_set_flags(), and n_gui_process_event().

◆ highlight_index

int N_GUI_COMBOBOX_DATA::highlight_index

open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).

While the dropdown is open, the wheel and arrow keys move this; hovering the panel sets it to the item under the pointer; Enter or a click commits it to selected_index. Reset to -1 when the panel closes.

Examples
ex_gui_dropmenu.c.

Definition at line 763 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), main(), n_gui_add_combobox(), n_gui_combobox_clear(), and n_gui_process_event().

◆ is_open

int N_GUI_COMBOBOX_DATA::is_open

is dropdown currently open

Examples
ex_gui_dropmenu.c.

Definition at line 756 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), main(), n_gui_add_combobox(), n_gui_combobox_clear(), and n_gui_process_event().

◆ item_bg_bitmap

ALLEGRO_BITMAP* N_GUI_COMBOBOX_DATA::item_bg_bitmap

optional bitmap for per-item background, normal state (NULL = color theme)

Definition at line 771 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), and n_gui_combobox_set_bitmaps().

◆ item_height

float N_GUI_COMBOBOX_DATA::item_height

item height in dropdown

Definition at line 765 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), and n_gui_process_event().

◆ item_selected_bitmap

ALLEGRO_BITMAP* N_GUI_COMBOBOX_DATA::item_selected_bitmap

optional bitmap for per-item background, selected/highlighted (NULL = color theme)

Definition at line 773 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), and n_gui_combobox_set_bitmaps().

◆ items

◆ items_capacity

size_t N_GUI_COMBOBOX_DATA::items_capacity

allocated capacity

Definition at line 752 of file n_gui.h.

Referenced by n_gui_add_combobox(), and n_gui_combobox_add_item().

◆ max_visible

int N_GUI_COMBOBOX_DATA::max_visible

max visible items in dropdown

Examples
ex_gui_dropmenu.c.

Definition at line 767 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), main(), n_gui_add_combobox(), and n_gui_process_event().

◆ nb_items

size_t N_GUI_COMBOBOX_DATA::nb_items

◆ on_select

void(* N_GUI_COMBOBOX_DATA::on_select) (int widget_id, int index, void *user_data)

callback on selection change (widget_id, selected_index, user_data)

Definition at line 775 of file n_gui.h.

Referenced by n_gui_add_combobox(), and n_gui_process_event().

◆ scroll_offset

int N_GUI_COMBOBOX_DATA::scroll_offset

scroll offset in dropdown

Definition at line 758 of file n_gui.h.

Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_clear(), and n_gui_process_event().

◆ selected_index

int N_GUI_COMBOBOX_DATA::selected_index

◆ user_data

void* N_GUI_COMBOBOX_DATA::user_data

user data for callback

Definition at line 777 of file n_gui.h.

Referenced by n_gui_add_combobox(), and n_gui_process_event().

◆ N_GUI_CTX

struct N_GUI_CTX
+ Collaboration diagram for N_GUI_CTX:
Data Fields
ALLEGRO_DISPLAY * active_display display that last received input, used to pick the display for clipboard and mouse-cursor calls.

NULL falls back to N_GUI_CTX::display.

double anim_until deadline (al_get_time seconds) until which a transient animation is in progress (button key-press flash, tooltip reveal): n_gui_needs_redraw keeps returning non-zero until then.

0 when no timed animation is pending.

int cursor_shape system mouse cursor currently applied to the display (an ALLEGRO_SYSTEM_MOUSE_CURSOR_* value), so a horizontal-resize cursor is set over a datagrid column border and reset elsewhere without redundant calls
ALLEGRO_FONT * default_font default font (must be set before adding widgets)
N_GUI_THEME default_tb_btn_theme default theme for titlebar minimize/maximize buttons
N_GUI_THEME default_tb_close_theme default theme for titlebar close button
N_GUI_THEME default_theme default theme (applied to new widgets/windows)
int dirty non-zero when the GUI's appearance may have changed since the last n_gui_draw.

Set by widget/window creation, by input events that can change state, and by n_gui_mark_dirty; cleared at the end of n_gui_draw. Read via n_gui_needs_redraw so an event-driven host can skip drawing an unchanged, non-animating GUI. Initialised to 1 so the first frame draws.

ALLEGRO_DISPLAY * display display pointer for clipboard operations (set via n_gui_set_display)
float display_h display/viewport height
float display_w display/viewport width (set via n_gui_set_display_size)
float dpi_scale DPI scale factor (1.0 = normal, 1.25 = 125%, 2.0 = HiDPI, etc.)
ALLEGRO_EVENT_QUEUE * event_queue event queue the context registers native window event sources into (set via n_gui_set_event_queue).

Required by n_gui_window_detach.

int focused_widget_id id of the widget that currently has focus, or -1
int global_hscroll_drag 1 if global scrollbar horizontal thumb is being dragged
float global_scroll_x global horizontal scroll offset (when GUI exceeds display)
float global_scroll_y global vertical scroll offset (when GUI exceeds display)
int global_vscroll_drag 1 if global scrollbar vertical thumb is being dragged
float gui_bounds_h total bounding box height of all windows (computed internally)
float gui_bounds_w total bounding box width of all windows (computed internally)
float gui_offset_x horizontal letterbox offset for virtual canvas
float gui_offset_y vertical letterbox offset for virtual canvas
float gui_scale computed uniform scale factor for virtual canvas
int mouse_b1 mouse button 1 state
int mouse_b1_prev previous mouse button 1 state
int mouse_x mouse state tracking
int mouse_y mouse state tracking
int next_widget_id next widget id to assign
int next_window_id next window id to assign
int open_combobox_id id of the combobox whose dropdown is currently open, or -1
int open_dropmenu_id id of the dropdown menu whose panel is currently open, or -1
ALLEGRO_DISPLAY * pass_display display the pass currently being processed or drawn belongs to: NULL for the host's main display (and for the headless case), or a detached window's native display.

Internal, maintained by n_gui_process_event and n_gui_draw / n_gui_draw_detached. A window takes part in the pass when its N_GUI_WINDOW::native equals this, so with no detached window every pass is the main one and behaviour is unchanged.

N_GUI_PENDING_GEOM * pending_layout layout entries for windows that did NOT exist when the saved layout was loaded (lazily-created panels).

n_gui_add_window applies the saved (x,y) to the first window created later with a matching title, giving cross-session position restore without eager-creating every window. Owned by the ctx; freed in n_gui_destroy_ctx.

int pending_layout_count number of valid entries in pending_layout
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_persist_key applies the first matching entry (by owning window title + key) to the widget being keyed.

Owned by the ctx; freed in n_gui_destroy_ctx.

int pending_widgets_count number of valid entries in pending_widgets
int prev_over_win whether the pointer was over a window on the previous motion event, so a motion that leaves the GUI still forces one redraw to clear hover state.
float ref_display_h reference display height at the time normalized values were last captured
float ref_display_w reference display width at the time normalized values were last captured
int resize_mode context resize mode: N_GUI_RESIZE_VIRTUAL or N_GUI_RESIZE_ADAPTIVE
int scrollbar_drag_widget_id id of the widget whose scrollbar is being dragged, or -1
int selected_label_id id of the label widget with the most recent text selection, or -1
int selected_syntaxview_id id of the syntax-view widget with the most recent text selection, or -1
N_GUI_STYLE style configurable style (sizes, colours, paddings)
int tooltip_anchor_x pointer x when the tooltip was last armed (movement re-arms)
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()
int tooltip_widget_id widget the pointer is resting on for tooltip purposes (-1 = none)
float virtual_h virtual canvas height (0 = disabled / identity transform)
float virtual_w virtual canvas width (0 = disabled / identity transform)
HASH_TABLE * widgets_by_id hash table for fast widget lookup by id
LIST * windows ordered list of N_GUI_WINDOW* (back to front)

◆ N_GUI_CUSTOM_DATA

struct N_GUI_CUSTOM_DATA

Owner-draw custom widget data: a paint callback plus its user pointer.

Definition at line 937 of file n_gui.h.

+ Collaboration diagram for N_GUI_CUSTOM_DATA:
Data Fields
N_GUI_CUSTOM_DRAW draw paint callback invoked during n_gui_draw (NULL = draw nothing)
void * user_data opaque user pointer handed back to the callback (not owned by n_gui)

◆ N_GUI_DATAGRID_COL

struct N_GUI_DATAGRID_COL

one data grid column definition

Definition at line 639 of file n_gui.h.

+ Collaboration diagram for N_GUI_DATAGRID_COL:
Data Fields
char title[128] column header title
int visible 1 = drawn, 0 = hidden (kept in storage, skipped in the header and rows)
float width column width in pixels

◆ N_GUI_DATAGRID_DATA

struct N_GUI_DATAGRID_DATA

data grid specific data: a sortable column table

Definition at line 649 of file n_gui.h.

+ Collaboration diagram for N_GUI_DATAGRID_DATA:

Data Fields

int anchor_row
 anchor row for Shift-click range selection, or -1
 
char ** cells
 row-major cell strings (nb_rows * nb_cols owned char*)
 
size_t * col_order
 display order: display_pos -> physical column index (sized cols_cap), or NULL when the display order is still the identity
 
int col_resize_col
 physical column being resized by a header-border drag, or -1
 
float col_resize_w0
 original width of the column at the start of a resize drag
 
float col_resize_x0
 cursor x at the start of a column-resize drag
 
N_GUI_DATAGRID_COLcols
 column definitions (physical/storage order; cells are indexed by these)
 
size_t cols_cap
 allocated column capacity
 
float h_scroll
 horizontal scroll offset in pixels: how far the columns are scrolled to the left when their total width exceeds the widget's pane.
 
int h_scroll_dragging
 1 while the user is dragging the horizontal scrollbar thumb (so the shared scrollbar-drag handler routes the drag to h_scroll, not the vertical scroll).
 
int multiselect
 1 = multi-row selection enabled (Ctrl/Shift-click), 0 = single-select
 
size_t nb_cols
 number of columns
 
size_t nb_rows
 number of rows
 
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, user_data), so the host can persist the new layout.
 
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, user_data); x/y are the cursor position in GUI coordinates so the caller can place a popup there.
 
void(* on_select )(int widget_id, int row, void *user_data)
 callback on row selection (widget_id, row, user_data)
 
ALLEGRO_COLOR * row_color
 per-row background tint, sized rows_cap; NULL until a row color is set
 
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
 
unsigned char * row_sel
 per-row selection flags (1 = selected), sized rows_cap; NULL until needed
 
size_t rows_cap
 allocated row capacity (in rows)
 
int scroll_offset
 first visible data row
 
int selected_row
 selected data row (the primary / last-clicked row), or -1
 
int sort_col
 column index used for sorting, or -1
 
int sort_dir
 sort direction: 1 ascending, -1 descending
 
void * user_data
 user data for callback
 

Field Documentation

◆ anchor_row

int N_GUI_DATAGRID_DATA::anchor_row

◆ cells

char** N_GUI_DATAGRID_DATA::cells

row-major cell strings (nb_rows * nb_cols owned char*)

Definition at line 670 of file n_gui.h.

Referenced by _destroy_widget(), _draw_datagrid(), n_gui_add_datagrid(), n_gui_datagrid_add_row(), n_gui_datagrid_clear_rows(), n_gui_datagrid_get_cell(), and n_gui_datagrid_sort().

◆ col_order

size_t* N_GUI_DATAGRID_DATA::col_order

display order: display_pos -> physical column index (sized cols_cap), or NULL when the display order is still the identity

Definition at line 658 of file n_gui.h.

Referenced by _datagrid_phys(), _destroy_widget(), n_gui_add_datagrid(), n_gui_datagrid_add_column(), and n_gui_datagrid_move_column().

◆ col_resize_col

int N_GUI_DATAGRID_DATA::col_resize_col

physical column being resized by a header-border drag, or -1

Definition at line 660 of file n_gui.h.

Referenced by n_gui_add_datagrid(), and n_gui_process_event().

◆ col_resize_w0

float N_GUI_DATAGRID_DATA::col_resize_w0

original width of the column at the start of a resize drag

Definition at line 664 of file n_gui.h.

Referenced by n_gui_add_datagrid(), and n_gui_process_event().

◆ col_resize_x0

float N_GUI_DATAGRID_DATA::col_resize_x0

cursor x at the start of a column-resize drag

Definition at line 662 of file n_gui.h.

Referenced by n_gui_add_datagrid(), and n_gui_process_event().

◆ cols

◆ cols_cap

size_t N_GUI_DATAGRID_DATA::cols_cap

allocated column capacity

Definition at line 655 of file n_gui.h.

Referenced by n_gui_add_datagrid(), and n_gui_datagrid_add_column().

◆ h_scroll

float N_GUI_DATAGRID_DATA::h_scroll

horizontal scroll offset in pixels: how far the columns are scrolled to the left when their total width exceeds the widget's pane.

0 = leftmost.

Definition at line 696 of file n_gui.h.

Referenced by _datagrid_resize_hover(), _draw_datagrid(), n_gui_add_datagrid(), and n_gui_process_event().

◆ h_scroll_dragging

int N_GUI_DATAGRID_DATA::h_scroll_dragging

1 while the user is dragging the horizontal scrollbar thumb (so the shared scrollbar-drag handler routes the drag to h_scroll, not the vertical scroll).

Definition at line 699 of file n_gui.h.

Referenced by n_gui_add_datagrid(), and n_gui_process_event().

◆ multiselect

int N_GUI_DATAGRID_DATA::multiselect

1 = multi-row selection enabled (Ctrl/Shift-click), 0 = single-select

Definition at line 682 of file n_gui.h.

Referenced by _draw_datagrid(), n_gui_add_datagrid(), n_gui_datagrid_get_selected_rows(), n_gui_datagrid_is_row_selected(), n_gui_datagrid_set_multiselect(), and n_gui_process_event().

◆ nb_cols

◆ nb_rows

◆ on_columns_changed

void(* N_GUI_DATAGRID_DATA::on_columns_changed) (int widget_id, void *user_data)

callback fired after the user resizes a column by dragging its header border (widget_id, user_data), so the host can persist the new layout.

NULL disables it.

Definition at line 668 of file n_gui.h.

Referenced by n_gui_add_datagrid(), n_gui_datagrid_set_on_columns_changed(), and n_gui_process_event().

◆ on_context

void(* N_GUI_DATAGRID_DATA::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, user_data); x/y are the cursor position in GUI coordinates so the caller can place a popup there.

NULL disables it.

Definition at line 705 of file n_gui.h.

Referenced by n_gui_add_datagrid(), and n_gui_process_event().

◆ on_select

void(* N_GUI_DATAGRID_DATA::on_select) (int widget_id, int row, void *user_data)

callback on row selection (widget_id, row, user_data)

Definition at line 701 of file n_gui.h.

Referenced by n_gui_add_datagrid(), n_gui_datagrid_set_selected(), and n_gui_process_event().

◆ row_color

ALLEGRO_COLOR* N_GUI_DATAGRID_DATA::row_color

per-row background tint, sized rows_cap; NULL until a row color is set

Definition at line 688 of file n_gui.h.

Referenced by _datagrid_ensure_colors(), _destroy_widget(), _draw_datagrid(), n_gui_add_datagrid(), n_gui_datagrid_add_row(), n_gui_datagrid_get_row_color(), n_gui_datagrid_set_row_color(), and n_gui_datagrid_sort().

◆ row_has_color

unsigned char* N_GUI_DATAGRID_DATA::row_has_color

◆ row_sel

◆ rows_cap

◆ scroll_offset

int N_GUI_DATAGRID_DATA::scroll_offset

◆ selected_row

◆ sort_col

int N_GUI_DATAGRID_DATA::sort_col

column index used for sorting, or -1

Definition at line 676 of file n_gui.h.

Referenced by _draw_datagrid(), n_gui_add_datagrid(), n_gui_datagrid_sort(), and n_gui_process_event().

◆ sort_dir

int N_GUI_DATAGRID_DATA::sort_dir

sort direction: 1 ascending, -1 descending

Definition at line 678 of file n_gui.h.

Referenced by _draw_datagrid(), n_gui_add_datagrid(), n_gui_datagrid_sort(), and n_gui_process_event().

◆ user_data

void* N_GUI_DATAGRID_DATA::user_data

user data for callback

Definition at line 707 of file n_gui.h.

Referenced by n_gui_add_datagrid(), n_gui_datagrid_set_selected(), and n_gui_process_event().

◆ N_GUI_DROPMENU_DATA

struct N_GUI_DROPMENU_DATA

dropdown menu specific data

Examples
ex_gui_dropmenu.c.

Definition at line 843 of file n_gui.h.

+ Collaboration diagram for N_GUI_DROPMENU_DATA:

Data Fields

N_GUI_DROPMENU_ENTRYentries
 dynamic array of entries
 
size_t entries_capacity
 allocated capacity
 
int flags
 bitmask of N_GUI_DROPMENU_* flags
 
int highlight_index
 open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).
 
int is_open
 is the menu currently open
 
float item_height
 item height
 
ALLEGRO_BITMAP * item_hover_bitmap
 optional bitmap for the hovered entry background (NULL = color theme)
 
char label [128]
 menu label (shown on the button)
 
int max_visible
 max visible items
 
size_t nb_entries
 number of entries
 
void(* on_open )(int widget_id, void *user_data)
 callback to rebuild dynamic entries each time the menu is opened.
 
void * on_open_user_data
 user data for on_open callback
 
ALLEGRO_BITMAP * panel_bitmap
 optional bitmap for the dropdown panel background (NULL = color theme)
 
int scroll_offset
 scroll offset
 

Field Documentation

◆ entries

◆ entries_capacity

size_t N_GUI_DROPMENU_DATA::entries_capacity

allocated capacity

Definition at line 851 of file n_gui.h.

Referenced by n_gui_add_dropmenu(), and n_gui_dropmenu_add_entry().

◆ flags

int N_GUI_DROPMENU_DATA::flags

bitmask of N_GUI_DROPMENU_* flags

Definition at line 876 of file n_gui.h.

Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), n_gui_dropmenu_set_flags(), and n_gui_process_event().

◆ highlight_index

int N_GUI_DROPMENU_DATA::highlight_index

open-panel navigation cursor for the wheel and Up/Down keys (-1 = none).

While the menu is open, the wheel and arrow keys move this; hovering the panel sets it to the entry under the pointer; Enter or a click activates it. Reset to -1 when the panel closes.

Examples
ex_gui_dropmenu.c.

Definition at line 860 of file n_gui.h.

Referenced by _draw_dropmenu_panel(), main(), n_gui_add_dropmenu(), and n_gui_process_event().

◆ is_open

int N_GUI_DROPMENU_DATA::is_open

is the menu currently open

Examples
ex_gui_dropmenu.c.

Definition at line 853 of file n_gui.h.

Referenced by _draw_dropmenu(), _draw_dropmenu_panel(), main(), n_gui_add_dropmenu(), and n_gui_process_event().

◆ item_height

float N_GUI_DROPMENU_DATA::item_height

item height

Definition at line 864 of file n_gui.h.

Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), and n_gui_process_event().

◆ item_hover_bitmap

ALLEGRO_BITMAP* N_GUI_DROPMENU_DATA::item_hover_bitmap

optional bitmap for the hovered entry background (NULL = color theme)

Definition at line 868 of file n_gui.h.

Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), and n_gui_dropmenu_set_bitmaps().

◆ label

char N_GUI_DROPMENU_DATA::label[128]

menu label (shown on the button)

Definition at line 845 of file n_gui.h.

Referenced by _draw_dropmenu(), n_gui_add_dropmenu(), and n_gui_dropmenu_set_label().

◆ max_visible

int N_GUI_DROPMENU_DATA::max_visible

◆ nb_entries

◆ on_open

void(* N_GUI_DROPMENU_DATA::on_open) (int widget_id, void *user_data)

callback to rebuild dynamic entries each time the menu is opened.

signature: void rebuild(int widget_id, void* user_data) The callback should call n_gui_dropmenu_clear_dynamic() then add dynamic entries.

Definition at line 872 of file n_gui.h.

Referenced by n_gui_add_dropmenu(), and n_gui_process_event().

◆ on_open_user_data

void* N_GUI_DROPMENU_DATA::on_open_user_data

user data for on_open callback

Definition at line 874 of file n_gui.h.

Referenced by n_gui_add_dropmenu(), and n_gui_process_event().

◆ panel_bitmap

ALLEGRO_BITMAP* N_GUI_DROPMENU_DATA::panel_bitmap

optional bitmap for the dropdown panel background (NULL = color theme)

Definition at line 866 of file n_gui.h.

Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), and n_gui_dropmenu_set_bitmaps().

◆ scroll_offset

int N_GUI_DROPMENU_DATA::scroll_offset

◆ N_GUI_DROPMENU_ENTRY

struct N_GUI_DROPMENU_ENTRY

A single entry in a dropdown menu (static or dynamic)

Definition at line 823 of file n_gui.h.

+ Collaboration diagram for N_GUI_DROPMENU_ENTRY:

Data Fields

int is_dynamic
 is this entry dynamic (rebuilt via callback each time menu opens)
 
void(* on_click )(int widget_id, int entry_index, int tag, void *user_data)
 callback when this entry is clicked (widget_id, entry_index, tag, user_data)
 
int tag
 user-defined tag for the entry (e.g.
 
char text [128]
 display text
 
void * user_data
 user data for callback
 

Field Documentation

◆ is_dynamic

int N_GUI_DROPMENU_ENTRY::is_dynamic

is this entry dynamic (rebuilt via callback each time menu opens)

Definition at line 827 of file n_gui.h.

Referenced by n_gui_dropmenu_add_dynamic_entry(), n_gui_dropmenu_add_entry(), and n_gui_dropmenu_clear_dynamic().

◆ on_click

void(* N_GUI_DROPMENU_ENTRY::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)

Definition at line 831 of file n_gui.h.

Referenced by n_gui_dropmenu_add_entry(), and n_gui_process_event().

◆ tag

int N_GUI_DROPMENU_ENTRY::tag

user-defined tag for the entry (e.g.

a window id)

Definition at line 829 of file n_gui.h.

Referenced by n_gui_dropmenu_add_entry(), and n_gui_process_event().

◆ text

char N_GUI_DROPMENU_ENTRY::text[128]

◆ user_data

void* N_GUI_DROPMENU_ENTRY::user_data

user data for callback

Definition at line 833 of file n_gui.h.

Referenced by n_gui_dropmenu_add_entry(), and n_gui_process_event().

◆ N_GUI_HEXVIEW_DATA

struct N_GUI_HEXVIEW_DATA

hex viewer specific data: a read-only byte dump

Definition at line 601 of file n_gui.h.

+ Collaboration diagram for N_GUI_HEXVIEW_DATA:
Data Fields
int bytes_per_row bytes shown per row
unsigned char * data owned copy of the bytes, or NULL
size_t len number of bytes
int scroll_offset first visible row

◆ N_GUI_IMAGE_DATA

struct N_GUI_IMAGE_DATA

image widget specific data

Definition at line 783 of file n_gui.h.

+ Collaboration diagram for N_GUI_IMAGE_DATA:
Data Fields
ALLEGRO_BITMAP * bitmap bitmap to display (not owned, not freed)
int scale_mode scale mode: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, N_GUI_IMAGE_CENTER

◆ N_GUI_KV_ROW

struct N_GUI_KV_ROW

a single row in the KV table

Definition at line 2552 of file n_gui.h.

+ Collaboration diagram for N_GUI_KV_ROW:
Data Fields
int active 1 if active, 0 if removed
int desc_id textarea widget ID for the description
int enabled_id checkbox widget ID for the enabled toggle
int key_id textarea widget ID for the key
int remove_id button widget ID for the remove action
int value_id textarea widget ID for the value

◆ N_GUI_KVTABLE

struct N_GUI_KVTABLE

key-value table built from textareas, checkboxes, and buttons

Examples
ex_gui_kvtable.c.

Definition at line 2562 of file n_gui.h.

+ Collaboration diagram for N_GUI_KVTABLE:

Data Fields

int btn_add
 button widget ID for "+" add row
 
N_GUI_CTXctx
 GUI context.
 
float header_height
 unscaled column-header row height
 
float init_win_h
 parent window height at create time
 
float init_win_w
 parent window width at create time
 
char * key_placeholder
 owned hint shown in each key textarea, or NULL
 
int lbl_desc
 label widget ID for "Description" header
 
int lbl_enabled
 label widget ID for "On" header
 
int lbl_key
 label widget ID for "Key" header
 
int lbl_value
 label widget ID for "Value" header
 
int nb_active
 active row count
 
int nb_rows
 total rows (including removed)
 
void(* on_remove )(int, void *)
 callback on row removal
 
float padding
 unscaled padding in pixels
 
float row_height
 unscaled row height in pixels
 
N_GUI_KV_ROW rows [128]
 row storage
 
int show_desc
 1 to show the Description column (default 1)
 
int show_enabled
 1 to show the enabled-checkbox column (default 1)
 
int show_value
 1 to show the Value column (default 1)
 
float top_offset
 unscaled y offset of the header row from the window top (default 0), to reserve space above the table for other widgets
 
void * user_data
 user data for callback
 
char * value_placeholder
 owned hint shown in each value textarea, or NULL
 
int window_id
 parent window
 

Field Documentation

◆ btn_add

int N_GUI_KVTABLE::btn_add

button widget ID for "+" add row

Examples
ex_gui_kvtable.c.

Definition at line 2577 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), main(), and n_gui_kvtable_create().

◆ ctx

◆ header_height

float N_GUI_KVTABLE::header_height

unscaled column-header row height

Definition at line 2570 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), and n_gui_kvtable_create().

◆ init_win_h

float N_GUI_KVTABLE::init_win_h

parent window height at create time

Definition at line 2572 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), and n_gui_kvtable_create().

◆ init_win_w

float N_GUI_KVTABLE::init_win_w

parent window width at create time

Definition at line 2571 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), and n_gui_kvtable_create().

◆ key_placeholder

char* N_GUI_KVTABLE::key_placeholder

owned hint shown in each key textarea, or NULL

Definition at line 2583 of file n_gui.h.

Referenced by n_gui_kvtable_add_row(), n_gui_kvtable_create(), and n_gui_kvtable_set_placeholders().

◆ lbl_desc

int N_GUI_KVTABLE::lbl_desc

label widget ID for "Description" header

Definition at line 2575 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), and n_gui_kvtable_create().

◆ lbl_enabled

int N_GUI_KVTABLE::lbl_enabled

label widget ID for "On" header

Definition at line 2576 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), and n_gui_kvtable_create().

◆ lbl_key

int N_GUI_KVTABLE::lbl_key

label widget ID for "Key" header

Examples
ex_gui_kvtable.c.

Definition at line 2573 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), main(), and n_gui_kvtable_create().

◆ lbl_value

int N_GUI_KVTABLE::lbl_value

label widget ID for "Value" header

Examples
ex_gui_kvtable.c.

Definition at line 2574 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), main(), and n_gui_kvtable_create().

◆ nb_active

int N_GUI_KVTABLE::nb_active

◆ nb_rows

◆ on_remove

void(* N_GUI_KVTABLE::on_remove) (int, void *)

callback on row removal

Definition at line 2578 of file n_gui.h.

Referenced by _n_gui_kv_remove_clicked(), and n_gui_kvtable_create().

◆ padding

float N_GUI_KVTABLE::padding

unscaled padding in pixels

Definition at line 2569 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().

◆ row_height

float N_GUI_KVTABLE::row_height

unscaled row height in pixels

Definition at line 2568 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().

◆ rows

◆ show_desc

int N_GUI_KVTABLE::show_desc

1 to show the Description column (default 1)

Definition at line 2581 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_create(), and n_gui_kvtable_set_columns().

◆ show_enabled

int N_GUI_KVTABLE::show_enabled

1 to show the enabled-checkbox column (default 1)

Definition at line 2582 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_create(), and n_gui_kvtable_set_columns().

◆ show_value

int N_GUI_KVTABLE::show_value

1 to show the Value column (default 1)

Definition at line 2580 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_create(), and n_gui_kvtable_set_columns().

◆ top_offset

float N_GUI_KVTABLE::top_offset

unscaled y offset of the header row from the window top (default 0), to reserve space above the table for other widgets

Definition at line 2585 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_create(), and n_gui_kvtable_set_top_offset().

◆ user_data

void* N_GUI_KVTABLE::user_data

user data for callback

Definition at line 2579 of file n_gui.h.

Referenced by _n_gui_kv_remove_clicked(), and n_gui_kvtable_create().

◆ value_placeholder

char* N_GUI_KVTABLE::value_placeholder

owned hint shown in each value textarea, or NULL

Definition at line 2584 of file n_gui.h.

Referenced by n_gui_kvtable_add_row(), n_gui_kvtable_create(), and n_gui_kvtable_set_placeholders().

◆ window_id

int N_GUI_KVTABLE::window_id

parent window

Definition at line 2564 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().

◆ N_GUI_LABEL_DATA

struct N_GUI_LABEL_DATA

static text label specific data

Definition at line 791 of file n_gui.h.

+ Collaboration diagram for N_GUI_LABEL_DATA:

Data Fields

int align
 text alignment: N_GUI_ALIGN_LEFT, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_RIGHT
 
ALLEGRO_BITMAP * bg_bitmap
 optional bitmap for the label background (NULL = no background)
 
char link [4096]
 optional hyperlink URL (empty string = no link)
 
void(* on_link_click )(int widget_id, const char *link, void *user_data)
 callback when link is clicked (widget_id, link_url, user_data)
 
float scroll_y
 vertical scroll offset for overflowing text (pixels)
 
int sel_dragging
 1 if mouse is actively dragging to select text
 
int sel_end
 selection end byte offset (-1 = no selection)
 
int sel_start
 selection start byte offset (-1 = no selection)
 
char text [4096]
 text to display
 
void * user_data
 user data for callback
 

Field Documentation

◆ align

int N_GUI_LABEL_DATA::align

text alignment: N_GUI_ALIGN_LEFT, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_RIGHT

Definition at line 797 of file n_gui.h.

Referenced by _draw_label(), _label_text_origin_x(), _window_update_content_size(), n_gui_add_label(), and n_gui_process_event().

◆ bg_bitmap

ALLEGRO_BITMAP* N_GUI_LABEL_DATA::bg_bitmap

optional bitmap for the label background (NULL = no background)

Definition at line 807 of file n_gui.h.

Referenced by _draw_label().

◆ link

char N_GUI_LABEL_DATA::link[4096]

optional hyperlink URL (empty string = no link)

Definition at line 795 of file n_gui.h.

Referenced by _draw_label(), n_gui_add_label(), n_gui_add_label_link(), n_gui_label_set_link(), and n_gui_process_event().

◆ on_link_click

void(* N_GUI_LABEL_DATA::on_link_click) (int widget_id, const char *link, void *user_data)

callback when link is clicked (widget_id, link_url, user_data)

Definition at line 809 of file n_gui.h.

Referenced by n_gui_add_label(), n_gui_add_label_link(), and n_gui_process_event().

◆ scroll_y

float N_GUI_LABEL_DATA::scroll_y

vertical scroll offset for overflowing text (pixels)

Definition at line 799 of file n_gui.h.

Referenced by _draw_label(), n_gui_add_label(), and n_gui_process_event().

◆ sel_dragging

int N_GUI_LABEL_DATA::sel_dragging

1 if mouse is actively dragging to select text

Definition at line 805 of file n_gui.h.

Referenced by n_gui_add_label(), and n_gui_process_event().

◆ sel_end

int N_GUI_LABEL_DATA::sel_end

selection end byte offset (-1 = no selection)

Definition at line 803 of file n_gui.h.

Referenced by _draw_label(), _ngui_publish_primary_selection(), n_gui_add_label(), and n_gui_process_event().

◆ sel_start

int N_GUI_LABEL_DATA::sel_start

selection start byte offset (-1 = no selection)

Definition at line 801 of file n_gui.h.

Referenced by _draw_label(), _ngui_publish_primary_selection(), n_gui_add_label(), and n_gui_process_event().

◆ text

◆ user_data

void* N_GUI_LABEL_DATA::user_data

user data for callback

Definition at line 811 of file n_gui.h.

Referenced by n_gui_add_label(), n_gui_add_label_link(), and n_gui_process_event().

◆ N_GUI_LISTBOX_DATA

struct N_GUI_LISTBOX_DATA

listbox specific data

Definition at line 553 of file n_gui.h.

+ Collaboration diagram for N_GUI_LISTBOX_DATA:

Data Fields

ALLEGRO_BITMAP * bg_bitmap
 optional bitmap for the listbox background (NULL = color theme)
 
int hover_row
 index of the row the mouse is currently over, or -1.
 
ALLEGRO_BITMAP * item_bg_bitmap
 optional bitmap for per-item background, normal state (NULL = color theme)
 
float item_height
 item height in pixels
 
ALLEGRO_BITMAP * item_selected_bitmap
 optional bitmap for per-item background, selected/highlighted (NULL = color theme)
 
N_GUI_LISTITEMitems
 dynamic array of items
 
size_t items_capacity
 allocated capacity
 
size_t nb_items
 number of items
 
void(* on_select )(int widget_id, int index, int selected, void *user_data)
 callback on selection change (widget_id, item_index, selected, user_data)
 
int scroll_offset
 scroll offset in items
 
int selection_mode
 selection mode: N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, N_GUI_SELECT_MULTIPLE
 
void * user_data
 user data for callback
 

Field Documentation

◆ bg_bitmap

ALLEGRO_BITMAP* N_GUI_LISTBOX_DATA::bg_bitmap

optional bitmap for the listbox background (NULL = color theme)

Definition at line 567 of file n_gui.h.

Referenced by _draw_listbox(), and n_gui_listbox_set_bitmaps().

◆ hover_row

int N_GUI_LISTBOX_DATA::hover_row

index of the row the mouse is currently over, or -1.

Updated in the event loop when the widget gains N_GUI_STATE_HOVER; consumed by the draw path to paint a hover highlight.

Definition at line 579 of file n_gui.h.

Referenced by _draw_listbox(), n_gui_add_listbox(), and n_gui_process_event().

◆ item_bg_bitmap

ALLEGRO_BITMAP* N_GUI_LISTBOX_DATA::item_bg_bitmap

optional bitmap for per-item background, normal state (NULL = color theme)

Definition at line 569 of file n_gui.h.

Referenced by _draw_listbox(), and n_gui_listbox_set_bitmaps().

◆ item_height

float N_GUI_LISTBOX_DATA::item_height

◆ item_selected_bitmap

ALLEGRO_BITMAP* N_GUI_LISTBOX_DATA::item_selected_bitmap

optional bitmap for per-item background, selected/highlighted (NULL = color theme)

Definition at line 571 of file n_gui.h.

Referenced by _draw_listbox(), and n_gui_listbox_set_bitmaps().

◆ items

◆ items_capacity

size_t N_GUI_LISTBOX_DATA::items_capacity

allocated capacity

Definition at line 559 of file n_gui.h.

Referenced by n_gui_add_listbox(), and n_gui_listbox_add_item().

◆ nb_items

◆ on_select

void(* N_GUI_LISTBOX_DATA::on_select) (int widget_id, int index, int selected, void *user_data)

callback on selection change (widget_id, item_index, selected, user_data)

Definition at line 573 of file n_gui.h.

Referenced by n_gui_add_listbox(), and n_gui_process_event().

◆ scroll_offset

◆ selection_mode

int N_GUI_LISTBOX_DATA::selection_mode

selection mode: N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, N_GUI_SELECT_MULTIPLE

Definition at line 561 of file n_gui.h.

Referenced by n_gui_add_listbox(), n_gui_listbox_set_selected(), and n_gui_process_event().

◆ user_data

void* N_GUI_LISTBOX_DATA::user_data

user data for callback

Definition at line 575 of file n_gui.h.

Referenced by n_gui_add_listbox(), and n_gui_process_event().

◆ N_GUI_LISTITEM

struct N_GUI_LISTITEM

a single item in a list/radio/combo widget

Definition at line 545 of file n_gui.h.

+ Collaboration diagram for N_GUI_LISTITEM:
Data Fields
int selected selection state (for listbox)
char text[128] item display text

◆ N_GUI_PENDING_GEOM

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).

Applied on first matching create.

Definition at line 1324 of file n_gui.h.

+ Collaboration diagram for N_GUI_PENDING_GEOM:
Data Fields
unsigned char consumed 1 once applied to a created window
float h saved height (display-scaled), 0 when absent
int state saved minimised/maximised bits, applied on create
char title[128] window title to match on
float w saved width (display-scaled), 0 when absent
float x saved x (already display-scaled)
float y saved y

◆ N_GUI_PENDING_WIDGET

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).

Applied on the first n_gui_widget_set_persist_key that matches the owning window title + key (consume-once), the widget-level analog of N_GUI_PENDING_GEOM.

Definition at line 1341 of file n_gui.h.

+ Collaboration diagram for N_GUI_PENDING_WIDGET:
Data Fields
unsigned char consumed 1 once applied
char key[128] widget persist key to match on
int kind N_GUI_TYPE_SPLITPANE or N_GUI_TYPE_DATAGRID.
int ncols column count (kind == DATAGRID)
int order[64] display position -> physical column
float ratio divider ratio (kind == SPLITPANE)
char title[128] owning window title to match on
int visible[64] per-physical-column visibility
float width[64] per-physical-column width

◆ N_GUI_PROGRESSBAR_DATA

struct N_GUI_PROGRESSBAR_DATA

Progress-bar widget data (display only).

Definition at line 815 of file n_gui.h.

+ Collaboration diagram for N_GUI_PROGRESSBAR_DATA:
Data Fields
char text[4096] optional centered overlay text (empty string = none)
float value progress fraction, clamped to 0.0 .

. 1.0

◆ N_GUI_RADIOLIST_DATA

struct N_GUI_RADIOLIST_DATA

radio list specific data

Definition at line 711 of file n_gui.h.

+ Collaboration diagram for N_GUI_RADIOLIST_DATA:

Data Fields

ALLEGRO_BITMAP * bg_bitmap
 optional bitmap for the radiolist background (NULL = color theme)
 
ALLEGRO_BITMAP * item_bg_bitmap
 optional bitmap for per-item background, normal state (NULL = color theme)
 
float item_height
 item height in pixels
 
ALLEGRO_BITMAP * item_selected_bitmap
 optional bitmap for per-item background, selected/highlighted (NULL = color theme)
 
N_GUI_LISTITEMitems
 dynamic array of items
 
size_t items_capacity
 allocated capacity
 
size_t nb_items
 number of items
 
void(* on_select )(int widget_id, int index, void *user_data)
 callback on selection change (widget_id, selected_index, user_data)
 
int scroll_offset
 scroll offset in items
 
int selected_index
 currently selected index (-1 = none)
 
void * user_data
 user data for callback
 

Field Documentation

◆ bg_bitmap

ALLEGRO_BITMAP* N_GUI_RADIOLIST_DATA::bg_bitmap

optional bitmap for the radiolist background (NULL = color theme)

Definition at line 725 of file n_gui.h.

Referenced by _draw_radiolist(), and n_gui_radiolist_set_bitmaps().

◆ item_bg_bitmap

ALLEGRO_BITMAP* N_GUI_RADIOLIST_DATA::item_bg_bitmap

optional bitmap for per-item background, normal state (NULL = color theme)

Definition at line 727 of file n_gui.h.

Referenced by _draw_radiolist(), and n_gui_radiolist_set_bitmaps().

◆ item_height

float N_GUI_RADIOLIST_DATA::item_height

item height in pixels

Definition at line 723 of file n_gui.h.

Referenced by _draw_radiolist(), n_gui_add_radiolist(), and n_gui_process_event().

◆ item_selected_bitmap

ALLEGRO_BITMAP* N_GUI_RADIOLIST_DATA::item_selected_bitmap

optional bitmap for per-item background, selected/highlighted (NULL = color theme)

Definition at line 729 of file n_gui.h.

Referenced by _draw_radiolist(), and n_gui_radiolist_set_bitmaps().

◆ items

N_GUI_LISTITEM* N_GUI_RADIOLIST_DATA::items

dynamic array of items

Definition at line 713 of file n_gui.h.

Referenced by _destroy_widget(), _draw_radiolist(), n_gui_add_radiolist(), and n_gui_radiolist_add_item().

◆ items_capacity

size_t N_GUI_RADIOLIST_DATA::items_capacity

allocated capacity

Definition at line 717 of file n_gui.h.

Referenced by n_gui_add_radiolist(), and n_gui_radiolist_add_item().

◆ nb_items

size_t N_GUI_RADIOLIST_DATA::nb_items

◆ on_select

void(* N_GUI_RADIOLIST_DATA::on_select) (int widget_id, int index, void *user_data)

callback on selection change (widget_id, selected_index, user_data)

Definition at line 731 of file n_gui.h.

Referenced by n_gui_add_radiolist(), and n_gui_process_event().

◆ scroll_offset

int N_GUI_RADIOLIST_DATA::scroll_offset

scroll offset in items

Definition at line 721 of file n_gui.h.

Referenced by _draw_radiolist(), n_gui_add_radiolist(), n_gui_process_event(), and n_gui_radiolist_clear().

◆ selected_index

int N_GUI_RADIOLIST_DATA::selected_index

currently selected index (-1 = none)

Definition at line 719 of file n_gui.h.

Referenced by _draw_radiolist(), n_gui_add_radiolist(), n_gui_process_event(), n_gui_radiolist_clear(), and n_gui_radiolist_set_selected().

◆ user_data

void* N_GUI_RADIOLIST_DATA::user_data

user data for callback

Definition at line 733 of file n_gui.h.

Referenced by n_gui_add_radiolist(), and n_gui_process_event().

◆ N_GUI_SCROLLBAR_DATA

struct N_GUI_SCROLLBAR_DATA

scrollbar specific data

Definition at line 519 of file n_gui.h.

+ Collaboration diagram for N_GUI_SCROLLBAR_DATA:

Data Fields

double content_size
 total content size
 
void(* on_scroll )(int widget_id, double scroll_pos, void *user_data)
 callback on scroll
 
int orientation
 orientation: N_GUI_SCROLLBAR_H or N_GUI_SCROLLBAR_V
 
double scroll_pos
 current scroll position
 
int shape
 shape type: N_GUI_SHAPE_RECT or N_GUI_SHAPE_ROUNDED
 
ALLEGRO_BITMAP * thumb_active_bitmap
 optional bitmap for the thumb while dragging (NULL = fallback to thumb_bitmap)
 
ALLEGRO_BITMAP * thumb_bitmap
 optional bitmap for the thumb/handle, normal state (NULL = color theme)
 
ALLEGRO_BITMAP * thumb_hover_bitmap
 optional bitmap for the thumb on hover (NULL = fallback to thumb_bitmap)
 
ALLEGRO_BITMAP * track_bitmap
 optional bitmap for the scrollbar track background (NULL = color theme)
 
void * user_data
 user data for callback
 
double viewport_size
 visible viewport size
 

Field Documentation

◆ content_size

double N_GUI_SCROLLBAR_DATA::content_size

◆ on_scroll

void(* N_GUI_SCROLLBAR_DATA::on_scroll) (int widget_id, double scroll_pos, void *user_data)

callback on scroll

Definition at line 539 of file n_gui.h.

Referenced by _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), and n_gui_process_event().

◆ orientation

int N_GUI_SCROLLBAR_DATA::orientation

orientation: N_GUI_SCROLLBAR_H or N_GUI_SCROLLBAR_V

Definition at line 521 of file n_gui.h.

Referenced by _draw_scrollbar(), _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), and n_gui_process_event().

◆ scroll_pos

double N_GUI_SCROLLBAR_DATA::scroll_pos

◆ shape

int N_GUI_SCROLLBAR_DATA::shape

shape type: N_GUI_SHAPE_RECT or N_GUI_SHAPE_ROUNDED

Definition at line 529 of file n_gui.h.

Referenced by _draw_scrollbar(), and n_gui_add_scrollbar().

◆ thumb_active_bitmap

ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::thumb_active_bitmap

optional bitmap for the thumb while dragging (NULL = fallback to thumb_bitmap)

Definition at line 537 of file n_gui.h.

Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().

◆ thumb_bitmap

ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::thumb_bitmap

optional bitmap for the thumb/handle, normal state (NULL = color theme)

Definition at line 533 of file n_gui.h.

Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().

◆ thumb_hover_bitmap

ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::thumb_hover_bitmap

optional bitmap for the thumb on hover (NULL = fallback to thumb_bitmap)

Definition at line 535 of file n_gui.h.

Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().

◆ track_bitmap

ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::track_bitmap

optional bitmap for the scrollbar track background (NULL = color theme)

Definition at line 531 of file n_gui.h.

Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().

◆ user_data

void* N_GUI_SCROLLBAR_DATA::user_data

user data for callback

Definition at line 541 of file n_gui.h.

Referenced by _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), and n_gui_process_event().

◆ viewport_size

double N_GUI_SCROLLBAR_DATA::viewport_size

◆ N_GUI_SECTION

struct N_GUI_SECTION

a single foldable section: a clickable header plus the member widgets it shows/hides

Definition at line 2401 of file n_gui.h.

+ Collaboration diagram for N_GUI_SECTION:
Data Fields
int folded 1 = collapsed (members hidden), 0 = expanded
int header_id clickable header button widget id
float natural_h stacked height of the members when expanded
int nb_widgets number of member widgets
char title[64] section title (header label minus the fold glyph)
float widget_dy[48] each member's y offset from the section content top, captured at add time
int widget_ids[48] member widget ids

◆ N_GUI_SECTIONLIST

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

Definition at line 2414 of file n_gui.h.

+ Collaboration diagram for N_GUI_SECTIONLIST:

Data Fields

N_GUI_CTXctx
 GUI context.
 
float first_inset
 content-local left inset applied to the FIRST header only, so a button can sit before it on the same row (0 = none)
 
float gap
 vertical gap between rows
 
float header_h
 header button height
 
int nb_sections
 number of sections
 
void(* on_toggle )(int, int, void *)
 callback(section_index, folded, user_data) on a header click (may be NULL)
 
N_GUI_SECTION sections [16]
 section storage
 
voiduser_data
 user data for the callback
 
float width
 header width
 
int window_id
 window holding the headers and members
 
float x
 content-local x of every header and the layout origin
 
float y0
 content-local y of the first header
 

Field Documentation

◆ ctx

◆ first_inset

float N_GUI_SECTIONLIST::first_inset

content-local left inset applied to the FIRST header only, so a button can sit before it on the same row (0 = none)

Definition at line 2424 of file n_gui.h.

Referenced by n_gui_sectionlist_relayout(), and n_gui_sectionlist_set_first_inset().

◆ gap

float N_GUI_SECTIONLIST::gap

◆ header_h

float N_GUI_SECTIONLIST::header_h

◆ nb_sections

◆ on_toggle

void(* N_GUI_SECTIONLIST::on_toggle) (int, int, void *)

callback(section_index, folded, user_data) on a header click (may be NULL)

Definition at line 2425 of file n_gui.h.

Referenced by _n_gui_sectionlist_header_clicked(), and n_gui_sectionlist_create().

◆ sections

◆ user_data

void* N_GUI_SECTIONLIST::user_data

user data for the callback

Definition at line 2426 of file n_gui.h.

Referenced by _n_gui_sectionlist_header_clicked(), and n_gui_sectionlist_create().

◆ width

float N_GUI_SECTIONLIST::width

header width

Definition at line 2419 of file n_gui.h.

Referenced by n_gui_sectionlist_add_section(), n_gui_sectionlist_create(), and n_gui_sectionlist_relayout().

◆ window_id

int N_GUI_SECTIONLIST::window_id

window holding the headers and members

Definition at line 2416 of file n_gui.h.

Referenced by n_gui_sectionlist_add_section(), n_gui_sectionlist_create(), and n_gui_sectionlist_relayout().

◆ x

float N_GUI_SECTIONLIST::x

content-local x of every header and the layout origin

Definition at line 2417 of file n_gui.h.

Referenced by n_gui_sectionlist_add_section(), n_gui_sectionlist_create(), and n_gui_sectionlist_relayout().

◆ y0

float N_GUI_SECTIONLIST::y0

content-local y of the first header

Definition at line 2418 of file n_gui.h.

Referenced by n_gui_sectionlist_content_height(), n_gui_sectionlist_create(), and n_gui_sectionlist_relayout().

◆ N_GUI_SLIDER_DATA

struct N_GUI_SLIDER_DATA

slider specific data

Definition at line 421 of file n_gui.h.

+ Collaboration diagram for N_GUI_SLIDER_DATA:

Data Fields

ALLEGRO_BITMAP * fill_bitmap
 optional bitmap for the filled portion of the track (NULL = color theme)
 
ALLEGRO_BITMAP * handle_active_bitmap
 optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap)
 
ALLEGRO_BITMAP * handle_bitmap
 optional bitmap for the draggable handle, normal state (NULL = color theme)
 
ALLEGRO_BITMAP * handle_hover_bitmap
 optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)
 
double max_val
 maximum value
 
double min_val
 minimum value
 
int mode
 mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT
 
void(* on_change )(int widget_id, double value, void *user_data)
 callback on value change
 
int orientation
 orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V
 
double step
 step increment (0 is treated as 1).
 
ALLEGRO_BITMAP * track_bitmap
 optional bitmap for the track/rail background (NULL = color theme)
 
void * user_data
 user data for callback
 
double value
 current value (always snapped to step)
 
char value_format [32]
 printf-style format string applied to the numeric value when the built-in readout draws.
 
int value_visible
 draw the built-in value label next to/below the handle.
 

Field Documentation

◆ fill_bitmap

ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::fill_bitmap

optional bitmap for the filled portion of the track (NULL = color theme)

Definition at line 437 of file n_gui.h.

Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().

◆ handle_active_bitmap

ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::handle_active_bitmap

optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap)

Definition at line 443 of file n_gui.h.

Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().

◆ handle_bitmap

ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::handle_bitmap

optional bitmap for the draggable handle, normal state (NULL = color theme)

Definition at line 439 of file n_gui.h.

Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().

◆ handle_hover_bitmap

ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::handle_hover_bitmap

optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)

Definition at line 441 of file n_gui.h.

Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().

◆ max_val

double N_GUI_SLIDER_DATA::max_val

◆ min_val

double N_GUI_SLIDER_DATA::min_val

◆ mode

int N_GUI_SLIDER_DATA::mode

mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT

Definition at line 431 of file n_gui.h.

Referenced by _draw_slider(), and n_gui_add_slider().

◆ on_change

void(* N_GUI_SLIDER_DATA::on_change) (int widget_id, double value, void *user_data)

callback on value change

Definition at line 445 of file n_gui.h.

Referenced by _slider_update_from_mouse(), n_gui_add_slider(), and n_gui_process_event().

◆ orientation

int N_GUI_SLIDER_DATA::orientation

orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V

Definition at line 433 of file n_gui.h.

Referenced by _draw_slider(), _slider_update_from_mouse(), n_gui_add_slider(), and n_gui_process_event().

◆ step

double N_GUI_SLIDER_DATA::step

step increment (0 is treated as 1).

All values snap to nearest multiple of step from min_val.

Definition at line 429 of file n_gui.h.

Referenced by _slider_update_from_mouse(), n_gui_add_slider(), n_gui_process_event(), n_gui_slider_set_range(), n_gui_slider_set_step(), and n_gui_slider_set_value().

◆ track_bitmap

ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::track_bitmap

optional bitmap for the track/rail background (NULL = color theme)

Definition at line 435 of file n_gui.h.

Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().

◆ user_data

void* N_GUI_SLIDER_DATA::user_data

user data for callback

Definition at line 447 of file n_gui.h.

Referenced by _slider_update_from_mouse(), n_gui_add_slider(), and n_gui_process_event().

◆ value

double N_GUI_SLIDER_DATA::value

◆ value_format

char N_GUI_SLIDER_DATA::value_format[32]

printf-style format string applied to the numeric value when the built-in readout draws.

Empty (first byte '\0') selects the legacy defaults: "%.1f" for VALUE mode, "%.0f%%" for PERCENT. Set via n_gui_slider_set_value_format().

Definition at line 452 of file n_gui.h.

Referenced by _draw_slider(), n_gui_add_slider(), and n_gui_slider_set_value_format().

◆ value_visible

int N_GUI_SLIDER_DATA::value_visible

draw the built-in value label next to/below the handle.

Default 1 (on) for backward compatibility. Set to 0 when the consumer is already painting the value elsewhere (e.g. a status bar) to avoid the double-render gotcha.

Definition at line 457 of file n_gui.h.

Referenced by _draw_slider(), n_gui_add_slider(), and n_gui_slider_set_value_visible().

◆ N_GUI_SPLITPANE_DATA

struct N_GUI_SPLITPANE_DATA

split pane specific data: a draggable divider between two regions

Definition at line 583 of file n_gui.h.

+ Collaboration diagram for N_GUI_SPLITPANE_DATA:

Data Fields

float divider
 divider thickness in pixels
 
float max_ratio
 upper clamp applied to ratio
 
float min_ratio
 lower clamp applied to ratio
 
void(* on_change )(int widget_id, float ratio, void *user_data)
 callback fired while the divider is dragged (widget_id, ratio, user_data)
 
int orientation
 N_GUI_SPLIT_VERTICAL or N_GUI_SPLIT_HORIZONTAL.
 
float ratio
 divider position as a fraction of the widget extent (0..1)
 
void * user_data
 user data for callback
 

Field Documentation

◆ divider

float N_GUI_SPLITPANE_DATA::divider

divider thickness in pixels

Definition at line 593 of file n_gui.h.

Referenced by _draw_splitpane(), n_gui_add_splitpane(), and n_gui_process_event().

◆ max_ratio

float N_GUI_SPLITPANE_DATA::max_ratio

upper clamp applied to ratio

Definition at line 591 of file n_gui.h.

Referenced by n_gui_add_splitpane(), n_gui_process_event(), n_gui_splitpane_set_limits(), and n_gui_splitpane_set_ratio().

◆ min_ratio

float N_GUI_SPLITPANE_DATA::min_ratio

lower clamp applied to ratio

Definition at line 589 of file n_gui.h.

Referenced by n_gui_add_splitpane(), n_gui_process_event(), n_gui_splitpane_set_limits(), and n_gui_splitpane_set_ratio().

◆ on_change

void(* N_GUI_SPLITPANE_DATA::on_change) (int widget_id, float ratio, void *user_data)

callback fired while the divider is dragged (widget_id, ratio, user_data)

Definition at line 595 of file n_gui.h.

Referenced by n_gui_add_splitpane(), and n_gui_process_event().

◆ orientation

int N_GUI_SPLITPANE_DATA::orientation

N_GUI_SPLIT_VERTICAL or N_GUI_SPLIT_HORIZONTAL.

Definition at line 585 of file n_gui.h.

Referenced by _draw_splitpane(), n_gui_add_splitpane(), and n_gui_process_event().

◆ ratio

float N_GUI_SPLITPANE_DATA::ratio

divider position as a fraction of the widget extent (0..1)

Definition at line 587 of file n_gui.h.

Referenced by _draw_splitpane(), n_gui_add_splitpane(), n_gui_process_event(), n_gui_splitpane_set_limits(), and n_gui_splitpane_set_ratio().

◆ user_data

void* N_GUI_SPLITPANE_DATA::user_data

user data for callback

Definition at line 597 of file n_gui.h.

Referenced by n_gui_add_splitpane(), and n_gui_process_event().

◆ N_GUI_STYLE

struct N_GUI_STYLE

Global style holding every configurable layout constant.

Initialised with sensible defaults by n_gui_default_style(). Can be serialised/deserialised to/from JSON with n_gui_style_to_json / n_gui_style_from_json.

Definition at line 1147 of file n_gui.h.

+ Collaboration diagram for N_GUI_STYLE:
Data Fields
float checkbox_label_gap gap between box and label text
float checkbox_label_offset horizontal offset from box edge to label text
float checkbox_mark_margin checkmark inset from box edge
float checkbox_mark_thickness checkmark line thickness
float checkbox_max_size maximum box size
float combobox_max_dropdown_width maximum dropdown width for N_GUI_COMBOBOX_AUTO_WIDTH (0 = display width)
int combobox_max_visible default max visible items for combobox dropdown
float dropdown_arrow_half_h vertical half-extent of the arrow chevron
float dropdown_arrow_half_w horizontal half-extent of the arrow chevron
float dropdown_arrow_reserve horizontal space reserved for the arrow on the right
float dropdown_arrow_thickness arrow stroke thickness
float dropdown_border_thickness dropdown panel border thickness
int dropmenu_max_visible default max visible items for dropmenu panel
float global_scroll_step pixels per mouse wheel notch for global scroll
float global_scrollbar_border_thickness global thumb border thickness
float global_scrollbar_size global scrollbar track width/height
ALLEGRO_COLOR global_scrollbar_thumb_border_color global scrollbar thumb border colour
ALLEGRO_COLOR global_scrollbar_thumb_color global scrollbar thumb colour
float global_scrollbar_thumb_corner_r global thumb corner radius
float global_scrollbar_thumb_min global minimum thumb dimension
float global_scrollbar_thumb_padding global thumb inset from track edge
ALLEGRO_COLOR global_scrollbar_track_color global scrollbar track colour
ALLEGRO_COLOR grip_color grip line colour
float grip_line_thickness grip line thickness
float grip_size grip area size
float item_height_pad min padding added to font height for item height
float item_selection_inset item highlight inset from left/right edges
float item_text_padding text padding inside list/combo/dropmenu items
float label_padding horizontal padding each side
ALLEGRO_COLOR link_color_hover link colour (hover)
ALLEGRO_COLOR link_color_normal link colour (normal)
float link_underline_thickness link underline thickness
float listbox_default_item_height default item height for listbox
float min_win_h minimum window height (for resize)
float min_win_w minimum window width (for resize)
float radio_circle_border_thickness outer circle border thickness
float radio_circle_min_r minimum outer circle radius
float radio_inner_offset inner filled circle shrink from outer
float radio_label_gap gap between circle and label text
float radiolist_default_item_height default item height for radiolist
float scroll_step pixels per mouse wheel notch for window auto-scroll
float scrollbar_size scrollbar track width/height
ALLEGRO_COLOR scrollbar_thumb_color scrollbar thumb colour
float scrollbar_thumb_corner_r thumb corner radius
float scrollbar_thumb_min minimum thumb dimension
float scrollbar_thumb_padding thumb inset from track edge
ALLEGRO_COLOR scrollbar_track_color scrollbar track colour
int shape_mode global widget shape override: N_GUI_SHAPE_ROUNDED forces a rounded GUI, N_GUI_SHAPE_RECT forces a square one, and -1 (default) leaves each widget on its own shape (the dropmenu button + panel still default to rounded).

Buttons and comboboxes follow this when it is set. Toggle with n_gui_set_shape_mode() for a round/square GUI.

float slider_handle_border_thickness handle border thickness
float slider_handle_edge_offset handle circle offset from edge
float slider_handle_min_r minimum handle circle radius
float slider_track_border_thickness track outline thickness
float slider_track_corner_r track corner radius
float slider_track_size track width (vertical) or height (horizontal)
float slider_value_label_offset gap between slider end and value label
float tb_btn_glyph_thickness line thickness for titlebar button glyphs
float tb_btn_right_margin right margin from window edge to rightmost button
float tb_btn_size titlebar button size (0 = auto: titlebar_h - 4)
float tb_btn_spacing gap between titlebar buttons
float textarea_cursor_blink_period cursor blink period in seconds (full cycle on+off)
float textarea_cursor_width cursor width in pixels
float textarea_padding
float title_max_w_reserve pixels reserved right of title for truncation
float title_padding padding left of title text
float titlebar_h title bar height
ALLEGRO_COLOR tooltip_bg tooltip bubble background color
ALLEGRO_COLOR tooltip_border tooltip bubble border color
float tooltip_delay inner padding

seconds the pointer must rest on a widget before its tooltip shows

ALLEGRO_COLOR tooltip_fg tooltip text color

◆ N_GUI_SYNTAXVIEW_DATA

struct N_GUI_SYNTAXVIEW_DATA

syntax view specific data: read-only highlighted text

Examples
ex_gui_syntaxview.c.

Definition at line 613 of file n_gui.h.

+ Collaboration diagram for N_GUI_SYNTAXVIEW_DATA:
Data Fields
int cached_headers_end cached first blank-line index (HTTP headers end), or INT_MAX; valid when lines_valid
int cached_nb_lines cached line count (matches _text_line_count), valid when lines_valid
size_t len text length in bytes
int lines_valid 0 when cached_nb_lines / cached_headers_end are stale (rebuild on next use).

Zero-initialised so a freshly created widget rebuilds on first draw; set back to 0 by n_gui_syntaxview_set_text.

int mode highlighting mode: N_GUI_SYNTAX_*
int scroll_offset first visible line
int sel_dragging 1 while a mouse drag is extending the selection, 0 otherwise
int sel_end selection end byte offset (tracks the cursor while a drag is in progress)
int sel_start selection start byte offset into text, or -1 when nothing is selected
char * text owned copy of the text, or NULL

◆ N_GUI_TAB_PANEL

struct N_GUI_TAB_PANEL

tab panel built from toggle buttons with content window management

Definition at line 2366 of file n_gui.h.

+ Collaboration diagram for N_GUI_TAB_PANEL:

Data Fields

int active_tab
 currently active tab index
 
float button_h
 height of each tab button
 
int button_ids [16]
 toggle button widget IDs
 
float button_w
 width of each tab button
 
int content_window_ids [16]
 content window IDs (-1 = none)
 
N_GUI_CTXctx
 GUI context.
 
int nb_tabs
 number of tabs
 
void(* on_tab_change )(int, void *)
 callback on tab switch (may be NULL)
 
int parent_window_id
 parent window for tab buttons
 
voiduser_data
 user data for callback
 
float x
 x origin of first tab button
 
float y
 y origin of tab button row
 

Field Documentation

◆ active_tab

int N_GUI_TAB_PANEL::active_tab

currently active tab index

Definition at line 2372 of file n_gui.h.

Referenced by n_gui_tab_add(), n_gui_tab_create(), n_gui_tab_get_active(), and n_gui_tab_set_active().

◆ button_h

float N_GUI_TAB_PANEL::button_h

height of each tab button

Definition at line 2376 of file n_gui.h.

Referenced by n_gui_tab_add(), and n_gui_tab_create().

◆ button_ids

int N_GUI_TAB_PANEL::button_ids[16]

toggle button widget IDs

Definition at line 2369 of file n_gui.h.

Referenced by _n_gui_tab_button_clicked(), n_gui_tab_add(), n_gui_tab_create(), and n_gui_tab_set_active().

◆ button_w

float N_GUI_TAB_PANEL::button_w

width of each tab button

Definition at line 2375 of file n_gui.h.

Referenced by n_gui_tab_add(), and n_gui_tab_create().

◆ content_window_ids

int N_GUI_TAB_PANEL::content_window_ids[16]

content window IDs (-1 = none)

Definition at line 2370 of file n_gui.h.

Referenced by n_gui_tab_create(), n_gui_tab_set_active(), and n_gui_tab_set_content_window().

◆ ctx

N_GUI_CTX* N_GUI_TAB_PANEL::ctx

GUI context.

Definition at line 2367 of file n_gui.h.

Referenced by n_gui_tab_add(), n_gui_tab_create(), and n_gui_tab_set_active().

◆ nb_tabs

int N_GUI_TAB_PANEL::nb_tabs

◆ on_tab_change

void(* N_GUI_TAB_PANEL::on_tab_change) (int, void *)

callback on tab switch (may be NULL)

Definition at line 2377 of file n_gui.h.

Referenced by _n_gui_tab_button_clicked(), and n_gui_tab_create().

◆ parent_window_id

int N_GUI_TAB_PANEL::parent_window_id

parent window for tab buttons

Definition at line 2368 of file n_gui.h.

Referenced by n_gui_tab_add(), and n_gui_tab_create().

◆ user_data

void* N_GUI_TAB_PANEL::user_data

user data for callback

Definition at line 2378 of file n_gui.h.

Referenced by _n_gui_tab_button_clicked(), and n_gui_tab_create().

◆ x

float N_GUI_TAB_PANEL::x

x origin of first tab button

Definition at line 2373 of file n_gui.h.

Referenced by n_gui_tab_add(), and n_gui_tab_create().

◆ y

float N_GUI_TAB_PANEL::y

y origin of tab button row

Definition at line 2374 of file n_gui.h.

Referenced by n_gui_tab_add(), and n_gui_tab_create().

◆ N_GUI_TB_BUTTONS

struct N_GUI_TB_BUTTONS

Titlebar button state for a window (minimize, maximize, close)

Definition at line 947 of file n_gui.h.

+ Collaboration diagram for N_GUI_TB_BUTTONS:

Data Fields

N_GUI_THEME btn_theme
 theme for minimize and maximize buttons
 
ALLEGRO_BITMAP * close_active_bitmap
 optional bitmap for close button active state
 
ALLEGRO_BITMAP * close_bitmap
 optional bitmap for close button normal state (NULL = color theme)
 
ALLEGRO_BITMAP * close_hover_bitmap
 optional bitmap for close button hover state
 
N_GUI_THEME close_theme
 theme for close button (defaults to red hover/active)
 
int hovered
 which button is currently hovered (N_GUI_TB_BTN_*)
 
ALLEGRO_BITMAP * maximize_active_bitmap
 optional bitmap for maximize button active state
 
ALLEGRO_BITMAP * maximize_bitmap
 optional bitmap for maximize button normal state (NULL = color theme)
 
ALLEGRO_BITMAP * maximize_hover_bitmap
 optional bitmap for maximize button hover state
 
ALLEGRO_BITMAP * minimize_active_bitmap
 optional bitmap for minimize button active state
 
ALLEGRO_BITMAP * minimize_bitmap
 optional bitmap for minimize button normal state (NULL = color theme)
 
ALLEGRO_BITMAP * minimize_hover_bitmap
 optional bitmap for minimize button hover state
 
void(* on_close )(int window_id, void *user_data)
 callback on close button click (NULL = default: clear N_GUI_WIN_OPEN)
 
void * on_close_user_data
 user data for on_close callback
 
void(* on_maximize )(int window_id, void *user_data)
 callback on maximize button click (NULL = default: toggle N_GUI_WIN_MAXIMISED)
 
void * on_maximize_user_data
 user data for on_maximize callback
 
void(* on_minimize )(int window_id, void *user_data)
 callback on minimize button click (NULL = default: toggle N_GUI_WIN_MINIMISED)
 
void * on_minimize_user_data
 user data for on_minimize callback
 
int pressed
 which button is currently pressed (N_GUI_TB_BTN_*)
 
float restore_h
 saved height before maximise (for restore)
 
float restore_w
 saved width before maximise (for restore)
 
float restore_x
 saved x position before maximise (for restore)
 
float restore_y
 saved y position before maximise (for restore)
 

Field Documentation

◆ btn_theme

N_GUI_THEME N_GUI_TB_BUTTONS::btn_theme

theme for minimize and maximize buttons

Definition at line 961 of file n_gui.h.

Referenced by _draw_tb_buttons(), n_gui_add_window(), n_gui_reset_all_widget_themes(), and n_gui_window_set_tb_btn_theme().

◆ close_active_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::close_active_bitmap

optional bitmap for close button active state

Definition at line 981 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ close_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::close_bitmap

optional bitmap for close button normal state (NULL = color theme)

Definition at line 977 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ close_hover_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::close_hover_bitmap

optional bitmap for close button hover state

Definition at line 979 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ close_theme

N_GUI_THEME N_GUI_TB_BUTTONS::close_theme

theme for close button (defaults to red hover/active)

Definition at line 963 of file n_gui.h.

Referenced by _draw_tb_buttons(), n_gui_add_window(), n_gui_reset_all_widget_themes(), and n_gui_window_set_tb_close_theme().

◆ hovered

int N_GUI_TB_BUTTONS::hovered

which button is currently hovered (N_GUI_TB_BTN_*)

Definition at line 949 of file n_gui.h.

Referenced by _draw_tb_buttons(), n_gui_process_event(), and n_gui_window_detach().

◆ maximize_active_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::maximize_active_bitmap

optional bitmap for maximize button active state

Definition at line 975 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ maximize_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::maximize_bitmap

optional bitmap for maximize button normal state (NULL = color theme)

Definition at line 971 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ maximize_hover_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::maximize_hover_bitmap

optional bitmap for maximize button hover state

Definition at line 973 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ minimize_active_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::minimize_active_bitmap

optional bitmap for minimize button active state

Definition at line 969 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ minimize_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::minimize_bitmap

optional bitmap for minimize button normal state (NULL = color theme)

Definition at line 965 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ minimize_hover_bitmap

ALLEGRO_BITMAP* N_GUI_TB_BUTTONS::minimize_hover_bitmap

optional bitmap for minimize button hover state

Definition at line 967 of file n_gui.h.

Referenced by _draw_tb_buttons(), and n_gui_window_set_tb_button_bitmaps().

◆ on_close

void(* N_GUI_TB_BUTTONS::on_close) (int window_id, void *user_data)

callback on close button click (NULL = default: clear N_GUI_WIN_OPEN)

Definition at line 991 of file n_gui.h.

Referenced by _tb_button_action(), n_gui_process_event(), and n_gui_window_set_close_callback().

◆ on_close_user_data

void* N_GUI_TB_BUTTONS::on_close_user_data

user data for on_close callback

Definition at line 993 of file n_gui.h.

Referenced by _tb_button_action(), n_gui_process_event(), and n_gui_window_set_close_callback().

◆ on_maximize

void(* N_GUI_TB_BUTTONS::on_maximize) (int window_id, void *user_data)

callback on maximize button click (NULL = default: toggle N_GUI_WIN_MAXIMISED)

Definition at line 987 of file n_gui.h.

Referenced by _tb_button_action(), and n_gui_window_set_maximize_callback().

◆ on_maximize_user_data

void* N_GUI_TB_BUTTONS::on_maximize_user_data

user data for on_maximize callback

Definition at line 989 of file n_gui.h.

Referenced by _tb_button_action(), and n_gui_window_set_maximize_callback().

◆ on_minimize

void(* N_GUI_TB_BUTTONS::on_minimize) (int window_id, void *user_data)

callback on minimize button click (NULL = default: toggle N_GUI_WIN_MINIMISED)

Definition at line 983 of file n_gui.h.

Referenced by _tb_button_action(), and n_gui_window_set_minimize_callback().

◆ on_minimize_user_data

void* N_GUI_TB_BUTTONS::on_minimize_user_data

user data for on_minimize callback

Definition at line 985 of file n_gui.h.

Referenced by _tb_button_action(), and n_gui_window_set_minimize_callback().

◆ pressed

int N_GUI_TB_BUTTONS::pressed

which button is currently pressed (N_GUI_TB_BTN_*)

Definition at line 951 of file n_gui.h.

Referenced by _draw_tb_buttons(), n_gui_process_event(), and n_gui_window_detach().

◆ restore_h

float N_GUI_TB_BUTTONS::restore_h

saved height before maximise (for restore)

Definition at line 959 of file n_gui.h.

Referenced by n_gui_maximize_window().

◆ restore_w

float N_GUI_TB_BUTTONS::restore_w

saved width before maximise (for restore)

Definition at line 957 of file n_gui.h.

Referenced by n_gui_maximize_window().

◆ restore_x

float N_GUI_TB_BUTTONS::restore_x

saved x position before maximise (for restore)

Definition at line 953 of file n_gui.h.

Referenced by n_gui_maximize_window().

◆ restore_y

float N_GUI_TB_BUTTONS::restore_y

saved y position before maximise (for restore)

Definition at line 955 of file n_gui.h.

Referenced by n_gui_maximize_window().

◆ N_GUI_TEXT_DIMS

struct N_GUI_TEXT_DIMS

bounding box dimensions returned by n_gui_get_text_dims()

Definition at line 331 of file n_gui.h.

+ Collaboration diagram for N_GUI_TEXT_DIMS:
Data Fields
int h bounding box height in pixels
int w bounding box width in pixels
int x bounding box x offset from draw origin
int y bounding box y offset from draw origin

◆ N_GUI_TEXTAREA_DATA

struct N_GUI_TEXTAREA_DATA

text area specific data

Examples
ex_gui_placeholder.c.

Definition at line 461 of file n_gui.h.

+ Collaboration diagram for N_GUI_TEXTAREA_DATA:

Data Fields

ALLEGRO_BITMAP * bg_bitmap
 optional bitmap for the text area background (NULL = color theme)
 
size_t char_limit
 maximum character limit (0 = N_GUI_TEXT_MAX)
 
size_t cursor_pos
 cursor position in text
 
double cursor_time
 timestamp of last cursor activity (for blink reset)
 
char mask_char
 mask character for password fields (0 = no masking, e.g.
 
int multiline
 0 = single line, 1 = multiline
 
void(* on_change )(int widget_id, const char *text, void *user_data)
 callback on text change
 
char * placeholder
 optional placeholder/hint text drawn dimmed while the field is empty (NULL = none); cleared from view as soon as any text is entered
 
int scroll_from_wheel
 set to 1 when scroll was changed by mouse wheel, cleared on key input
 
float scroll_x
 horizontal scroll offset for single-line text (pixels)
 
int scroll_y
 scroll offset for long text
 
size_t sel_end
 selection end position (tracks cursor during selection)
 
size_t sel_start
 selection anchor position (where shift-click/shift-arrow started).
 
char * text
 text content (dynamically allocated, text_alloc bytes)
 
size_t text_alloc
 allocated buffer size (char_limit + 1)
 
size_t text_len
 current text length
 
void * user_data
 user data for callback
 

Field Documentation

◆ bg_bitmap

ALLEGRO_BITMAP* N_GUI_TEXTAREA_DATA::bg_bitmap

optional bitmap for the text area background (NULL = color theme)

Definition at line 488 of file n_gui.h.

Referenced by _draw_textarea(), and n_gui_add_textarea().

◆ char_limit

size_t N_GUI_TEXTAREA_DATA::char_limit

maximum character limit (0 = N_GUI_TEXT_MAX)

Definition at line 469 of file n_gui.h.

Referenced by _textarea_handle_key(), n_gui_add_textarea(), and n_gui_textarea_set_text().

◆ cursor_pos

◆ cursor_time

double N_GUI_TEXTAREA_DATA::cursor_time

timestamp of last cursor activity (for blink reset)

Definition at line 486 of file n_gui.h.

Referenced by _draw_textarea(), _textarea_handle_key(), n_gui_add_textarea(), n_gui_process_event(), and n_gui_set_focus().

◆ mask_char

char N_GUI_TEXTAREA_DATA::mask_char

mask character for password fields (0 = no masking, e.g.

'*')

Definition at line 490 of file n_gui.h.

Referenced by _draw_textarea(), _textarea_pos_from_mouse(), and n_gui_add_textarea().

◆ multiline

◆ on_change

void(* N_GUI_TEXTAREA_DATA::on_change) (int widget_id, const char *text, void *user_data)

callback on text change

Definition at line 495 of file n_gui.h.

Referenced by _textarea_delete_selection(), _textarea_handle_key(), _textarea_paste_clip(), and n_gui_add_textarea().

◆ placeholder

char* N_GUI_TEXTAREA_DATA::placeholder

optional placeholder/hint text drawn dimmed while the field is empty (NULL = none); cleared from view as soon as any text is entered

Definition at line 493 of file n_gui.h.

Referenced by _destroy_widget(), _draw_textarea_placeholder(), and n_gui_textarea_set_placeholder().

◆ scroll_from_wheel

int N_GUI_TEXTAREA_DATA::scroll_from_wheel

set to 1 when scroll was changed by mouse wheel, cleared on key input

Definition at line 484 of file n_gui.h.

Referenced by _draw_textarea(), _textarea_handle_key(), n_gui_process_event(), and n_gui_textarea_scroll_to_offset().

◆ scroll_x

float N_GUI_TEXTAREA_DATA::scroll_x

horizontal scroll offset for single-line text (pixels)

Definition at line 482 of file n_gui.h.

Referenced by _draw_textarea(), _textarea_pos_from_mouse(), n_gui_add_textarea(), and n_gui_textarea_set_text().

◆ scroll_y

int N_GUI_TEXTAREA_DATA::scroll_y

◆ sel_end

size_t N_GUI_TEXTAREA_DATA::sel_end

selection end position (tracks cursor during selection)

Definition at line 478 of file n_gui.h.

Referenced by _textarea_clear_selection(), _textarea_handle_key(), _textarea_has_selection(), _textarea_sel_range(), n_gui_add_textarea(), n_gui_process_event(), and n_gui_textarea_set_selection().

◆ sel_start

size_t N_GUI_TEXTAREA_DATA::sel_start

selection anchor position (where shift-click/shift-arrow started).

When sel_start == sel_end, no selection is active.

Definition at line 476 of file n_gui.h.

Referenced by _textarea_clear_selection(), _textarea_handle_key(), _textarea_has_selection(), _textarea_sel_range(), n_gui_add_textarea(), n_gui_process_event(), and n_gui_textarea_set_selection().

◆ text

◆ text_alloc

size_t N_GUI_TEXTAREA_DATA::text_alloc

allocated buffer size (char_limit + 1)

Definition at line 467 of file n_gui.h.

Referenced by n_gui_add_textarea().

◆ text_len

◆ user_data

void* N_GUI_TEXTAREA_DATA::user_data

user data for callback

Definition at line 497 of file n_gui.h.

Referenced by _textarea_delete_selection(), _textarea_handle_key(), _textarea_paste_clip(), and n_gui_add_textarea().

◆ N_GUI_THEME

struct N_GUI_THEME

Color theme for a widget.

Examples
ex_gui.c.

Definition at line 341 of file n_gui.h.

+ Collaboration diagram for N_GUI_THEME:
Data Fields
ALLEGRO_COLOR bg_active background active/pressed
ALLEGRO_COLOR bg_hover background hover
ALLEGRO_COLOR bg_normal background normal
ALLEGRO_COLOR border_active border active
ALLEGRO_COLOR border_hover border hover
ALLEGRO_COLOR border_normal border normal
float border_thickness border thickness
float corner_rx corner radius for rounded shapes
float corner_ry corner radius Y for rounded shapes
ALLEGRO_COLOR selection_color text selection highlight colour (semi-transparent recommended)
ALLEGRO_COLOR text_active text active
ALLEGRO_COLOR text_hover text hover
ALLEGRO_COLOR text_normal text normal

◆ N_GUI_TREE

struct N_GUI_TREE

tree view built from an N_GUI listbox

Definition at line 2477 of file n_gui.h.

+ Collaboration diagram for N_GUI_TREE:

Data Fields

N_GUI_CTXctx
 GUI context.
 
int drag_active
 1 once past threshold
 
int drag_armed_node
 pressed-but-not-yet-dragging
 
int drag_hover_node
 current hover node, or -1
 
float drag_press_x
 mouse x at press time
 
float drag_press_y
 mouse y at press time
 
int drag_source_node
 node being dragged, or -1
 
int drop_position
 N_GUI_DROP_BEFORE / INTO / AFTER.
 
void * drop_user_data
 user data for on_drop
 
int listbox_id
 listbox widget ID
 
int mouse_b1_prev
 previous frame's b1 state
 
int nb_nodes
 number of nodes
 
int nb_visible
 number of visible rows
 
N_GUI_TREE_NODE nodes [2048]
 node storage
 
n_gui_tree_on_drop_t on_drop
 drag-reorder state (managed by n_gui_tree_tick)
 
void(* on_select )(int, void *)
 selection callback
 
void * user_data
 user data for callback
 
int visible_map [2048]
 visible row to node index
 
int window_id
 owning window for coord math
 

Field Documentation

◆ ctx

◆ drag_active

int N_GUI_TREE::drag_active

1 once past threshold

Definition at line 2495 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_draw_overlay(), n_gui_tree_set_on_drop(), and n_gui_tree_tick().

◆ drag_armed_node

int N_GUI_TREE::drag_armed_node

pressed-but-not-yet-dragging

Definition at line 2492 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_set_on_drop(), and n_gui_tree_tick().

◆ drag_hover_node

int N_GUI_TREE::drag_hover_node

current hover node, or -1

Definition at line 2493 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_draw_overlay(), n_gui_tree_set_on_drop(), and n_gui_tree_tick().

◆ drag_press_x

float N_GUI_TREE::drag_press_x

mouse x at press time

Definition at line 2496 of file n_gui.h.

Referenced by n_gui_tree_create(), and n_gui_tree_tick().

◆ drag_press_y

float N_GUI_TREE::drag_press_y

mouse y at press time

Definition at line 2497 of file n_gui.h.

Referenced by n_gui_tree_create(), and n_gui_tree_tick().

◆ drag_source_node

int N_GUI_TREE::drag_source_node

node being dragged, or -1

Definition at line 2491 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_set_on_drop(), and n_gui_tree_tick().

◆ drop_position

int N_GUI_TREE::drop_position

N_GUI_DROP_BEFORE / INTO / AFTER.

Definition at line 2494 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_draw_overlay(), and n_gui_tree_tick().

◆ drop_user_data

void* N_GUI_TREE::drop_user_data

user data for on_drop

Definition at line 2490 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_set_on_drop(), and n_gui_tree_tick().

◆ listbox_id

◆ mouse_b1_prev

int N_GUI_TREE::mouse_b1_prev

previous frame's b1 state

Definition at line 2498 of file n_gui.h.

Referenced by n_gui_tree_create(), and n_gui_tree_tick().

◆ nb_nodes

◆ nb_visible

◆ nodes

◆ on_drop

n_gui_tree_on_drop_t N_GUI_TREE::on_drop

drag-reorder state (managed by n_gui_tree_tick)

drop callback, or NULL

Definition at line 2489 of file n_gui.h.

Referenced by n_gui_tree_create(), n_gui_tree_set_on_drop(), and n_gui_tree_tick().

◆ on_select

void(* N_GUI_TREE::on_select) (int, void *)

selection callback

Definition at line 2485 of file n_gui.h.

Referenced by _n_gui_tree_listbox_selected(), and n_gui_tree_create().

◆ user_data

void* N_GUI_TREE::user_data

user data for callback

Definition at line 2486 of file n_gui.h.

Referenced by _n_gui_tree_listbox_selected(), and n_gui_tree_create().

◆ visible_map

int N_GUI_TREE::visible_map[2048]

◆ window_id

int N_GUI_TREE::window_id

owning window for coord math

Definition at line 2480 of file n_gui.h.

Referenced by _n_gui_tree_listbox_bounds(), and n_gui_tree_create().

◆ N_GUI_TREE_NODE

struct N_GUI_TREE_NODE

a single node in the tree view

Definition at line 2454 of file n_gui.h.

+ Collaboration diagram for N_GUI_TREE_NODE:
Data Fields
int depth depth in tree (0 = root)
int expanded 1 if expanded
int has_children 1 if node has children
char label[128] display text
int parent_index parent node index, or -1 for root
void * user_data user data for this node

◆ N_GUI_WIDGET

struct N_GUI_WIDGET

A single GUI widget.

Examples
ex_gui_custom.c, ex_gui_dropmenu.c, ex_gui_kvtable.c, ex_gui_placeholder.c, and ex_gui_syntaxview.c.

Definition at line 882 of file n_gui.h.

+ Collaboration diagram for N_GUI_WIDGET:
Data Fields
void * data widget-specific data (union via void pointer)
int enabled enabled flag (1 = enabled, 0 = disabled: drawn dimmed and ignores input)
ALLEGRO_FONT * font font used by this widget (NULL = context default)
float h height
int id unique widget id
float norm_h normalized height (fraction of parent window h)
float norm_w normalized width (fraction of parent window w)
float norm_x normalized position x (fraction of parent window w, used for SCALE resize)
float norm_y normalized position y (fraction of parent window h, used for SCALE resize)
char persist_key[128] optional stable key for persisting this widget's user-adjustable state (splitpane divider ratio, datagrid column order/visibility/width) across sessions inside the layout JSON.

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

int state current state flags (N_GUI_STATE_*)
N_GUI_THEME theme color theme for this widget
char * tooltip owned tooltip text shown after the pointer rests on the widget (NULL = none); heap-allocated with no length cap so long tooltips are not truncated
int type widget type (N_GUI_TYPE_*)
int visible visibility flag
float w width
float x position x relative to parent window
float y position y relative to parent window

◆ N_GUI_WINDOW

struct N_GUI_WINDOW

A pseudo window that contains widgets.

Examples
ex_gui_kvtable.c, ex_gui_layout_persist.c, and ex_gui_multiwin.c.

Definition at line 999 of file n_gui.h.

+ Collaboration diagram for N_GUI_WINDOW:

Data Fields

float autofit_border
 padding/border around content for auto-fit (pixels, applied on each side)
 
int autofit_flags
 bitmask of N_GUI_AUTOFIT_* flags (0 = no auto-fitting)
 
float autofit_origin_x
 original insertion point x for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)
 
float autofit_origin_y
 original insertion point y for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)
 
ALLEGRO_BITMAPbg_bitmap
 optional bitmap for the window body background (NULL = color fill)
 
int bg_scale_mode
 scale mode for bg_bitmap: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER
 
float content_h
 total content height computed from widgets (internal)
 
float content_w
 total content width computed from widgets (internal)
 
int detach_flags
 options the window was detached with (N_GUI_DETACH_*), remembered so a close/open cycle and a restored layout can re-create the same native window
 
float drag_ox
 drag offset x (internal)
 
float drag_oy
 drag offset y (internal)
 
int flags
 feature flags (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, etc.)
 
ALLEGRO_FONTfont
 font for the title bar
 
float h
 window height
 
int id
 unique window id
 
float min_h
 minimum height
 
float min_w
 minimum width
 
ALLEGRO_DISPLAYnative
 native OS window backing this pseudo-window, or NULL (the default) when the window is drawn as a pop-up inside the host's main display.
 
int native_close_pending
 1 when the native window must be released at the next safe point (an ALLEGRO_EVENT_DISPLAY_CLOSE arrived, or the window was closed while detached).
 
int native_drag_anchored
 1 when the four native_drag_* fields hold a usable grab, that is when al_get_mouse_cursor_position worked.
 
int native_drag_cx
 desktop x of the mouse cursor when a native (N_GUI_DETACH_OWN_CHROME) title bar drag started.
 
int native_drag_cy
 desktop y of the mouse cursor at the drag grab (see native_drag_cx)
 
int native_drag_wx
 native window x at the drag grab, the move is native_drag_wx plus the desktop cursor travel since the grab
 
int native_drag_wy
 native window y at the drag grab (see native_drag_wx)
 
float native_h
 last known native window height (see native_w)
 
int native_halted
 1 while the native window's drawing is halted.
 
int native_pos_x
 last known native window position on the desktop, applied when the native window is re-created.
 
int native_pos_y
 last known native window y position (see native_pos_x)
 
float native_w
 last known native window width, 0 until the window is first detached.
 
float norm_h
 normalized height (fraction of reference display height, used in SCALE mode)
 
float norm_w
 normalized width (fraction of reference display width, used in SCALE mode)
 
float norm_x
 normalized position x (0.0-1.0 fraction of reference display width)
 
float norm_y
 normalized position y (0.0-1.0 fraction of reference display height)
 
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, at the window's z-order (NULL = none).
 
voidon_content_draw_data
 user data passed to on_content_draw
 
int resize_policy
 per-window resize policy: N_GUI_WIN_RESIZE_NONE, _MOVE, or _SCALE
 
int saved_flags
 embedded feature flags saved by n_gui_window_detach (a detached window is forced frameless because the OS draws the title bar)
 
float saved_h
 embedded height saved by n_gui_window_detach, restored by n_gui_window_attach
 
float saved_w
 embedded width saved by n_gui_window_detach, restored by n_gui_window_attach
 
float saved_x
 embedded x saved by n_gui_window_detach, restored by n_gui_window_attach
 
float saved_y
 embedded y saved by n_gui_window_detach, restored by n_gui_window_attach
 
float scroll_x
 horizontal scroll offset for auto-scrollbar (pixels)
 
float scroll_y
 vertical scroll offset for auto-scrollbar (pixels)
 
int state
 state flags (N_GUI_WIN_*)
 
N_GUI_TB_BUTTONS tb_buttons
 titlebar button state (minimize, maximize, close)
 
N_GUI_THEME theme
 color theme for this window chrome
 
char title [128]
 window title
 
ALLEGRO_BITMAPtitlebar_bitmap
 optional bitmap for the titlebar background (NULL = color fill)
 
float titlebar_h
 title bar height
 
float w
 window width
 
int want_native
 1 when the window should live in a native OS window: set by n_gui_window_detach and by a loaded layout, cleared by n_gui_window_attach.
 
LISTwidgets
 list of N_GUI_WIDGET* contained in this window
 
float x
 position x on screen
 
float y
 position y on screen
 
int z_order
 z-order mode (N_GUI_ZORDER_NORMAL, _ALWAYS_ON_TOP, _ALWAYS_BEHIND, _FIXED)
 
int z_value
 z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top)
 

Field Documentation

◆ autofit_border

float N_GUI_WINDOW::autofit_border

padding/border around content for auto-fit (pixels, applied on each side)

Definition at line 1053 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_apply_autofit(), and n_gui_window_set_autofit().

◆ autofit_flags

int N_GUI_WINDOW::autofit_flags

bitmask of N_GUI_AUTOFIT_* flags (0 = no auto-fitting)

Definition at line 1051 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_draw(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_apply_autofit(), and n_gui_window_set_autofit().

◆ autofit_origin_x

float N_GUI_WINDOW::autofit_origin_x

original insertion point x for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)

Definition at line 1055 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_window_apply_autofit(), and n_gui_window_set_autofit().

◆ autofit_origin_y

float N_GUI_WINDOW::autofit_origin_y

original insertion point y for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)

Definition at line 1057 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_window_apply_autofit(), and n_gui_window_set_autofit().

◆ bg_bitmap

ALLEGRO_BITMAP* N_GUI_WINDOW::bg_bitmap

optional bitmap for the window body background (NULL = color fill)

Definition at line 1045 of file n_gui.h.

Referenced by _draw_window(), and n_gui_window_set_bitmaps().

◆ bg_scale_mode

int N_GUI_WINDOW::bg_scale_mode

scale mode for bg_bitmap: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER

Definition at line 1049 of file n_gui.h.

Referenced by _draw_window(), and n_gui_window_set_bitmaps().

◆ content_h

float N_GUI_WINDOW::content_h

total content height computed from widgets (internal)

Definition at line 1037 of file n_gui.h.

Referenced by _draw_window(), _window_update_content_size(), n_gui_add_window(), n_gui_process_event(), and n_gui_window_apply_autofit().

◆ content_w

float N_GUI_WINDOW::content_w

total content width computed from widgets (internal)

Definition at line 1039 of file n_gui.h.

Referenced by _draw_window(), _window_update_content_size(), n_gui_add_window(), n_gui_process_event(), and n_gui_window_apply_autofit().

◆ detach_flags

int N_GUI_WINDOW::detach_flags

options the window was detached with (N_GUI_DETACH_*), remembered so a close/open cycle and a restored layout can re-create the same native window

Definition at line 1084 of file n_gui.h.

Referenced by _n_gui_kv_apply_layout(), _native_own_chrome(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_open_window(), n_gui_process_event(), n_gui_save_layout_json(), and n_gui_window_detach().

◆ drag_ox

float N_GUI_WINDOW::drag_ox

drag offset x (internal)

Definition at line 1025 of file n_gui.h.

Referenced by n_gui_add_window(), and n_gui_process_event().

◆ drag_oy

float N_GUI_WINDOW::drag_oy

drag offset y (internal)

Definition at line 1027 of file n_gui.h.

Referenced by n_gui_add_window(), and n_gui_process_event().

◆ flags

◆ font

ALLEGRO_FONT* N_GUI_WINDOW::font

font for the title bar

Definition at line 1023 of file n_gui.h.

Referenced by _draw_window(), and n_gui_add_window().

◆ h

◆ id

◆ min_h

◆ min_w

◆ native

◆ native_close_pending

int N_GUI_WINDOW::native_close_pending

1 when the native window must be released at the next safe point (an ALLEGRO_EVENT_DISPLAY_CLOSE arrived, or the window was closed while detached).

Destroying a display from inside event processing would leave already-queued events pointing at freed memory, so n_gui_draw_detached performs the actual release once the queue has been drained.

Definition at line 1094 of file n_gui.h.

Referenced by _release_native_window(), _tb_button_action(), n_gui_add_window(), n_gui_close_window(), n_gui_draw_detached(), n_gui_open_window(), n_gui_process_event(), and n_gui_window_detach().

◆ native_drag_anchored

int N_GUI_WINDOW::native_drag_anchored

1 when the four native_drag_* fields hold a usable grab, that is when al_get_mouse_cursor_position worked.

0 falls the drag back to the display-local delta, which is all a platform without desktop cursor coordinates can offer.

Definition at line 1133 of file n_gui.h.

Referenced by _native_drag_begin(), n_gui_add_window(), n_gui_process_event(), and n_gui_window_detach().

◆ native_drag_cx

int N_GUI_WINDOW::native_drag_cx

desktop x of the mouse cursor when a native (N_GUI_DETACH_OWN_CHROME) title bar drag started.

Desktop coordinates are unaffected by the window moving, so the whole drag is expressed against this single grab point instead of accumulating display-local deltas.

Definition at line 1121 of file n_gui.h.

Referenced by _native_drag_begin(), n_gui_add_window(), and n_gui_process_event().

◆ native_drag_cy

int N_GUI_WINDOW::native_drag_cy

desktop y of the mouse cursor at the drag grab (see native_drag_cx)

Definition at line 1123 of file n_gui.h.

Referenced by _native_drag_begin(), n_gui_add_window(), and n_gui_process_event().

◆ native_drag_wx

int N_GUI_WINDOW::native_drag_wx

native window x at the drag grab, the move is native_drag_wx plus the desktop cursor travel since the grab

Definition at line 1126 of file n_gui.h.

Referenced by _native_drag_begin(), n_gui_add_window(), and n_gui_process_event().

◆ native_drag_wy

int N_GUI_WINDOW::native_drag_wy

native window y at the drag grab (see native_drag_wx)

Definition at line 1128 of file n_gui.h.

Referenced by _native_drag_begin(), n_gui_add_window(), and n_gui_process_event().

◆ native_h

float N_GUI_WINDOW::native_h

last known native window height (see native_w)

Definition at line 1111 of file n_gui.h.

Referenced by _release_native_window(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_process_event(), n_gui_save_layout_json(), and n_gui_window_detach().

◆ native_halted

int N_GUI_WINDOW::native_halted

1 while the native window's drawing is halted.

Set on ALLEGRO_EVENT_DISPLAY_HALT_DRAWING and cleared on RESUME_DRAWING, both acknowledged to Allegro. n_gui_draw_detached skips a halted window: drawing into one is undefined, and on Android the OS has taken the surface away entirely.

Definition at line 1139 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_draw_detached(), n_gui_process_event(), and n_gui_window_native_is_hidden().

◆ native_pos_x

int N_GUI_WINDOW::native_pos_x

last known native window position on the desktop, applied when the native window is re-created.

INT_MIN means "unknown, let the OS place it".

Definition at line 1114 of file n_gui.h.

Referenced by _release_native_window(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_process_event(), n_gui_save_layout_json(), and n_gui_window_detach().

◆ native_pos_y

int N_GUI_WINDOW::native_pos_y

last known native window y position (see native_pos_x)

Definition at line 1116 of file n_gui.h.

Referenced by _release_native_window(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_process_event(), n_gui_save_layout_json(), and n_gui_window_detach().

◆ native_w

float N_GUI_WINDOW::native_w

last known native window width, 0 until the window is first detached.

Tracked across resizes and persisted, so a re-created native window comes back at the size the user left it rather than at the pop-up's size.

Definition at line 1109 of file n_gui.h.

Referenced by _release_native_window(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_process_event(), n_gui_save_layout_json(), and n_gui_window_detach().

◆ norm_h

float N_GUI_WINDOW::norm_h

normalized height (fraction of reference display height, used in SCALE mode)

Definition at line 1067 of file n_gui.h.

Referenced by _n_gui_window_capture_normalized(), n_gui_add_window(), n_gui_apply_adaptive_resize(), n_gui_load_layout_json(), and n_gui_save_layout_json().

◆ norm_w

float N_GUI_WINDOW::norm_w

normalized width (fraction of reference display width, used in SCALE mode)

Definition at line 1065 of file n_gui.h.

Referenced by _n_gui_window_capture_normalized(), n_gui_add_window(), n_gui_apply_adaptive_resize(), n_gui_load_layout_json(), and n_gui_save_layout_json().

◆ norm_x

float N_GUI_WINDOW::norm_x

normalized position x (0.0-1.0 fraction of reference display width)

Definition at line 1061 of file n_gui.h.

Referenced by _n_gui_window_capture_normalized(), n_gui_add_window(), n_gui_apply_adaptive_resize(), n_gui_load_layout_json(), and n_gui_save_layout_json().

◆ norm_y

float N_GUI_WINDOW::norm_y

normalized position y (0.0-1.0 fraction of reference display height)

Definition at line 1063 of file n_gui.h.

Referenced by _n_gui_window_capture_normalized(), n_gui_add_window(), n_gui_apply_adaptive_resize(), n_gui_load_layout_json(), and n_gui_save_layout_json().

◆ on_content_draw

void(* N_GUI_WINDOW::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, at the window's z-order (NULL = none).

Lets a caller add custom immediate-mode rendering that is correctly occluded by any window drawn on top of this one.

Definition at line 1074 of file n_gui.h.

Referenced by n_gui_draw(), n_gui_draw_detached(), and n_gui_window_set_content_draw_callback().

◆ on_content_draw_data

void* N_GUI_WINDOW::on_content_draw_data

user data passed to on_content_draw

Definition at line 1076 of file n_gui.h.

Referenced by n_gui_draw(), n_gui_draw_detached(), and n_gui_window_set_content_draw_callback().

◆ resize_policy

int N_GUI_WINDOW::resize_policy

◆ saved_flags

int N_GUI_WINDOW::saved_flags

embedded feature flags saved by n_gui_window_detach (a detached window is forced frameless because the OS draws the title bar)

Definition at line 1105 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_attach(), and n_gui_window_detach().

◆ saved_h

float N_GUI_WINDOW::saved_h

embedded height saved by n_gui_window_detach, restored by n_gui_window_attach

Examples
ex_gui_multiwin.c.

Definition at line 1102 of file n_gui.h.

Referenced by main(), n_gui_add_window(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_attach(), and n_gui_window_detach().

◆ saved_w

float N_GUI_WINDOW::saved_w

embedded width saved by n_gui_window_detach, restored by n_gui_window_attach

Examples
ex_gui_multiwin.c.

Definition at line 1100 of file n_gui.h.

Referenced by main(), n_gui_add_window(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_attach(), and n_gui_window_detach().

◆ saved_x

float N_GUI_WINDOW::saved_x

embedded x saved by n_gui_window_detach, restored by n_gui_window_attach

Definition at line 1096 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_attach(), and n_gui_window_detach().

◆ saved_y

float N_GUI_WINDOW::saved_y

embedded y saved by n_gui_window_detach, restored by n_gui_window_attach

Definition at line 1098 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_attach(), and n_gui_window_detach().

◆ scroll_x

float N_GUI_WINDOW::scroll_x

horizontal scroll offset for auto-scrollbar (pixels)

Definition at line 1035 of file n_gui.h.

Referenced by _datagrid_resize_hover(), _draw_window(), _find_widget_window(), _tooltip_widget_at(), n_gui_add_window(), n_gui_process_event(), n_gui_window_attach(), and n_gui_window_detach().

◆ scroll_y

float N_GUI_WINDOW::scroll_y

vertical scroll offset for auto-scrollbar (pixels)

Definition at line 1033 of file n_gui.h.

Referenced by _datagrid_resize_hover(), _draw_window(), _find_widget_window(), _tooltip_widget_at(), n_gui_add_window(), n_gui_process_event(), n_gui_window_attach(), and n_gui_window_detach().

◆ state

◆ tb_buttons

◆ theme

N_GUI_THEME N_GUI_WINDOW::theme

color theme for this window chrome

Examples
ex_gui_multiwin.c.

Definition at line 1021 of file n_gui.h.

Referenced by _draw_window(), n_gui_add_window(), n_gui_draw_detached(), n_gui_load_theme_json(), n_gui_reset_all_widget_themes(), and sample_chrome_titlebar().

◆ title

◆ titlebar_bitmap

ALLEGRO_BITMAP* N_GUI_WINDOW::titlebar_bitmap

optional bitmap for the titlebar background (NULL = color fill)

Definition at line 1047 of file n_gui.h.

Referenced by _draw_window(), and n_gui_window_set_bitmaps().

◆ titlebar_h

float N_GUI_WINDOW::titlebar_h

◆ w

◆ want_native

int N_GUI_WINDOW::want_native

1 when the window should live in a native OS window: set by n_gui_window_detach and by a loaded layout, cleared by n_gui_window_attach.

n_gui_open_window re-creates the native window when this is set.

Definition at line 1088 of file n_gui.h.

Referenced by n_gui_add_window(), n_gui_draw_detached(), n_gui_load_layout_json(), n_gui_open_window(), n_gui_save_layout_json(), n_gui_window_attach(), and n_gui_window_detach().

◆ widgets

◆ x

◆ y

◆ z_order

int N_GUI_WINDOW::z_order

z-order mode (N_GUI_ZORDER_NORMAL, _ALWAYS_ON_TOP, _ALWAYS_BEHIND, _FIXED)

Definition at line 1041 of file n_gui.h.

Referenced by _zorder_group(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_lower_window(), n_gui_raise_window(), n_gui_save_layout_json(), n_gui_window_get_zorder(), and n_gui_window_set_zorder().

◆ z_value

int N_GUI_WINDOW::z_value

z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top)

Definition at line 1043 of file n_gui.h.

Referenced by _sort_windows_by_zorder(), n_gui_add_window(), n_gui_load_layout_json(), n_gui_save_layout_json(), n_gui_window_get_zvalue(), and n_gui_window_set_zorder().

Macro Definition Documentation

◆ N_GUI_ALIGN_CENTER

#define N_GUI_ALIGN_CENTER   1

center aligned text

Examples
ex_gui.c.

Definition at line 191 of file n_gui.h.

◆ N_GUI_ALIGN_JUSTIFIED

#define N_GUI_ALIGN_JUSTIFIED   3

justified text (spread words to fill width)

Examples
ex_gui.c, ex_gui_bench.c, and ex_gui_dictionary.c.

Definition at line 195 of file n_gui.h.

◆ N_GUI_ALIGN_LEFT

#define N_GUI_ALIGN_LEFT   0

◆ N_GUI_ALIGN_RIGHT

#define N_GUI_ALIGN_RIGHT   2

right aligned text

Examples
ex_gui.c.

Definition at line 193 of file n_gui.h.

◆ N_GUI_AUTOFIT_CENTER

#define N_GUI_AUTOFIT_CENTER   16

center the window on its insertion point after auto-fit (overrides EXPAND_LEFT/EXPAND_UP for centering)

Examples
ex_gui.c.

Definition at line 304 of file n_gui.h.

◆ N_GUI_AUTOFIT_EXPAND_LEFT

#define N_GUI_AUTOFIT_EXPAND_LEFT   4

expand leftward instead of rightward when adjusting width

Definition at line 300 of file n_gui.h.

◆ N_GUI_AUTOFIT_EXPAND_UP

#define N_GUI_AUTOFIT_EXPAND_UP   8

expand upward instead of downward when adjusting height

Definition at line 302 of file n_gui.h.

◆ N_GUI_AUTOFIT_H

#define N_GUI_AUTOFIT_H   2

auto-adjust window height to content

Definition at line 296 of file n_gui.h.

◆ N_GUI_AUTOFIT_W

#define N_GUI_AUTOFIT_W   1

auto-adjust window width to content

Definition at line 294 of file n_gui.h.

◆ N_GUI_AUTOFIT_WH

#define N_GUI_AUTOFIT_WH   3

auto-adjust both width and height (convenience: W|H)

Examples
ex_gui.c.

Definition at line 298 of file n_gui.h.

◆ N_GUI_COMBOBOX_AUTO_WIDTH

#define N_GUI_COMBOBOX_AUTO_WIDTH   1

dropdown panel expands to fit the longest item text

Definition at line 738 of file n_gui.h.

◆ N_GUI_COMBOBOX_EXPAND_UP

#define N_GUI_COMBOBOX_EXPAND_UP   2

dropdown panel opens upward (above the widget) instead of downward.

Useful for bottom-anchored comboboxes where the default downward panel would render off-screen. Without the flag, an auto-flip fallback still kicks in whenever the panel doesn't fit below and does fit above.

Definition at line 743 of file n_gui.h.

◆ N_GUI_DETACH_NONE

#define N_GUI_DETACH_NONE   0

no option

Definition at line 248 of file n_gui.h.

◆ N_GUI_DETACH_OWN_CHROME

#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.

Dragging the title bar moves the OS window, the resize grip resizes it, and the minimise / maximise / close buttons act on it.

Without this flag (the default) the OS supplies the title bar and all of the above is the window manager's job. Frameless windows are the less well trodden path on some window managers, which is why this is opt-in.

Examples
ex_gui_detach.c, and ex_gui_multiwin.c.

Definition at line 266 of file n_gui.h.

◆ N_GUI_DETACH_RESIZABLE

#define N_GUI_DETACH_RESIZABLE   1

the native window can be resized by the user through the OS window manager

Examples
ex_gui_detach.c, and ex_gui_multiwin.c.

Definition at line 250 of file n_gui.h.

◆ N_GUI_DETACH_SCALE_CONTENT

#define N_GUI_DETACH_SCALE_CONTENT   2

scale the window's widgets when the native window is resized by the user.

Requires N_GUI_DETACH_RESIZABLE and normalized widget coords, which n_gui_window_detach captures at detach time. Without it the widgets keep their pixel layout and the extra room is just empty space (or scrolled, when the window carries N_GUI_WIN_AUTO_SCROLLBAR).

Examples
ex_gui_detach.c.

Definition at line 256 of file n_gui.h.

◆ N_GUI_DROP_AFTER

#define N_GUI_DROP_AFTER   2

Definition at line 2466 of file n_gui.h.

◆ N_GUI_DROP_BEFORE

#define N_GUI_DROP_BEFORE   0

drop position relative to a tree row (drag-and-drop)

Definition at line 2464 of file n_gui.h.

◆ N_GUI_DROP_INTO

#define N_GUI_DROP_INTO   1

Definition at line 2465 of file n_gui.h.

◆ N_GUI_DROPMENU_EXPAND_UP

#define N_GUI_DROPMENU_EXPAND_UP   1

dropdown panel opens upward (above the button) instead of downward.

Auto-flip fallback (pick direction based on available space) also kicks in whenever the panel doesn't fit below and does fit above.

Definition at line 840 of file n_gui.h.

◆ N_GUI_ID_MAX

#define N_GUI_ID_MAX   128

maximum length for widget id/name strings

Examples
ex_gui.c.

Definition at line 85 of file n_gui.h.

◆ N_GUI_IMAGE_CENTER

#define N_GUI_IMAGE_CENTER   2

draw at original size, centered

Examples
ex_gui.c.

Definition at line 185 of file n_gui.h.

◆ N_GUI_IMAGE_FIT

#define N_GUI_IMAGE_FIT   0

scale to fit within bounds, keep aspect ratio

Examples
ex_gui.c.

Definition at line 181 of file n_gui.h.

◆ N_GUI_IMAGE_STRETCH

#define N_GUI_IMAGE_STRETCH   1

stretch to fill bounds

Examples
ex_gui.c.

Definition at line 183 of file n_gui.h.

◆ N_GUI_KEY_MOD_MASK

#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

Definition at line 372 of file n_gui.h.

◆ N_GUI_KEY_SOURCES_MAX

#define N_GUI_KEY_SOURCES_MAX   8

maximum number of source widgets for a focused key binding

Definition at line 375 of file n_gui.h.

◆ N_GUI_KV_MAX

#define N_GUI_KV_MAX   128

maximum number of rows in a KV table

Definition at line 2549 of file n_gui.h.

◆ N_GUI_PERSIST_MAX_COLS

#define N_GUI_PERSIST_MAX_COLS   64

Maximum datagrid columns whose layout is persisted per widget.

Definition at line 1335 of file n_gui.h.

◆ N_GUI_RESIZE_ADAPTIVE

#define N_GUI_RESIZE_ADAPTIVE   1

virtual size tracks display; windows adapt per their resize_policy

Examples
ex_gui.c, and ex_gui_kvtable.c.

Definition at line 282 of file n_gui.h.

◆ N_GUI_RESIZE_VIRTUAL

#define N_GUI_RESIZE_VIRTUAL   0

fixed virtual canvas with uniform scaling (default/existing behavior)

Definition at line 280 of file n_gui.h.

◆ N_GUI_SCROLLBAR_H

#define N_GUI_SCROLLBAR_H   0

horizontal scrollbar

Examples
ex_gui.c.

Definition at line 167 of file n_gui.h.

◆ N_GUI_SCROLLBAR_V

#define N_GUI_SCROLLBAR_V   1

vertical scrollbar

Examples
ex_gui.c.

Definition at line 169 of file n_gui.h.

◆ N_GUI_SECTION_WIDGETS_MAX

#define N_GUI_SECTION_WIDGETS_MAX   48

maximum number of member widgets per section

Definition at line 2398 of file n_gui.h.

◆ N_GUI_SECTIONLIST_MAX

#define N_GUI_SECTIONLIST_MAX   16

maximum number of foldable sections in a section list

Definition at line 2395 of file n_gui.h.

◆ N_GUI_SELECT_MULTIPLE

#define N_GUI_SELECT_MULTIPLE   2

multiple item selection

Examples
ex_gui.c.

Definition at line 177 of file n_gui.h.

◆ N_GUI_SELECT_NONE

#define N_GUI_SELECT_NONE   0

no selection allowed (display only)

Examples
ex_gui_network.c.

Definition at line 173 of file n_gui.h.

◆ N_GUI_SELECT_SINGLE

#define N_GUI_SELECT_SINGLE   1

single item selection

Examples
ex_gui.c, ex_gui_bench.c, ex_gui_detach.c, ex_gui_dictionary.c, and ex_gui_isometric.c.

Definition at line 175 of file n_gui.h.

◆ N_GUI_SHAPE_BITMAP

#define N_GUI_SHAPE_BITMAP   2

bitmap-based rendering

Definition at line 151 of file n_gui.h.

◆ N_GUI_SHAPE_RECT

#define N_GUI_SHAPE_RECT   0

rectangle shape (default)

Examples
ex_gui.c, ex_gui_dropmenu.c, and ex_gui_multiwin.c.

Definition at line 147 of file n_gui.h.

◆ N_GUI_SHAPE_ROUNDED

#define N_GUI_SHAPE_ROUNDED   1

◆ N_GUI_SLIDER_H

#define N_GUI_SLIDER_H   0

horizontal slider (default)

Definition at line 161 of file n_gui.h.

◆ N_GUI_SLIDER_PERCENT

#define N_GUI_SLIDER_PERCENT   1

slider uses 0-100 percentage

Examples
ex_gui.c, and ex_gui_detach.c.

Definition at line 157 of file n_gui.h.

◆ N_GUI_SLIDER_V

#define N_GUI_SLIDER_V   1

vertical slider

Definition at line 163 of file n_gui.h.

◆ N_GUI_SLIDER_VALUE

#define N_GUI_SLIDER_VALUE   0

slider uses raw start/end values

Examples
ex_gui.c, and ex_gui_isometric.c.

Definition at line 155 of file n_gui.h.

◆ N_GUI_SPLIT_HORIZONTAL

#define N_GUI_SPLIT_HORIZONTAL   1

split pane: horizontal divider, regions are top and bottom

Examples
ex_gui_layout_persist.c.

Definition at line 130 of file n_gui.h.

◆ N_GUI_SPLIT_VERTICAL

#define N_GUI_SPLIT_VERTICAL   0

split pane: vertical divider, regions are left and right

Examples
ex_gui_layout_persist.c, ex_gui_splitpane.c, and ex_gui_zorder.c.

Definition at line 128 of file n_gui.h.

◆ N_GUI_STATE_ACTIVE

#define N_GUI_STATE_ACTIVE   2

widget is being pressed / dragged

Definition at line 203 of file n_gui.h.

◆ N_GUI_STATE_FOCUSED

#define N_GUI_STATE_FOCUSED   4

widget has keyboard focus

Definition at line 205 of file n_gui.h.

◆ N_GUI_STATE_HOVER

#define N_GUI_STATE_HOVER   1

mouse is hovering the widget

Examples
ex_gui_dropmenu.c.

Definition at line 201 of file n_gui.h.

◆ N_GUI_STATE_IDLE

#define N_GUI_STATE_IDLE   0

widget is idle / normal state

Definition at line 199 of file n_gui.h.

◆ N_GUI_STATE_SCROLLBAR_DRAG

#define N_GUI_STATE_SCROLLBAR_DRAG   8

widget scrollbar is being dragged

Definition at line 207 of file n_gui.h.

◆ N_GUI_SYNTAX_HTTP

#define N_GUI_SYNTAX_HTTP   1

syntax view: HTTP message highlighting (request/status line and headers)

Examples
ex_gui_syntaxview.c.

Definition at line 135 of file n_gui.h.

◆ N_GUI_SYNTAX_JS

#define N_GUI_SYNTAX_JS   5

syntax view: JavaScript highlighting (keywords, strings, numbers, comments)

Examples
ex_gui_syntaxview.c.

Definition at line 143 of file n_gui.h.

◆ N_GUI_SYNTAX_JSON

#define N_GUI_SYNTAX_JSON   2

syntax view: JSON highlighting (keys, strings, numbers, punctuation)

Examples
ex_gui_bench.c, and ex_gui_syntaxview.c.

Definition at line 137 of file n_gui.h.

◆ N_GUI_SYNTAX_PLAIN

#define N_GUI_SYNTAX_PLAIN   0

syntax view: no highlighting

Examples
ex_gui_syntaxview.c.

Definition at line 133 of file n_gui.h.

◆ N_GUI_SYNTAX_XML

#define N_GUI_SYNTAX_XML   3

syntax view: XML/HTML highlighting (tags, attributes, quoted values, comments)

Examples
ex_gui_syntaxview.c.

Definition at line 139 of file n_gui.h.

◆ N_GUI_SYNTAX_YAML

#define N_GUI_SYNTAX_YAML   4

syntax view: YAML highlighting (keys, quoted values, list markers, comments)

Examples
ex_gui_syntaxview.c.

Definition at line 141 of file n_gui.h.

◆ N_GUI_TAB_MAX

#define N_GUI_TAB_MAX   16

maximum number of tabs in a single tab panel

Definition at line 2363 of file n_gui.h.

◆ N_GUI_TB_BTN_CLOSE

#define N_GUI_TB_BTN_CLOSE   3

close titlebar button

Examples
ex_gui.c.

Definition at line 276 of file n_gui.h.

◆ N_GUI_TB_BTN_MAXIMIZE

#define N_GUI_TB_BTN_MAXIMIZE   2

maximize/restore titlebar button

Definition at line 274 of file n_gui.h.

◆ N_GUI_TB_BTN_MINIMIZE

#define N_GUI_TB_BTN_MINIMIZE   1

minimize titlebar button

Definition at line 272 of file n_gui.h.

◆ N_GUI_TB_BTN_NONE

#define N_GUI_TB_BTN_NONE   0

no titlebar button

Definition at line 270 of file n_gui.h.

◆ N_GUI_TEXT_MAX

#define N_GUI_TEXT_MAX   4096

maximum length for textarea content

Definition at line 87 of file n_gui.h.

◆ N_GUI_TREE_MAX

#define N_GUI_TREE_MAX   2048

maximum number of nodes in a tree view

Definition at line 2451 of file n_gui.h.

◆ N_GUI_TYPE_BUTTON

#define N_GUI_TYPE_BUTTON   1

widget type: button

Definition at line 91 of file n_gui.h.

◆ N_GUI_TYPE_CHECKBOX

#define N_GUI_TYPE_CHECKBOX   4

widget type: checkbox

Definition at line 97 of file n_gui.h.

◆ N_GUI_TYPE_COMBOBOX

#define N_GUI_TYPE_COMBOBOX   8

widget type: combo box (dropdown)

Definition at line 105 of file n_gui.h.

◆ N_GUI_TYPE_CUSTOM

#define N_GUI_TYPE_CUSTOM   17

widget type: owner-draw custom widget (rendering delegated to a callback)

Examples
ex_gui_custom.c.

Definition at line 125 of file n_gui.h.

◆ N_GUI_TYPE_DATAGRID

#define N_GUI_TYPE_DATAGRID   15

widget type: sortable column data grid

Definition at line 119 of file n_gui.h.

◆ N_GUI_TYPE_DROPMENU

#define N_GUI_TYPE_DROPMENU   11

widget type: dropdown menu with static and dynamic entries

Examples
ex_gui_dropmenu.c.

Definition at line 111 of file n_gui.h.

◆ N_GUI_TYPE_HEXVIEW

#define N_GUI_TYPE_HEXVIEW   13

widget type: read-only hexadecimal byte viewer

Definition at line 115 of file n_gui.h.

◆ N_GUI_TYPE_IMAGE

#define N_GUI_TYPE_IMAGE   9

widget type: image display

Definition at line 107 of file n_gui.h.

◆ N_GUI_TYPE_LABEL

#define N_GUI_TYPE_LABEL   10

widget type: static text label (with optional hyperlink)

Definition at line 109 of file n_gui.h.

◆ N_GUI_TYPE_LISTBOX

#define N_GUI_TYPE_LISTBOX   6

widget type: listbox (selectable list)

Definition at line 101 of file n_gui.h.

◆ N_GUI_TYPE_PROGRESSBAR

#define N_GUI_TYPE_PROGRESSBAR   16

widget type: horizontal progress bar (display only)

Definition at line 122 of file n_gui.h.

◆ N_GUI_TYPE_RADIOLIST

#define N_GUI_TYPE_RADIOLIST   7

widget type: radio list (single select radio buttons)

Definition at line 103 of file n_gui.h.

◆ N_GUI_TYPE_SCROLLBAR

#define N_GUI_TYPE_SCROLLBAR   5

widget type: scrollbar

Definition at line 99 of file n_gui.h.

◆ N_GUI_TYPE_SLIDER

#define N_GUI_TYPE_SLIDER   2

widget type: slider

Definition at line 93 of file n_gui.h.

◆ N_GUI_TYPE_SPLITPANE

#define N_GUI_TYPE_SPLITPANE   12

widget type: split pane with a draggable divider between two regions

Definition at line 113 of file n_gui.h.

◆ N_GUI_TYPE_SYNTAXVIEW

#define N_GUI_TYPE_SYNTAXVIEW   14

widget type: read-only syntax-highlighted text view

Definition at line 117 of file n_gui.h.

◆ N_GUI_TYPE_TEXTAREA

#define N_GUI_TYPE_TEXTAREA   3

widget type: text area

Examples
ex_gui_placeholder.c.

Definition at line 95 of file n_gui.h.

◆ N_GUI_WIN_AUTO_SCROLLBAR

#define N_GUI_WIN_AUTO_SCROLLBAR   16

enable automatic scrollbars when content exceeds window size

Examples
ex_gui.c.

Definition at line 227 of file n_gui.h.

◆ N_GUI_WIN_BTN_ALL

enable all three title bar buttons (minimize + maximize + close)

Examples
ex_gui_detach.c, and ex_gui_multiwin.c.

Definition at line 241 of file n_gui.h.

◆ N_GUI_WIN_BTN_CLOSE

#define N_GUI_WIN_BTN_CLOSE   1024

enable close button on the title bar

Definition at line 239 of file n_gui.h.

◆ N_GUI_WIN_BTN_MAXIMIZE

#define N_GUI_WIN_BTN_MAXIMIZE   512

enable maximize/restore button on the title bar

Definition at line 237 of file n_gui.h.

◆ N_GUI_WIN_BTN_MINIMIZE

#define N_GUI_WIN_BTN_MINIMIZE   256

enable minimize button on the title bar

Examples
ex_gui_detach.c.

Definition at line 235 of file n_gui.h.

◆ N_GUI_WIN_DRAGGING

#define N_GUI_WIN_DRAGGING   4

window is being dragged

Examples
ex_gui_multiwin.c.

Definition at line 215 of file n_gui.h.

◆ N_GUI_WIN_FIXED_POSITION

#define N_GUI_WIN_FIXED_POSITION   64

disable window dragging (default:enable)

Examples
ex_gui.c, ex_gui_dictionary.c, and ex_gui_network.c.

Definition at line 231 of file n_gui.h.

◆ N_GUI_WIN_FRAMELESS

#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

Examples
ex_gui.c, ex_gui_datagrid.c, ex_gui_dropmenu.c, ex_gui_multiwin.c, ex_gui_reentrant.c, and ex_gui_zorder.c.

Definition at line 233 of file n_gui.h.

◆ N_GUI_WIN_HSCROLL_DRAG

#define N_GUI_WIN_HSCROLL_DRAG   32

window horizontal auto-scrollbar is being dragged

Definition at line 221 of file n_gui.h.

◆ N_GUI_WIN_MAXIMISED

#define N_GUI_WIN_MAXIMISED   64

window is maximised (full display size)

Examples
ex_gui_multiwin.c.

Definition at line 223 of file n_gui.h.

◆ N_GUI_WIN_MINIMISED

#define N_GUI_WIN_MINIMISED   2

window is minimised (title bar only)

Examples
ex_gui_multiwin.c.

Definition at line 213 of file n_gui.h.

◆ N_GUI_WIN_NO_HSCROLL

#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

Examples
ex_gui.c.

Definition at line 244 of file n_gui.h.

◆ N_GUI_WIN_OPEN

#define N_GUI_WIN_OPEN   1

window is visible

Definition at line 211 of file n_gui.h.

◆ N_GUI_WIN_RESIZABLE

#define N_GUI_WIN_RESIZABLE   32

enable user-resizable window with a drag handle at bottom-right

Examples
ex_gui.c, ex_gui_detach.c, ex_gui_multiwin.c, and ex_gui_network.c.

Definition at line 229 of file n_gui.h.

◆ N_GUI_WIN_RESIZE_MOVE

#define N_GUI_WIN_RESIZE_MOVE   1

reposition proportionally, keep pixel size

Examples
ex_gui.c, and ex_gui_kvtable.c.

Definition at line 288 of file n_gui.h.

◆ N_GUI_WIN_RESIZE_NONE

#define N_GUI_WIN_RESIZE_NONE   0

no adaptation: absolute position and size unchanged

Examples
ex_gui.c.

Definition at line 286 of file n_gui.h.

◆ N_GUI_WIN_RESIZE_SCALE

#define N_GUI_WIN_RESIZE_SCALE   2

reposition AND resize proportionally, child widgets scale too

Examples
ex_gui.c, and ex_gui_kvtable.c.

Definition at line 290 of file n_gui.h.

◆ N_GUI_WIN_RESIZING

#define N_GUI_WIN_RESIZING   8

window is being resized

Examples
ex_gui_multiwin.c.

Definition at line 217 of file n_gui.h.

◆ N_GUI_WIN_VSCROLL_DRAG

#define N_GUI_WIN_VSCROLL_DRAG   16

window vertical auto-scrollbar is being dragged

Definition at line 219 of file n_gui.h.

◆ N_GUI_ZORDER_ALWAYS_BEHIND

#define N_GUI_ZORDER_ALWAYS_BEHIND   2

always drawn behind normal windows, cannot be raised above them

Definition at line 312 of file n_gui.h.

◆ N_GUI_ZORDER_ALWAYS_ON_TOP

#define N_GUI_ZORDER_ALWAYS_ON_TOP   1

always drawn on top of normal windows, cannot be lowered behind them

Definition at line 310 of file n_gui.h.

◆ N_GUI_ZORDER_FIXED

#define N_GUI_ZORDER_FIXED   3

fixed z-value: window is sorted within a dedicated group between ALWAYS_BEHIND and NORMAL windows.

The draw order of groups is: ALWAYS_BEHIND < FIXED < NORMAL < ALWAYS_ON_TOP < POPUP. Within the FIXED group, windows are ordered by z_value (lower = drawn first / behind, higher = drawn last / on top). z_value has no effect on other z-order modes. Windows with the same z_value preserve their relative list order (stable sort).

Definition at line 319 of file n_gui.h.

◆ N_GUI_ZORDER_NORMAL

#define N_GUI_ZORDER_NORMAL   0

default z-order: window participates in normal raise/lower ordering

Definition at line 308 of file n_gui.h.

◆ N_GUI_ZORDER_POPUP

#define N_GUI_ZORDER_POPUP   4

popup/modal dialogs: drawn above EVERYTHING including ALWAYS_ON_TOP windows.

Use for transient attention-demanding windows (confirmations, invitations, NPC dialogs, loot/reward popups, context menus). Unlike ALWAYS_ON_TOP, POPUP windows ARE raisable (n_gui_raise_window / click-to-raise) WITHIN their group, so the most recently opened/clicked popup wins among popups while none of them can ever be covered by HUD furniture.

Examples
ex_gui_reentrant.c.

Definition at line 326 of file n_gui.h.

Typedef Documentation

◆ N_GUI_CUSTOM_DRAW

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).

Invoked during n_gui_draw with the widget's absolute top-left screen position. The callback renders anything it likes inside the rectangle [x, y, x + widget->w, y + widget->h] using Allegro drawing primitives.

Parameters
widgetthe custom widget being drawn (read its w, h, theme, state)
xabsolute screen x of the widget's top-left corner
yabsolute screen y of the widget's top-left corner
fontthe effective font (the widget's own font, or the context default)
user_datathe user pointer passed to n_gui_add_custom

Definition at line 934 of file n_gui.h.

◆ n_gui_tree_on_drop_t

typedef int(* n_gui_tree_on_drop_t) (int src_node, int dst_node, int position, void *user_data)

drag-reorder drop callback.

Called when the user drags node src_node and releases the mouse over dst_node at position (N_GUI_DROP_BEFORE / INTO / AFTER). Return 1 to accept; the caller is responsible for mutating the underlying data model and rebuilding the tree. Return 0 to reject (widget clears its drag state silently).

Definition at line 2474 of file n_gui.h.

Function Documentation

◆ n_gui_add_button()

◆ n_gui_add_button_bitmap()

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(*)(int, void *)  on_click,
void *  user_data 
)

add a bitmap-based button widget

add a bitmap-based button widget

Returns
widget id, or -1 on error

Definition at line 2165 of file n_gui.c.

References N_GUI_BUTTON_DATA::bitmap, N_GUI_BUTTON_DATA::bitmap_active, N_GUI_BUTTON_DATA::bitmap_hover, N_GUI_WIDGET::data, n_gui_add_button(), n_gui_get_widget(), and N_GUI_SHAPE_BITMAP.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_checkbox()

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(*)(int, int, void *)  on_toggle,
void *  user_data 
)

◆ n_gui_add_combobox()

◆ n_gui_add_custom()

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.

The widget participates in the window layout, z-order, visibility, enable/ disable dimming, and resize like any other widget, but its interior is painted by draw during n_gui_draw. This is the general extension point for rendering a chart, a canvas, a custom editor, or any host-supplied content that no stock widget covers. Input is not routed to the widget (place stock widgets around it for interaction); the callback is paint-only.

Parameters
ctxthe GUI context
window_idthe window to add the widget to
xwidget x relative to the window
ywidget y relative to the window
wwidget width
hwidget height
drawthe paint callback (NULL draws nothing but reserves the space)
user_dataopaque pointer handed back to the callback (not owned by n_gui)
Returns
the new widget id, or -1 on error

Add an owner-draw custom widget to a window.

Definition at line 4315 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, N_GUI_CUSTOM_DATA::draw, Free, N_GUI_WIDGET::id, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_CUSTOM, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_CUSTOM_DATA::user_data, and N_GUI_WINDOW::widgets.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_datagrid()

int n_gui_add_datagrid ( N_GUI_CTX ctx,
int  window_id,
float  x,
float  y,
float  w,
float  h,
void(*)(int, int, void *)  on_select,
void *  user_data 
)

add a sortable data grid; returns the widget id or -1

add a sortable data grid; returns the widget id or -1

Parameters
ctxthe GUI context
window_idthe parent window id
xwidget x within the window content area
ywidget y within the window content area
wwidget width
hwidget height
on_selectcallback fired on row selection, or NULL
user_datauser data passed to on_select
Returns
widget id, or -1 on error

Definition at line 2787 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_DATAGRID_DATA::anchor_row, N_GUI_DATAGRID_DATA::cells, N_GUI_DATAGRID_DATA::col_order, N_GUI_DATAGRID_DATA::col_resize_col, N_GUI_DATAGRID_DATA::col_resize_w0, N_GUI_DATAGRID_DATA::col_resize_x0, N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::cols_cap, N_GUI_WIDGET::data, Free, N_GUI_DATAGRID_DATA::h_scroll, N_GUI_DATAGRID_DATA::h_scroll_dragging, N_GUI_WIDGET::id, list_push(), Malloc, N_GUI_DATAGRID_DATA::multiselect, n_gui_get_window(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_DATAGRID_DATA::on_columns_changed, N_GUI_DATAGRID_DATA::on_context, N_GUI_DATAGRID_DATA::on_select, N_GUI_DATAGRID_DATA::row_color, N_GUI_DATAGRID_DATA::row_has_color, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::rows_cap, N_GUI_DATAGRID_DATA::scroll_offset, N_GUI_DATAGRID_DATA::selected_row, N_GUI_DATAGRID_DATA::sort_col, N_GUI_DATAGRID_DATA::sort_dir, N_GUI_DATAGRID_DATA::user_data, and N_GUI_WINDOW::widgets.

Referenced by build_datagrid_window(), build_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_dropmenu()

int n_gui_add_dropmenu ( N_GUI_CTX ctx,
int  window_id,
const char *  label,
float  x,
float  y,
float  w,
float  h,
void(*)(int, void *)  on_open,
void *  on_open_user_data 
)

add a dropdown menu widget (button that opens a menu panel with entries)

Parameters
ctxthe GUI context
window_idid of the parent window
labelbutton label text
xhorizontal position
yvertical position
wwidget width
hwidget height
on_opencallback invoked when the menu is opened (or NULL)
on_open_user_datauser data passed to on_open callback
Returns
widget id, or -1 on error

add a dropdown menu widget (button that opens a menu panel with entries)

Returns
widget id, or -1 on error

Definition at line 4568 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, N_GUI_STYLE::dropmenu_max_visible, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_DATA::entries_capacity, N_GUI_DROPMENU_DATA::flags, Free, N_GUI_DROPMENU_DATA::highlight_index, N_GUI_WIDGET::id, N_GUI_DROPMENU_DATA::is_open, N_GUI_DROPMENU_DATA::item_height, N_GUI_DROPMENU_DATA::item_hover_bitmap, N_GUI_DROPMENU_DATA::label, list_push(), Malloc, N_GUI_DROPMENU_DATA::max_visible, n_gui_get_window(), N_GUI_ID_MAX, N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_DROPMENU_DATA::on_open, N_GUI_DROPMENU_DATA::on_open_user_data, N_GUI_DROPMENU_DATA::panel_bitmap, N_GUI_DROPMENU_DATA::scroll_offset, N_GUI_CTX::style, and N_GUI_WINDOW::widgets.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_hexview()

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

add a read-only hex viewer; returns the widget id or -1

Parameters
ctxthe GUI context
window_idthe parent window id
xwidget x within the window content area
ywidget y within the window content area
wwidget width
hwidget height
Returns
widget id, or -1 on error

Definition at line 2707 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_HEXVIEW_DATA::bytes_per_row, N_GUI_HEXVIEW_DATA::data, N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_HEXVIEW_DATA::len, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_HEXVIEW, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_HEXVIEW_DATA::scroll_offset, and N_GUI_WINDOW::widgets.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_image()

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

add an image widget

Parameters
ctxthe GUI context
window_idid of the parent window
xhorizontal position
yvertical position
wwidget width
hwidget height
bitmapthe bitmap to display (not owned by the widget)
scale_modeN_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER
Returns
widget id, or -1 on error

Definition at line 2937 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_IMAGE, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, and N_GUI_WINDOW::widgets.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_label()

◆ n_gui_add_label_link()

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(*)(int, const char *, void *)  on_link_click,
void *  user_data 
)

add a text label with hyperlink

add a text label with hyperlink

Returns
widget id, or -1 on error

Definition at line 3007 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LABEL_DATA::link, n_gui_add_label(), n_gui_get_widget(), N_GUI_TEXT_MAX, on_link_click(), N_GUI_LABEL_DATA::on_link_click, and N_GUI_LABEL_DATA::user_data.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_listbox()

int n_gui_add_listbox ( N_GUI_CTX ctx,
int  window_id,
float  x,
float  y,
float  w,
float  h,
int  selection_mode,
void(*)(int, int, int, void *)  on_select,
void *  user_data 
)

add a listbox widget

add a listbox widget

Parameters
ctxthe GUI context
window_idid of the parent window
xhorizontal position
yvertical position
wwidget width
hwidget height
selection_modeN_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, or N_GUI_SELECT_MULTIPLE
on_selectcallback invoked when an item is selected (or NULL)
user_datauser data passed to on_select callback
Returns
widget id, or -1 on error

Definition at line 2620 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_LISTBOX_DATA::hover_row, N_GUI_WIDGET::id, N_GUI_LISTBOX_DATA::item_height, N_GUI_LISTBOX_DATA::items, N_GUI_LISTBOX_DATA::items_capacity, list_push(), N_GUI_STYLE::listbox_default_item_height, Malloc, n_gui_get_window(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_LISTBOX_DATA::on_select, N_GUI_LISTBOX_DATA::scroll_offset, N_GUI_LISTBOX_DATA::selection_mode, N_GUI_CTX::style, N_GUI_LISTBOX_DATA::user_data, and N_GUI_WINDOW::widgets.

Referenced by build_widgets_window(), main(), main(), and n_gui_tree_create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_progressbar()

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

Definition at line 4253 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, N_GUI_WIDGET::enabled, Free, N_GUI_WIDGET::id, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_PROGRESSBAR, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_PROGRESSBAR_DATA::text, N_GUI_PROGRESSBAR_DATA::value, and N_GUI_WINDOW::widgets.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_radiolist()

int n_gui_add_radiolist ( N_GUI_CTX ctx,
int  window_id,
float  x,
float  y,
float  w,
float  h,
void(*)(int, int, void *)  on_select,
void *  user_data 
)

◆ n_gui_add_scrollbar()

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(*)(int, double, void *)  on_scroll,
void *  user_data 
)

◆ n_gui_add_slider()

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(*)(int, double, void *)  on_change,
void *  user_data 
)

◆ n_gui_add_splitpane()

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(*)(int, float, void *)  on_change,
void *  user_data 
)

add a split pane (draggable divider); returns the widget id or -1

add a split pane (draggable divider); returns the widget id or -1

Parameters
ctxthe GUI context
window_idthe parent window id
xwidget x within the window content area
ywidget y within the window content area
wwidget width
hwidget height
orientationN_GUI_SPLIT_VERTICAL or N_GUI_SPLIT_HORIZONTAL
ratioinitial divider position as a fraction (0..1)
on_changecallback fired while the divider is dragged, or NULL
user_datauser data passed to on_change
Returns
widget id, or -1 on error

Definition at line 2666 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, N_GUI_SPLITPANE_DATA::divider, Free, N_GUI_WIDGET::id, list_push(), Malloc, N_GUI_SPLITPANE_DATA::max_ratio, N_GUI_SPLITPANE_DATA::min_ratio, n_gui_get_window(), N_GUI_SPLIT_HORIZONTAL, N_GUI_SPLIT_VERTICAL, N_GUI_TYPE_SPLITPANE, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_SPLITPANE_DATA::on_change, N_GUI_SPLITPANE_DATA::orientation, N_GUI_SPLITPANE_DATA::ratio, N_GUI_SPLITPANE_DATA::user_data, and N_GUI_WINDOW::widgets.

Referenced by build_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_syntaxview()

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

add a read-only syntax-highlighted text view; returns the widget id or -1

Parameters
ctxthe GUI context
window_idthe parent window id
xwidget x within the window content area
ywidget y within the window content area
wwidget width
hwidget height
modehighlighting mode (N_GUI_SYNTAX_PLAIN, _HTTP, _JSON, _XML, _YAML or _JS)
Returns
widget id, or -1 on error

Definition at line 2745 of file n_gui.c.

References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_SYNTAXVIEW_DATA::len, list_push(), Malloc, mode, N_GUI_SYNTAXVIEW_DATA::mode, n_gui_get_window(), N_GUI_TYPE_SYNTAXVIEW, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_SYNTAXVIEW_DATA::scroll_offset, N_GUI_SYNTAXVIEW_DATA::sel_dragging, N_GUI_SYNTAXVIEW_DATA::sel_end, N_GUI_SYNTAXVIEW_DATA::sel_start, N_GUI_SYNTAXVIEW_DATA::text, and N_GUI_WINDOW::widgets.

Referenced by build_syntaxview_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_textarea()

◆ n_gui_add_toggle_button()

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(*)(int, void *)  on_click,
void *  user_data 
)

toggle button creation (returns widget id)

toggle button creation (returns widget id)

Parameters
ctxthe GUI context
window_idid of the parent window
labelbutton label text
xhorizontal position
yvertical position
wwidget width
hwidget height
shapebutton shape (N_GUI_SHAPE_*)
initial_state0 = off, 1 = on
on_clickcallback invoked on click (or NULL)
user_datauser data passed to on_click callback
Returns
widget id, or -1 on error

Definition at line 2193 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_add_button(), n_gui_get_widget(), N_GUI_BUTTON_DATA::toggle_mode, and N_GUI_BUTTON_DATA::toggled.

Referenced by main(), and n_gui_tab_add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_vslider()

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(*)(int, double, void *)  on_change,
void *  user_data 
)

add a vertical slider (same as n_gui_add_slider but oriented vertically)

add a vertical slider (same as n_gui_add_slider but oriented vertically)

Returns
widget id, or -1 on error

Definition at line 2484 of file n_gui.c.

References N_GUI_WIDGET::data, mode, n_gui_add_slider(), n_gui_get_widget(), and N_GUI_SLIDER_V.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_window()

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

add a window to the GUI context

Returns
the window id, or -1 on error

Definition at line 1063 of file n_gui.c.

References __n_assert, _destroy_window(), _n_gui_window_capture_normalized(), _sort_windows_by_zorder(), N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WINDOW::autofit_origin_x, N_GUI_WINDOW::autofit_origin_y, N_GUI_TB_BUTTONS::btn_theme, N_GUI_TB_BUTTONS::close_theme, N_GUI_PENDING_GEOM::consumed, N_GUI_WINDOW::content_h, N_GUI_WINDOW::content_w, N_GUI_CTX::default_tb_btn_theme, N_GUI_CTX::default_tb_close_theme, N_GUI_CTX::default_theme, N_GUI_WINDOW::detach_flags, N_GUI_CTX::dirty, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_WINDOW::drag_ox, N_GUI_WINDOW::drag_oy, N_GUI_WINDOW::flags, N_GUI_WINDOW::font, Free, N_GUI_WINDOW::h, N_GUI_PENDING_GEOM::h, N_GUI_WINDOW::id, list_push(), LOG_ERR, Malloc, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_DETACH_NONE, N_GUI_ID_MAX, N_GUI_RESIZE_ADAPTIVE, N_GUI_WIN_MAXIMISED, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WIN_RESIZE_NONE, N_GUI_ZORDER_NORMAL, n_log, N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_WINDOW::native_drag_anchored, N_GUI_WINDOW::native_drag_cx, N_GUI_WINDOW::native_drag_cy, N_GUI_WINDOW::native_drag_wx, N_GUI_WINDOW::native_drag_wy, N_GUI_WINDOW::native_h, N_GUI_WINDOW::native_halted, N_GUI_WINDOW::native_pos_x, N_GUI_WINDOW::native_pos_y, N_GUI_WINDOW::native_w, new_generic_list(), N_GUI_CTX::next_window_id, N_GUI_WINDOW::norm_h, N_GUI_WINDOW::norm_w, N_GUI_WINDOW::norm_x, N_GUI_WINDOW::norm_y, N_GUI_CTX::pending_layout, N_GUI_CTX::pending_layout_count, N_GUI_CTX::resize_mode, N_GUI_WINDOW::resize_policy, N_GUI_WINDOW::saved_flags, N_GUI_WINDOW::saved_h, N_GUI_WINDOW::saved_w, N_GUI_WINDOW::saved_x, N_GUI_WINDOW::saved_y, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::state, N_GUI_PENDING_GEOM::state, N_GUI_CTX::style, N_GUI_WINDOW::tb_buttons, N_GUI_WINDOW::theme, N_GUI_WINDOW::title, N_GUI_PENDING_GEOM::title, N_GUI_WINDOW::titlebar_h, N_GUI_STYLE::titlebar_h, UNLIMITED_LIST_ITEMS, N_GUI_WINDOW::w, N_GUI_PENDING_GEOM::w, N_GUI_WINDOW::want_native, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WINDOW::x, N_GUI_PENDING_GEOM::x, N_GUI_WINDOW::y, N_GUI_PENDING_GEOM::y, N_GUI_WINDOW::z_order, and N_GUI_WINDOW::z_value.

Referenced by build_datagrid_window(), build_panel(), build_syntaxview_window(), build_textarea_window(), build_widgets_window(), build_window(), main(), main(), and n_gui_add_window_auto().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_add_window_auto()

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)

add a window that sizes itself automatically to fit its widgets (call n_gui_window_autosize after adding all widgets)

Returns
the window id, or -1 on error

Definition at line 1942 of file n_gui.c.

References N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, n_gui_add_window(), and N_GUI_CTX::style.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_apply_adaptive_resize()

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.

Called automatically from n_gui_set_display_size() when in ADAPTIVE mode, but can also be called manually.

apply adaptive resize: reposition/resize all windows according to their policies for the new display dimensions.

Called automatically from n_gui_set_display_size() when in ADAPTIVE mode, but can also be called manually.

Definition at line 8978 of file n_gui.c.

References __n_assert, N_GUI_WINDOW::flags, N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_WIN_FRAMELESS, N_GUI_WIN_RESIZE_MOVE, N_GUI_WIN_RESIZE_NONE, N_GUI_WIN_RESIZE_SCALE, N_GUI_WINDOW::native, N_GUI_WIDGET::norm_h, N_GUI_WINDOW::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WINDOW::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WINDOW::norm_x, N_GUI_WIDGET::norm_y, N_GUI_WINDOW::norm_y, N_GUI_WINDOW::resize_policy, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.

Referenced by n_gui_set_display_size().

+ Here is the caller graph for this function:

◆ n_gui_button_is_toggled()

int n_gui_button_is_toggled ( N_GUI_CTX ctx,
int  widget_id 
)

check if button is toggled

check if button is toggled

Returns
1 if toggled on, 0 if off or not a toggle button

Definition at line 2209 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.

Referenced by main(), on_ghost_toggle(), on_ghost_toggle(), on_grid_toggle(), on_grid_toggle(), on_height_toggle(), on_height_toggle(), on_player_toggle(), on_player_toggle(), on_smooth_toggle(), and on_smooth_toggle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_button_set_keycode()

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.

When the key is pressed (with matching modifiers) and no text input widget has focus, the button's on_click callback is triggered. Pass keycode 0 to unbind. Use ALLEGRO_KEY_* constants for the keycode. When modifiers is 0, any modifier state matches (no modifier requirement). When modifiers is non-zero, only an exact match of the specified modifiers (masked by N_GUI_KEY_MOD_MASK) triggers the keybind. Example: n_gui_button_set_keycode(ctx, id, ALLEGRO_KEY_A, ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL)

Parameters
ctxGUI context
widget_idbutton widget id
keycodeALLEGRO_KEY_* constant, or 0 to unbind
modifiersALLEGRO_KEYMOD_* flags ORed together, or 0 for no requirement

bind a keyboard key with optional modifier requirements to a button.

When the key is pressed (with matching modifiers) and no text input widget has focus, the button's on_click callback is triggered (and toggle state flipped for toggle buttons). Pass keycode 0 to unbind. When modifiers is 0, any modifier state matches (no modifier requirement). When modifiers is non-zero, only an exact match triggers the keybind. Example: ALLEGRO_KEY_A with ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL

Definition at line 2411 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::keycode, n_gui_get_widget(), N_GUI_KEY_MOD_MASK, N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_button_set_keycode_focused()

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.

Unlike n_gui_button_set_keycode (global), this binding triggers only when the button itself or one of the listed source widgets currently has focus. This allows e.g. ENTER in a URL textarea to trigger a Send button without interfering with ENTER in other textareas.

Parameters
ctxGUI context
widget_idbutton widget id
keycodeALLEGRO_KEY_* constant, or 0 to unbind
modifiersALLEGRO_KEYMOD_* flags ORed together, or 0 for no requirement
sourcesarray of widget IDs whose focus can trigger this binding
source_countnumber of entries in sources (max N_GUI_KEY_SOURCES_MAX)

bind a keyboard key to a button that fires only when specific widgets have focus.

Definition at line 2421 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_BUTTON_DATA::key_focus_only, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::key_sources, N_GUI_BUTTON_DATA::keycode, n_gui_get_widget(), N_GUI_KEY_MOD_MASK, N_GUI_KEY_SOURCES_MAX, N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_button_set_label()

void n_gui_button_set_label ( N_GUI_CTX ctx,
int  widget_id,
const char *  label 
)

replace the label text drawn on a button

replace the label text drawn on a button

No-op on non-button widgets or NULL label.

Definition at line 2221 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_BUTTON_DATA::label, n_gui_get_widget(), N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.

Referenced by _n_gui_sectionlist_set_header_label(), and refresh_buttons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_button_set_state_bitmaps()

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)

skin a button or toggle button with caller-owned per-state bitmaps (switches its shape to N_GUI_SHAPE_BITMAP; toggled-on renders active)

Switches the button shape to N_GUI_SHAPE_BITMAP and assigns the three state bitmaps; a toggled-on toggle button renders active persistently (the draw path already maps toggled to the ACTIVE visual state). The bitmaps stay owned by the caller, exactly like n_gui_add_button_bitmap; the label keeps drawing on top, so pass "" at creation for icon-only buttons. No-op on non-button widgets.

Parameters
ctxthe GUI context
widget_idid of the target button widget
normalbitmap for the idle state
hoverbitmap for the hover state (NULL = normal)
activebitmap for the pressed / toggled-on state (NULL = normal)

Definition at line 2365 of file n_gui.c.

References N_GUI_BUTTON_DATA::bitmap, N_GUI_BUTTON_DATA::bitmap_active, N_GUI_BUTTON_DATA::bitmap_hover, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_SHAPE_BITMAP, N_GUI_TYPE_BUTTON, N_GUI_BUTTON_DATA::shape, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_button_set_toggle_mode()

void n_gui_button_set_toggle_mode ( N_GUI_CTX ctx,
int  widget_id,
int  toggle_mode 
)

set button toggle mode

set button toggle mode

Parameters
ctxthe GUI context
widget_idid of the target button widget
toggle_mode0 = momentary, 1 = toggle

Definition at line 2392 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_BUTTON, N_GUI_BUTTON_DATA::toggle_mode, N_GUI_BUTTON_DATA::toggled, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_button_set_toggled()

void n_gui_button_set_toggled ( N_GUI_CTX ctx,
int  widget_id,
int  toggled 
)

set button toggled state

set button toggled state

Definition at line 2379 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.

Referenced by main(), n_gui_tab_set_active(), on_height_toggle(), on_player_toggle(), on_proj_select(), and on_proj_select().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_checkbox_is_checked()

int n_gui_checkbox_is_checked ( N_GUI_CTX ctx,
int  widget_id 
)

check if checkbox is checked

check if checkbox is checked

Parameters
ctxGUI context
widget_idid of the checkbox widget
Returns
1 if checked, 0 otherwise

Definition at line 3290 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_CHECKBOX, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_checkbox_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a checkbox widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4847 of file n_gui.c.

References N_GUI_CHECKBOX_DATA::box_bitmap, N_GUI_CHECKBOX_DATA::box_checked_bitmap, N_GUI_CHECKBOX_DATA::box_hover_bitmap, N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_CHECKBOX, n_log, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_checkbox_set_checked()

void n_gui_checkbox_set_checked ( N_GUI_CTX ctx,
int  widget_id,
int  checked 
)

set checkbox checked state

set checkbox checked state

Parameters
ctxGUI context
widget_idid of the checkbox widget
checked1 to check, 0 to uncheck

Definition at line 3304 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_CHECKBOX, and N_GUI_WIDGET::type.

Referenced by n_gui_kvtable_add_row().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_close_window()

void n_gui_close_window ( N_GUI_CTX ctx,
int  window_id 
)

close (hide) a window

close (hide) a window

Definition at line 1191 of file n_gui.c.

References n_gui_get_window(), N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, and N_GUI_WINDOW::state.

Referenced by _tb_button_action(), main(), main(), n_gui_tab_set_active(), on_ghost_toggle(), and on_panel_close().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_combobox_add_item()

int n_gui_combobox_add_item ( N_GUI_CTX ctx,
int  widget_id,
const char *  text 
)

add an item to a combo box

Definition at line 4431 of file n_gui.c.

References _items_grow(), N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::items, N_GUI_COMBOBOX_DATA::items_capacity, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_combobox_clear()

void n_gui_combobox_clear ( N_GUI_CTX ctx,
int  widget_id 
)

remove all items from a combobox

remove all items from a combobox

Parameters
ctxGUI context
widget_idid of the combobox widget

Definition at line 4417 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::highlight_index, N_GUI_COMBOBOX_DATA::is_open, N_GUI_COMBOBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::nb_items, N_GUI_COMBOBOX_DATA::scroll_offset, N_GUI_COMBOBOX_DATA::selected_index, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_combobox_get_item_text()

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)

Definition at line 4461 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_combobox_get_selected()

int n_gui_combobox_get_selected ( N_GUI_CTX ctx,
int  widget_id 
)

get the selected item index

get the selected item index

Parameters
ctxGUI context
widget_idid of the combobox widget
Returns
index of the selected item, or -1 if none

Definition at line 4453 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_combobox_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a combobox widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4938 of file n_gui.c.

References N_GUI_COMBOBOX_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::item_bg_bitmap, N_GUI_COMBOBOX_DATA::item_selected_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, n_log, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_combobox_set_flags()

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)

set combobox feature flags (bitmask of N_GUI_COMBOBOX_* values)

Parameters
ctxGUI context. Must not be NULL.
widget_idCombobox widget id.
flagsBitmask of N_GUI_COMBOBOX_* values.

Definition at line 2915 of file n_gui.c.

References __n_assert, N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::flags, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_combobox_set_selected()

void n_gui_combobox_set_selected ( N_GUI_CTX ctx,
int  widget_id,
int  index 
)

set the selected item index

set the selected item index

Parameters
ctxGUI context
widget_idid of the combobox widget
indexindex of the item to select, or -1 for none

Definition at line 4478 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::selected_index, and N_GUI_WIDGET::type.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_count_detached()

int n_gui_count_detached ( N_GUI_CTX ctx)

count the windows currently detached into native OS windows

count the windows currently detached into native OS windows

Definition at line 1609 of file n_gui.c.

References __n_assert, list_foreach, N_GUI_WINDOW::native, and N_GUI_CTX::windows.

Referenced by main(), and refresh_buttons().

+ Here is the caller graph for this function:

◆ n_gui_datagrid_add_column()

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

Definition at line 3805 of file n_gui.c.

References N_GUI_DATAGRID_DATA::col_order, N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::cols_cap, N_GUI_WIDGET::data, FreeNoLog, Malloc, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_COL::title, N_GUI_WIDGET::type, N_GUI_DATAGRID_COL::visible, and N_GUI_DATAGRID_COL::width.

Referenced by build_datagrid_window(), build_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_add_row()

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

Definition at line 3862 of file n_gui.c.

References N_GUI_DATAGRID_DATA::cells, N_GUI_WIDGET::data, FreeNoLog, Malloc, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_color, N_GUI_DATAGRID_DATA::row_has_color, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::rows_cap, and N_GUI_WIDGET::type.

Referenced by build_datagrid_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_clear_row_color()

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)

Definition at line 4051 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_has_color, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_clear_row_colors()

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)

Definition at line 4069 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::row_has_color, N_GUI_DATAGRID_DATA::rows_cap, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_clear_rows()

void n_gui_datagrid_clear_rows ( N_GUI_CTX ctx,
int  widget_id 
)

◆ n_gui_datagrid_clear_selection()

void n_gui_datagrid_clear_selection ( N_GUI_CTX ctx,
int  widget_id 
)

clear the entire selection (no row selected)

Definition at line 4016 of file n_gui.c.

References N_GUI_DATAGRID_DATA::anchor_row, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::rows_cap, N_GUI_DATAGRID_DATA::selected_row, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_display_to_physical()

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

Definition at line 4150 of file n_gui.c.

References _datagrid_data(), _datagrid_phys(), and N_GUI_DATAGRID_DATA::nb_cols.

Referenced by _datagrid_apply_columns(), main(), and n_gui_save_layout_json().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_cell()

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

Definition at line 3944 of file n_gui.c.

References N_GUI_DATAGRID_DATA::cells, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DATAGRID_DATA::nb_rows, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_column_count()

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

Definition at line 4115 of file n_gui.c.

References _datagrid_data(), and N_GUI_DATAGRID_DATA::nb_cols.

Referenced by _apply_pending_widget(), main(), and n_gui_save_layout_json().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_column_title()

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

Definition at line 4120 of file n_gui.c.

References _datagrid_data(), N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::nb_cols, and N_GUI_DATAGRID_COL::title.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_column_visible()

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

Definition at line 4132 of file n_gui.c.

References _datagrid_data(), N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::nb_cols, and N_GUI_DATAGRID_COL::visible.

Referenced by main(), and n_gui_save_layout_json().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_column_width()

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

Definition at line 4144 of file n_gui.c.

References _datagrid_data(), N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::nb_cols, and N_GUI_DATAGRID_COL::width.

Referenced by main(), and n_gui_save_layout_json().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_h_scroll()

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 exceeds the widget's pane), or 0.

Read it before a rebuild and pass it back to n_gui_datagrid_set_h_scroll to preserve the horizontal view across a clear/refill.

Definition at line 4093 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_row_color()

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.

out may be NULL to just test.

Definition at line 4059 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_color, N_GUI_DATAGRID_DATA::row_has_color, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_row_count()

int n_gui_datagrid_get_row_count ( N_GUI_CTX ctx,
int  widget_id 
)

get the number of rows in a data grid

Definition at line 3938 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_scroll_offset()

int n_gui_datagrid_get_scroll_offset ( N_GUI_CTX ctx,
int  widget_id 
)

first visible data row (the vertical scroll position), or 0.

Read it before a rebuild and pass it back to n_gui_datagrid_set_scroll_offset so an in-place edit that clears and refills the grid does not jump the view back to the top.

Definition at line 4076 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_selected()

int n_gui_datagrid_get_selected ( N_GUI_CTX ctx,
int  widget_id 
)

get the selected row index, or -1 if none

Definition at line 3952 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_get_selected_rows()

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.

With multi-select disabled this reports the single selected row. out may be NULL to just count.

Definition at line 3995 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DATAGRID_DATA::multiselect, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::selected_row, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_is_row_selected()

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)

Definition at line 3986 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DATAGRID_DATA::multiselect, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::selected_row, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_move_column()

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)

Definition at line 4156 of file n_gui.c.

References _datagrid_data(), N_GUI_DATAGRID_DATA::col_order, and N_GUI_DATAGRID_DATA::nb_cols.

Referenced by _datagrid_apply_columns(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_select_row()

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.

a select-all action); selecting also makes it the primary selected row

Definition at line 4025 of file n_gui.c.

References _datagrid_ensure_sel(), N_GUI_DATAGRID_DATA::anchor_row, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::selected_row, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_column_visible()

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

Definition at line 4126 of file n_gui.c.

References _datagrid_data(), N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::nb_cols, and N_GUI_DATAGRID_COL::visible.

Referenced by _datagrid_apply_columns(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_column_width()

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)

Definition at line 4138 of file n_gui.c.

References _datagrid_data(), N_GUI_DATAGRID_DATA::cols, N_GUI_DATAGRID_DATA::nb_cols, and N_GUI_DATAGRID_COL::width.

Referenced by _datagrid_apply_columns(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_h_scroll()

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).

Pairs with n_gui_datagrid_get_h_scroll.

Definition at line 4099 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_multiselect()

void n_gui_datagrid_set_multiselect ( N_GUI_CTX ctx,
int  widget_id,
int  enabled 
)

enable (1) or disable (0) multi-row selection.

When enabled, a plain click selects one row, Ctrl-click toggles a row, and Shift-click selects the range from the anchor; all selected rows are highlighted. Single-select consumers are unaffected (the default is disabled).

Definition at line 3973 of file n_gui.c.

References _datagrid_ensure_sel(), N_GUI_DATAGRID_DATA::anchor_row, N_GUI_WIDGET::data, N_GUI_DATAGRID_DATA::multiselect, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::rows_cap, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_on_columns_changed()

void n_gui_datagrid_set_on_columns_changed ( N_GUI_CTX ctx,
int  widget_id,
void(*)(int, void *)  cb 
)

set the callback fired after the user drags a column border to resize it, so the host can persist the layout.

Pass NULL to disable.

Definition at line 4171 of file n_gui.c.

References _datagrid_data(), and N_GUI_DATAGRID_DATA::on_columns_changed.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_on_context()

void n_gui_datagrid_set_on_context ( N_GUI_CTX ctx,
int  widget_id,
void(*)(int, int, int, int, void *)  on_context 
)

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.

The callback shares the data grid's user_data. Pass NULL to disable.

Definition at line 3967 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_row_color()

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.

a rule engine coloring matching entries). The tint is drawn under the cell text and follows the row through a sort; the selection is drawn over it as a darkening wash plus an active border so a tinted row still reads as selected. Cell text switches to black or white per the tint luminance so it stays legible. Row colors are dropped by n_gui_datagrid_clear_rows() along with the rows they belong to.

Definition at line 4041 of file n_gui.c.

References _datagrid_ensure_colors(), N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::row_color, N_GUI_DATAGRID_DATA::row_has_color, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_scroll_offset()

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.

Pairs with n_gui_datagrid_get_scroll_offset to preserve the scroll position across a clear/refill.

Definition at line 4082 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_set_selected()

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)

Definition at line 3958 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DATAGRID, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_DATAGRID_DATA::on_select, N_GUI_DATAGRID_DATA::selected_row, N_GUI_WIDGET::type, and N_GUI_DATAGRID_DATA::user_data.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_datagrid_sort()

void n_gui_datagrid_sort ( N_GUI_CTX ctx,
int  widget_id,
int  col,
int  dir 
)

◆ n_gui_default_style()

N_GUI_STYLE n_gui_default_style ( void  )

return the built-in default style

return the built-in default style

Definition at line 788 of file n_gui.c.

References N_GUI_STYLE::checkbox_label_gap, N_GUI_STYLE::checkbox_label_offset, N_GUI_STYLE::checkbox_mark_margin, N_GUI_STYLE::checkbox_mark_thickness, N_GUI_STYLE::checkbox_max_size, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_STYLE::combobox_max_visible, N_GUI_STYLE::dropdown_arrow_half_h, N_GUI_STYLE::dropdown_arrow_half_w, N_GUI_STYLE::dropdown_arrow_reserve, N_GUI_STYLE::dropdown_arrow_thickness, N_GUI_STYLE::dropdown_border_thickness, N_GUI_STYLE::dropmenu_max_visible, N_GUI_STYLE::global_scroll_step, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_STYLE::label_padding, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, N_GUI_STYLE::listbox_default_item_height, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_STYLE::radio_circle_border_thickness, N_GUI_STYLE::radio_circle_min_r, N_GUI_STYLE::radio_inner_offset, N_GUI_STYLE::radio_label_gap, N_GUI_STYLE::radiolist_default_item_height, N_GUI_STYLE::scroll_step, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_thumb_corner_r, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_STYLE::scrollbar_track_color, N_GUI_STYLE::shape_mode, N_GUI_STYLE::slider_handle_border_thickness, N_GUI_STYLE::slider_handle_edge_offset, N_GUI_STYLE::slider_handle_min_r, N_GUI_STYLE::slider_track_border_thickness, N_GUI_STYLE::slider_track_corner_r, N_GUI_STYLE::slider_track_size, N_GUI_STYLE::slider_value_label_offset, N_GUI_STYLE::tb_btn_glyph_thickness, N_GUI_STYLE::tb_btn_right_margin, N_GUI_STYLE::tb_btn_size, N_GUI_STYLE::tb_btn_spacing, N_GUI_STYLE::textarea_cursor_blink_period, N_GUI_STYLE::textarea_cursor_width, N_GUI_STYLE::textarea_padding, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, N_GUI_STYLE::titlebar_h, N_GUI_STYLE::tooltip_bg, N_GUI_STYLE::tooltip_border, N_GUI_STYLE::tooltip_delay, and N_GUI_STYLE::tooltip_fg.

Referenced by n_gui_new_ctx().

+ Here is the caller graph for this function:

◆ n_gui_default_tb_btn_theme()

N_GUI_THEME n_gui_default_tb_btn_theme ( void  )

return the built-in default theme for titlebar minimize/maximize buttons

return the built-in default theme for titlebar minimize/maximize buttons

Semi-transparent, blends with the titlebar background.

Definition at line 728 of file n_gui.c.

References N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_THEME::selection_color, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, and N_GUI_THEME::text_normal.

Referenced by n_gui_default_tb_close_theme(), and n_gui_new_ctx().

+ Here is the caller graph for this function:

◆ n_gui_default_tb_close_theme()

N_GUI_THEME n_gui_default_tb_close_theme ( void  )

return the built-in default theme for the titlebar close button (red hover/active)

return the built-in default theme for the titlebar close button (red hover/active)

Same as the btn theme but with red hover/active backgrounds.

Definition at line 751 of file n_gui.c.

References N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, and n_gui_default_tb_btn_theme().

Referenced by n_gui_new_ctx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_default_theme()

N_GUI_THEME n_gui_default_theme ( void  )

◆ n_gui_destroy_ctx()

void n_gui_destroy_ctx ( N_GUI_CTX **  ctx)

destroy a GUI context and free all resources

destroy a GUI context and free all resources

Parameters
ctxpointer to the context pointer (set to NULL)

Definition at line 995 of file n_gui.c.

References __n_assert, _release_native_window(), destroy_ht(), Free, FreeNoLog, list_destroy(), list_foreach, n_clipboard_destroy(), and N_GUI_WINDOW::native.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_detect_dpi_scale()

float n_gui_detect_dpi_scale ( N_GUI_CTX ctx,
ALLEGRO_DISPLAY *  display 
)

detect and apply DPI scale from the given allegro display.

Works on Linux (X11/Wayland), Windows, and Android. Returns the detected scale factor.

detect and apply DPI scale from the given allegro display.

Detection strategy (cross-platform):

  • Compare the physical pixel size (framebuffer) to the logical window size. On HiDPI displays these differ (e.g. a 1920-logical window may have a 3840-pixel framebuffer on a 2x Retina display).
  • On Android, al_get_display_option(ALLEGRO_DEFAULT_DISPLAY_ADAPTER) and the framebuffer/window ratio gives the density scale.
  • On Windows with per-monitor DPI awareness, the ratio reflects the OS scaling percentage (125% = 1.25, 150% = 1.5, etc.).
  • On Linux/X11/Wayland, the ratio picks up Xft.dpi or Wayland scale factor if Allegro was built with the appropriate backend.

If the framebuffer and window sizes are both reported identically (no HiDPI support from the Allegro build), the function falls back to 1.0.

Returns
the detected scale factor (also stored in ctx->dpi_scale)

Definition at line 9113 of file n_gui.c.

References __n_assert, display, and N_GUI_CTX::dpi_scale.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_draw()

void n_gui_draw ( N_GUI_CTX ctx)

draw all visible GUI windows and widgets

draw all visible GUI windows and widgets

When a display size has been set (via n_gui_set_display_size) and the total GUI bounding box exceeds it, global scrollbars are drawn at the edges of the display and all windows are offset by the global scroll position.

Parameters
ctxthe GUI context

Definition at line 8542 of file n_gui.c.

References __n_assert, _compute_gui_bounds(), _draw_combobox_dropdown(), _draw_dropmenu_panel(), _draw_tooltip(), _draw_window(), _win_on_pass(), N_GUI_WINDOW::autofit_flags, N_GUI_CTX::default_font, N_GUI_CTX::dirty, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::global_scroll_x, N_GUI_CTX::global_scroll_y, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_WINDOW::id, list_foreach, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, n_gui_window_apply_autofit(), N_GUI_WINDOW::on_content_draw, N_GUI_WINDOW::on_content_draw_data, N_GUI_CTX::pass_display, N_GUI_WINDOW::state, N_GUI_CTX::style, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, and N_GUI_CTX::windows.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_draw_detached()

void n_gui_draw_detached ( N_GUI_CTX ctx)

render and flip every detached window, and release the ones whose native window was closed.

Call once per frame, after the event queue has been drained. Restores the caller's target bitmap before returning, and does not touch the main display's backbuffer.

render and flip every detached window, and release the ones whose native window was closed.

Call once per frame, after the event queue has been drained: this is the safe point where a display whose close was requested is actually destroyed, so no already-queued event can name a freed display.

Each native window is drawn with an identity transform, the virtual canvas, global scroll and global scrollbars belong to the main display only. The caller's target bitmap is restored before returning.

Definition at line 8737 of file n_gui.c.

References __n_assert, _draw_combobox_dropdown(), _draw_dropmenu_panel(), _draw_tooltip(), _draw_window(), _release_native_window(), N_GUI_WINDOW::autofit_flags, N_GUI_THEME::bg_normal, N_GUI_CTX::default_font, N_GUI_WINDOW::flags, N_GUI_WINDOW::h, N_GUI_WINDOW::id, list_foreach, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, n_gui_window_apply_autofit(), N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_WINDOW::native_halted, N_GUI_WINDOW::on_content_draw, N_GUI_WINDOW::on_content_draw_data, N_GUI_CTX::pass_display, N_GUI_WINDOW::saved_flags, N_GUI_WINDOW::saved_h, N_GUI_WINDOW::saved_w, N_GUI_WINDOW::saved_x, N_GUI_WINDOW::saved_y, N_GUI_WINDOW::state, N_GUI_CTX::style, N_GUI_WINDOW::theme, N_GUI_WINDOW::w, N_GUI_WINDOW::want_native, N_GUI_CTX::windows, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_add_dynamic_entry()

int n_gui_dropmenu_add_dynamic_entry ( N_GUI_CTX ctx,
int  widget_id,
const char *  text,
int  tag,
void(*)(int, int, int, void *)  on_click,
void *  user_data 
)

add a dynamic entry (rebuilt each time menu opens)

add a dynamic entry (rebuilt each time menu opens)

Returns
entry index, or -1 on error

Definition at line 4669 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_ENTRY::is_dynamic, LOG_ERR, n_gui_dropmenu_add_entry(), n_gui_get_widget(), and n_log.

Referenced by on_windows_menu_open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_add_entry()

int n_gui_dropmenu_add_entry ( N_GUI_CTX ctx,
int  widget_id,
const char *  text,
int  tag,
void(*)(int, int, int, void *)  on_click,
void *  user_data 
)

add a static entry to a dropdown menu

add a static entry to a dropdown menu

Returns
entry index, or -1 on error

Definition at line 4646 of file n_gui.c.

References _dropmenu_entries_grow(), N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_DATA::entries_capacity, N_GUI_DROPMENU_ENTRY::is_dynamic, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_ENTRY::on_click, N_GUI_DROPMENU_ENTRY::tag, N_GUI_DROPMENU_ENTRY::text, N_GUI_WIDGET::type, and N_GUI_DROPMENU_ENTRY::user_data.

Referenced by main(), main(), and n_gui_dropmenu_add_dynamic_entry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_clear()

void n_gui_dropmenu_clear ( N_GUI_CTX ctx,
int  widget_id 
)

remove all entries

remove all entries

Definition at line 4723 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_clear_dynamic()

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)

remove all dynamic entries (call from on_open callback before re-adding)

Definition at line 4694 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_ENTRY::is_dynamic, N_GUI_DROPMENU_DATA::max_visible, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by on_windows_menu_open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_get_count()

int n_gui_dropmenu_get_count ( N_GUI_CTX ctx,
int  widget_id 
)

get number of entries

get number of entries

Definition at line 4748 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_panel_width()

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).

Returns 0 for a non-dropmenu widget.

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).

The collapsed dropmenu button is often narrow (it only shows a short category label), but the floating panel must be wide enough that its entries read in full. This returns the larger of the button width and the widest entry text, padded by the item text padding on both sides and, when the entry count overflows the visible window, the scrollbar width. The draw and hit-test paths share it so the panel background, the clickable item area, and the scrollbar all use one width.

Parameters
ctxthe GUI context
widget_idthe dropmenu widget id
Returns
the panel width in pixels, or 0 for a non-dropmenu widget

Definition at line 4771 of file n_gui.c.

References _text_w(), N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_DROPMENU_DATA::entries, N_GUI_WIDGET::font, N_GUI_STYLE::item_text_padding, N_GUI_DROPMENU_DATA::max_visible, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_STYLE::scrollbar_size, N_GUI_CTX::style, N_GUI_DROPMENU_ENTRY::text, N_GUI_WIDGET::type, and N_GUI_WIDGET::w.

Referenced by _draw_dropmenu_panel(), main(), and n_gui_process_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a dropmenu widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4954 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::item_hover_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, n_log, N_GUI_DROPMENU_DATA::panel_bitmap, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_dropmenu_set_entry_text()

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

update text of an existing entry by index

Definition at line 4734 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_ENTRY::text, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_dropmenu_set_flags()

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)

set dropmenu feature flags (bitmask of N_GUI_DROPMENU_* values)

Definition at line 4612 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::flags, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_dropmenu_set_label()

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)

replace the button label shown on a dropmenu (NULL clears it)

The label is the text drawn on the collapsed dropmenu button (before the arrow). Useful when a single dropmenu widget is reused to present different menus (a pooled toolbar category button, for instance). A NULL label clears it. The text is truncated to N_GUI_ID_MAX-1 bytes.

Parameters
ctxthe GUI context
widget_idthe dropmenu widget id
labelnew button label, or NULL to clear

Definition at line 4631 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::label, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_focus_window()

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)

give a window keyboard focus: raise it within its z-order group and focus its first focusable widget (clears focus if it has none)

Raises the window within its z-order group (so it is drawn on top of its peers) and moves keyboard focus to its first focusable, visible, enabled widget. If the window has no focusable widget, focus is cleared so global key bindings still fire. Does nothing if the window id is unknown.

Definition at line 1881 of file n_gui.c.

References __n_assert, _is_focusable_type(), N_GUI_WIDGET::enabled, N_GUI_WIDGET::id, list_foreach, n_gui_get_window(), n_gui_raise_window(), n_gui_set_focus(), N_GUI_WIDGET::type, N_GUI_WIDGET::visible, and N_GUI_WINDOW::widgets.

+ Here is the call graph for this function:

◆ n_gui_get_dpi_scale()

float n_gui_get_dpi_scale ( const N_GUI_CTX ctx)

get current DPI scale factor

get current DPI scale factor

Definition at line 9089 of file n_gui.c.

References __n_assert, and N_GUI_CTX::dpi_scale.

◆ n_gui_get_event_queue()

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)

get the event queue previously given to n_gui_set_event_queue (NULL if none)

Definition at line 1365 of file n_gui.c.

References __n_assert, and N_GUI_CTX::event_queue.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_get_resize_mode()

int n_gui_get_resize_mode ( N_GUI_CTX ctx)

get current resize mode

get current resize mode

Returns
N_GUI_RESIZE_VIRTUAL or N_GUI_RESIZE_ADAPTIVE

Definition at line 8926 of file n_gui.c.

References __n_assert, and N_GUI_CTX::resize_mode.

◆ n_gui_get_shape_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)

get the global widget shape (N_GUI_SHAPE_ROUNDED or N_GUI_SHAPE_RECT)

Parameters
ctxGUI context.
Returns
N_GUI_SHAPE_ROUNDED or N_GUI_SHAPE_RECT (rounded when ctx is NULL).

Definition at line 9064 of file n_gui.c.

References N_GUI_SHAPE_ROUNDED, N_GUI_STYLE::shape_mode, and N_GUI_CTX::style.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_get_text_dims()

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.

Uses al_get_text_dimensions for accurate measurement including glyph overhangs.

Definition at line 103 of file n_gui.c.

References N_GUI_TEXT_DIMS::h, N_GUI_TEXT_DIMS::w, N_GUI_TEXT_DIMS::x, and N_GUI_TEXT_DIMS::y.

◆ n_gui_get_topmost_open_window()

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.

Because the window list is kept sorted by z-order group, this is the topmost window currently on screen.

get the id of the frontmost open, non-minimized window (the last one in draw order), or -1 if no window is open.

The window list is kept sorted by z-order group with the topmost group last, so the last open window in list order is the one drawn on top. Returns -1 when no window is open.

Definition at line 1861 of file n_gui.c.

References __n_assert, LIST::end, N_GUI_WINDOW::id, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WINDOW::state, and N_GUI_CTX::windows.

◆ n_gui_get_widget()

N_GUI_WIDGET * n_gui_get_widget ( N_GUI_CTX ctx,
int  widget_id 
)

get a widget by id

get a widget by id

Definition at line 3028 of file n_gui.c.

References __n_assert, ht_get_ptr(), key, and N_GUI_CTX::widgets_by_id.

Referenced by _clear_syntaxview_selection(), _datagrid_data(), _draw_combobox_dropdown(), _draw_dropmenu_panel(), _draw_tooltip(), _n_gui_kv_apply_layout(), _n_gui_tree_listbox_bounds(), _ngui_publish_primary_selection(), dropmenu_label(), main(), n_gui_add_button_bitmap(), n_gui_add_label_link(), n_gui_add_toggle_button(), n_gui_add_vslider(), n_gui_button_is_toggled(), n_gui_button_set_keycode(), n_gui_button_set_keycode_focused(), n_gui_button_set_label(), n_gui_button_set_state_bitmaps(), n_gui_button_set_toggle_mode(), n_gui_button_set_toggled(), n_gui_checkbox_is_checked(), n_gui_checkbox_set_bitmaps(), n_gui_checkbox_set_checked(), n_gui_combobox_add_item(), n_gui_combobox_clear(), n_gui_combobox_get_item_text(), n_gui_combobox_get_selected(), n_gui_combobox_set_bitmaps(), n_gui_combobox_set_flags(), n_gui_combobox_set_selected(), n_gui_datagrid_add_column(), n_gui_datagrid_add_row(), n_gui_datagrid_clear_row_color(), n_gui_datagrid_clear_row_colors(), n_gui_datagrid_clear_rows(), n_gui_datagrid_clear_selection(), n_gui_datagrid_get_cell(), n_gui_datagrid_get_h_scroll(), n_gui_datagrid_get_row_color(), n_gui_datagrid_get_row_count(), n_gui_datagrid_get_scroll_offset(), n_gui_datagrid_get_selected(), n_gui_datagrid_get_selected_rows(), n_gui_datagrid_is_row_selected(), n_gui_datagrid_select_row(), n_gui_datagrid_set_h_scroll(), n_gui_datagrid_set_multiselect(), n_gui_datagrid_set_on_context(), n_gui_datagrid_set_row_color(), n_gui_datagrid_set_scroll_offset(), n_gui_datagrid_set_selected(), n_gui_datagrid_sort(), n_gui_dropmenu_add_dynamic_entry(), n_gui_dropmenu_add_entry(), n_gui_dropmenu_clear(), n_gui_dropmenu_clear_dynamic(), n_gui_dropmenu_get_count(), n_gui_dropmenu_panel_width(), n_gui_dropmenu_set_bitmaps(), n_gui_dropmenu_set_entry_text(), n_gui_dropmenu_set_flags(), n_gui_dropmenu_set_label(), n_gui_hexview_get_length(), n_gui_hexview_set_data(), n_gui_image_set_bitmap(), n_gui_is_widget_enabled(), n_gui_label_set_bitmap(), n_gui_label_set_link(), n_gui_label_set_text(), n_gui_listbox_add_item(), n_gui_listbox_clear(), n_gui_listbox_get_count(), n_gui_listbox_get_item_text(), n_gui_listbox_get_scroll_offset(), n_gui_listbox_get_selected(), n_gui_listbox_is_selected(), n_gui_listbox_remove_item(), n_gui_listbox_set_bitmaps(), n_gui_listbox_set_scroll_offset(), n_gui_listbox_set_selected(), n_gui_needs_redraw(), n_gui_process_event(), n_gui_progressbar_get_value(), n_gui_progressbar_set_text(), n_gui_progressbar_set_value(), n_gui_radiolist_add_item(), n_gui_radiolist_clear(), n_gui_radiolist_get_selected(), n_gui_radiolist_set_bitmaps(), n_gui_radiolist_set_selected(), n_gui_scrollbar_get_pos(), n_gui_scrollbar_set_bitmaps(), n_gui_scrollbar_set_pos(), n_gui_scrollbar_set_sizes(), n_gui_sectionlist_add_widget(), n_gui_sectionlist_relayout(), n_gui_set_focus(), n_gui_set_widget_enabled(), n_gui_set_widget_theme(), n_gui_set_widget_tooltip(), n_gui_set_widget_visible(), n_gui_slider_get_value(), n_gui_slider_set_bitmaps(), n_gui_slider_set_range(), n_gui_slider_set_step(), n_gui_slider_set_value(), n_gui_slider_set_value_format(), n_gui_slider_set_value_visible(), n_gui_splitpane_get_ratio(), n_gui_splitpane_set_limits(), n_gui_splitpane_set_ratio(), n_gui_syntaxview_get_line_count(), n_gui_syntaxview_get_selected_text(), n_gui_syntaxview_get_text(), n_gui_syntaxview_scroll_to_offset(), n_gui_syntaxview_select_all(), n_gui_syntaxview_set_mode(), n_gui_syntaxview_set_selection(), n_gui_syntaxview_set_text(), n_gui_textarea_get_text(), n_gui_textarea_get_text_length(), n_gui_textarea_scroll_to_bottom(), n_gui_textarea_scroll_to_offset(), n_gui_textarea_set_bitmap(), n_gui_textarea_set_mask_char(), n_gui_textarea_set_placeholder(), n_gui_textarea_set_selection(), n_gui_textarea_set_text(), n_gui_tree_draw_overlay(), n_gui_widget_get_persist_key(), n_gui_widget_set_persist_key(), and placeholder_of().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_get_window()

N_GUI_WINDOW * n_gui_get_window ( N_GUI_CTX ctx,
int  window_id 
)

get a window by id

get a window by id

Definition at line 1182 of file n_gui.c.

References _find_window_node(), and LIST_NODE::ptr.

Referenced by _n_gui_kv_apply_layout(), _n_gui_tree_listbox_bounds(), main(), n_gui_add_button(), n_gui_add_checkbox(), n_gui_add_combobox(), n_gui_add_custom(), n_gui_add_datagrid(), n_gui_add_dropmenu(), n_gui_add_hexview(), n_gui_add_image(), n_gui_add_label(), n_gui_add_listbox(), n_gui_add_progressbar(), n_gui_add_radiolist(), n_gui_add_scrollbar(), n_gui_add_slider(), n_gui_add_splitpane(), n_gui_add_syntaxview(), n_gui_add_textarea(), n_gui_close_window(), n_gui_focus_window(), n_gui_kvtable_create(), n_gui_maximize_window(), n_gui_minimize_window(), n_gui_open_window(), n_gui_process_event(), n_gui_restore_window(), n_gui_sectionlist_relayout(), n_gui_toggle_window(), n_gui_window_apply_autofit(), n_gui_window_attach(), n_gui_window_autosize(), n_gui_window_detach(), n_gui_window_get_display(), n_gui_window_get_flags(), n_gui_window_get_resize_policy(), n_gui_window_get_zorder(), n_gui_window_get_zvalue(), n_gui_window_is_detached(), n_gui_window_is_maximised(), n_gui_window_is_minimised(), n_gui_window_is_open(), n_gui_window_native_is_hidden(), n_gui_window_set_autofit(), n_gui_window_set_bitmaps(), n_gui_window_set_close_callback(), n_gui_window_set_content_draw_callback(), n_gui_window_set_flags(), n_gui_window_set_maximize_callback(), n_gui_window_set_minimize_callback(), n_gui_window_set_native_icons(), n_gui_window_set_resize_policy(), n_gui_window_set_tb_btn_theme(), n_gui_window_set_tb_button_bitmaps(), n_gui_window_set_tb_close_theme(), n_gui_window_set_zorder(), n_gui_window_update_normalized(), and sample_chrome_titlebar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_hexview_get_length()

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

Parameters
ctxGUI context
widget_idid of the hex viewer widget
Returns
the byte count, or 0 if the widget is invalid

Definition at line 3610 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_HEXVIEW, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_hexview_set_data()

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

set (copy) the bytes shown by a hex viewer; data may be NULL to clear

Parameters
ctxGUI context
widget_idid of the hex viewer widget
datathe bytes to display, or NULL to clear
lennumber of bytes in data

Definition at line 3588 of file n_gui.c.

References N_GUI_HEXVIEW_DATA::data, N_GUI_WIDGET::data, FreeNoLog, N_GUI_HEXVIEW_DATA::len, Malloc, n_gui_get_widget(), N_GUI_TYPE_HEXVIEW, N_GUI_HEXVIEW_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_image_set_bitmap()

void n_gui_image_set_bitmap ( N_GUI_CTX ctx,
int  widget_id,
ALLEGRO_BITMAP *  bitmap 
)

set the bitmap on an image widget

set the bitmap on an image widget

Parameters
ctxGUI context
widget_idid of the image widget
bitmappointer to the ALLEGRO_BITMAP to set

Definition at line 4496 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_IMAGE, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_is_widget_enabled()

int n_gui_is_widget_enabled ( N_GUI_CTX ctx,
int  widget_id 
)

check if a widget is enabled

check if a widget is enabled

Returns
1 if enabled, 0 if disabled

Definition at line 3093 of file n_gui.c.

References N_GUI_WIDGET::enabled, and n_gui_get_widget().

+ Here is the call graph for this function:

◆ n_gui_kvtable_add_row()

◆ n_gui_kvtable_clear()

void n_gui_kvtable_clear ( N_GUI_KVTABLE table)

remove every row at once.

The key column and remove button are always kept; the freed row slots (and their widgets) are reused by the next add_row calls, so repeated clear+repopulate cycles do not grow the widget count toward N_GUI_KV_MAX. Use before reloading a table's contents.

Definition at line 14126 of file n_gui.c.

References _n_gui_kv_apply_layout(), N_GUI_KV_ROW::active, N_GUI_KVTABLE::ctx, N_GUI_KV_ROW::desc_id, N_GUI_KV_ROW::enabled_id, N_GUI_KV_ROW::key_id, n_gui_set_widget_visible(), N_GUI_KVTABLE::nb_active, N_GUI_KVTABLE::nb_rows, N_GUI_KV_ROW::remove_id, N_GUI_KVTABLE::rows, and N_GUI_KV_ROW::value_id.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_kvtable_create()

◆ n_gui_kvtable_free()

void n_gui_kvtable_free ( N_GUI_KVTABLE **  table)

free a KV table (does not destroy the N_GUI widgets)

Definition at line 14180 of file n_gui.c.

References FreeNoLog.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_kvtable_get_count()

int n_gui_kvtable_get_count ( const N_GUI_KVTABLE table)

get the number of active rows

Definition at line 14172 of file n_gui.c.

References N_GUI_KVTABLE::nb_active.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_kvtable_relayout()

void n_gui_kvtable_relayout ( N_GUI_KVTABLE table)

re-apply layout to all KV table widgets (positions, sizes, normalized coords).

Called automatically on create/add/remove; callers should invoke it after any manual window size change the kvtable cannot see.

Definition at line 14176 of file n_gui.c.

References _n_gui_kv_apply_layout().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_kvtable_remove_row()

void n_gui_kvtable_remove_row ( N_GUI_KVTABLE table,
int  row_index 
)

remove a row by index (hides widgets, marks inactive)

Definition at line 14112 of file n_gui.c.

References _n_gui_kv_apply_layout(), N_GUI_KV_ROW::active, N_GUI_KVTABLE::ctx, N_GUI_KV_ROW::desc_id, N_GUI_KV_ROW::enabled_id, N_GUI_KV_ROW::key_id, n_gui_set_widget_visible(), N_GUI_KVTABLE::nb_active, N_GUI_KVTABLE::nb_rows, N_GUI_KV_ROW::remove_id, N_GUI_KVTABLE::rows, and N_GUI_KV_ROW::value_id.

Referenced by _n_gui_kv_remove_clicked(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_kvtable_set_columns()

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.

The key column and the remove ("x") button are always shown. Defaults to all shown (a full three-column table, backward compatible). Pass 0 to hide a column for a simpler table, e.g. a single-value list (0,0,0). Hidden columns' widgets are hidden and the visible columns reflow to fill the width.

Definition at line 14144 of file n_gui.c.

References _n_gui_kv_apply_layout(), N_GUI_KVTABLE::show_desc, N_GUI_KVTABLE::show_enabled, and N_GUI_KVTABLE::show_value.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_kvtable_set_placeholders()

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.

Applies to existing rows and to rows added afterwards. Either argument may be NULL to clear that hint.

Definition at line 14152 of file n_gui.c.

References N_GUI_KVTABLE::ctx, FreeNoLog, N_GUI_KV_ROW::key_id, N_GUI_KVTABLE::key_placeholder, n_gui_textarea_set_placeholder(), N_GUI_KVTABLE::nb_rows, N_GUI_KVTABLE::rows, N_GUI_KV_ROW::value_id, and N_GUI_KVTABLE::value_placeholder.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_kvtable_set_top_offset()

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.

The offset scales with the window like the rest of the table. Default 0.

Definition at line 14166 of file n_gui.c.

References _n_gui_kv_apply_layout(), and N_GUI_KVTABLE::top_offset.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_label_set_bitmap()

void n_gui_label_set_bitmap ( N_GUI_CTX ctx,
int  widget_id,
ALLEGRO_BITMAP *  bg 
)

set optional background bitmap on a label widget.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional background bitmap on a label widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4969 of file n_gui.c.

References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_LABEL, n_log, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_label_set_link()

void n_gui_label_set_link ( N_GUI_CTX ctx,
int  widget_id,
const char *  link 
)

set label hyperlink URL

set label hyperlink URL

Parameters
ctxGUI context
widget_idid of the label widget
linkthe URL to set, or NULL to clear

Definition at line 4531 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LABEL_DATA::link, n_gui_get_widget(), N_GUI_TEXT_MAX, N_GUI_TYPE_LABEL, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_label_set_text()

void n_gui_label_set_text ( N_GUI_CTX ctx,
int  widget_id,
const char *  text 
)

set label text content

set label text content

Parameters
ctxGUI context
widget_idid of the label widget
textthe text to set, or NULL to clear

Definition at line 4511 of file n_gui.c.

References _normalize_crlf(), N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TEXT_MAX, N_GUI_TYPE_LABEL, N_GUI_LABEL_DATA::text, and N_GUI_WIDGET::type.

Referenced by main(), main(), refresh_buttons(), and update_definitions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_add_item()

int n_gui_listbox_add_item ( N_GUI_CTX ctx,
int  widget_id,
const char *  text 
)

add an item to a listbox

add an item to a listbox

Parameters
ctxGUI context
widget_idid of the listbox widget
texttext of the item to add
Returns
index of the new item or -1 on error

Definition at line 3371 of file n_gui.c.

References _items_grow(), N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, N_GUI_LISTBOX_DATA::items_capacity, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.

Referenced by build_widgets_window(), chat_log_add(), main(), main(), n_gui_tree_rebuild(), and update_completion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_clear()

void n_gui_listbox_clear ( N_GUI_CTX ctx,
int  widget_id 
)

clear all items from a listbox

clear all items from a listbox

Parameters
ctxGUI context
widget_idid of the listbox widget

Definition at line 3418 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by n_gui_tree_clear(), n_gui_tree_rebuild(), refresh_clients_list(), and update_completion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_get_count()

int n_gui_listbox_get_count ( N_GUI_CTX ctx,
int  widget_id 
)

get number of items in a listbox

get number of items in a listbox

Parameters
ctxGUI context
widget_idid of the listbox widget
Returns
number of items

Definition at line 3433 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_listbox_get_item_text()

const char * n_gui_listbox_get_item_text ( N_GUI_CTX ctx,
int  widget_id,
int  index 
)

get item text by index

get item text by index

Parameters
ctxGUI context
widget_idid of the listbox widget
indexindex of the item
Returns
pointer to the item text, or empty string on error

Definition at line 3448 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.

Referenced by on_completion_select().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_get_scroll_offset()

int n_gui_listbox_get_scroll_offset ( N_GUI_CTX ctx,
int  widget_id 
)

get the current scroll offset (in items)

Definition at line 3512 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by n_gui_tree_rebuild().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_get_selected()

int n_gui_listbox_get_selected ( N_GUI_CTX ctx,
int  widget_id 
)

get the first selected item index

get the first selected item index

Parameters
ctxGUI context
widget_idid of the listbox widget
Returns
index of the first selected item, or -1 if none

Definition at line 3465 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTITEM::selected, and N_GUI_WIDGET::type.

Referenced by main(), and n_gui_tree_get_selection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_is_selected()

int n_gui_listbox_is_selected ( N_GUI_CTX ctx,
int  widget_id,
int  index 
)

check if an item is selected

check if an item is selected

Parameters
ctxGUI context
widget_idid of the listbox widget
indexindex of the item to check
Returns
1 if selected, 0 otherwise

Definition at line 3483 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTITEM::selected, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_listbox_remove_item()

int n_gui_listbox_remove_item ( N_GUI_CTX ctx,
int  widget_id,
int  index 
)

remove an item from a listbox by index

remove an item from a listbox by index

Parameters
ctxGUI context
widget_idid of the listbox widget
indexindex of the item to remove
Returns
0 on success, -1 on error

Definition at line 3394 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_listbox_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a listbox widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4906 of file n_gui.c.

References N_GUI_LISTBOX_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::item_bg_bitmap, N_GUI_LISTBOX_DATA::item_selected_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, n_log, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_set_scroll_offset()

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

Definition at line 3519 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_LISTBOX_DATA::item_height, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.

Referenced by n_gui_tree_rebuild(), and n_gui_tree_set_selection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_listbox_set_selected()

void n_gui_listbox_set_selected ( N_GUI_CTX ctx,
int  widget_id,
int  index,
int  selected 
)

set item selection state

set item selection state

Parameters
ctxGUI context
widget_idid of the listbox widget
indexindex of the item
selected1 to select, 0 to deselect

Definition at line 3501 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_SELECT_SINGLE, N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTBOX_DATA::selection_mode, and N_GUI_WIDGET::type.

Referenced by main(), n_gui_tree_rebuild(), and n_gui_tree_set_selection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_load_layout_json()

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.

Matching is by window title (IDs are not stable across runs). If multiple windows share a title, they are matched in creation order (first-seen-first-match). Unknown titles in the file are ignored (defensive for versions). Missing titles in the context are ignored (no-op for windows not yet created). A missing file is treated as a successful no-op (returns -1 with LOG_DEBUG). Saved per-window widget state (see n_gui_save_layout_json) is stashed as pending and applied to each keyed widget when n_gui_widget_set_persist_key is next called with a matching window title + key (so lazily-created widgets restore too). Returns 0 on success, -1 on error.

Load a JSON window layout file and apply it to matching windows in the context.

Parameters
ctxGUI context
filepathpath to the input JSON file
Returns
0 on success, -1 on error

Definition at line 12870 of file n_gui.c.

References __n_assert, _json_get_float(), _json_get_int(), _N_GUI_WIN_STATE_PERSIST_MASK, N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_PENDING_GEOM::consumed, N_GUI_WINDOW::detach_flags, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::event_queue, N_GUI_WINDOW::flags, FreeNoLog, N_GUI_WINDOW::h, N_GUI_PENDING_GEOM::h, N_GUI_WINDOW::id, N_GUI_PENDING_WIDGET::key, N_GUI_PENDING_WIDGET::kind, list_foreach, LOG_DEBUG, Malloc, N_GUI_DETACH_NONE, N_GUI_ID_MAX, N_GUI_PERSIST_MAX_COLS, N_GUI_TYPE_DATAGRID, N_GUI_TYPE_SPLITPANE, N_GUI_WIN_OPEN, n_gui_window_detach(), n_log, N_GUI_WINDOW::native, N_GUI_WINDOW::native_h, N_GUI_WINDOW::native_pos_x, N_GUI_WINDOW::native_pos_y, N_GUI_WINDOW::native_w, N_GUI_PENDING_WIDGET::ncols, N_GUI_WINDOW::norm_h, N_GUI_WINDOW::norm_w, N_GUI_WINDOW::norm_x, N_GUI_WINDOW::norm_y, N_GUI_PENDING_WIDGET::order, N_GUI_CTX::pending_layout, N_GUI_CTX::pending_layout_count, N_GUI_CTX::pending_widgets, N_GUI_CTX::pending_widgets_count, N_GUI_PENDING_WIDGET::ratio, N_GUI_WINDOW::resize_policy, N_GUI_WINDOW::saved_flags, N_GUI_WINDOW::saved_h, N_GUI_WINDOW::saved_w, N_GUI_WINDOW::saved_x, N_GUI_WINDOW::saved_y, N_GUI_WINDOW::state, N_GUI_PENDING_GEOM::state, N_GUI_WINDOW::title, N_GUI_PENDING_GEOM::title, N_GUI_PENDING_WIDGET::title, N_GUI_PENDING_WIDGET::visible, N_GUI_WINDOW::w, N_GUI_PENDING_GEOM::w, N_GUI_WINDOW::want_native, N_GUI_PENDING_WIDGET::width, N_GUI_CTX::windows, N_GUI_WINDOW::x, N_GUI_PENDING_GEOM::x, N_GUI_WINDOW::y, N_GUI_PENDING_GEOM::y, N_GUI_WINDOW::z_order, and N_GUI_WINDOW::z_value.

Referenced by main(), on_load_layout(), and on_load_layout_click().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_load_theme_json()

int n_gui_load_theme_json ( N_GUI_CTX ctx,
const char *  filepath 
)

Load a JSON theme file and apply it to the context.

Returns 0 on success, -1 on error.

Load a JSON theme file and apply it to the context.

Parameters
ctxGUI context
filepathpath to the input JSON file
Returns
0 on success, -1 on error

Definition at line 12558 of file n_gui.c.

References __n_assert, _json_get_color(), _json_get_float(), _json_get_int(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_STYLE::checkbox_label_gap, N_GUI_STYLE::checkbox_label_offset, N_GUI_STYLE::checkbox_mark_margin, N_GUI_STYLE::checkbox_mark_thickness, N_GUI_STYLE::checkbox_max_size, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_STYLE::combobox_max_visible, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_CTX::default_theme, N_GUI_STYLE::dropdown_arrow_half_h, N_GUI_STYLE::dropdown_arrow_half_w, N_GUI_STYLE::dropdown_arrow_reserve, N_GUI_STYLE::dropdown_arrow_thickness, N_GUI_STYLE::dropdown_border_thickness, N_GUI_STYLE::dropmenu_max_visible, FreeNoLog, N_GUI_STYLE::global_scroll_step, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_STYLE::label_padding, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, list_foreach, N_GUI_STYLE::listbox_default_item_height, Malloc, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_STYLE::radio_circle_border_thickness, N_GUI_STYLE::radio_circle_min_r, N_GUI_STYLE::radio_inner_offset, N_GUI_STYLE::radio_label_gap, N_GUI_STYLE::radiolist_default_item_height, N_GUI_STYLE::scroll_step, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_thumb_corner_r, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_STYLE::scrollbar_track_color, N_GUI_THEME::selection_color, N_GUI_STYLE::shape_mode, N_GUI_STYLE::slider_handle_border_thickness, N_GUI_STYLE::slider_handle_edge_offset, N_GUI_STYLE::slider_handle_min_r, N_GUI_STYLE::slider_track_border_thickness, N_GUI_STYLE::slider_track_corner_r, N_GUI_STYLE::slider_track_size, N_GUI_STYLE::slider_value_label_offset, N_GUI_CTX::style, N_GUI_STYLE::tb_btn_glyph_thickness, N_GUI_STYLE::tb_btn_right_margin, N_GUI_STYLE::tb_btn_size, N_GUI_STYLE::tb_btn_spacing, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, N_GUI_THEME::text_normal, N_GUI_STYLE::textarea_cursor_blink_period, N_GUI_STYLE::textarea_cursor_width, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::theme, N_GUI_WINDOW::theme, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, N_GUI_STYLE::titlebar_h, N_GUI_WINDOW::widgets, and N_GUI_CTX::windows.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_lower_window()

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)

lower a window to the bottom of the stack (respects z-order constraints)

Only NORMAL windows can be lowered.

Definition at line 1842 of file n_gui.c.

References __n_assert, _destroy_window(), _find_window_node(), _sort_windows_by_zorder(), LIST_NODE::destroy_func, list_unshift(), N_GUI_ZORDER_NORMAL, LIST_NODE::ptr, remove_list_node_f(), N_GUI_CTX::windows, and N_GUI_WINDOW::z_order.

+ Here is the call graph for this function:

◆ n_gui_make_theme()

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

create a custom theme from individual colors and properties

Parameters
bgbackground colour
bg_hoverbackground colour on hover
bg_activebackground colour when active
borderborder colour
border_hoverborder colour on hover
border_activeborder colour when active
texttext colour
text_hovertext colour on hover
text_activetext colour when active
border_thicknessborder thickness in pixels
corner_rxhorizontal corner radius
corner_ryvertical corner radius
Returns
configured N_GUI_THEME

Definition at line 685 of file n_gui.c.

References N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_THEME::selection_color, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, and N_GUI_THEME::text_normal.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_mark_dirty()

void n_gui_mark_dirty ( N_GUI_CTX ctx)

Mark the GUI as needing a redraw.

Call after changing widget or window state from outside n_gui_process_event (for example a host timer that updates a label or progress bar); state changed inside an event callback is already covered because the event itself marks the GUI dirty. Cheap and idempotent.

Definition at line 974 of file n_gui.c.

References N_GUI_CTX::dirty.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_maximize_window()

void n_gui_maximize_window ( N_GUI_CTX ctx,
int  window_id 
)

toggle maximised state (full display or restore to previous size)

toggle maximised state (full display or restore to previous size)

When maximising: saves current position/size, expands to fill the display (or virtual canvas if enabled), and clears minimised state. When restoring: returns to the saved position/size.

Definition at line 1267 of file n_gui.c.

References __n_assert, _n_gui_window_capture_normalized(), _native_apply_minimised(), _native_monitor_info(), _native_own_chrome(), N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_WINDOW::h, LOG_DEBUG, n_gui_get_window(), N_GUI_RESIZE_ADAPTIVE, N_GUI_WIN_MAXIMISED, n_log, N_GUI_WINDOW::native, N_GUI_CTX::resize_mode, N_GUI_TB_BUTTONS::restore_h, N_GUI_TB_BUTTONS::restore_w, N_GUI_TB_BUTTONS::restore_x, N_GUI_TB_BUTTONS::restore_y, N_GUI_WINDOW::state, N_GUI_WINDOW::tb_buttons, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_WINDOW::w, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.

Referenced by _tb_button_action(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_minimize_window()

void n_gui_minimize_window ( N_GUI_CTX ctx,
int  window_id 
)

minimize a window (title bar only)

minimize a window (title bar only)

Definition at line 1224 of file n_gui.c.

References _native_apply_minimised(), n_gui_get_window(), N_GUI_WIN_MINIMISED, and N_GUI_WINDOW::state.

Referenced by _tb_button_action(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_needs_redraw()

int n_gui_needs_redraw ( N_GUI_CTX ctx)

Return non-zero if the GUI must be redrawn this frame, i.e.

something changed since the last n_gui_draw OR a time-based animation is in progress (focused text-area cursor blink, tooltip reveal, button key-press flash). Lets an event-driven host skip n_gui_draw + al_flip_display while the GUI is idle and unchanged: while (running) { while (al_get_next_event(q, &ev)) n_gui_process_event(ctx, &ev); if (n_gui_needs_redraw(ctx)) { clear; n_gui_draw(ctx); flip; } } Hosts that redraw every frame regardless (a GUI composited over a live game scene) can ignore this. Optional and additive: the dirty bit is maintained whether or not it is queried, so calling n_gui_draw unconditionally is unchanged. Detached native windows still need n_gui_draw_detached each frame.

Definition at line 978 of file n_gui.c.

References N_GUI_CTX::anim_until, N_GUI_CTX::dirty, N_GUI_CTX::focused_widget_id, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_new_ctx()

N_GUI_CTX * n_gui_new_ctx ( ALLEGRO_FONT *  default_font)

create a new GUI context

create a new GUI context

Parameters
default_fontthe default ALLEGRO_FONT to use
Returns
a new N_GUI_CTX or NULL on error

Definition at line 903 of file n_gui.c.

References __n_assert, N_GUI_CTX::active_display, N_GUI_CTX::anim_until, N_GUI_CTX::cursor_shape, N_GUI_CTX::default_font, N_GUI_CTX::default_tb_btn_theme, N_GUI_CTX::default_tb_close_theme, N_GUI_CTX::default_theme, N_GUI_CTX::dirty, N_GUI_CTX::display, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::dpi_scale, N_GUI_CTX::event_queue, N_GUI_CTX::focused_widget_id, Free, N_GUI_CTX::global_hscroll_drag, N_GUI_CTX::global_scroll_x, N_GUI_CTX::global_scroll_y, N_GUI_CTX::global_vscroll_drag, N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, list_destroy(), LOG_ERR, Malloc, N_GUI_CTX::mouse_b1, N_GUI_CTX::mouse_b1_prev, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, n_gui_default_style(), n_gui_default_tb_btn_theme(), n_gui_default_tb_close_theme(), n_gui_default_theme(), N_GUI_RESIZE_VIRTUAL, n_log, new_generic_list(), new_ht(), N_GUI_CTX::next_widget_id, N_GUI_CTX::next_window_id, N_GUI_CTX::open_combobox_id, N_GUI_CTX::open_dropmenu_id, N_GUI_CTX::pass_display, N_GUI_CTX::pending_layout, N_GUI_CTX::pending_layout_count, N_GUI_CTX::pending_widgets, N_GUI_CTX::pending_widgets_count, N_GUI_CTX::prev_over_win, N_GUI_CTX::ref_display_h, N_GUI_CTX::ref_display_w, N_GUI_CTX::resize_mode, N_GUI_CTX::scrollbar_drag_widget_id, N_GUI_CTX::selected_label_id, N_GUI_CTX::selected_syntaxview_id, N_GUI_CTX::style, N_GUI_CTX::tooltip_anchor_x, N_GUI_CTX::tooltip_anchor_y, N_GUI_CTX::tooltip_armed_at, N_GUI_CTX::tooltip_widget_id, UNLIMITED_LIST_ITEMS, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_CTX::widgets_by_id, and N_GUI_CTX::windows.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_open_window()

void n_gui_open_window ( N_GUI_CTX ctx,
int  window_id 
)

open (show) a window

open (show) a window

Definition at line 1206 of file n_gui.c.

References N_GUI_WINDOW::detach_flags, N_GUI_CTX::event_queue, n_gui_get_window(), N_GUI_WIN_OPEN, n_gui_window_detach(), N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_WINDOW::state, and N_GUI_WINDOW::want_native.

Referenced by main(), main(), n_gui_tab_set_active(), on_ghost_toggle(), on_open_popup(), and on_show_all().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_process_event()

int n_gui_process_event ( N_GUI_CTX ctx,
ALLEGRO_EVENT  event 
)

process an allegro event for the GUI

process an allegro event for the GUI

Parameters
ctxthe GUI context
eventthe allegro event to process
Returns
1 if the event was consumed by the GUI (mouse over a window/widget, active capture operation, keyboard input to focused widget, etc.), 0 if the event was not handled by the GUI and can be processed by the application (e.g. game logic).

Definition at line 9836 of file n_gui.c.

References __n_assert, _clamp(), _clear_syntaxview_selection(), _compute_gui_bounds(), _ctx_io_display(), _datagrid_ensure_sel(), _datagrid_hmetrics(), _datagrid_phys(), _datagrid_resize_hover(), _dropdown_panel_y(), _event_display(), _find_focused_window(), _find_widget_window(), _is_focusable_type(), _justified_char_at_pos(), _label_char_at_x(), _label_content_height(), _label_text_origin_x(), _list_panel_highlight_step(), _n_gui_window_capture_normalized(), _native_drag_begin(), _native_own_chrome(), _ngui_clip_get(), _ngui_clip_set(), _ngui_publish_primary_selection(), _point_in_rect(), _pointer_over_window(), _scrollbar_calc_scroll(), _scrollbar_calc_scroll_int(), _scrollbar_update_from_mouse(), _slider_snap_value(), _slider_update_from_mouse(), _syntaxview_ensure_lines(), _syntaxview_offset_from_mouse(), _tb_button_action(), _tb_button_rect(), _text_w(), _textarea_content_height(), _textarea_handle_key(), _textarea_paste_clip(), _textarea_pos_from_mouse(), _tooltip_widget_at(), _win_on_pass(), _win_tbh(), _window_update_content_size(), N_GUI_CTX::active_display, N_GUI_LABEL_DATA::align, N_GUI_DATAGRID_DATA::anchor_row, N_GUI_CTX::anim_until, N_GUI_HEXVIEW_DATA::bytes_per_row, N_GUI_SYNTAXVIEW_DATA::cached_nb_lines, N_GUI_CHECKBOX_DATA::checked, N_GUI_DATAGRID_DATA::col_resize_col, N_GUI_DATAGRID_DATA::col_resize_w0, N_GUI_DATAGRID_DATA::col_resize_x0, N_GUI_DATAGRID_DATA::cols, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_WINDOW::content_h, N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WINDOW::content_w, N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_CTX::cursor_shape, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WINDOW::detach_flags, N_GUI_CTX::dirty, N_GUI_CTX::display, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_SPLITPANE_DATA::divider, N_GUI_WINDOW::drag_ox, N_GUI_WINDOW::drag_oy, N_GUI_WIDGET::enabled, LIST::end, N_GUI_DROPMENU_DATA::entries, N_GUI_COMBOBOX_DATA::flags, N_GUI_DROPMENU_DATA::flags, N_GUI_WINDOW::flags, N_GUI_CTX::focused_widget_id, N_GUI_WIDGET::font, Free, N_GUI_CTX::global_hscroll_drag, N_GUI_STYLE::global_scroll_step, N_GUI_CTX::global_scroll_x, N_GUI_CTX::global_scroll_y, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_CTX::global_vscroll_drag, N_GUI_STYLE::grip_size, N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_WIDGET::h, N_GUI_WINDOW::h, N_GUI_DATAGRID_DATA::h_scroll, N_GUI_DATAGRID_DATA::h_scroll_dragging, N_GUI_COMBOBOX_DATA::highlight_index, N_GUI_DROPMENU_DATA::highlight_index, N_GUI_LISTBOX_DATA::hover_row, N_GUI_TB_BUTTONS::hovered, N_GUI_WIDGET::id, N_GUI_WINDOW::id, N_GUI_COMBOBOX_DATA::is_open, N_GUI_DROPMENU_DATA::is_open, N_GUI_LISTBOX_DATA::item_height, N_GUI_RADIOLIST_DATA::item_height, N_GUI_COMBOBOX_DATA::item_height, N_GUI_DROPMENU_DATA::item_height, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_text_padding, N_GUI_LISTBOX_DATA::items, N_GUI_COMBOBOX_DATA::items, N_GUI_BUTTON_DATA::key_focus_only, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::key_press_until, N_GUI_BUTTON_DATA::key_sources, N_GUI_BUTTON_DATA::keycode, N_GUI_STYLE::label_padding, N_GUI_HEXVIEW_DATA::len, N_GUI_LABEL_DATA::link, list_foreach, N_GUI_SPLITPANE_DATA::max_ratio, N_GUI_SLIDER_DATA::max_val, N_GUI_COMBOBOX_DATA::max_visible, N_GUI_DROPMENU_DATA::max_visible, N_GUI_WINDOW::min_h, N_GUI_SPLITPANE_DATA::min_ratio, N_GUI_SLIDER_DATA::min_val, N_GUI_WINDOW::min_w, N_GUI_CTX::mouse_b1, N_GUI_CTX::mouse_b1_prev, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, N_GUI_TEXTAREA_DATA::multiline, N_GUI_DATAGRID_DATA::multiselect, N_CLIPBOARD_CLIPBOARD, N_CLIPBOARD_PRIMARY, N_GUI_ALIGN_JUSTIFIED, N_GUI_ANIM_TAIL_SEC, N_GUI_COMBOBOX_AUTO_WIDTH, N_GUI_COMBOBOX_EXPAND_UP, n_gui_datagrid_sort(), N_GUI_DETACH_SCALE_CONTENT, N_GUI_DROPMENU_EXPAND_UP, n_gui_dropmenu_panel_width(), n_gui_get_widget(), n_gui_get_window(), N_GUI_KEY_MOD_MASK, N_GUI_KEY_PRESS_FLASH_SEC, N_GUI_KEY_SOURCES_MAX, n_gui_raise_window(), N_GUI_RESIZE_ADAPTIVE, N_GUI_SCROLLBAR_V, N_GUI_SELECT_MULTIPLE, N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, n_gui_set_focus(), N_GUI_SLIDER_H, N_GUI_SPLIT_VERTICAL, N_GUI_STATE_ACTIVE, N_GUI_STATE_FOCUSED, N_GUI_STATE_HOVER, n_gui_syntaxview_get_selected_text(), n_gui_syntaxview_select_all(), N_GUI_TB_BTN_CLOSE, N_GUI_TB_BTN_MAXIMIZE, N_GUI_TB_BTN_MINIMIZE, N_GUI_TB_BTN_NONE, N_GUI_TEXT_MAX, N_GUI_TYPE_BUTTON, N_GUI_TYPE_CHECKBOX, N_GUI_TYPE_COMBOBOX, N_GUI_TYPE_DATAGRID, N_GUI_TYPE_DROPMENU, N_GUI_TYPE_HEXVIEW, N_GUI_TYPE_LABEL, N_GUI_TYPE_LISTBOX, N_GUI_TYPE_RADIOLIST, N_GUI_TYPE_SCROLLBAR, N_GUI_TYPE_SLIDER, N_GUI_TYPE_SPLITPANE, N_GUI_TYPE_SYNTAXVIEW, N_GUI_TYPE_TEXTAREA, N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_DRAGGING, N_GUI_WIN_FIXED_POSITION, N_GUI_WIN_FRAMELESS, N_GUI_WIN_HSCROLL_DRAG, N_GUI_WIN_MAXIMISED, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WIN_RESIZABLE, N_GUI_WIN_RESIZING, N_GUI_WIN_VSCROLL_DRAG, N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_WINDOW::native_drag_anchored, N_GUI_WINDOW::native_drag_cx, N_GUI_WINDOW::native_drag_cy, N_GUI_WINDOW::native_drag_wx, N_GUI_WINDOW::native_drag_wy, N_GUI_WINDOW::native_h, N_GUI_WINDOW::native_halted, N_GUI_WINDOW::native_pos_x, N_GUI_WINDOW::native_pos_y, N_GUI_WINDOW::native_w, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_LISTBOX_DATA::nb_items, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_COMBOBOX_DATA::nb_items, LIST::nb_items, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_SLIDER_DATA::on_change, N_GUI_SPLITPANE_DATA::on_change, N_GUI_DROPMENU_ENTRY::on_click, N_GUI_BUTTON_DATA::on_click, N_GUI_TB_BUTTONS::on_close, N_GUI_TB_BUTTONS::on_close_user_data, N_GUI_DATAGRID_DATA::on_columns_changed, N_GUI_DATAGRID_DATA::on_context, N_GUI_LABEL_DATA::on_link_click, N_GUI_DROPMENU_DATA::on_open, N_GUI_DROPMENU_DATA::on_open_user_data, N_GUI_SCROLLBAR_DATA::on_scroll, N_GUI_LISTBOX_DATA::on_select, N_GUI_RADIOLIST_DATA::on_select, N_GUI_COMBOBOX_DATA::on_select, N_GUI_DATAGRID_DATA::on_select, N_GUI_CHECKBOX_DATA::on_toggle, N_GUI_CTX::open_combobox_id, N_GUI_CTX::open_dropmenu_id, N_GUI_SLIDER_DATA::orientation, N_GUI_SCROLLBAR_DATA::orientation, N_GUI_SPLITPANE_DATA::orientation, N_GUI_CTX::pass_display, N_GUI_TB_BUTTONS::pressed, N_GUI_CTX::prev_over_win, LIST_NODE::ptr, N_GUI_SPLITPANE_DATA::ratio, N_GUI_CTX::resize_mode, N_GUI_DATAGRID_DATA::row_sel, N_GUI_DATAGRID_DATA::rows_cap, N_GUI_TEXTAREA_DATA::scroll_from_wheel, N_GUI_LISTBOX_DATA::scroll_offset, N_GUI_HEXVIEW_DATA::scroll_offset, N_GUI_SYNTAXVIEW_DATA::scroll_offset, N_GUI_DATAGRID_DATA::scroll_offset, N_GUI_RADIOLIST_DATA::scroll_offset, N_GUI_COMBOBOX_DATA::scroll_offset, N_GUI_DROPMENU_DATA::scroll_offset, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_STYLE::scroll_step, N_GUI_WINDOW::scroll_x, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_LABEL_DATA::scroll_y, N_GUI_WINDOW::scroll_y, N_GUI_CTX::scrollbar_drag_widget_id, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_SYNTAXVIEW_DATA::sel_dragging, N_GUI_LABEL_DATA::sel_dragging, N_GUI_TEXTAREA_DATA::sel_end, N_GUI_SYNTAXVIEW_DATA::sel_end, N_GUI_LABEL_DATA::sel_end, N_GUI_TEXTAREA_DATA::sel_start, N_GUI_SYNTAXVIEW_DATA::sel_start, N_GUI_LABEL_DATA::sel_start, N_GUI_LISTITEM::selected, N_GUI_RADIOLIST_DATA::selected_index, N_GUI_COMBOBOX_DATA::selected_index, N_GUI_CTX::selected_label_id, N_GUI_DATAGRID_DATA::selected_row, N_GUI_CTX::selected_syntaxview_id, N_GUI_LISTBOX_DATA::selection_mode, N_GUI_DATAGRID_DATA::sort_col, N_GUI_DATAGRID_DATA::sort_dir, N_GUI_WIDGET::state, N_GUI_WINDOW::state, N_GUI_SLIDER_DATA::step, N_GUI_CTX::style, N_GUI_DROPMENU_ENTRY::tag, N_GUI_WINDOW::tb_buttons, N_GUI_LISTITEM::text, N_GUI_SYNTAXVIEW_DATA::text, N_GUI_LABEL_DATA::text, N_GUI_STYLE::textarea_padding, N_GUI_STYLE::title_max_w_reserve, N_GUI_BUTTON_DATA::toggle_mode, N_GUI_BUTTON_DATA::toggled, N_GUI_CTX::tooltip_anchor_x, N_GUI_CTX::tooltip_anchor_y, N_GUI_CTX::tooltip_armed_at, N_GUI_STYLE::tooltip_delay, N_GUI_CTX::tooltip_widget_id, N_GUI_WIDGET::type, N_GUI_BUTTON_DATA::user_data, N_GUI_SLIDER_DATA::user_data, N_GUI_CHECKBOX_DATA::user_data, N_GUI_SCROLLBAR_DATA::user_data, N_GUI_LISTBOX_DATA::user_data, N_GUI_SPLITPANE_DATA::user_data, N_GUI_DATAGRID_DATA::user_data, N_GUI_RADIOLIST_DATA::user_data, N_GUI_COMBOBOX_DATA::user_data, N_GUI_LABEL_DATA::user_data, N_GUI_DROPMENU_ENTRY::user_data, N_GUI_SLIDER_DATA::value, N_GUI_SCROLLBAR_DATA::viewport_size, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_DATAGRID_COL::visible, N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_DATAGRID_COL::width, N_GUI_CTX::windows, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.

Referenced by click_at(), click_on(), ctrl_key(), main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_progressbar_get_value()

float n_gui_progressbar_get_value ( N_GUI_CTX ctx,
int  widget_id 
)

get the current progress fraction (0.0 on an invalid widget)

Definition at line 4290 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_PROGRESSBAR, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_progressbar_set_text()

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)

Definition at line 4297 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TEXT_MAX, N_GUI_TYPE_PROGRESSBAR, N_GUI_PROGRESSBAR_DATA::text, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_progressbar_set_value()

void n_gui_progressbar_set_value ( N_GUI_CTX ctx,
int  widget_id,
float  value 
)

set the progress fraction (clamped to 0.0 .

. 1.0)

Definition at line 4279 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_PROGRESSBAR, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_radiolist_add_item()

int n_gui_radiolist_add_item ( N_GUI_CTX ctx,
int  widget_id,
const char *  text 
)

add an item to a radio list

add an item to a radio list

Parameters
ctxGUI context
widget_idid of the radiolist widget
texttext of the item to add
Returns
index of the new item or -1 on error

Definition at line 4349 of file n_gui.c.

References _items_grow(), N_GUI_WIDGET::data, N_GUI_RADIOLIST_DATA::items, N_GUI_RADIOLIST_DATA::items_capacity, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.

Referenced by build_widgets_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_radiolist_clear()

void n_gui_radiolist_clear ( N_GUI_CTX ctx,
int  widget_id 
)

remove all items from a radio list

remove all items from a radio list

Parameters
ctxGUI context
widget_idid of the radiolist widget

Definition at line 4370 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_RADIOLIST_DATA::scroll_offset, N_GUI_RADIOLIST_DATA::selected_index, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_radiolist_get_selected()

int n_gui_radiolist_get_selected ( N_GUI_CTX ctx,
int  widget_id 
)

get the selected item index

get the selected item index

Parameters
ctxGUI context
widget_idid of the radiolist widget
Returns
index of the selected item, or -1 if none

Definition at line 4386 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_radiolist_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a radiolist widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4922 of file n_gui.c.

References N_GUI_RADIOLIST_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_RADIOLIST_DATA::item_bg_bitmap, N_GUI_RADIOLIST_DATA::item_selected_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, n_log, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_radiolist_set_selected()

void n_gui_radiolist_set_selected ( N_GUI_CTX ctx,
int  widget_id,
int  index 
)

set the selected item index

set the selected item index

Parameters
ctxGUI context
widget_idid of the radiolist widget
indexindex of the item to select, or -1 for none

Definition at line 4400 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::selected_index, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_raise_window()

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)

raise a window to the top of the stack (respects z-order constraints)

Respects z-order constraints: ALWAYS_BEHIND, FIXED and ALWAYS_ON_TOP windows are not moved. NORMAL and POPUP windows are raised WITHIN their own z-group (the stable re-sort keeps group boundaries). After raising, the window list is re-sorted.

Definition at line 1824 of file n_gui.c.

References __n_assert, _destroy_window(), _find_window_node(), _sort_windows_by_zorder(), LIST_NODE::destroy_func, list_push(), N_GUI_ZORDER_NORMAL, N_GUI_ZORDER_POPUP, LIST_NODE::ptr, remove_list_node_f(), N_GUI_CTX::windows, and N_GUI_WINDOW::z_order.

Referenced by n_gui_focus_window(), n_gui_process_event(), n_gui_set_focus(), and on_open_popup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_reset_all_widget_themes()

void n_gui_reset_all_widget_themes ( N_GUI_CTX ctx)

reset all widget and window themes to ctx->default_theme

reset all widget and window themes to ctx->default_theme

Iterates every window and every widget, setting their theme to the context default. Call this after changing ctx->default_theme so that all existing widgets pick up the new palette. Widgets that need a custom theme (accent buttons, status labels, etc.) must be re-themed individually after this call.

Definition at line 3056 of file n_gui.c.

References N_GUI_TB_BUTTONS::btn_theme, N_GUI_TB_BUTTONS::close_theme, N_GUI_CTX::default_tb_btn_theme, N_GUI_CTX::default_tb_close_theme, N_GUI_CTX::default_theme, list_foreach, N_GUI_WINDOW::tb_buttons, N_GUI_WIDGET::theme, N_GUI_WINDOW::theme, N_GUI_WINDOW::widgets, and N_GUI_CTX::windows.

◆ n_gui_restore_window()

void n_gui_restore_window ( N_GUI_CTX ctx,
int  window_id 
)

restore a minimised window to its full size

restore a minimised window to its full size

Unlike n_gui_minimize_window, which toggles, this always clears the minimised state, so a caller that is about to show a window (an "open this dialog" action) can guarantee the content is visible without knowing the current state. A window that is not minimised is left untouched, and the maximised state is not affected.

Parameters
ctxthe gui context
window_idthe id of the window to restore

Definition at line 1242 of file n_gui.c.

References _native_apply_minimised(), n_gui_get_window(), and N_GUI_WINDOW::state.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_save_layout_json()

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.

Persists per-window: title, x, y, w, h, state (persistent bits only), z_order, z_value, flags, norm_x/y/w/h, autofit_flags, autofit_border, resize_policy. Widget content and callbacks are NOT saved, they are domain data owned by the calling program, EXCEPT the user-adjustable state of widgets that were given a persist key (n_gui_widget_set_persist_key): each such widget's splitpane divider ratio, or datagrid column order/visibility/width, is saved under a per-window "widgets" array so the layout survives a restart. Returns 0 on success, -1 on error.

Save the geometry + persistent state of every window in the context to a JSON file.

Parameters
ctxGUI context
filepathpath to the output JSON file
Returns
0 on success, -1 on error

Definition at line 12712 of file n_gui.c.

References __n_assert, _gui_fopen_write(), _N_GUI_WIN_STATE_PERSIST_MASK, N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WIDGET::data, N_GUI_WINDOW::detach_flags, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_WINDOW::flags, N_GUI_WINDOW::h, N_GUI_WIDGET::id, list_foreach, n_gui_datagrid_display_to_physical(), n_gui_datagrid_get_column_count(), n_gui_datagrid_get_column_visible(), n_gui_datagrid_get_column_width(), N_GUI_PERSIST_MAX_COLS, N_GUI_TYPE_DATAGRID, N_GUI_TYPE_SPLITPANE, N_GUI_WINDOW::native, N_GUI_WINDOW::native_h, N_GUI_WINDOW::native_pos_x, N_GUI_WINDOW::native_pos_y, N_GUI_WINDOW::native_w, N_GUI_WINDOW::norm_h, N_GUI_WINDOW::norm_w, N_GUI_WINDOW::norm_x, N_GUI_WINDOW::norm_y, N_GUI_WIDGET::persist_key, N_GUI_WINDOW::resize_policy, N_GUI_WINDOW::saved_flags, N_GUI_WINDOW::saved_h, N_GUI_WINDOW::saved_w, N_GUI_WINDOW::saved_x, N_GUI_WINDOW::saved_y, N_GUI_WINDOW::state, N_GUI_WINDOW::title, N_GUI_WIDGET::type, N_GUI_WINDOW::w, N_GUI_WINDOW::want_native, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WINDOW::x, N_GUI_WINDOW::y, N_GUI_WINDOW::z_order, and N_GUI_WINDOW::z_value.

Referenced by main(), on_save_layout(), and on_save_layout_click().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_save_theme_json()

int n_gui_save_theme_json ( N_GUI_CTX ctx,
const char *  filepath 
)

Save the full theme (default_theme + style) to a JSON file.

Returns 0 on success, -1 on error.

Save the full theme (default_theme + style) to a JSON file.

Parameters
ctxGUI context
filepathpath to the output JSON file
Returns
0 on success, -1 on error

Definition at line 12429 of file n_gui.c.

References __n_assert, _gui_fopen_write(), _json_add_color(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_STYLE::checkbox_label_gap, N_GUI_STYLE::checkbox_label_offset, N_GUI_STYLE::checkbox_mark_margin, N_GUI_STYLE::checkbox_mark_thickness, N_GUI_STYLE::checkbox_max_size, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_STYLE::combobox_max_visible, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_CTX::default_theme, N_GUI_STYLE::dropdown_arrow_half_h, N_GUI_STYLE::dropdown_arrow_half_w, N_GUI_STYLE::dropdown_arrow_reserve, N_GUI_STYLE::dropdown_arrow_thickness, N_GUI_STYLE::dropdown_border_thickness, N_GUI_STYLE::dropmenu_max_visible, N_GUI_STYLE::global_scroll_step, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_STYLE::label_padding, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, N_GUI_STYLE::listbox_default_item_height, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_STYLE::radio_circle_border_thickness, N_GUI_STYLE::radio_circle_min_r, N_GUI_STYLE::radio_inner_offset, N_GUI_STYLE::radio_label_gap, N_GUI_STYLE::radiolist_default_item_height, N_GUI_STYLE::scroll_step, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_thumb_corner_r, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_STYLE::scrollbar_track_color, N_GUI_THEME::selection_color, N_GUI_STYLE::shape_mode, N_GUI_STYLE::slider_handle_border_thickness, N_GUI_STYLE::slider_handle_edge_offset, N_GUI_STYLE::slider_handle_min_r, N_GUI_STYLE::slider_track_border_thickness, N_GUI_STYLE::slider_track_corner_r, N_GUI_STYLE::slider_track_size, N_GUI_STYLE::slider_value_label_offset, N_GUI_CTX::style, N_GUI_STYLE::tb_btn_glyph_thickness, N_GUI_STYLE::tb_btn_right_margin, N_GUI_STYLE::tb_btn_size, N_GUI_STYLE::tb_btn_spacing, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, N_GUI_THEME::text_normal, N_GUI_STYLE::textarea_cursor_blink_period, N_GUI_STYLE::textarea_cursor_width, N_GUI_STYLE::textarea_padding, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, and N_GUI_STYLE::titlebar_h.

+ Here is the call graph for this function:

◆ n_gui_screen_to_virtual()

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.

If virtual canvas is disabled, outputs equal inputs.

Parameters
ctxGUI context
sxscreen X (physical pixels)
syscreen Y (physical pixels)
vxoutput virtual X (may be NULL)
vyoutput virtual Y (may be NULL)

convert physical screen coordinates to virtual canvas coordinates.

If virtual canvas is disabled (virtual_w/virtual_h == 0), outputs equal inputs.

Definition at line 8876 of file n_gui.c.

References __n_assert, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_scrollbar_get_pos()

double n_gui_scrollbar_get_pos ( N_GUI_CTX ctx,
int  widget_id 
)

get scrollbar position

get scrollbar position

Parameters
ctxGUI context
widget_idid of the scrollbar widget
Returns
current scroll position

Definition at line 3319 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_scrollbar_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a scrollbar widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4830 of file n_gui.c.

References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, n_log, N_GUI_SCROLLBAR_DATA::thumb_active_bitmap, N_GUI_SCROLLBAR_DATA::thumb_bitmap, N_GUI_SCROLLBAR_DATA::thumb_hover_bitmap, N_GUI_SCROLLBAR_DATA::track_bitmap, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_scrollbar_set_pos()

void n_gui_scrollbar_set_pos ( N_GUI_CTX ctx,
int  widget_id,
double  pos 
)

set scrollbar position

set scrollbar position

Parameters
ctxGUI context
widget_idid of the scrollbar widget
posnew scroll position

Definition at line 3333 of file n_gui.c.

References _clamp(), N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_WIDGET::type, and N_GUI_SCROLLBAR_DATA::viewport_size.

+ Here is the call graph for this function:

◆ n_gui_scrollbar_set_sizes()

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

set scrollbar content and viewport sizes

Parameters
ctxGUI context
widget_idid of the scrollbar widget
content_sizetotal size of the content
viewport_sizevisible viewport size

Definition at line 3350 of file n_gui.c.

References _clamp(), N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_WIDGET::type, and N_GUI_SCROLLBAR_DATA::viewport_size.

+ Here is the call graph for this function:

◆ n_gui_sectionlist_add_section()

int n_gui_sectionlist_add_section ( N_GUI_SECTIONLIST sl,
const char *  title,
float  header_y,
int  folded 
)

◆ n_gui_sectionlist_add_widget()

void n_gui_sectionlist_add_widget ( N_GUI_SECTIONLIST sl,
int  section_index,
int  widget_id 
)

◆ n_gui_sectionlist_content_height()

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

Definition at line 14322 of file n_gui.c.

References N_GUI_SECTION::folded, N_GUI_SECTIONLIST::gap, N_GUI_SECTIONLIST::header_h, N_GUI_SECTION::natural_h, N_GUI_SECTIONLIST::nb_sections, N_GUI_SECTIONLIST::sections, and N_GUI_SECTIONLIST::y0.

◆ n_gui_sectionlist_create()

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(*)(int, int, void *)  on_toggle,
void *  user_data 
)

◆ n_gui_sectionlist_free()

void n_gui_sectionlist_free ( N_GUI_SECTIONLIST **  sl)

free the section list (does not destroy the N_GUI widgets or window)

Definition at line 14336 of file n_gui.c.

References FreeNoLog.

◆ n_gui_sectionlist_get_count()

int n_gui_sectionlist_get_count ( const N_GUI_SECTIONLIST sl)

number of sections in the list

Definition at line 14332 of file n_gui.c.

References N_GUI_SECTIONLIST::nb_sections.

◆ n_gui_sectionlist_is_folded()

int n_gui_sectionlist_is_folded ( const N_GUI_SECTIONLIST sl,
int  section_index 
)

query a section's folded state (1 = folded, 0 = expanded)

Definition at line 14317 of file n_gui.c.

References N_GUI_SECTION::folded, N_GUI_SECTIONLIST::nb_sections, and N_GUI_SECTIONLIST::sections.

◆ n_gui_sectionlist_relayout()

◆ n_gui_sectionlist_set_first_inset()

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

Definition at line 14273 of file n_gui.c.

References N_GUI_SECTIONLIST::first_inset.

◆ n_gui_sectionlist_set_folded()

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)

Definition at line 14311 of file n_gui.c.

References N_GUI_SECTION::folded, n_gui_sectionlist_relayout(), N_GUI_SECTIONLIST::nb_sections, and N_GUI_SECTIONLIST::sections.

+ Here is the call graph for this function:

◆ n_gui_set_default_theme()

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.

Sets ctx->default_theme and derives scrollbar track/thumb colors from the theme's bg_normal and border_normal fields so scrollbars match the active theme automatically.

Parameters
ctxN_GUI context. Must not be NULL.
themeTheme to apply as the new default.

Definition at line 758 of file n_gui.c.

References _color_with_alpha(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_normal, N_GUI_THEME::border_normal, N_GUI_CTX::default_tb_btn_theme, N_GUI_CTX::default_tb_close_theme, N_GUI_CTX::default_theme, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_track_color, N_GUI_CTX::style, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, and N_GUI_THEME::text_normal.

+ Here is the call graph for this function:

◆ n_gui_set_display()

void n_gui_set_display ( N_GUI_CTX ctx,
ALLEGRO_DISPLAY *  display 
)

set the display pointer for clipboard operations (copy/paste)

set the display pointer for clipboard operations (copy/paste)

Definition at line 9071 of file n_gui.c.

References __n_assert, display, and N_GUI_CTX::display.

Referenced by main(), and main().

+ Here is the caller graph for this function:

◆ n_gui_set_display_size()

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.

Call this on startup and whenever the display is resized. When virtual canvas is enabled, also updates the virtual-to-display transform.

set the display (viewport) size so global scrollbars can be computed.

Call on startup and whenever ALLEGRO_EVENT_DISPLAY_RESIZE is received. When virtual canvas is enabled, also recalculates the virtual-to-display transform.

Definition at line 9034 of file n_gui.c.

References __n_assert, N_GUI_CTX::display_h, N_GUI_CTX::display_w, n_gui_apply_adaptive_resize(), N_GUI_RESIZE_ADAPTIVE, n_gui_update_transform(), N_GUI_CTX::resize_mode, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_dpi_scale()

void n_gui_set_dpi_scale ( N_GUI_CTX ctx,
float  scale 
)

set DPI scale factor manually (default is 1.0).

Affects global scrollbar rendering and can be queried by the application.

set DPI scale factor manually (default is 1.0).

Definition at line 9079 of file n_gui.c.

References __n_assert, and N_GUI_CTX::dpi_scale.

◆ n_gui_set_event_queue()

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

Parameters
ctxthe GUI context
queuethe host's event queue, or NULL to forget it. Must be set before n_gui_window_detach, and must outlive every detached window.

give the context the event queue it registers native window event sources into

Definition at line 1356 of file n_gui.c.

References __n_assert, and N_GUI_CTX::event_queue.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_set_focus()

void n_gui_set_focus ( N_GUI_CTX ctx,
int  widget_id 
)

set keyboard focus to a specific widget (-1 to clear focus)

Parameters
ctxthe GUI context
widget_idthe widget to focus (-1 to clear focus)

set keyboard focus to a specific widget (-1 to clear focus)

Pass widget_id = -1 to clear focus. If the widget is a textarea, resets cursor blink timer. Raises the parent window if it exists and is open.

Definition at line 3105 of file n_gui.c.

References __n_assert, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, N_GUI_CTX::focused_widget_id, N_GUI_WIDGET::id, N_GUI_WINDOW::id, list_foreach, LOG_ERR, n_gui_get_widget(), n_gui_raise_window(), N_GUI_STATE_FOCUSED, N_GUI_TYPE_TEXTAREA, N_GUI_WIN_OPEN, n_log, N_GUI_WIDGET::state, N_GUI_WINDOW::state, N_GUI_WIDGET::type, N_GUI_WINDOW::widgets, and N_GUI_CTX::windows.

Referenced by main(), main(), n_gui_focus_window(), and n_gui_process_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_resize_mode()

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

set context-level resize mode: N_GUI_RESIZE_VIRTUAL (default) or N_GUI_RESIZE_ADAPTIVE

When switching to ADAPTIVE, the virtual canvas is disabled and normalized coordinates are captured for all existing windows.

Definition at line 8897 of file n_gui.c.

References __n_assert, _n_gui_window_capture_normalized(), N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, list_foreach, mode, N_GUI_RESIZE_ADAPTIVE, N_GUI_CTX::ref_display_h, N_GUI_CTX::ref_display_w, N_GUI_CTX::resize_mode, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, and N_GUI_CTX::windows.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_shape_mode()

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)

set the global widget shape (N_GUI_SHAPE_ROUNDED for a round GUI, else square)

Parameters
ctxGUI context. Ignored when NULL.
shape_modeN_GUI_SHAPE_ROUNDED for a rounded look, anything else for rectangular. Shape-aware widgets (the dropmenu button + panel, and the buttons/comboboxes that consult it) redraw accordingly on the next frame.

Definition at line 9054 of file n_gui.c.

References __n_assert, N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_STYLE::shape_mode, and N_GUI_CTX::style.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_set_virtual_size()

void n_gui_set_virtual_size ( N_GUI_CTX ctx,
float  w,
float  h 
)

set the virtual canvas size for resolution-independent scaling.

When set (w > 0 && h > 0), all widget coordinates are in virtual space. An ALLEGRO_TRANSFORM is applied during draw and mouse input is reverse- transformed automatically. Pass (0, 0) to disable (identity transform). This is opt-in: the virtual canvas is enabled only when both w and h are > 0, and disabled when both are 0 (legacy behaviour).

set the virtual canvas size for resolution-independent scaling.

When enabled (w > 0 && h > 0), all widget coordinates are treated as virtual pixels. An ALLEGRO_TRANSFORM is applied in n_gui_draw() and mouse input is reverse-transformed in n_gui_process_event(). Pass (0, 0) to disable (identity transform, legacy behaviour).

Definition at line 8831 of file n_gui.c.

References __n_assert, LOG_ERR, n_gui_update_transform(), n_log, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_widget_enabled()

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)

set widget enabled state (0 = disabled: drawn dimmed and ignores all input)

Disabled widgets are drawn dimmed and ignore all mouse/keyboard input.

Definition at line 3084 of file n_gui.c.

References N_GUI_WIDGET::enabled, and n_gui_get_widget().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_widget_theme()

void n_gui_set_widget_theme ( N_GUI_CTX ctx,
int  widget_id,
N_GUI_THEME  theme 
)

set the theme on a widget

set the theme on a widget

Definition at line 3042 of file n_gui.c.

References n_gui_get_widget(), and N_GUI_WIDGET::theme.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_widget_tooltip()

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

set (or clear with "" / NULL) the tooltip text shown after the pointer rests on a widget

The tooltip appears after the pointer rests on the widget for style.tooltip_delay seconds and hides on movement, click, or leave.

Parameters
ctxthe GUI context
widget_idid of the target widget
texttooltip text; NULL or "" clears it

Definition at line 2240 of file n_gui.c.

References FreeNoLog, n_gui_get_widget(), and N_GUI_WIDGET::tooltip.

Referenced by build_panel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_set_widget_visible()

void n_gui_set_widget_visible ( N_GUI_CTX ctx,
int  widget_id,
int  visible 
)

set widget visibility

set widget visibility

Definition at line 3075 of file n_gui.c.

References n_gui_get_widget(), and N_GUI_WIDGET::visible.

Referenced by _n_gui_kv_apply_layout(), main(), n_gui_kvtable_add_row(), n_gui_kvtable_clear(), n_gui_kvtable_remove_row(), and n_gui_sectionlist_relayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_slider_get_value()

double n_gui_slider_get_value ( N_GUI_CTX ctx,
int  widget_id 
)

get slider current value

get slider current value

Parameters
ctxGUI context
widget_idid of the slider widget
Returns
current slider value

Definition at line 3159 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SLIDER, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_slider_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional bitmap overlays on a slider widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4812 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::fill_bitmap, N_GUI_SLIDER_DATA::handle_active_bitmap, N_GUI_SLIDER_DATA::handle_bitmap, N_GUI_SLIDER_DATA::handle_hover_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_SLIDER, n_log, N_GUI_SLIDER_DATA::track_bitmap, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_slider_set_range()

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

Parameters
ctxGUI context
widget_idid of the slider widget
min_valnew minimum value
max_valnew maximum value

Definition at line 3191 of file n_gui.c.

References _clamp(), _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_SLIDER_DATA::step, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value.

+ Here is the call graph for this function:

◆ n_gui_slider_set_step()

void n_gui_slider_set_step ( N_GUI_CTX ctx,
int  widget_id,
double  step 
)

set slider step increment (0 is treated as 1).

Value is re-snapped.

set slider step increment (0 is treated as 1).

0 means continuous (no snapping). When step > 0, the current value is immediately snapped.

Parameters
ctxGUI context
widget_idid of the slider widget
stepstep increment (0 = continuous)

Definition at line 3211 of file n_gui.c.

References _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_SLIDER_DATA::step, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_slider_set_value()

void n_gui_slider_set_value ( N_GUI_CTX ctx,
int  widget_id,
double  value 
)

set slider value

set slider value

Parameters
ctxGUI context
widget_idid of the slider widget
valuenew value to set

Definition at line 3173 of file n_gui.c.

References _clamp(), _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_SLIDER_DATA::step, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_slider_set_value_format()

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.

Pass NULL or "" to restore the default ("%.1f" in VALUE mode, "%.0f%%" in PERCENT mode). Format must consume the slider's double value (use f/g/e or cast with a precision width, a single d works too via stringification fallbacks). Buffer cap is 32 bytes.

Definition at line 3222 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value_format.

+ Here is the call graph for this function:

◆ n_gui_slider_set_value_visible()

void n_gui_slider_set_value_visible ( N_GUI_CTX ctx,
int  widget_id,
int  visible 
)

Toggle the built-in value label.

Default 1 (visible). Set to 0 when the caller is already painting the value elsewhere so the slider doesn't double-render it.

Definition at line 3234 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value_visible.

+ Here is the call graph for this function:

◆ n_gui_splitpane_get_ratio()

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

get the current divider ratio (0..1), or 0.5 if the widget is invalid

Parameters
ctxGUI context
widget_idid of the split pane widget
Returns
the divider ratio (0..1), or 0.5 if the widget is invalid

Definition at line 3538 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SPLITPANE, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_splitpane_set_limits()

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

set the minimum and maximum allowed divider ratio

Parameters
ctxGUI context
widget_idid of the split pane widget
min_ratiolower clamp (0..1)
max_ratioupper clamp (0..1)

Definition at line 3566 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_SPLITPANE_DATA::max_ratio, N_GUI_SPLITPANE_DATA::min_ratio, n_gui_get_widget(), N_GUI_TYPE_SPLITPANE, N_GUI_SPLITPANE_DATA::ratio, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_splitpane_set_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)

set the divider ratio (clamped to the configured min/max)

Parameters
ctxGUI context
widget_idid of the split pane widget
ratiothe requested divider ratio (0..1)

Definition at line 3550 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_SPLITPANE_DATA::max_ratio, N_GUI_SPLITPANE_DATA::min_ratio, n_gui_get_widget(), N_GUI_TYPE_SPLITPANE, N_GUI_SPLITPANE_DATA::ratio, and N_GUI_WIDGET::type.

Referenced by _apply_pending_widget(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_get_line_count()

int n_gui_syntaxview_get_line_count ( N_GUI_CTX ctx,
int  widget_id 
)

get the number of text lines in a syntax view

Parameters
ctxGUI context
widget_idid of the syntax view widget
Returns
the line count, or 0 if the widget is invalid

Definition at line 3667 of file n_gui.c.

References _text_line_count(), N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_get_selected_text()

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.

The caller owns the returned buffer and must Free() it.

copy of the currently selected text in a syntax view, or NULL when nothing is selected.

Parameters
ctxGUI context
widget_idid of the syntax view widget
Returns
a newly allocated copy of the selected substring (caller frees with Free()), or NULL when nothing is selected or the widget is invalid

Definition at line 3692 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_SYNTAXVIEW_DATA::len, Malloc, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, N_GUI_SYNTAXVIEW_DATA::sel_end, N_GUI_SYNTAXVIEW_DATA::sel_start, N_GUI_SYNTAXVIEW_DATA::text, and N_GUI_WIDGET::type.

Referenced by _ngui_publish_primary_selection(), main(), and n_gui_process_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_get_text()

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)

get the text shown by a syntax view (borrowed pointer, do not free; NULL if empty)

Parameters
ctxGUI context
widget_idid of the syntax view widget
Returns
a borrowed pointer to the text (do not free), or NULL when empty/invalid

Definition at line 3679 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_scroll_to_offset()

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

scroll a syntax view so the line holding the given byte offset is vertically centered

Parameters
ctxGUI context
widget_idid of the syntax view widget
byte_offsetbyte offset into the text (clamped to the text length)

Definition at line 3751 of file n_gui.c.

References _syntaxview_ensure_lines(), N_GUI_SYNTAXVIEW_DATA::cached_nb_lines, N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_SYNTAXVIEW_DATA::len, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, N_GUI_SYNTAXVIEW_DATA::scroll_offset, N_GUI_CTX::style, N_GUI_SYNTAXVIEW_DATA::text, N_GUI_STYLE::textarea_padding, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_select_all()

void n_gui_syntaxview_select_all ( N_GUI_CTX ctx,
int  widget_id 
)

select the entire text of a syntax view

Parameters
ctxGUI context
widget_idid of the syntax view widget

Definition at line 3739 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), n_gui_syntaxview_set_selection(), N_GUI_TYPE_SYNTAXVIEW, and N_GUI_WIDGET::type.

Referenced by main(), and n_gui_process_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_set_mode()

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

set the highlighting mode (N_GUI_SYNTAX_*) of a syntax view

Parameters
ctxGUI context
widget_idid of the syntax view widget
modeone of the N_GUI_SYNTAX_* modes (PLAIN, HTTP, JSON, XML, YAML, JS)

Definition at line 3655 of file n_gui.c.

References N_GUI_WIDGET::data, mode, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_set_selection()

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

set the selection range (byte offsets into the text, clamped to its length); pass start == end to clear the selection

Parameters
ctxGUI context
widget_idid of the syntax view widget
startselection start byte offset (clamped to the text length)
endselection end byte offset (clamped to the text length); start == end clears

Definition at line 3719 of file n_gui.c.

References N_GUI_WIDGET::data, N_GUI_SYNTAXVIEW_DATA::len, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, N_GUI_SYNTAXVIEW_DATA::sel_end, N_GUI_SYNTAXVIEW_DATA::sel_start, N_GUI_CTX::selected_syntaxview_id, and N_GUI_WIDGET::type.

Referenced by main(), and n_gui_syntaxview_select_all().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_syntaxview_set_text()

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

set (copy) the text shown by a syntax view; text may be NULL to clear

Parameters
ctxGUI context
widget_idid of the syntax view widget
textthe text to display, or NULL to clear

Definition at line 3624 of file n_gui.c.

References N_GUI_WIDGET::data, FreeNoLog, N_GUI_SYNTAXVIEW_DATA::len, N_GUI_SYNTAXVIEW_DATA::lines_valid, Malloc, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, N_GUI_SYNTAXVIEW_DATA::scroll_offset, N_GUI_SYNTAXVIEW_DATA::sel_dragging, N_GUI_SYNTAXVIEW_DATA::sel_end, N_GUI_SYNTAXVIEW_DATA::sel_start, N_GUI_CTX::selected_syntaxview_id, N_GUI_SYNTAXVIEW_DATA::text, and N_GUI_WIDGET::type.

Referenced by build_syntaxview_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_tab_add()

◆ n_gui_tab_create()

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(*)(int, void *)  on_tab_change,
void *  user_data 
)

◆ n_gui_tab_free()

void n_gui_tab_free ( N_GUI_TAB_PANEL **  panel)

free a tab panel (does not destroy the N_GUI widgets)

Definition at line 13322 of file n_gui.c.

References FreeNoLog.

◆ n_gui_tab_get_active()

int n_gui_tab_get_active ( const N_GUI_TAB_PANEL panel)

get the active tab index

Definition at line 13318 of file n_gui.c.

References N_GUI_TAB_PANEL::active_tab.

◆ n_gui_tab_set_active()

void n_gui_tab_set_active ( N_GUI_TAB_PANEL panel,
int  index 
)

set the active tab (toggles buttons, opens/closes content windows)

Definition at line 13304 of file n_gui.c.

References N_GUI_TAB_PANEL::active_tab, N_GUI_TAB_PANEL::button_ids, N_GUI_TAB_PANEL::content_window_ids, N_GUI_TAB_PANEL::ctx, n_gui_button_set_toggled(), n_gui_close_window(), n_gui_open_window(), and N_GUI_TAB_PANEL::nb_tabs.

Referenced by _n_gui_tab_button_clicked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_tab_set_content_window()

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

Definition at line 13299 of file n_gui.c.

References N_GUI_TAB_PANEL::content_window_ids, and N_GUI_TAB_PANEL::nb_tabs.

◆ n_gui_textarea_get_text()

const char * n_gui_textarea_get_text ( N_GUI_CTX ctx,
int  widget_id 
)

get text area content

get text area content

Parameters
ctxGUI context
widget_idid of the textarea widget
Returns
pointer to the text content

Definition at line 3249 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, and N_GUI_WIDGET::type.

Referenced by on_send_click().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_textarea_get_text_length()

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)

return the current text length in bytes (0 if widget is invalid)

Parameters
ctxGUI context
widget_idid of the textarea widget
Returns
text length in bytes, or 0 if widget is invalid

Definition at line 5336 of file n_gui.c.

References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_textarea_scroll_to_bottom()

void n_gui_textarea_scroll_to_bottom ( N_GUI_CTX ctx,
int  widget_id 
)

scroll a multiline textarea to the bottom

Parameters
ctxGUI context
widget_idid of the textarea widget

Definition at line 5236 of file n_gui.c.

References _textarea_content_height(), N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_TEXTAREA_DATA::multiline, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_CTX::style, N_GUI_TEXTAREA_DATA::text_len, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::type, and N_GUI_WIDGET::w.

+ Here is the call graph for this function:

◆ n_gui_textarea_scroll_to_offset()

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

Parameters
ctxGUI context
widget_idid of the textarea widget
byte_offsetbyte offset in text to center on screen

Definition at line 5275 of file n_gui.c.

References _text_w(), _textarea_content_height(), _utf8_char_len(), N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_TEXTAREA_DATA::multiline, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::scroll_from_wheel, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_STYLE::scrollbar_size, N_GUI_CTX::style, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::type, and N_GUI_WIDGET::w.

+ Here is the call graph for this function:

◆ n_gui_textarea_set_bitmap()

void n_gui_textarea_set_bitmap ( N_GUI_CTX ctx,
int  widget_id,
ALLEGRO_BITMAP *  bg 
)

set optional background bitmap on a textarea widget.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the widget's lifetime and destroy them after the GUI context is destroyed.

set optional background bitmap on a textarea widget.

Note
Bitmaps are NOT owned by N_GUI.

Definition at line 4863 of file n_gui.c.

References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, n_log, and N_GUI_WIDGET::type.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_textarea_set_mask_char()

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.

'*'). Set to '\0' to disable masking. Only affects single-line textareas.

Parameters
ctxthe GUI context
widget_idid of the textarea widget

set a mask character for password-style input (e.g.

Parameters
maskThe character to display instead of actual text (e.g. '*'). Set to '\0' to disable masking.

Definition at line 4877 of file n_gui.c.

References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, n_log, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_textarea_set_placeholder()

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.

Pass NULL or "" to remove the placeholder. The string is copied.

Parameters
ctxthe GUI context
widget_idid of the textarea widget
textthe placeholder text, or NULL to clear

set placeholder/hint text for a textarea, shown dimmed while the field is empty and cleared from view as soon as the user types.

Definition at line 4889 of file n_gui.c.

References N_GUI_WIDGET::data, FreeNoLog, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, n_log, N_GUI_TEXTAREA_DATA::placeholder, and N_GUI_WIDGET::type.

Referenced by main(), n_gui_kvtable_add_row(), and n_gui_kvtable_set_placeholders().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_textarea_set_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)

Parameters
ctxGUI context
widget_idid of the textarea widget
startselection start byte offset
endselection end byte offset

Definition at line 5258 of file n_gui.c.

References N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::sel_end, N_GUI_TEXTAREA_DATA::sel_start, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_WIDGET::type.

+ Here is the call graph for this function:

◆ n_gui_textarea_set_text()

void n_gui_textarea_set_text ( N_GUI_CTX ctx,
int  widget_id,
const char *  text 
)

set text area content

set text area content

Parameters
ctxGUI context
widget_idid of the textarea widget
textthe text to set, or NULL to clear

Definition at line 3263 of file n_gui.c.

References _normalize_crlf(), N_GUI_TEXTAREA_DATA::char_limit, N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::scroll_x, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_WIDGET::type.

Referenced by build_textarea_window(), main(), main(), n_gui_kvtable_add_row(), on_clear_click(), on_completion_select(), and on_send_click().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_toggle_window()

void n_gui_toggle_window ( N_GUI_CTX ctx,
int  window_id 
)

toggle window visibility (show/hide)

toggle window visibility (show/hide)

Definition at line 1950 of file n_gui.c.

References n_gui_get_window(), N_GUI_WIN_OPEN, and N_GUI_WINDOW::state.

Referenced by on_window_toggle_click().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_tooltip_pending()

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)

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)

Hosts that cache the GUI render must keep invalidating/redrawing while this returns 1 (arming), or the bubble can never appear - it shows only after the pointer STOPS, when no more input events trigger redraws. A steady 2 (shown) needs one re-render on the transition and none after; re-rendering every tick during 2 would burn the cache for nothing.

Parameters
ctxthe GUI context
Returns
0 = none/disabled, 1 = arming, 2 = shown

Definition at line 2323 of file n_gui.c.

References N_GUI_CTX::style, N_GUI_CTX::tooltip_armed_at, N_GUI_STYLE::tooltip_delay, and N_GUI_CTX::tooltip_widget_id.

◆ n_gui_tree_add_node()

int n_gui_tree_add_node ( N_GUI_TREE tree,
const char *  label,
int  parent_index,
void *  user_data 
)

◆ n_gui_tree_clear()

void n_gui_tree_clear ( N_GUI_TREE tree)

remove all nodes and clear the backing listbox; tree object remains valid

Definition at line 13401 of file n_gui.c.

References N_GUI_TREE::ctx, N_GUI_TREE::listbox_id, n_gui_listbox_clear(), N_GUI_TREE::nb_nodes, and N_GUI_TREE::nb_visible.

+ Here is the call graph for this function:

◆ n_gui_tree_create()

◆ n_gui_tree_draw_overlay()

void n_gui_tree_draw_overlay ( N_GUI_TREE tree)

per-frame overlay drawing: draws the active drop-indicator on top of the listbox.

Call after n_gui_draw(). No-op when no drag is in progress.

Definition at line 13730 of file n_gui.c.

References _n_gui_tree_listbox_bounds(), N_GUI_THEME::border_active, N_GUI_TREE::ctx, N_GUI_CTX::default_theme, N_GUI_TREE::drag_active, N_GUI_TREE::drag_hover_node, N_GUI_TREE::drop_position, N_GUI_TREE::listbox_id, N_GUI_DROP_BEFORE, N_GUI_DROP_INTO, n_gui_get_widget(), N_GUI_TREE::nb_visible, N_GUI_WIDGET::theme, and N_GUI_TREE::visible_map.

+ Here is the call graph for this function:

◆ n_gui_tree_find_by_user_data()

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.

Used to re-resolve a node index after a rebuild compacted the array: the caller stashes the stable user_data pointer before the rebuild, then calls this to find the new index.

Definition at line 13499 of file n_gui.c.

References N_GUI_TREE::nb_nodes, N_GUI_TREE::nodes, and N_GUI_TREE_NODE::user_data.

◆ n_gui_tree_free()

void n_gui_tree_free ( N_GUI_TREE **  tree)

free a tree view (does not destroy the N_GUI listbox)

Definition at line 13562 of file n_gui.c.

References FreeNoLog.

◆ n_gui_tree_get_selection()

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

Definition at line 13470 of file n_gui.c.

References N_GUI_TREE::ctx, N_GUI_TREE::listbox_id, n_gui_listbox_get_selected(), N_GUI_TREE::nb_visible, and N_GUI_TREE::visible_map.

Referenced by n_gui_tree_rebuild().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_tree_rebuild()

◆ n_gui_tree_remove_node()

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)

Definition at line 13408 of file n_gui.c.

References N_GUI_TREE_NODE::has_children, N_GUI_TREE_MAX, n_gui_tree_rebuild(), N_GUI_TREE::nb_nodes, N_GUI_TREE::nodes, and N_GUI_TREE_NODE::parent_index.

+ Here is the call graph for this function:

◆ n_gui_tree_set_label()

void n_gui_tree_set_label ( N_GUI_TREE tree,
int  node_index,
const char *  new_label 
)

change the display label of a node

Definition at line 13462 of file n_gui.c.

References N_GUI_TREE_NODE::label, n_gui_tree_rebuild(), N_GUI_TREE::nb_nodes, and N_GUI_TREE::nodes.

+ Here is the call graph for this function:

◆ n_gui_tree_set_on_drop()

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.

Drag state is only tracked when on_drop is non-NULL.

Definition at line 13573 of file n_gui.c.

References N_GUI_TREE::drag_active, N_GUI_TREE::drag_armed_node, N_GUI_TREE::drag_hover_node, N_GUI_TREE::drag_source_node, N_GUI_TREE::drop_user_data, and N_GUI_TREE::on_drop.

◆ n_gui_tree_set_selection()

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.

Does not fire the on_select callback. No-op if node_index is out of range.

Definition at line 13477 of file n_gui.c.

References N_GUI_TREE::ctx, N_GUI_TREE_NODE::expanded, N_GUI_TREE::listbox_id, n_gui_listbox_set_scroll_offset(), n_gui_listbox_set_selected(), n_gui_tree_rebuild(), N_GUI_TREE::nb_nodes, N_GUI_TREE::nb_visible, N_GUI_TREE::nodes, N_GUI_TREE_NODE::parent_index, and N_GUI_TREE::visible_map.

+ Here is the call graph for this function:

◆ n_gui_tree_tick()

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.

Call once per frame while the tree is visible, before n_gui_draw(). No-op when on_drop is NULL.

Definition at line 13668 of file n_gui.c.

References _N_GUI_TREE_DRAG_THRESHOLD_PX, _n_gui_tree_hit_row(), N_GUI_TREE::ctx, N_GUI_TREE::drag_active, N_GUI_TREE::drag_armed_node, N_GUI_TREE::drag_hover_node, N_GUI_TREE::drag_press_x, N_GUI_TREE::drag_press_y, N_GUI_TREE::drag_source_node, N_GUI_TREE::drop_position, N_GUI_TREE::drop_user_data, N_GUI_CTX::mouse_b1, N_GUI_TREE::mouse_b1_prev, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, N_GUI_DROP_INTO, and N_GUI_TREE::on_drop.

+ Here is the call graph for this function:

◆ n_gui_tree_toggle_expand()

void n_gui_tree_toggle_expand ( N_GUI_TREE tree,
int  node_index 
)

toggle expand/collapse of a node

Definition at line 13507 of file n_gui.c.

References N_GUI_TREE_NODE::expanded, N_GUI_TREE_NODE::has_children, n_gui_tree_rebuild(), N_GUI_TREE::nb_nodes, and N_GUI_TREE::nodes.

Referenced by _n_gui_tree_listbox_selected().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_update_transform()

void n_gui_update_transform ( N_GUI_CTX ctx)

recalculate scale and offset from virtual canvas to display.

Called automatically by n_gui_set_display_size when virtual canvas is set. You should not normally need to call this directly.

recalculate scale and offset from virtual canvas to display.

Uses uniform (aspect-preserving) scaling with centred letterboxing, identical to the approach used by BlockBlaster's update_view_offset(). Called automatically by n_gui_set_display_size() when virtual canvas is set.

Definition at line 8849 of file n_gui.c.

References __n_assert, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.

Referenced by n_gui_set_display_size(), and n_gui_set_virtual_size().

+ Here is the caller graph for this function:

◆ n_gui_wants_mouse()

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)

check if the mouse is currently over any open GUI window (use to prevent click-through to the game world)

Use this to prevent mouse clicks from passing through the GUI to the game.

Parameters
ctxthe GUI context
Returns
1 if the mouse is over a GUI window, 0 otherwise

Definition at line 12337 of file n_gui.c.

References __n_assert, _point_in_rect(), _win_tbh(), N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_WINDOW::h, list_foreach, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WINDOW::native, N_GUI_WINDOW::state, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_WINDOW::w, N_GUI_CTX::windows, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_widget_get_persist_key()

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.

Definition at line 2306 of file n_gui.c.

References n_gui_get_widget(), and N_GUI_WIDGET::persist_key.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_widget_set_persist_key()

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.

The key is unique within its window (matching is by owning-window title + key). Passing NULL/"" clears the key (stops persisting). If a saved layout was already loaded, the matching pending state is applied to the widget immediately (consume-once). No-op for a widget type that carries no persistable state.

Definition at line 2293 of file n_gui.c.

References _apply_pending_widget(), _find_widget_window(), key, n_gui_get_widget(), N_GUI_WIDGET::persist_key, and N_GUI_WINDOW::title.

Referenced by build_window(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_apply_autofit()

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)

Parameters
ctxthe GUI context
window_idthe window to recalculate

trigger auto-fit recalculation for a window (call after adding/removing/resizing widgets)

Computes content bounding box from visible widgets and adjusts window dimensions based on autofit_flags and autofit_border.

Definition at line 2035 of file n_gui.c.

References __n_assert, _win_tbh(), N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WINDOW::autofit_origin_x, N_GUI_WINDOW::autofit_origin_y, N_GUI_WINDOW::content_h, N_GUI_WINDOW::content_w, N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_AUTOFIT_CENTER, N_GUI_AUTOFIT_EXPAND_LEFT, N_GUI_AUTOFIT_EXPAND_UP, N_GUI_AUTOFIT_H, N_GUI_AUTOFIT_W, n_gui_get_window(), N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.

Referenced by main(), n_gui_draw(), and n_gui_draw_detached().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_attach()

int n_gui_window_attach ( N_GUI_CTX ctx,
int  window_id 
)

return a detached window to being an in-display pop-up

Parameters
ctxthe GUI context
window_idthe window to re-attach
Returns
0 on success (or if the window was not detached), -1 on error

return a detached window to being an in-display pop-up

Definition at line 1542 of file n_gui.c.

References __n_assert, _n_gui_widget_capture_normalized(), _release_native_window(), N_GUI_WINDOW::flags, N_GUI_WINDOW::h, list_foreach, LOG_DEBUG, LOG_ERR, n_gui_get_window(), n_log, N_GUI_WINDOW::native, N_GUI_WINDOW::saved_flags, N_GUI_WINDOW::saved_h, N_GUI_WINDOW::saved_w, N_GUI_WINDOW::saved_x, N_GUI_WINDOW::saved_y, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::title, N_GUI_WINDOW::w, N_GUI_WINDOW::want_native, N_GUI_WINDOW::widgets, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.

Referenced by main(), on_attach_all(), and on_toggle_detach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_autosize()

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

recompute and apply minimum-fit size for a window based on its current widgets

Adds padding around the furthest widget extents.

Definition at line 1987 of file n_gui.c.

References _win_tbh(), N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, n_gui_get_window(), N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_detach()

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

Creates an ALLEGRO_DISPLAY sized to the window's body, registers its event source in the context's event queue, and moves the window to (0,0) inside it. The window is forced frameless: the OS supplies the title bar, so dragging, resizing, minimising and maximising are handled by the window manager and the window's own title bar buttons are no longer drawn. The window's title becomes the OS window title.

The host must call n_gui_draw_detached() once per frame to render and flip the native windows, and keep feeding every event to n_gui_process_event(), which routes each one to the display it came from.

Parameters
ctxthe GUI context. An event queue must have been set.
window_idthe window to detach
detach_flagsbitmask of N_GUI_DETACH_* options
Returns
0 on success (or if the window was already detached), -1 on error

promote a pop-up window to a native OS window

Definition at line 1409 of file n_gui.c.

References __n_assert, _n_gui_widget_capture_normalized(), _win_tbh(), N_GUI_WINDOW::detach_flags, N_GUI_CTX::event_queue, N_GUI_WINDOW::flags, N_GUI_WINDOW::h, N_GUI_TB_BUTTONS::hovered, list_foreach, LOG_DEBUG, LOG_ERR, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_DETACH_OWN_CHROME, N_GUI_DETACH_RESIZABLE, n_gui_get_window(), N_GUI_TB_BTN_NONE, N_GUI_WIN_DRAGGING, N_GUI_WIN_FRAMELESS, N_GUI_WIN_HSCROLL_DRAG, N_GUI_WIN_MAXIMISED, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WIN_RESIZING, N_GUI_WIN_VSCROLL_DRAG, n_log, N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_WINDOW::native_drag_anchored, N_GUI_WINDOW::native_h, N_GUI_WINDOW::native_pos_x, N_GUI_WINDOW::native_pos_y, N_GUI_WINDOW::native_w, N_GUI_TB_BUTTONS::pressed, N_GUI_WINDOW::saved_flags, N_GUI_WINDOW::saved_h, N_GUI_WINDOW::saved_w, N_GUI_WINDOW::saved_x, N_GUI_WINDOW::saved_y, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::state, N_GUI_WINDOW::tb_buttons, N_GUI_WINDOW::title, N_GUI_WINDOW::w, N_GUI_WINDOW::want_native, N_GUI_WINDOW::widgets, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.

Referenced by main(), n_gui_load_layout_json(), n_gui_open_window(), on_detach_all(), and on_toggle_detach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_from_display()

int n_gui_window_from_display ( N_GUI_CTX ctx,
ALLEGRO_DISPLAY *  display 
)

find the window detached into a given display

Returns
the window id, or -1 when no detached window owns display

find the window detached into a given display

Definition at line 1596 of file n_gui.c.

References __n_assert, display, N_GUI_WINDOW::id, list_foreach, N_GUI_WINDOW::native, and N_GUI_CTX::windows.

Referenced by main().

+ Here is the caller graph for this function:

◆ n_gui_window_get_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

get the native display backing a window, or NULL when it is a pop-up

Definition at line 1584 of file n_gui.c.

References __n_assert, n_gui_get_window(), and N_GUI_WINDOW::native.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_get_flags()

int n_gui_window_get_flags ( N_GUI_CTX ctx,
int  window_id 
)

get feature flags of a window

get feature flags of a window

Returns
the flags, or 0

Definition at line 1977 of file n_gui.c.

References N_GUI_WINDOW::flags, and n_gui_get_window().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_get_resize_policy()

int n_gui_window_get_resize_policy ( N_GUI_CTX ctx,
int  window_id 
)

get per-window resize policy

get per-window resize policy

Returns
N_GUI_WIN_RESIZE_NONE, _MOVE, or _SCALE

Definition at line 8949 of file n_gui.c.

References __n_assert, n_gui_get_window(), and N_GUI_WINDOW::resize_policy.

+ Here is the call graph for this function:

◆ n_gui_window_get_zorder()

int n_gui_window_get_zorder ( N_GUI_CTX ctx,
int  window_id 
)

get window z-order mode

get window z-order mode

Definition at line 1921 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_ZORDER_NORMAL, and N_GUI_WINDOW::z_order.

+ Here is the call graph for this function:

◆ n_gui_window_get_zvalue()

int n_gui_window_get_zvalue ( N_GUI_CTX ctx,
int  window_id 
)

get window z-value (for N_GUI_ZORDER_FIXED mode)

get window z-value (for N_GUI_ZORDER_FIXED mode)

Definition at line 1931 of file n_gui.c.

References __n_assert, n_gui_get_window(), and N_GUI_WINDOW::z_value.

+ Here is the call graph for this function:

◆ n_gui_window_is_detached()

int n_gui_window_is_detached ( N_GUI_CTX ctx,
int  window_id 
)

check whether a window currently lives in a native OS window

check whether a window currently lives in a native OS window

Definition at line 1575 of file n_gui.c.

References __n_assert, n_gui_get_window(), and N_GUI_WINDOW::native.

Referenced by main(), on_detach_all(), on_toggle_detach(), and refresh_buttons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_is_maximised()

int n_gui_window_is_maximised ( N_GUI_CTX ctx,
int  window_id 
)

check if a window is currently maximised

check if a window is currently maximised

Returns
1 if maximised, 0 if not (or invalid id)

Definition at line 1344 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_WIN_MAXIMISED, and N_GUI_WINDOW::state.

+ Here is the call graph for this function:

◆ n_gui_window_is_minimised()

int n_gui_window_is_minimised ( N_GUI_CTX ctx,
int  window_id 
)

check if a window is currently minimised

check if a window is currently minimised

Parameters
ctxthe gui context
window_idthe id of the window to query
Returns
1 if the window is minimised, 0 otherwise (or on a bad id)

Definition at line 1255 of file n_gui.c.

References n_gui_get_window(), N_GUI_WIN_MINIMISED, and N_GUI_WINDOW::state.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_is_open()

int n_gui_window_is_open ( N_GUI_CTX ctx,
int  window_id 
)

check if window is visible

check if window is visible

Returns
1 if open, 0 if closed

Definition at line 1959 of file n_gui.c.

References n_gui_get_window(), N_GUI_WIN_OPEN, and N_GUI_WINDOW::state.

Referenced by main(), and on_windows_menu_open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_native_is_hidden()

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.

A halted window is skipped by n_gui_draw_detached.

Returns
1 when the window is detached and not currently drawable, else 0

check whether a detached window's drawing is currently halted by the OS (Android surface loss) or the window manager has iconified it.

Definition at line 1644 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_WINDOW::native, and N_GUI_WINDOW::native_halted.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_autofit()

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

Parameters
ctxthe GUI context
window_idthe window to configure
autofit_flagsbitmask of N_GUI_AUTOFIT_W, N_GUI_AUTOFIT_H, N_GUI_AUTOFIT_EXPAND_LEFT, N_GUI_AUTOFIT_EXPAND_UP
borderpadding in pixels between content bounding box and window edge (on each side)

configure auto-fit behavior for a dialog window

Store the flags and border value in the window struct.

Definition at line 2016 of file n_gui.c.

References __n_assert, N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WINDOW::autofit_origin_x, N_GUI_WINDOW::autofit_origin_y, LOG_ERR, n_gui_get_window(), n_log, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_bitmaps()

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.

Pass NULL for any bitmap you don't want to set.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the window's lifetime and destroy them after the GUI context is destroyed.
Parameters
ctxthe GUI context
window_idid of the target window
bgbody background bitmap (NULL = color fill)
titlebartitlebar background bitmap (NULL = color fill)
bg_scale_modescale mode for bg: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER

set optional bitmap overlays on a window's body and titlebar.

Note
Bitmaps are NOT owned by N_GUI. The caller must keep them alive for the window's lifetime and destroy them after the GUI context is destroyed.

Definition at line 4797 of file n_gui.c.

References N_GUI_WINDOW::bg_bitmap, N_GUI_WINDOW::bg_scale_mode, LOG_WARNING, n_gui_get_window(), n_log, and N_GUI_WINDOW::titlebar_bitmap.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_close_callback()

void n_gui_window_set_close_callback ( N_GUI_CTX ctx,
int  window_id,
void(*)(int, void *)  on_close,
void *  user_data 
)

set the close button callback for a window (NULL = default: hide window)

Parameters
ctxthe GUI context
window_idthe target window
on_closecallback receiving (window_id, user_data). Must call n_gui_close_window() itself if desired.
user_datauser data passed to the callback

set the close button callback for a window (NULL = default: hide window)

Definition at line 1655 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_TB_BUTTONS::on_close, N_GUI_TB_BUTTONS::on_close_user_data, and N_GUI_WINDOW::tb_buttons.

Referenced by build_panel(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_content_draw_callback()

void n_gui_window_set_content_draw_callback ( N_GUI_CTX ctx,
int  window_id,
void(*)(int, void *)  on_content_draw,
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)

Parameters
ctxthe GUI context
window_idthe target window
on_content_drawcallback receiving (window_id, user_data); NULL clears it
user_datauser data passed to the callback

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)

The callback runs during n_gui_draw immediately after the window's own content is drawn, at the window's z-order, so any custom rendering it performs is occluded by windows that draw on top of this one.

Definition at line 1670 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_WINDOW::on_content_draw, and N_GUI_WINDOW::on_content_draw_data.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_flags()

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, ...)

Parameters
ctxthe GUI context
window_idid of the target window
flagsbitmask of N_GUI_WIN_* flags to set

set feature flags on a window (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, ...)

Definition at line 1968 of file n_gui.c.

References N_GUI_WINDOW::flags, and n_gui_get_window().

Referenced by build_panel(), main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_maximize_callback()

void n_gui_window_set_maximize_callback ( N_GUI_CTX ctx,
int  window_id,
void(*)(int, void *)  on_maximize,
void *  user_data 
)

set the maximize button callback for a window (NULL = default: toggle maximised)

Parameters
ctxthe GUI context
window_idthe target window
on_maximizecallback receiving (window_id, user_data)
user_datauser data passed to the callback

set the maximize button callback for a window (NULL = default: toggle maximised)

Definition at line 1692 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_TB_BUTTONS::on_maximize, N_GUI_TB_BUTTONS::on_maximize_user_data, and N_GUI_WINDOW::tb_buttons.

+ Here is the call graph for this function:

◆ n_gui_window_set_minimize_callback()

void n_gui_window_set_minimize_callback ( N_GUI_CTX ctx,
int  window_id,
void(*)(int, void *)  on_minimize,
void *  user_data 
)

set the minimize button callback for a window (NULL = default: toggle minimised)

Parameters
ctxthe GUI context
window_idthe target window
on_minimizecallback receiving (window_id, user_data)
user_datauser data passed to the callback

set the minimize button callback for a window (NULL = default: toggle minimised)

Definition at line 1681 of file n_gui.c.

References __n_assert, n_gui_get_window(), N_GUI_TB_BUTTONS::on_minimize, N_GUI_TB_BUTTONS::on_minimize_user_data, and N_GUI_WINDOW::tb_buttons.

+ Here is the call graph for this function:

◆ n_gui_window_set_native_icons()

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

Only meaningful while the window is detached, a pop-up has no OS window to put an icon on. Like every other bitmap N_GUI is handed, the bitmaps are BORROWED: Allegro copies what it needs at call time, but keep them alive for as long as you may re-apply them and destroy them yourself.

Parameters
ctxthe GUI context
window_ida detached window
iconsarray of bitmaps, ideally several sizes so the platform can pick
num_iconsnumber of entries in icons (1 is fine)
Returns
0 on success, -1 when the window does not exist or is not detached

give a detached window's OS window a taskbar / title bar icon

Definition at line 1622 of file n_gui.c.

References __n_assert, LOG_ERR, n_gui_get_window(), n_log, and N_GUI_WINDOW::native.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_resize_policy()

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).

Automatically captures normalized coordinates from the window's current position/size relative to the current display size.

set per-window resize policy (N_GUI_WIN_RESIZE_NONE / _MOVE / _SCALE).

Automatically captures normalized coordinates from the window's current position/size relative to the current display size.

Definition at line 8936 of file n_gui.c.

References __n_assert, _n_gui_window_capture_normalized(), n_gui_get_window(), and N_GUI_WINDOW::resize_policy.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_tb_btn_theme()

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

set the theme for titlebar minimize/maximize buttons on a specific window

Definition at line 1703 of file n_gui.c.

References __n_assert, N_GUI_TB_BUTTONS::btn_theme, n_gui_get_window(), and N_GUI_WINDOW::tb_buttons.

+ Here is the call graph for this function:

◆ n_gui_window_set_tb_button_bitmaps()

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

Parameters
ctxthe GUI context
window_idthe target window
btn_typeN_GUI_TB_BTN_MINIMIZE, N_GUI_TB_BTN_MAXIMIZE, or N_GUI_TB_BTN_CLOSE
normalbitmap for normal state (NULL = color theme)
hoverbitmap for hover state (NULL = fallback to normal)
activebitmap for active/pressed state (NULL = fallback to normal)

set optional bitmap overlays on a titlebar button

Definition at line 1723 of file n_gui.c.

References __n_assert, N_GUI_TB_BUTTONS::close_active_bitmap, N_GUI_TB_BUTTONS::close_bitmap, N_GUI_TB_BUTTONS::close_hover_bitmap, N_GUI_TB_BUTTONS::maximize_active_bitmap, N_GUI_TB_BUTTONS::maximize_bitmap, N_GUI_TB_BUTTONS::maximize_hover_bitmap, N_GUI_TB_BUTTONS::minimize_active_bitmap, N_GUI_TB_BUTTONS::minimize_bitmap, N_GUI_TB_BUTTONS::minimize_hover_bitmap, n_gui_get_window(), N_GUI_TB_BTN_CLOSE, N_GUI_TB_BTN_MAXIMIZE, N_GUI_TB_BTN_MINIMIZE, and N_GUI_WINDOW::tb_buttons.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_set_tb_close_theme()

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

set the theme for the titlebar close button on a specific window

Definition at line 1713 of file n_gui.c.

References __n_assert, N_GUI_TB_BUTTONS::close_theme, n_gui_get_window(), and N_GUI_WINDOW::tb_buttons.

+ Here is the call graph for this function:

◆ n_gui_window_set_zorder()

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

Parameters
ctxthe GUI context
window_idthe window to configure
z_modeone of N_GUI_ZORDER_NORMAL, N_GUI_ZORDER_ALWAYS_ON_TOP, N_GUI_ZORDER_ALWAYS_BEHIND, N_GUI_ZORDER_FIXED, N_GUI_ZORDER_POPUP
z_valuez-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top), ignored for other modes

set window z-order mode and value

Re-sorts the window list after changing.

Definition at line 1903 of file n_gui.c.

References __n_assert, _sort_windows_by_zorder(), LOG_ERR, n_gui_get_window(), N_GUI_ZORDER_ALWAYS_BEHIND, N_GUI_ZORDER_ALWAYS_ON_TOP, N_GUI_ZORDER_FIXED, N_GUI_ZORDER_NORMAL, N_GUI_ZORDER_POPUP, n_log, N_GUI_WINDOW::z_order, and N_GUI_WINDOW::z_value.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ n_gui_window_update_normalized()

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.

Call after programmatically moving/resizing a window if you want the new position to be the adaptive reference point.

recapture normalized coordinates for a window from its current absolute position/size.

Call after programmatically moving/resizing a window if you want the new position to be the adaptive reference point.

Definition at line 8962 of file n_gui.c.

References __n_assert, _n_gui_window_capture_normalized(), N_GUI_CTX::display_h, N_GUI_CTX::display_w, n_gui_get_window(), N_GUI_CTX::ref_display_h, and N_GUI_CTX::ref_display_w.

+ Here is the call graph for this function: