![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows. More...
#include "nilorea/n_gui.h"#include "nilorea/n_clipboard.h"#include <limits.h>#include "cJSON.h"#include <fcntl.h>#include <unistd.h>
Include dependency graph for n_gui.c:Go to the source code of this file.
Data Structures | |
| struct | N_GUI_MEAS_ENTRY |
Macros | |
| #define | _N_GUI_TREE_DRAG_THRESHOLD_PX 4.0f |
| pixels of mouse movement before a press becomes a drag | |
| #define | _N_GUI_WIN_STATE_PERSIST_MASK (N_GUI_WIN_OPEN | N_GUI_WIN_MINIMISED | N_GUI_WIN_MAXIMISED) |
| #define | N_GUI_ANIM_TAIL_SEC 0.05 |
| #define | N_GUI_KEY_PRESS_FLASH_SEC 0.12 |
| #define | N_GUI_MEAS_CACHE_SIZE 1024u /* power of two */ |
| #define | N_GUI_MEAS_KEY_MAX 32 /* strings this long or longer bypass the cache */ |
Functions | |
| static void | _apply_pending_widget (N_GUI_CTX *ctx, const char *title, const N_GUI_WIDGET *wgt) |
| static ALLEGRO_COLOR | _bg_for_state (const N_GUI_THEME *t, int state) |
| helper: pick colour based on widget state | |
| static ALLEGRO_COLOR | _border_for_state (const N_GUI_THEME *t, int state) |
| static int | _cell_cmp (const char *a, const char *b) |
| compare two cell strings: numerically when both are integers, else case-insensitive | |
| static int | _cell_is_num (const char *s) |
| true when every character of a non-empty string is a decimal digit | |
| static double | _clamp (double v, double lo, double hi) |
| helper: clamp a double between lo and hi | |
| static void | _clear_syntaxview_selection (N_GUI_CTX *ctx) |
| drop any active syntax-view text selection (used when focus moves to another selectable widget, so only one selection is live at a time). | |
| static ALLEGRO_COLOR | _color_with_alpha (ALLEGRO_COLOR c, float a) |
| Helper: return a copy of c with the given alpha (0..1). | |
| static void | _compute_gui_bounds (N_GUI_CTX *ctx) |
| helper: compute the bounding box of all open windows | |
| static ALLEGRO_DISPLAY * | _ctx_io_display (const N_GUI_CTX *ctx) |
| helper: the display to use for clipboard and mouse-cursor calls. | |
| static void | _datagrid_apply_columns (N_GUI_CTX *ctx, int widget_id, int ncols, const int *order, const int *visible, const float *width) |
| static N_GUI_DATAGRID_DATA * | _datagrid_data (N_GUI_CTX *ctx, int widget_id) |
| fetch a data grid's column table for an API call, or NULL on a bad id. | |
| static int | _datagrid_ensure_colors (N_GUI_DATAGRID_DATA *gd) |
| helper: ensure the per-row tint arrays exist, sized to rows_cap (rows start untinted); returns 1 when both arrays are available | |
| static void | _datagrid_ensure_sel (N_GUI_DATAGRID_DATA *gd) |
| helper: ensure the per-row selection array exists, sized to rows_cap | |
| static void | _datagrid_hmetrics (const N_GUI_WIDGET *wgt, const N_GUI_DATAGRID_DATA *gd, ALLEGRO_FONT *font, const N_GUI_STYLE *style, float *content_w, float *pane_w, int *need_hsb) |
Compute the datagrid horizontal-scroll metrics used identically by the draw path and the mouse handlers, so the thumb geometry never drifts between them: content_w = left pad + the total width of the visible columns; pane_w = the viewport width available to the columns (widget width minus a vertical scrollbar when the rows overflow); need_hsb = 1 when the content is wider than the pane. | |
| static size_t | _datagrid_phys (const N_GUI_DATAGRID_DATA *gd, size_t dp) |
physical column index shown at display position dp (identity when no order). | |
| static int | _datagrid_resize_hover (N_GUI_CTX *ctx, float px, float py) |
| Whether the pointer at (px,py) rests on a datagrid column-resize border: the header row of a visible datagrid, within a few pixels of a visible column's right edge. | |
| static void | _destroy_widget (void *ptr) |
| static void | _destroy_window (void *ptr) |
| helper: destroy a single window (called by list destructor) | |
| static void | _draw_bitmap_scaled (ALLEGRO_BITMAP *bmp, float dx, float dy, float dw, float dh, int mode) |
| helper: draw a bitmap into a rectangle, respecting the given scale mode. | |
| static void | _draw_button (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, const N_GUI_STYLE *style) |
| draw a button widget | |
| static void | _draw_checkbox (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a checkbox widget | |
| static void | _draw_cols_scrollbar (float ax, float bar_y, float track_w, float content_w, float h_scroll, const N_GUI_STYLE *style, N_GUI_THEME *theme) |
draw a horizontal scrollbar along the bottom edge of a widget: track_w is the width of the scrollable pane (from ax), bar_y its top, content_w the total content width, h_scroll the current pixel offset. | |
| static void | _draw_combobox (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, const N_GUI_STYLE *style) |
| draw a combobox widget (closed state) | |
| static void | _draw_combobox_dropdown (N_GUI_CTX *ctx) |
| static void | _draw_custom (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font) |
| draw a single widget. | |
| static void | _draw_datagrid (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| static void | _draw_dropmenu (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, const N_GUI_STYLE *style) |
| draw a dropdown menu button (closed state) | |
| static void | _draw_dropmenu_panel (N_GUI_CTX *ctx) |
| draw the dropdown menu panel overlay (called after all windows) | |
| static void | _draw_hexview (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a read-only hex viewer: offset, hex bytes, and an ASCII gutter | |
| static void | _draw_image (N_GUI_WIDGET *wgt, float ox, float oy) |
| draw an image widget | |
| static void | _draw_justified_selection (ALLEGRO_FONT *font, float x, float y, float max_w, float max_h, const char *text, int sel_start, int sel_end, ALLEGRO_COLOR sel_color) |
| helper: draw selection highlight rectangles over justified/wrapped text. | |
| static void | _draw_label (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, float win_w, N_GUI_STYLE *style) |
| static void | _draw_listbox (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a listbox widget | |
| static void | _draw_progressbar (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a sortable data grid: fixed header row plus scrollable data rows | |
| static void | _draw_radiolist (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, const N_GUI_STYLE *style) |
| draw a radiolist widget | |
| static void | _draw_rows_scrollbar (float ax, float ay, float w, float h, int nb_rows, int visible, int scroll_offset, const N_GUI_STYLE *style, N_GUI_THEME *theme) |
| draw a row-indexed vertical scrollbar (shared by hexview, syntaxview and datagrid) at the right edge of [ax,ay,w,h]. | |
| static void | _draw_scrollbar (N_GUI_WIDGET *wgt, float ox, float oy, const N_GUI_STYLE *style) |
| draw a scrollbar widget | |
| static void | _draw_slider (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a slider widget (horizontal or vertical) | |
| static void | _draw_splitpane (N_GUI_WIDGET *wgt, float ox, float oy) |
| draw a split pane: only the divider bar is painted (the app fills the two regions with its own widgets, positioned from the divider ratio) | |
| static void | _draw_syntaxview (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| static void | _draw_tb_buttons (N_GUI_WINDOW *win, const N_GUI_STYLE *style) |
| draw the titlebar buttons for a window | |
| static void | _draw_text_justified (ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_w, float max_h, const char *text) |
| helper: draw justified text within a given width, with multi-line word wrapping. | |
| static void | _draw_text_truncated (ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_w, const char *text) |
| helper: draw text truncated to a maximum pixel width. | |
| static void | _draw_textarea (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a textarea widget | |
| static void | _draw_textarea_placeholder (const N_GUI_TEXTAREA_DATA *td, const N_GUI_WIDGET *wgt, ALLEGRO_FONT *font, float tx, float ty) |
| draw a textarea's placeholder/hint at (tx,ty), dimmed, while the field is empty; a no-op once any text has been entered or when no placeholder is set | |
| static void | _draw_themed_rect (N_GUI_THEME *t, int state, float x, float y, float w, float h, int rounded) |
| draw a themed rectangle or rounded rectangle. | |
| static void | _draw_tooltip (N_GUI_CTX *ctx) |
| helper: draw the hover-tooltip bubble for the currently armed tooltip widget, but ONLY in the render pass of the display that owns that widget's window. | |
| static void | _draw_widget (N_GUI_WIDGET *wgt, float ox, float oy, ALLEGRO_FONT *default_font, float win_w, N_GUI_STYLE *style) |
| static void | _draw_widget_vscrollbar (float area_x, float area_y, float area_w, float view_h, float content_h, float scroll_y, N_GUI_STYLE *style) |
| helper: draw a mini vertical scrollbar inside a widget. | |
| static void | _draw_window (N_GUI_WINDOW *win, ALLEGRO_FONT *default_font, N_GUI_STYLE *style) |
| draw a window chrome + its widgets | |
| static float | _dropdown_panel_y (const N_GUI_CTX *ctx, float widget_top, float widget_bottom, float panel_h, int expand_up) |
| draw the combobox dropdown overlay (called after all windows) | |
| static int | _dropmenu_entries_grow (N_GUI_DROPMENU_ENTRY **entries, const size_t *nb, size_t *cap) |
| helper: ensure dropmenu entries array has room for one more | |
| static ALLEGRO_DISPLAY * | _event_display (const ALLEGRO_EVENT *event) |
| helper: the display an event originates from, or NULL when the event carries no display (timer, user and joystick events) or the field is unset, as in the headless tests that synthesize events with memset. | |
| static N_GUI_WINDOW * | _find_focused_window (N_GUI_CTX *ctx) |
| helper: find the window containing a focused widget | |
| static N_GUI_WINDOW * | _find_widget_window (N_GUI_CTX *ctx, int wgt_id, float *ox, float *oy) |
| helper: find the parent window of a widget by id, returning the window's content origin (accounting for scroll offsets). | |
| static LIST_NODE * | _find_window_node (N_GUI_CTX *ctx, int window_id) |
| helper: find a window node in the context list by id | |
| static FILE * | _gui_fopen_write (const char *path, const char *mode) |
| static int | _is_focusable_type (int type) |
| helper: check if a widget type is focusable via Tab navigation | |
| static int | _items_grow (N_GUI_LISTITEM **items, const size_t *nb, size_t *cap) |
| helper: ensure items array has room for one more, returns 1 on success | |
| static void | _json_add_color (cJSON *parent, const char *name, ALLEGRO_COLOR c) |
| helper: add an RGBA colour as a JSON array [r,g,b,a] (0-255) | |
| static ALLEGRO_COLOR | _json_get_color (cJSON *parent, const char *name, ALLEGRO_COLOR fallback) |
| helper: read an RGBA colour from a JSON array [r,g,b,a] | |
| static float | _json_get_float (cJSON *parent, const char *name, float fallback) |
| helper: read a float from JSON, return fallback if missing | |
| static int | _json_get_int (cJSON *parent, const char *name, int fallback) |
| helper: read an int from JSON, return fallback if missing | |
| static int | _justified_char_at_pos (const char *text, ALLEGRO_FONT *font, float max_w, float text_x, float text_y, float scroll_y, float click_mx, float click_my) |
| helper: find the byte offset in justified text closest to a click position. | |
| static int | _label_char_at_x (const N_GUI_LABEL_DATA *lb, ALLEGRO_FONT *font, float click_x) |
| draw a label widget. | |
| static float | _label_content_height (const char *text, ALLEGRO_FONT *font, float max_w) |
| helper: compute the total content height of justified/wrapped label text, in pixels. | |
| static float | _label_text_origin_x (const N_GUI_LABEL_DATA *lb, ALLEGRO_FONT *font, float ax, float wgt_w, float win_w, float wgt_x, float label_padding) |
| helper: compute the screen-space x origin where label text starts, accounting for alignment. | |
| static void | _list_panel_highlight_step (int *highlight, int *scroll, int nb, int max_visible, int delta, int fallback) |
helper: move an open list panel's highlight cursor (combobox / dropmenu) by delta items and scroll the visible window so the highlighted item stays in view. | |
| static float | _min_thickness (float requested) |
| helper: compute minimum line thickness so it stays >= 1 physical pixel. | |
| static void | _n_gui_kv_add_clicked (int widget_id, void *user_data) |
| static void | _n_gui_kv_apply_layout (N_GUI_KVTABLE *table) |
| static void | _n_gui_kv_remove_clicked (int widget_id, void *user_data) |
| static void | _n_gui_sectionlist_header_clicked (int widget_id, void *user_data) |
| static void | _n_gui_sectionlist_set_header_label (N_GUI_SECTIONLIST *sl, int idx) |
| static void | _n_gui_tab_button_clicked (int widget_id, void *user_data) |
| static int | _n_gui_tree_hit_row (N_GUI_TREE *tree, float mx, float my, int *out_node_idx, int *out_drop_pos) |
| Hit-test the mouse against the listbox's visible rows and fill the out params. | |
| static int | _n_gui_tree_listbox_bounds (N_GUI_TREE *tree, float *out_x, float *out_y, float *out_w, float *out_h, float *out_item_area_w, float *out_inset, float *out_item_h, int *out_scroll_off) |
| Return the listbox's absolute (screen-space) bounds and geometry via out params. | |
| static void | _n_gui_tree_listbox_selected (int widget_id, int index, int selected, void *user_data) |
| static int | _n_gui_tree_node_visible (N_GUI_TREE *tree, int node_index) |
| static void | _n_gui_widget_capture_normalized (const N_GUI_WINDOW *win, N_GUI_WIDGET *wgt) |
| capture normalized coords for a single widget relative to its parent window | |
| static void | _n_gui_window_capture_normalized (const N_GUI_CTX *ctx, N_GUI_WINDOW *win) |
| capture normalized coords for a window and its widgets from current absolutes | |
| static void | _native_apply_minimised (N_GUI_WINDOW *win) |
| helper: mirror an own-chrome window's minimised state onto its OS window by shrinking the display to the title bar and growing it back. | |
| static void | _native_drag_begin (N_GUI_WINDOW *win) |
| helper: anchor an own-chrome window's title bar drag on the desktop cursor. | |
| static int | _native_monitor_info (ALLEGRO_DISPLAY *display, ALLEGRO_MONITOR_INFO *info) |
| helper: the monitor rectangle a native window sits on. | |
| static int | _native_own_chrome (const N_GUI_WINDOW *win) |
| helper: whether a window is detached AND keeps drawing its own chrome (N_GUI_DETACH_OWN_CHROME). | |
| static N_GUI_WIDGET * | _new_widget (N_GUI_CTX *ctx, int type, float x, float y, float w, float h) |
| helper: allocate and initialise a base widget | |
| static char * | _ngui_clip_get (ALLEGRO_DISPLAY *display, int which) |
| static void | _ngui_clip_set (ALLEGRO_DISPLAY *display, int which, const char *text) |
| static N_GUI_MEAS_ENTRY * | _ngui_meas_slot (ALLEGRO_FONT *font, const char *text, size_t len) |
| find (or claim) the cache slot for (font, text[len]). | |
| static void | _ngui_publish_primary_selection (N_GUI_CTX *ctx) |
| publish the active text selection (syntax view, label, or focused textarea) to the X11 PRIMARY selection, implementing select-to-copy: selecting text with the mouse or keyboard makes it available for a middle-click paste, without disturbing CLIPBOARD. | |
| static void | _normalize_crlf (char *s) |
| helper: strip CR from a string in-place, normalizing CRLF to LF. | |
| static int | _point_in_rect (float px, float py, float rx, float ry, float rw, float rh) |
| helper: test if point is inside a rectangle | |
| static int | _pointer_over_window (const N_GUI_CTX *ctx, float px, float py) |
| helper: is the pointer over any open window that takes part in the current pass? O(windows) and used to short-circuit the per-widget tooltip and datagrid-cursor scans on motion events when the pointer is over empty background (the common case when the GUI is composited over a game). | |
| static void | _register_widget (N_GUI_CTX *ctx, N_GUI_WIDGET *w) |
| helper: register a widget in the hash table | |
| static void | _release_native_window (N_GUI_CTX *ctx, N_GUI_WINDOW *win) |
| forward declaration: unregister and destroy a window's native display, leaving the window's geometry untouched (see the native window section) | |
| static float | _scrollbar_calc_scroll (float mouse, float track_start, float track_length, float viewport, float content, float thumb_min) |
| helper: compute scroll position from mouse coordinate using thumb-aware math. | |
| static int | _scrollbar_calc_scroll_int (float mouse, float track_start, float track_length, int visible_items, int total_items, float thumb_min) |
| helper: integer variant of _scrollbar_calc_scroll for item-based widgets. | |
| static void | _scrollbar_update_from_mouse (N_GUI_WIDGET *wgt, float mx, float my, float win_x, float win_content_y, const N_GUI_STYLE *style) |
| handle scrollbar drag | |
| static ALLEGRO_BITMAP * | _select_state_bitmap (int state, ALLEGRO_BITMAP *normal_bmp, ALLEGRO_BITMAP *hover_bmp, ALLEGRO_BITMAP *active_bmp) |
| helper: select per-state bitmap with fallback chain. | |
| static void | _set_clipping_rect_transformed (int wx, int wy, int ww, int wh) |
| helper: set clipping rectangle in world space, transforming to screen space. | |
| static int | _shape_rounded (const N_GUI_STYLE *style, int widget_shape) |
| resolve whether a shape-aware widget draws rounded: the global shape_mode override (style->shape_mode) wins when set to ROUNDED or RECT, otherwise the widget's own shape decides. | |
| static double | _slider_snap_value (double val, double min_val, double max_val, double step) |
| helper: snap a slider value to the nearest valid step from min_val. | |
| static void | _slider_update_from_mouse (N_GUI_WIDGET *wgt, float mx, float my, float win_x, float win_content_y) |
| handle slider drag (horizontal or vertical) | |
| static void | _sort_windows_by_zorder (N_GUI_CTX *ctx) |
| Sort windows list by z-order: ALWAYS_BEHIND first, then FIXED (by z_value), then NORMAL, then ALWAYS_ON_TOP, then POPUP. | |
| static void | _syntax_draw_line (ALLEGRO_FONT *font, N_GUI_THEME *th, float x, float y, const char *s, int n, int mode, int line_idx, int in_headers) |
| draw one text line with mode-specific highlighting starting at (x,y) | |
| static int | _syntax_js_keyword (const char *s, int n) |
| whether the n bytes at s form a JavaScript keyword or literal name | |
| static int | _syntax_js_regex_kw (const char *s, int n) |
| whether the n bytes at s are a keyword after which an expression (and therefore a regex literal) can start, e.g. | |
| static int | _syntax_js_regex_possible (char c) |
| whether a '/' may start a regex literal after last significant char c (start of line, after an operator, an opener, or a separator) | |
| static float | _syntax_prefix_w (ALLEGRO_FONT *font, const char *s, int n) |
pixel width of the first n bytes of s in font (bounded copy). | |
| static void | _syntax_run (ALLEGRO_FONT *font, ALLEGRO_COLOR col, float *cx, float y, const char *s, int len) |
| draw a run of text and advance the pen x by its width | |
| static void | _syntaxview_ensure_lines (N_GUI_SYNTAXVIEW_DATA *yd) |
| forward declaration: (re)build a syntaxview's cached line count and headers-end index when stale. | |
| static int | _syntaxview_offset_from_mouse (const N_GUI_SYNTAXVIEW_DATA *yd, ALLEGRO_FONT *font, float mx, float my, float ax, float ay, float pad) |
| Map a mouse position over a syntax view to a byte offset into its text. | |
| static float | _tb_btn_resolved_size (const N_GUI_WINDOW *win, const N_GUI_STYLE *style) |
| return the effective titlebar button size (0 = auto from titlebar_h) | |
| static void | _tb_button_action (N_GUI_CTX *ctx, N_GUI_WINDOW *win, int btn_type) |
| Dispatch a titlebar button action, invoke the user callback if set, otherwise fall back to the built-in minimize / maximize / close behaviour. | |
| static int | _tb_button_rect (const N_GUI_WINDOW *win, const N_GUI_STYLE *style, int btn_type, float *out_x, float *out_y, float *out_w, float *out_h) |
| compute the absolute rect for a titlebar button. | |
| static float | _tb_buttons_area_width (const N_GUI_WINDOW *win, const N_GUI_STYLE *style) |
| compute the total width consumed by enabled titlebar buttons (0 if none/frameless) | |
| static void | _text_dims (ALLEGRO_FONT *font, const char *text, int *x, int *y, int *w, int *h) |
| helper: memoized al_get_text_dimensions (bounding box x/y/w/h). | |
| static ALLEGRO_COLOR | _text_for_state (const N_GUI_THEME *t, int state) |
| static int | _text_line_count (const char *s) |
| helper: destroy a single widget (called by list destructor) | |
| static float | _text_w (ALLEGRO_FONT *font, const char *text) |
| helper: get the advance width of text. | |
| static void | _textarea_clear_selection (N_GUI_TEXTAREA_DATA *td) |
| clear the selection (set both anchors to cursor_pos) | |
| static float | _textarea_content_height (const N_GUI_TEXTAREA_DATA *td, ALLEGRO_FONT *font, float widget_w, float pad) |
| helper: compute the total content height of multiline textarea text (with line-wrap), in pixels. | |
| static int | _textarea_copy_to_clipboard (const N_GUI_TEXTAREA_DATA *td, ALLEGRO_DISPLAY *display) |
| copy selected text to clipboard. | |
| static void | _textarea_delete_selection (N_GUI_WIDGET *wgt) |
| delete the currently selected text, move cursor to selection start | |
| static int | _textarea_handle_key (N_GUI_WIDGET *wgt, ALLEGRO_EVENT *ev, ALLEGRO_FONT *font, float pad, float sb_size, N_GUI_CTX *ctx) |
| handle textarea key input. | |
| static int | _textarea_has_selection (const N_GUI_TEXTAREA_DATA *td) |
| return 1 if the textarea has an active selection | |
| static void | _textarea_paste_clip (N_GUI_WIDGET *wgt, N_GUI_TEXTAREA_DATA *td, const char *clip) |
| insert clipboard text at the cursor, replacing any selection. | |
| static size_t | _textarea_pos_from_mouse (const N_GUI_TEXTAREA_DATA *td, ALLEGRO_FONT *font, float mx, float my, float ax, float ay, float widget_w, float widget_h, float pad, float scrollbar_size) |
| helper: find the byte position in a textarea closest to the given mouse coordinates (mx, my in screen space). | |
| static void | _textarea_sel_range (const N_GUI_TEXTAREA_DATA *td, size_t *lo, size_t *hi) |
| get the ordered selection range (lo, hi) | |
| static bool | _tooltip_line_cb (int line_num, const char *line, int size, void *extra) |
| helper: al_do_multiline_text callback that just counts the wrapped lines. | |
| static int | _tooltip_widget_at (N_GUI_CTX *ctx, float px, float py) |
| helper: top-most visible tooltip-bearing widget under a gui-space point (-1 = none) | |
| static int | _utf8_char_len (unsigned char c) |
| return the byte length of a UTF-8 character from its lead byte | |
| static int | _utf8_encode (int cp, char *out) |
| encode a Unicode code point into UTF-8, return the number of bytes written (0 on error) | |
| static int | _win_on_pass (const N_GUI_CTX *ctx, const N_GUI_WINDOW *win) |
| helper: whether a window takes part in the pass currently being processed or drawn. | |
| static float | _win_tbh (const N_GUI_WINDOW *win) |
| helper: effective title bar height (0 for frameless windows) | |
| static void | _window_update_content_size (N_GUI_WINDOW *win, ALLEGRO_FONT *default_font) |
| helper: recompute content extents for a window (for scrollbar support) | |
| static int | _zorder_group (const N_GUI_WINDOW *w) |
| 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 to a window. | |
| int | n_gui_add_button_bitmap (N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, ALLEGRO_BITMAP *normal, ALLEGRO_BITMAP *hover, ALLEGRO_BITMAP *active, void(*on_click)(int, void *), void *user_data) |
| Add a bitmap-based button. | |
| 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 (dropdown selector) | |
| 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; returns the widget id or -1 | |
| 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 widget. | |
| 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. | |
| int | n_gui_add_hexview (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h) |
| Add a read-only hexadecimal byte viewer. | |
| 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 display 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 static text label. | |
| 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 static 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 (single selection with radio bullets) | |
| 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 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 widget: a draggable divider between two regions. | |
| 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. | |
| 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) |
| Add a toggle button widget (stays clicked/unclicked on single click) | |
| 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 widget. | |
| int | n_gui_add_window (N_GUI_CTX *ctx, const char *title, float x, float y, float w, float h) |
| Add a new pseudo-window to the context. | |
| int | n_gui_add_window_auto (N_GUI_CTX *ctx, const char *title, float x, float y) |
| Add a window with automatic sizing (use n_gui_window_autosize after adding 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 a toggle button is currently in the "on" state. | |
| 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) |
| Set a focused key binding on a button. | |
| 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 per-state bitmaps. | |
| void | n_gui_button_set_toggle_mode (N_GUI_CTX *ctx, int widget_id, int toggle_mode) |
| Enable or disable toggle mode on a button. | |
| void | n_gui_button_set_toggled (N_GUI_CTX *ctx, int widget_id, int toggled) |
| Set the toggle state of a button. | |
| int | n_gui_checkbox_is_checked (N_GUI_CTX *ctx, int widget_id) |
| check if a checkbox widget 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 the checked state of a checkbox widget | |
| 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 widget | |
| 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 in a combobox widget | |
| 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. | |
| void | n_gui_combobox_set_selected (N_GUI_CTX *ctx, int widget_id, int index) |
| set the selected item in a combobox widget | |
| 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) |
| Build sensible default style (all configurable sizes, colours, paddings) | |
| N_GUI_THEME | n_gui_default_tb_btn_theme (void) |
| Build a default theme for titlebar minimize/maximize buttons. | |
| N_GUI_THEME | n_gui_default_tb_close_theme (void) |
| Build a default theme for the titlebar close button. | |
| N_GUI_THEME | n_gui_default_theme (void) |
| Build a sensible default colour theme. | |
| void | n_gui_destroy_ctx (N_GUI_CTX **ctx) |
| Destroy a GUI context and all its windows/widgets. | |
| float | n_gui_detect_dpi_scale (N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display) |
| Detect and apply DPI scale from an Allegro display. | |
| void | n_gui_draw (N_GUI_CTX *ctx) |
| Draw all visible windows and their 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 from a dropdown menu. | |
| void | n_gui_dropmenu_clear_dynamic (N_GUI_CTX *ctx, int widget_id) |
| Remove all dynamic entries (keep static ones) | |
| int | n_gui_dropmenu_get_count (N_GUI_CTX *ctx, int widget_id) |
| Get number of entries in a dropdown menu. | |
| float | n_gui_dropmenu_panel_width (N_GUI_CTX *ctx, int widget_id) |
| Width the open drop-down panel needs to show its entries. | |
| 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. | |
| 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. | |
| void | n_gui_focus_window (N_GUI_CTX *ctx, int window_id) |
| Give a window keyboard focus and bring it to the front. | |
| 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. | |
| 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_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. | |
| N_GUI_WIDGET * | n_gui_get_widget (N_GUI_CTX *ctx, int widget_id) |
| Get a widget pointer by id. | |
| N_GUI_WINDOW * | n_gui_get_window (N_GUI_CTX *ctx, int window_id) |
| Get a window pointer 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 | |
| void | n_gui_image_set_bitmap (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bitmap) |
| set the bitmap of an image widget | |
| int | n_gui_is_widget_enabled (N_GUI_CTX *ctx, int widget_id) |
| Check if a widget is enabled. | |
| int | n_gui_kvtable_add_row (N_GUI_KVTABLE *table, const char *key, const char *value, const char *description, int enabled) |
| add a row to the KV table | |
| void | n_gui_kvtable_clear (N_GUI_KVTABLE *table) |
| remove every row at once. | |
| N_GUI_KVTABLE * | n_gui_kvtable_create (N_GUI_CTX *ctx, int window_id, float row_height, float padding, void(*on_remove)(int, void *), void *user_data) |
| create a KV table in an existing window | |
| 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 the link URL of a label widget | |
| void | n_gui_label_set_text (N_GUI_CTX *ctx, int widget_id, const char *text) |
| set the text of a label widget | |
| int | n_gui_listbox_add_item (N_GUI_CTX *ctx, int widget_id, const char *text) |
| add an item to a listbox widget | |
| void | n_gui_listbox_clear (N_GUI_CTX *ctx, int widget_id) |
| remove all items from a listbox widget | |
| int | n_gui_listbox_get_count (N_GUI_CTX *ctx, int widget_id) |
| get the number of items in a listbox widget | |
| const char * | n_gui_listbox_get_item_text (N_GUI_CTX *ctx, int widget_id, int index) |
| get the text of a listbox item | |
| 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 index of the first selected item in a listbox | |
| int | n_gui_listbox_is_selected (N_GUI_CTX *ctx, int widget_id, int index) |
| check if a listbox item is selected | |
| int | n_gui_listbox_remove_item (N_GUI_CTX *ctx, int widget_id, int index) |
| remove an item from a listbox widget | |
| 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 the selection state of a listbox item | |
| 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 | |
| int | n_gui_load_theme_json (N_GUI_CTX *ctx, const char *filepath) |
| load a theme and style from a JSON file | |
| void | n_gui_lower_window (N_GUI_CTX *ctx, int window_id) |
| Lower a window to the bottom of the draw order. | |
| 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 with explicit colours. | |
| 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) |
| Minimise a window (show title bar only) | |
| int | n_gui_needs_redraw (N_GUI_CTX *ctx) |
| Return non-zero if the GUI must be redrawn this frame, i.e. | |
| N_GUI_CTX * | n_gui_new_ctx (ALLEGRO_FONT *default_font) |
| Create a new GUI context. | |
| void | n_gui_open_window (N_GUI_CTX *ctx, int window_id) |
| Open (show) a window. | |
| int | n_gui_process_event (N_GUI_CTX *ctx, ALLEGRO_EVENT event) |
| Process an allegro event through the GUI system. | |
| 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 radiolist widget | |
| void | n_gui_radiolist_clear (N_GUI_CTX *ctx, int widget_id) |
| remove all items from a radiolist widget | |
| int | n_gui_radiolist_get_selected (N_GUI_CTX *ctx, int widget_id) |
| get the selected item index in a radiolist widget | |
| 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 in a radiolist widget | |
| void | n_gui_raise_window (N_GUI_CTX *ctx, int window_id) |
| Bring a window to the front (top of draw order). | |
| 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 to a JSON file | |
| int | n_gui_save_theme_json (N_GUI_CTX *ctx, const char *filepath) |
| save the current theme and 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 the current scroll position of a scrollbar widget | |
| 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 the scroll position of a scrollbar widget | |
| void | n_gui_scrollbar_set_sizes (N_GUI_CTX *ctx, int widget_id, double content_size, double viewport_size) |
| set the content and viewport sizes of a scrollbar widget | |
| 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_SECTIONLIST * | n_gui_sectionlist_create (N_GUI_CTX *ctx, int window_id, float x, float y0, float width, float header_h, float gap, void(*on_toggle)(int, int, void *), void *user_data) |
| create an empty section list anchored at (x,y0) in window_id; sections stack downward from y0 | |
| void | n_gui_sectionlist_free (N_GUI_SECTIONLIST **sl) |
| free the section list (does not destroy the N_GUI widgets or window) | |
| int | n_gui_sectionlist_get_count (const N_GUI_SECTIONLIST *sl) |
| number of sections in the list | |
| int | n_gui_sectionlist_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 for global scrollbar computation. | |
| void | n_gui_set_dpi_scale (N_GUI_CTX *ctx, float scale) |
| Set DPI scale factor manually (default 1.0) | |
| void | n_gui_set_event_queue (N_GUI_CTX *ctx, ALLEGRO_EVENT_QUEUE *queue) |
| Set the event queue used to register native window event sources. | |
| void | n_gui_set_focus (N_GUI_CTX *ctx, int widget_id) |
| Set keyboard focus to a specific widget. | |
| void | n_gui_set_resize_mode (N_GUI_CTX *ctx, int mode) |
| Set context-level resize mode: N_GUI_RESIZE_VIRTUAL (default) or N_GUI_RESIZE_ADAPTIVE. | |
| void | n_gui_set_shape_mode (N_GUI_CTX *ctx, int shape_mode) |
| Set the global widget shape (round or square GUI). | |
| 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) |
| Enable or disable a widget. | |
| void | n_gui_set_widget_theme (N_GUI_CTX *ctx, int widget_id, N_GUI_THEME theme) |
| Override the theme of a specific widget. | |
| void | n_gui_set_widget_tooltip (N_GUI_CTX *ctx, int widget_id, const char *text) |
| Set (or clear) the tooltip text of any widget. | |
| void | n_gui_set_widget_visible (N_GUI_CTX *ctx, int widget_id, int visible) |
| Show or hide a widget. | |
| double | n_gui_slider_get_value (N_GUI_CTX *ctx, int widget_id) |
| get the current value of a slider widget | |
| 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. | |
| void | n_gui_slider_set_value (N_GUI_CTX *ctx, int widget_id, double value) |
| set the value of a slider widget | |
| 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 of a split pane | |
| 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 of a split pane | |
| void | n_gui_splitpane_set_ratio (N_GUI_CTX *ctx, int widget_id, float ratio) |
| set the divider ratio of a split pane (clamped to its 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) |
| get a copy of the currently selected text in a syntax view | |
| const char * | n_gui_syntaxview_get_text (N_GUI_CTX *ctx, int widget_id) |
| get the text currently shown by a syntax view | |
| 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 a 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 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 of a syntax view (byte offsets into the 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 | |
| int | n_gui_tab_add (N_GUI_TAB_PANEL *panel, const char *label) |
| add a tab to the panel, returns tab index | |
| N_GUI_TAB_PANEL * | n_gui_tab_create (N_GUI_CTX *ctx, int window_id, float x, float y, float button_w, float button_h, void(*on_tab_change)(int, void *), void *user_data) |
| create a tab panel in an existing window | |
| void | n_gui_tab_free (N_GUI_TAB_PANEL **panel) |
| free a tab panel (does not destroy the N_GUI widgets) | |
| int | n_gui_tab_get_active (const N_GUI_TAB_PANEL *panel) |
| get the active tab index | |
| void | n_gui_tab_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 the text content of a textarea widget | |
| size_t | n_gui_textarea_get_text_length (N_GUI_CTX *ctx, int widget_id) |
| return the current text length in bytes | |
| 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. | |
| void | n_gui_textarea_set_placeholder (N_GUI_CTX *ctx, int widget_id, const char *text) |
| Set placeholder/hint text shown dimmed while a textarea is empty. | |
| 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 the text content of a textarea widget | |
| void | n_gui_toggle_window (N_GUI_CTX *ctx, int window_id) |
| Toggle window visibility (show if hidden, hide if shown) | |
| int | n_gui_tooltip_pending (N_GUI_CTX *ctx) |
| Report the tooltip phase. | |
| int | n_gui_tree_add_node (N_GUI_TREE *tree, const char *label, int parent_index, void *user_data) |
| add a node to the tree | |
| void | n_gui_tree_clear (N_GUI_TREE *tree) |
| remove all nodes and clear the backing listbox; tree object remains valid | |
| N_GUI_TREE * | n_gui_tree_create (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, void(*on_select)(int, void *), void *user_data) |
| create a tree view in an existing window | |
| void | n_gui_tree_draw_overlay (N_GUI_TREE *tree) |
| per-frame overlay drawing: draws the active drop-indicator on top of the listbox. | |
| 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 physical display. | |
| int | n_gui_wants_mouse (N_GUI_CTX *ctx) |
| Check if the mouse is currently over any open GUI window. | |
| 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. | |
| 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 a window is currently visible. | |
| int | n_gui_window_native_is_hidden (N_GUI_CTX *ctx, int window_id) |
| Check whether a detached window is currently not drawable. | |
| 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. | |
| 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 the content-draw callback for a window. | |
| void | n_gui_window_set_flags (N_GUI_CTX *ctx, int window_id, int flags) |
| Set feature flags on a window. | |
| 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. | |
| 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. | |
| 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. | |
Variables | |
| static N_GUI_MEAS_ENTRY | _ngui_meas_cache [1024u] |
GUI system: buttons, sliders, text areas, checkboxes, scrollbars, dropdown menus, windows.
Definition in file n_gui.c.
| struct N_GUI_MEAS_ENTRY |
| #define _N_GUI_TREE_DRAG_THRESHOLD_PX 4.0f |
| #define _N_GUI_WIN_STATE_PERSIST_MASK (N_GUI_WIN_OPEN | N_GUI_WIN_MINIMISED | N_GUI_WIN_MAXIMISED) |
| #define N_GUI_MEAS_KEY_MAX 32 /* strings this long or longer bypass the cache */ |
|
static |
Definition at line 2271 of file n_gui.c.
References _datagrid_apply_columns(), N_GUI_PENDING_WIDGET::consumed, N_GUI_WIDGET::id, N_GUI_PENDING_WIDGET::key, N_GUI_PENDING_WIDGET::kind, n_gui_datagrid_get_column_count(), N_GUI_ID_MAX, n_gui_splitpane_set_ratio(), N_GUI_TYPE_DATAGRID, N_GUI_TYPE_SPLITPANE, N_GUI_PENDING_WIDGET::ncols, N_GUI_PENDING_WIDGET::order, N_GUI_CTX::pending_widgets, N_GUI_CTX::pending_widgets_count, N_GUI_WIDGET::persist_key, N_GUI_PENDING_WIDGET::ratio, N_GUI_PENDING_WIDGET::title, N_GUI_WIDGET::type, N_GUI_PENDING_WIDGET::visible, and N_GUI_PENDING_WIDGET::width.
Referenced by n_gui_widget_set_persist_key().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: pick colour based on widget state
Definition at line 5647 of file n_gui.c.
References N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_STATE_ACTIVE, and N_GUI_STATE_HOVER.
Referenced by _draw_slider(), and _draw_themed_rect().
Here is the caller graph for this function:
|
static |
Definition at line 5653 of file n_gui.c.
References N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_STATE_ACTIVE, and N_GUI_STATE_HOVER.
Referenced by _draw_slider(), and _draw_themed_rect().
Here is the caller graph for this function:
|
static |
compare two cell strings: numerically when both are integers, else case-insensitive
Definition at line 3794 of file n_gui.c.
References _cell_is_num().
Referenced by n_gui_datagrid_sort().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
true when every character of a non-empty string is a decimal digit
Definition at line 3784 of file n_gui.c.
Referenced by _cell_cmp().
Here is the caller graph for this function:
|
static |
helper: clamp a double between lo and hi
Definition at line 83 of file n_gui.c.
Referenced by _slider_update_from_mouse(), n_gui_add_slider(), n_gui_process_event(), n_gui_scrollbar_set_pos(), n_gui_scrollbar_set_sizes(), n_gui_slider_set_range(), and n_gui_slider_set_value().
Here is the caller graph for this function:
|
static |
drop any active syntax-view text selection (used when focus moves to another selectable widget, so only one selection is live at a time).
Definition at line 6885 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SYNTAXVIEW, N_GUI_SYNTAXVIEW_DATA::sel_dragging, 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 n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Helper: return a copy of c with the given alpha (0..1).
Definition at line 718 of file n_gui.c.
Referenced by n_gui_set_default_theme().
Here is the caller graph for this function:
|
static |
helper: compute the bounding box of all open windows
Definition at line 8430 of file n_gui.c.
References _win_on_pass(), N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_WINDOW::h, list_foreach, N_GUI_WIN_OPEN, N_GUI_WINDOW::state, N_GUI_WINDOW::w, N_GUI_CTX::windows, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by n_gui_draw(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: the display to use for clipboard and mouse-cursor calls.
Follows the display that last received input, so a copy/paste or a cursor change inside a detached window addresses that window rather than the host's main display. Falls back to the display given to n_gui_set_display.
Definition at line 424 of file n_gui.c.
References N_GUI_CTX::active_display, and N_GUI_CTX::display.
Referenced by _ngui_publish_primary_selection(), _textarea_handle_key(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
Definition at line 2251 of file n_gui.c.
References n_gui_datagrid_display_to_physical(), n_gui_datagrid_move_column(), n_gui_datagrid_set_column_visible(), and n_gui_datagrid_set_column_width().
Referenced by _apply_pending_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
fetch a data grid's column table for an API call, or NULL on a bad id.
Definition at line 4109 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 n_gui_datagrid_display_to_physical(), n_gui_datagrid_get_column_count(), n_gui_datagrid_get_column_title(), n_gui_datagrid_get_column_visible(), n_gui_datagrid_get_column_width(), n_gui_datagrid_move_column(), n_gui_datagrid_set_column_visible(), n_gui_datagrid_set_column_width(), and n_gui_datagrid_set_on_columns_changed().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: ensure the per-row tint arrays exist, sized to rows_cap (rows start untinted); returns 1 when both arrays are available
Definition at line 3852 of file n_gui.c.
References Malloc, N_GUI_DATAGRID_DATA::row_color, N_GUI_DATAGRID_DATA::row_has_color, and N_GUI_DATAGRID_DATA::rows_cap.
Referenced by n_gui_datagrid_set_row_color().
Here is the caller graph for this function:
|
static |
helper: ensure the per-row selection array exists, sized to rows_cap
Definition at line 3844 of file n_gui.c.
References Malloc, N_GUI_DATAGRID_DATA::row_sel, and N_GUI_DATAGRID_DATA::rows_cap.
Referenced by n_gui_datagrid_select_row(), n_gui_datagrid_set_multiselect(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
Compute the datagrid horizontal-scroll metrics used identically by the draw path and the mouse handlers, so the thumb geometry never drifts between them: content_w = left pad + the total width of the visible columns; pane_w = the viewport width available to the columns (widget width minus a vertical scrollbar when the rows overflow); need_hsb = 1 when the content is wider than the pane.
Any output pointer may be NULL.
Definition at line 6449 of file n_gui.c.
References _datagrid_phys(), N_GUI_DATAGRID_DATA::cols, N_GUI_WIDGET::h, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_text_padding, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_STYLE::scrollbar_size, N_GUI_DATAGRID_COL::visible, N_GUI_WIDGET::w, and N_GUI_DATAGRID_COL::width.
Referenced by _draw_datagrid(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
physical column index shown at display position dp (identity when no order).
Definition at line 3839 of file n_gui.c.
References N_GUI_DATAGRID_DATA::col_order.
Referenced by _datagrid_hmetrics(), _datagrid_resize_hover(), _draw_datagrid(), n_gui_datagrid_display_to_physical(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
Whether the pointer at (px,py) rests on a datagrid column-resize border: the header row of a visible datagrid, within a few pixels of a visible column's right edge.
Mirrors the hit test that starts a resize drag on mouse-down, so the caller can show a horizontal-resize cursor there for discoverability. The topmost datagrid under the point wins (windows are ordered back to front).
Definition at line 9783 of file n_gui.c.
References _datagrid_phys(), _point_in_rect(), _win_on_pass(), _win_tbh(), N_GUI_DATAGRID_DATA::cols, N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_DATAGRID_DATA::h_scroll, N_GUI_STYLE::item_height_pad, list_foreach, N_GUI_TYPE_DATAGRID, N_GUI_WIN_OPEN, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::state, N_GUI_CTX::style, N_GUI_WIDGET::type, N_GUI_DATAGRID_COL::visible, N_GUI_WIDGET::visible, N_GUI_WIDGET::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 n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 527 of file n_gui.c.
References N_GUI_DATAGRID_DATA::cells, N_GUI_DATAGRID_DATA::col_order, N_GUI_DATAGRID_DATA::cols, N_GUI_HEXVIEW_DATA::data, N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, FreeNoLog, N_GUI_LISTBOX_DATA::items, N_GUI_RADIOLIST_DATA::items, N_GUI_COMBOBOX_DATA::items, N_GUI_TYPE_COMBOBOX, N_GUI_TYPE_DATAGRID, N_GUI_TYPE_DROPMENU, N_GUI_TYPE_HEXVIEW, N_GUI_TYPE_LISTBOX, N_GUI_TYPE_RADIOLIST, N_GUI_TYPE_SYNTAXVIEW, N_GUI_TYPE_TEXTAREA, N_GUI_DATAGRID_DATA::nb_cols, N_GUI_DATAGRID_DATA::nb_rows, N_GUI_TEXTAREA_DATA::placeholder, N_GUI_DATAGRID_DATA::row_color, N_GUI_DATAGRID_DATA::row_has_color, N_GUI_DATAGRID_DATA::row_sel, N_GUI_TEXTAREA_DATA::text, N_GUI_SYNTAXVIEW_DATA::text, N_GUI_WIDGET::tooltip, and N_GUI_WIDGET::type.
Referenced by 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(), and n_gui_add_textarea().
Here is the caller graph for this function:
|
static |
helper: destroy a single window (called by list destructor)
Definition at line 575 of file n_gui.c.
References FreeNoLog, list_destroy(), and N_GUI_WINDOW::widgets.
Referenced by _sort_windows_by_zorder(), n_gui_add_window(), n_gui_lower_window(), and n_gui_raise_window().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: draw a bitmap into a rectangle, respecting the given scale mode.
mode: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER.
Definition at line 4982 of file n_gui.c.
References mode, N_GUI_IMAGE_CENTER, and N_GUI_IMAGE_STRETCH.
Referenced by _draw_window().
Here is the caller graph for this function:
|
static |
draw a button widget
Definition at line 5693 of file n_gui.c.
References _draw_text_truncated(), _draw_themed_rect(), _shape_rounded(), _text_dims(), _text_for_state(), N_GUI_BUTTON_DATA::bitmap, N_GUI_BUTTON_DATA::bitmap_active, N_GUI_BUTTON_DATA::bitmap_hover, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_BUTTON_DATA::key_press_until, N_GUI_BUTTON_DATA::label, N_GUI_STYLE::label_padding, N_GUI_SHAPE_BITMAP, N_GUI_STATE_ACTIVE, N_GUI_STATE_HOVER, N_GUI_BUTTON_DATA::shape, N_GUI_WIDGET::state, N_GUI_WIDGET::theme, N_GUI_BUTTON_DATA::toggle_mode, N_GUI_BUTTON_DATA::toggled, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a checkbox widget
Definition at line 6304 of file n_gui.c.
References _draw_text_truncated(), _draw_themed_rect(), _min_thickness(), _text_dims(), _text_for_state(), N_GUI_CHECKBOX_DATA::box_bitmap, N_GUI_CHECKBOX_DATA::box_checked_bitmap, N_GUI_CHECKBOX_DATA::box_hover_bitmap, 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_CHECKBOX_DATA::checked, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_CHECKBOX_DATA::label, N_GUI_STATE_HOVER, N_GUI_WIDGET::state, N_GUI_THEME::text_active, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a horizontal scrollbar along the bottom edge of a widget: track_w is the width of the scrollable pane (from ax), bar_y its top, content_w the total content width, h_scroll the current pixel offset.
Mirrors _draw_rows_scrollbar but pixel-based.
Definition at line 6427 of file n_gui.c.
References N_GUI_THEME::border_normal, 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, and N_GUI_STYLE::scrollbar_track_color.
Referenced by _draw_datagrid().
Here is the caller graph for this function:
|
static |
draw a combobox widget (closed state)
Definition at line 7429 of file n_gui.c.
References _draw_text_truncated(), _draw_themed_rect(), _min_thickness(), _shape_rounded(), _text_dims(), _text_for_state(), N_GUI_COMBOBOX_DATA::bg_bitmap, N_GUI_WIDGET::data, 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_WIDGET::font, N_GUI_WIDGET::h, N_GUI_STYLE::item_text_padding, N_GUI_COMBOBOX_DATA::items, N_GUI_SHAPE_RECT, N_GUI_COMBOBOX_DATA::nb_items, N_GUI_COMBOBOX_DATA::selected_index, N_GUI_WIDGET::state, N_GUI_LISTITEM::text, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 7496 of file n_gui.c.
References _draw_text_truncated(), _dropdown_panel_y(), _find_widget_window(), _min_thickness(), _text_w(), _win_on_pass(), N_GUI_THEME::bg_active, N_GUI_COMBOBOX_DATA::bg_bitmap, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_CTX::display_w, N_GUI_STYLE::dropdown_border_thickness, N_GUI_COMBOBOX_DATA::flags, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_COMBOBOX_DATA::highlight_index, N_GUI_WIDGET::id, N_GUI_COMBOBOX_DATA::is_open, N_GUI_COMBOBOX_DATA::item_bg_bitmap, N_GUI_COMBOBOX_DATA::item_height, N_GUI_STYLE::item_height_pad, N_GUI_COMBOBOX_DATA::item_selected_bitmap, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_COMBOBOX_DATA::items, N_GUI_COMBOBOX_DATA::max_visible, N_GUI_COMBOBOX_AUTO_WIDTH, N_GUI_COMBOBOX_EXPAND_UP, n_gui_get_widget(), N_GUI_COMBOBOX_DATA::nb_items, N_GUI_CTX::open_combobox_id, N_GUI_COMBOBOX_DATA::scroll_offset, 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_COMBOBOX_DATA::selected_index, N_GUI_CTX::style, N_GUI_LISTITEM::text, N_GUI_THEME::text_active, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by n_gui_draw(), and n_gui_draw_detached().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a single widget.
win_w is the parent window width (>0 for resizable windows, 0 otherwise) so that labels can expand to fill available space.
Definition at line 8017 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_CUSTOM_DATA::draw, N_GUI_WIDGET::font, N_GUI_CUSTOM_DATA::user_data, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the caller graph for this function:
|
static |
Definition at line 7059 of file n_gui.c.
References _datagrid_hmetrics(), _datagrid_phys(), _draw_cols_scrollbar(), _draw_rows_scrollbar(), _draw_text_truncated(), _min_thickness(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_DATAGRID_DATA::cells, N_GUI_DATAGRID_DATA::cols, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_DATAGRID_DATA::h_scroll, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_text_padding, N_GUI_DATAGRID_DATA::multiselect, N_GUI_ID_MAX, 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::scroll_offset, N_GUI_STYLE::scrollbar_size, N_GUI_DATAGRID_DATA::selected_row, N_GUI_DATAGRID_DATA::sort_col, N_GUI_DATAGRID_DATA::sort_dir, N_GUI_THEME::text_active, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_DATAGRID_COL::title, N_GUI_DATAGRID_COL::visible, N_GUI_WIDGET::w, N_GUI_DATAGRID_COL::width, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a dropdown menu button (closed state)
Definition at line 7636 of file n_gui.c.
References _draw_text_truncated(), _draw_themed_rect(), _min_thickness(), _text_dims(), _text_for_state(), N_GUI_WIDGET::data, 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_WIDGET::font, N_GUI_WIDGET::h, N_GUI_DROPMENU_DATA::is_open, N_GUI_STYLE::item_text_padding, N_GUI_DROPMENU_DATA::label, N_GUI_SHAPE_RECT, N_GUI_STATE_ACTIVE, N_GUI_STYLE::shape_mode, N_GUI_WIDGET::state, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw the dropdown menu panel overlay (called after all windows)
Definition at line 7669 of file n_gui.c.
References _draw_text_truncated(), _dropdown_panel_y(), _find_widget_window(), _min_thickness(), _win_on_pass(), N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_STYLE::dropdown_border_thickness, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_DATA::flags, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_DROPMENU_DATA::highlight_index, N_GUI_WIDGET::id, N_GUI_DROPMENU_DATA::is_open, N_GUI_DROPMENU_DATA::item_height, N_GUI_STYLE::item_height_pad, N_GUI_DROPMENU_DATA::item_hover_bitmap, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_DROPMENU_DATA::max_visible, N_GUI_DROPMENU_EXPAND_UP, n_gui_dropmenu_panel_width(), n_gui_get_widget(), N_GUI_SHAPE_RECT, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_CTX::open_dropmenu_id, N_GUI_DROPMENU_DATA::panel_bitmap, N_GUI_DROPMENU_DATA::scroll_offset, 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_CTX::style, N_GUI_DROPMENU_ENTRY::text, N_GUI_THEME::text_hover, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by n_gui_draw(), and n_gui_draw_detached().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a read-only hex viewer: offset, hex bytes, and an ASCII gutter
Definition at line 6471 of file n_gui.c.
References _draw_rows_scrollbar(), _min_thickness(), N_GUI_THEME::bg_normal, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_HEXVIEW_DATA::bytes_per_row, N_GUI_HEXVIEW_DATA::data, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_HEXVIEW_DATA::len, N_GUI_HEXVIEW_DATA::scroll_offset, N_GUI_STYLE::scrollbar_size, N_GUI_THEME::text_normal, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw an image widget
Definition at line 7783 of file n_gui.c.
References N_GUI_IMAGE_DATA::bitmap, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_IMAGE_CENTER, N_GUI_IMAGE_STRETCH, N_GUI_IMAGE_DATA::scale_mode, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the caller graph for this function:
|
static |
helper: draw selection highlight rectangles over justified/wrapped text.
Mirrors the word-wrap layout of _draw_text_justified.
Definition at line 5465 of file n_gui.c.
References _text_w(), and N_GUI_TEXT_MAX.
Referenced by _draw_label().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 7870 of file n_gui.c.
References _draw_justified_selection(), _draw_text_justified(), _draw_text_truncated(), _draw_widget_vscrollbar(), _label_content_height(), _min_thickness(), _set_clipping_rect_transformed(), _text_dims(), _text_for_state(), _text_w(), N_GUI_LABEL_DATA::align, N_GUI_LABEL_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_STYLE::label_padding, N_GUI_LABEL_DATA::link, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_JUSTIFIED, N_GUI_ALIGN_RIGHT, N_GUI_STATE_HOVER, N_GUI_TEXT_MAX, N_GUI_LABEL_DATA::scroll_y, N_GUI_STYLE::scrollbar_size, N_GUI_LABEL_DATA::sel_end, N_GUI_LABEL_DATA::sel_start, N_GUI_THEME::selection_color, N_GUI_WIDGET::state, N_GUI_LABEL_DATA::text, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a listbox widget
Definition at line 7226 of file n_gui.c.
References _draw_text_truncated(), N_GUI_THEME::bg_active, N_GUI_LISTBOX_DATA::bg_bitmap, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_LISTBOX_DATA::hover_row, N_GUI_LISTBOX_DATA::item_bg_bitmap, N_GUI_LISTBOX_DATA::item_height, N_GUI_STYLE::item_height_pad, N_GUI_LISTBOX_DATA::item_selected_bitmap, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_LISTBOX_DATA::items, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_THEME::text_active, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a sortable data grid: fixed header row plus scrollable data rows
Definition at line 7031 of file n_gui.c.
References N_GUI_THEME::bg_active, N_GUI_THEME::bg_normal, N_GUI_THEME::border_normal, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_PROGRESSBAR_DATA::text, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_PROGRESSBAR_DATA::value, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the caller graph for this function:
|
static |
draw a radiolist widget
Definition at line 7334 of file n_gui.c.
References _min_thickness(), N_GUI_RADIOLIST_DATA::bg_bitmap, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_RADIOLIST_DATA::item_bg_bitmap, N_GUI_RADIOLIST_DATA::item_height, N_GUI_STYLE::item_height_pad, N_GUI_RADIOLIST_DATA::item_selected_bitmap, N_GUI_RADIOLIST_DATA::items, N_GUI_STATE_HOVER, N_GUI_RADIOLIST_DATA::nb_items, 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_RADIOLIST_DATA::scroll_offset, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_RADIOLIST_DATA::selected_index, N_GUI_WIDGET::state, N_GUI_LISTITEM::text, N_GUI_THEME::text_active, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a row-indexed vertical scrollbar (shared by hexview, syntaxview and datagrid) at the right edge of [ax,ay,w,h].
nb_rows total, visible per page, scroll_offset is the first visible row.
Definition at line 6404 of file n_gui.c.
References N_GUI_THEME::border_normal, 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, and N_GUI_STYLE::scrollbar_track_color.
Referenced by _draw_datagrid(), _draw_hexview(), and _draw_syntaxview().
Here is the caller graph for this function:
|
static |
draw a scrollbar widget
Definition at line 6352 of file n_gui.c.
References _draw_themed_rect(), _select_state_bitmap(), N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_SCROLLBAR_V, N_GUI_SHAPE_ROUNDED, N_GUI_STATE_IDLE, N_GUI_SCROLLBAR_DATA::orientation, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_SCROLLBAR_DATA::shape, N_GUI_WIDGET::state, N_GUI_WIDGET::theme, 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, N_GUI_SCROLLBAR_DATA::viewport_size, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a slider widget (horizontal or vertical)
Definition at line 5742 of file n_gui.c.
References _bg_for_state(), _border_for_state(), _min_thickness(), _select_state_bitmap(), _text_dims(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_normal, N_GUI_THEME::border_normal, N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::fill_bitmap, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_SLIDER_DATA::handle_active_bitmap, N_GUI_SLIDER_DATA::handle_bitmap, N_GUI_SLIDER_DATA::handle_hover_bitmap, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, N_GUI_SLIDER_DATA::mode, N_GUI_SLIDER_PERCENT, N_GUI_SLIDER_V, N_GUI_SLIDER_DATA::orientation, 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_WIDGET::state, N_GUI_THEME::text_normal, N_GUI_WIDGET::theme, N_GUI_SLIDER_DATA::track_bitmap, N_GUI_SLIDER_DATA::value, N_GUI_SLIDER_DATA::value_format, N_GUI_SLIDER_DATA::value_visible, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a split pane: only the divider bar is painted (the app fills the two regions with its own widgets, positioned from the divider ratio)
Definition at line 7205 of file n_gui.c.
References N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_normal, N_GUI_WIDGET::data, N_GUI_SPLITPANE_DATA::divider, N_GUI_WIDGET::h, N_GUI_SPLIT_VERTICAL, N_GUI_STATE_ACTIVE, N_GUI_STATE_HOVER, N_GUI_SPLITPANE_DATA::orientation, N_GUI_SPLITPANE_DATA::ratio, N_GUI_WIDGET::state, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the caller graph for this function:
|
static |
Definition at line 6933 of file n_gui.c.
References _draw_rows_scrollbar(), _min_thickness(), _syntax_draw_line(), _syntax_prefix_w(), _syntaxview_ensure_lines(), N_GUI_THEME::bg_normal, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_SYNTAXVIEW_DATA::cached_headers_end, N_GUI_SYNTAXVIEW_DATA::cached_nb_lines, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_SYNTAXVIEW_DATA::len, N_GUI_SYNTAXVIEW_DATA::mode, N_GUI_SYNTAXVIEW_DATA::scroll_offset, N_GUI_STYLE::scrollbar_size, N_GUI_SYNTAXVIEW_DATA::sel_end, N_GUI_SYNTAXVIEW_DATA::sel_start, N_GUI_THEME::selection_color, N_GUI_SYNTAXVIEW_DATA::text, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::theme, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw the titlebar buttons for a window
Definition at line 8155 of file n_gui.c.
References _draw_themed_rect(), _tb_button_rect(), _text_for_state(), N_GUI_TB_BUTTONS::btn_theme, N_GUI_TB_BUTTONS::close_active_bitmap, N_GUI_TB_BUTTONS::close_bitmap, N_GUI_TB_BUTTONS::close_hover_bitmap, N_GUI_TB_BUTTONS::close_theme, N_GUI_TB_BUTTONS::hovered, 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_STATE_ACTIVE, N_GUI_STATE_HOVER, N_GUI_STATE_IDLE, N_GUI_TB_BTN_CLOSE, N_GUI_TB_BTN_MAXIMIZE, N_GUI_TB_BTN_MINIMIZE, N_GUI_WIN_MAXIMISED, N_GUI_TB_BUTTONS::pressed, N_GUI_WINDOW::state, N_GUI_STYLE::tb_btn_glyph_thickness, and N_GUI_WINDOW::tb_buttons.
Referenced by _draw_window().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: draw justified text within a given width, with multi-line word wrapping.
Words are packed into lines using minimum spacing; full lines are justified (gaps spread evenly), the last line is left-aligned. Only shows "..." when a single word is wider than max_w.
Definition at line 5114 of file n_gui.c.
References _draw_text_truncated(), _text_w(), and N_GUI_TEXT_MAX.
Referenced by _draw_label().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: draw text truncated to a maximum pixel width.
If the text is wider than max_w, it is clipped and "..." is appended.
Definition at line 5070 of file n_gui.c.
References _text_w(), and N_GUI_TEXT_MAX.
Referenced by _draw_button(), _draw_checkbox(), _draw_combobox(), _draw_combobox_dropdown(), _draw_datagrid(), _draw_dropmenu(), _draw_dropmenu_panel(), _draw_label(), _draw_listbox(), _draw_text_justified(), and _draw_window().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a textarea widget
Definition at line 6011 of file n_gui.c.
References _draw_textarea_placeholder(), _draw_widget_vscrollbar(), _min_thickness(), _set_clipping_rect_transformed(), _text_w(), _textarea_content_height(), _textarea_has_selection(), _textarea_sel_range(), _utf8_char_len(), N_GUI_THEME::bg_active, N_GUI_TEXTAREA_DATA::bg_bitmap, 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_TEXTAREA_DATA::cursor_pos, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_TEXTAREA_DATA::mask_char, N_GUI_TEXTAREA_DATA::multiline, N_GUI_STATE_FOCUSED, N_GUI_STATE_HOVER, N_GUI_TEXT_MAX, run, N_GUI_TEXTAREA_DATA::scroll_from_wheel, N_GUI_TEXTAREA_DATA::scroll_x, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_STYLE::scrollbar_size, N_GUI_THEME::selection_color, N_GUI_WIDGET::state, N_GUI_TEXTAREA_DATA::text, N_GUI_THEME::text_active, N_GUI_TEXTAREA_DATA::text_len, 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_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_widget().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a textarea's placeholder/hint at (tx,ty), dimmed, while the field is empty; a no-op once any text has been entered or when no placeholder is set
Definition at line 5999 of file n_gui.c.
References N_GUI_THEME::bg_normal, N_GUI_TEXTAREA_DATA::placeholder, N_GUI_TEXTAREA_DATA::text_len, N_GUI_THEME::text_normal, and N_GUI_WIDGET::theme.
Referenced by _draw_textarea().
Here is the caller graph for this function:
|
static |
draw a themed rectangle or rounded rectangle.
For thin outlines, inset the border by half the thickness so that all four corners render symmetrically (avoids Allegro pixel-alignment artifact on the bottom-right corner).
Definition at line 5669 of file n_gui.c.
References _bg_for_state(), _border_for_state(), _min_thickness(), N_GUI_THEME::border_thickness, N_GUI_THEME::corner_rx, and N_GUI_THEME::corner_ry.
Referenced by _draw_button(), _draw_checkbox(), _draw_combobox(), _draw_dropmenu(), _draw_scrollbar(), and _draw_tb_buttons().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: draw the hover-tooltip bubble for the currently armed tooltip widget, but ONLY in the render pass of the display that owns that widget's window.
A detached (native) window is a separate Allegro display, so a tooltip for a widget on it must be drawn into that display with that window's local mouse coordinates, exactly like the combobox/dropmenu overlays; drawing it once in the main pass (as before) put the bubble under the native window and it did not follow the window. Called from both the main pass and each detached pass; the pass_display guard makes it draw exactly once, on the right display.
The bubble is kept ENTIRELY inside its widget's window (intersected with the display): a tooltip wider than the window is WORD-WRAPPED to the window width and the bubble is shifted left/up (flipping above the cursor) so the full text always shows and nothing is clipped at the window edge - unless the window is genuinely too small to hold even the wrapped text, in which case it is best-effort clamped.
Definition at line 8470 of file n_gui.c.
References _find_widget_window(), _text_w(), _tooltip_line_cb(), N_GUI_CTX::default_font, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_WINDOW::h, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, n_gui_get_widget(), N_GUI_WINDOW::native, N_GUI_CTX::pass_display, N_GUI_CTX::style, N_GUI_WIDGET::tooltip, N_GUI_CTX::tooltip_armed_at, N_GUI_STYLE::tooltip_bg, N_GUI_STYLE::tooltip_border, N_GUI_STYLE::tooltip_delay, N_GUI_STYLE::tooltip_fg, N_GUI_CTX::tooltip_widget_id, N_GUI_WIDGET::visible, N_GUI_WINDOW::w, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by n_gui_draw(), and n_gui_draw_detached().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 8023 of file n_gui.c.
References _draw_button(), _draw_checkbox(), _draw_combobox(), _draw_custom(), _draw_datagrid(), _draw_dropmenu(), _draw_hexview(), _draw_image(), _draw_label(), _draw_listbox(), _draw_progressbar(), _draw_radiolist(), _draw_scrollbar(), _draw_slider(), _draw_splitpane(), _draw_syntaxview(), _draw_textarea(), N_GUI_WIDGET::enabled, N_GUI_WIDGET::h, N_GUI_STATE_IDLE, N_GUI_TYPE_BUTTON, N_GUI_TYPE_CHECKBOX, N_GUI_TYPE_COMBOBOX, N_GUI_TYPE_CUSTOM, N_GUI_TYPE_DATAGRID, N_GUI_TYPE_DROPMENU, N_GUI_TYPE_HEXVIEW, N_GUI_TYPE_IMAGE, N_GUI_TYPE_LABEL, N_GUI_TYPE_LISTBOX, N_GUI_TYPE_PROGRESSBAR, 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_WIDGET::state, N_GUI_WIDGET::type, N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_window().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: draw a mini vertical scrollbar inside a widget.
content_h = total content height, view_h = visible area height, scroll_y = current scroll offset. Draws at the right edge of the area [area_x .. area_x+area_w], [area_y .. area_y+view_h].
Definition at line 5606 of file n_gui.c.
References 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, and N_GUI_STYLE::scrollbar_track_color.
Referenced by _draw_label(), and _draw_textarea().
Here is the caller graph for this function:
|
static |
draw a window chrome + its widgets
Definition at line 8234 of file n_gui.c.
References _draw_bitmap_scaled(), _draw_tb_buttons(), _draw_text_truncated(), _draw_widget(), _min_thickness(), _set_clipping_rect_transformed(), _tb_buttons_area_width(), _text_dims(), _window_update_content_size(), N_GUI_THEME::bg_active, N_GUI_WINDOW::bg_bitmap, N_GUI_THEME::bg_normal, N_GUI_WINDOW::bg_scale_mode, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_WINDOW::content_h, N_GUI_WINDOW::content_w, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_WINDOW::flags, N_GUI_WINDOW::font, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_WINDOW::h, N_GUI_STYLE::label_padding, list_foreach, N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_FRAMELESS, N_GUI_WIN_MINIMISED, N_GUI_WIN_NO_HSCROLL, N_GUI_WIN_OPEN, N_GUI_WIN_RESIZABLE, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, 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_WINDOW::state, N_GUI_THEME::text_active, N_GUI_WINDOW::theme, N_GUI_WINDOW::title, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, N_GUI_WINDOW::titlebar_bitmap, N_GUI_WINDOW::titlebar_h, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by n_gui_draw(), and n_gui_draw_detached().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw the combobox dropdown overlay (called after all windows)
Definition at line 7478 of file n_gui.c.
References N_GUI_CTX::display_h.
Referenced by _draw_combobox_dropdown(), _draw_dropmenu_panel(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: ensure dropmenu entries array has room for one more
Definition at line 4547 of file n_gui.c.
References FreeNoLog, and Malloc.
Referenced by n_gui_dropmenu_add_entry().
Here is the caller graph for this function:
|
static |
helper: the display an event originates from, or NULL when the event carries no display (timer, user and joystick events) or the field is unset, as in the headless tests that synthesize events with memset.
Definition at line 380 of file n_gui.c.
Referenced by n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: find the window containing a focused widget
Definition at line 122 of file n_gui.c.
References N_GUI_CTX::focused_widget_id, N_GUI_WIDGET::id, list_foreach, N_GUI_WIN_OPEN, N_GUI_WINDOW::state, N_GUI_WINDOW::widgets, and N_GUI_CTX::windows.
Referenced by n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: find the parent window of a widget by id, returning the window's content origin (accounting for scroll offsets).
| ctx | GUI context |
| wgt_id | widget id to search for |
| ox | [out] content origin X |
| oy | [out] content origin Y |
Definition at line 503 of file n_gui.c.
References _win_tbh(), list_foreach, N_GUI_WIN_OPEN, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::state, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by _draw_combobox_dropdown(), _draw_dropmenu_panel(), _draw_tooltip(), n_gui_process_event(), and n_gui_widget_set_persist_key().
Here is the call graph for this function:
Here is the caller graph for this function:helper: find a window node in the context list by id
Definition at line 585 of file n_gui.c.
References __n_assert, N_GUI_WINDOW::id, list_foreach, and N_GUI_CTX::windows.
Referenced by n_gui_get_window(), n_gui_lower_window(), and n_gui_raise_window().
Here is the caller graph for this function:
|
static |
Definition at line 12373 of file n_gui.c.
References mode.
Referenced by n_gui_save_layout_json(), and n_gui_save_theme_json().
Here is the caller graph for this function:
|
static |
helper: check if a widget type is focusable via Tab navigation
Definition at line 110 of file n_gui.c.
References N_GUI_TYPE_CHECKBOX, N_GUI_TYPE_COMBOBOX, N_GUI_TYPE_DROPMENU, N_GUI_TYPE_LISTBOX, N_GUI_TYPE_RADIOLIST, N_GUI_TYPE_SCROLLBAR, N_GUI_TYPE_SLIDER, and N_GUI_TYPE_TEXTAREA.
Referenced by n_gui_focus_window(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: ensure items array has room for one more, returns 1 on success
Definition at line 606 of file n_gui.c.
References FreeNoLog, and Malloc.
Referenced by n_gui_combobox_add_item(), n_gui_listbox_add_item(), and n_gui_radiolist_add_item().
Here is the caller graph for this function:
|
static |
helper: add an RGBA colour as a JSON array [r,g,b,a] (0-255)
Definition at line 12387 of file n_gui.c.
Referenced by n_gui_save_theme_json().
Here is the caller graph for this function:
|
static |
helper: read an RGBA colour from a JSON array [r,g,b,a]
Definition at line 12399 of file n_gui.c.
Referenced by n_gui_load_theme_json().
Here is the caller graph for this function:
|
static |
helper: read a float from JSON, return fallback if missing
Definition at line 12410 of file n_gui.c.
Referenced by n_gui_load_layout_json(), and n_gui_load_theme_json().
Here is the caller graph for this function:
|
static |
helper: read an int from JSON, return fallback if missing
Definition at line 12417 of file n_gui.c.
Referenced by n_gui_load_layout_json(), and n_gui_load_theme_json().
Here is the caller graph for this function:
|
static |
helper: find the byte offset in justified text closest to a click position.
text_x, text_y = top-left of the text area. Returns -1 on error.
Definition at line 5346 of file n_gui.c.
References _text_w(), _utf8_char_len(), and N_GUI_TEXT_MAX.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a label widget.
win_w > 0 means the parent window is resizable and the label may expand horizontally to fill the available window width.
helper: find the byte offset in a label's text closest to a given pixel x position. Returns -1 if the label has no text or font.
Definition at line 7819 of file n_gui.c.
References _text_w(), _utf8_char_len(), N_GUI_TEXT_MAX, and N_GUI_LABEL_DATA::text.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: compute the total content height of justified/wrapped label text, in pixels.
Mirrors the _draw_text_justified word-wrap logic.
Definition at line 5566 of file n_gui.c.
References _text_w(), and N_GUI_TEXT_MAX.
Referenced by _draw_label(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: compute the screen-space x origin where label text starts, accounting for alignment.
ax is the widget's screen-space left edge. win_w is the label_win_w hint (0 for fixed windows).
Definition at line 7848 of file n_gui.c.
References _text_dims(), N_GUI_LABEL_DATA::align, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_RIGHT, and N_GUI_LABEL_DATA::text.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: move an open list panel's highlight cursor (combobox / dropmenu) by delta items and scroll the visible window so the highlighted item stays in view.
Shared by the wheel and the Up/Down keys so both drive the same cursor.
| highlight | in/out highlight index (-1 = none; seeded from fallback) |
| scroll | in/out first-visible-item offset |
| nb | total item count |
| max_visible | number of items the panel shows at once |
| delta | signed step (negative = up, positive = down) |
| fallback | index to start from when highlight is -1 (e.g. the selected item, or the first visible item) |
Definition at line 9749 of file n_gui.c.
Referenced by n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: compute minimum line thickness so it stays >= 1 physical pixel.
Extracts the scale factor from the current Allegro transform using the lengths of the basis vectors so that rotation and non-uniform scaling are handled correctly (m[0][0] alone can be near 0 for a 90-degree rotation).
Definition at line 5633 of file n_gui.c.
Referenced by _draw_checkbox(), _draw_combobox(), _draw_combobox_dropdown(), _draw_datagrid(), _draw_dropmenu(), _draw_dropmenu_panel(), _draw_hexview(), _draw_label(), _draw_radiolist(), _draw_slider(), _draw_syntaxview(), _draw_textarea(), _draw_themed_rect(), and _draw_window().
Here is the caller graph for this function:
|
static |
Definition at line 13795 of file n_gui.c.
References n_gui_kvtable_add_row().
Referenced by n_gui_kvtable_create().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 13820 of file n_gui.c.
References _n_gui_widget_capture_normalized(), N_GUI_KV_ROW::active, N_GUI_KVTABLE::btn_add, N_GUI_KVTABLE::ctx, N_GUI_KV_ROW::desc_id, N_GUI_WINDOW::detach_flags, N_GUI_KV_ROW::enabled_id, N_GUI_WIDGET::h, N_GUI_WINDOW::h, N_GUI_KVTABLE::header_height, N_GUI_KVTABLE::init_win_h, N_GUI_KVTABLE::init_win_w, N_GUI_KV_ROW::key_id, N_GUI_KVTABLE::lbl_desc, N_GUI_KVTABLE::lbl_enabled, N_GUI_KVTABLE::lbl_key, N_GUI_KVTABLE::lbl_value, N_GUI_DETACH_SCALE_CONTENT, n_gui_get_widget(), n_gui_get_window(), n_gui_set_widget_visible(), N_GUI_WIN_RESIZE_SCALE, N_GUI_WINDOW::native, N_GUI_KVTABLE::nb_rows, N_GUI_KVTABLE::padding, N_GUI_KV_ROW::remove_id, N_GUI_WINDOW::resize_policy, N_GUI_KVTABLE::row_height, N_GUI_KVTABLE::rows, N_GUI_KVTABLE::show_desc, N_GUI_KVTABLE::show_enabled, N_GUI_KVTABLE::show_value, N_GUI_KVTABLE::top_offset, N_GUI_KV_ROW::value_id, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_KVTABLE::window_id, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by n_gui_kvtable_add_row(), n_gui_kvtable_clear(), n_gui_kvtable_create(), n_gui_kvtable_relayout(), n_gui_kvtable_remove_row(), n_gui_kvtable_set_columns(), and n_gui_kvtable_set_top_offset().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 13802 of file n_gui.c.
References N_GUI_KV_ROW::active, n_gui_kvtable_remove_row(), N_GUI_KVTABLE::nb_rows, N_GUI_KVTABLE::on_remove, N_GUI_KV_ROW::remove_id, N_GUI_KVTABLE::rows, and N_GUI_KVTABLE::user_data.
Referenced by n_gui_kvtable_add_row().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 14206 of file n_gui.c.
References N_GUI_SECTION::folded, N_GUI_SECTION::header_id, n_gui_sectionlist_relayout(), N_GUI_SECTIONLIST::nb_sections, N_GUI_SECTIONLIST::on_toggle, N_GUI_SECTIONLIST::sections, and N_GUI_SECTIONLIST::user_data.
Referenced by n_gui_sectionlist_add_section().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 14197 of file n_gui.c.
References N_GUI_SECTIONLIST::ctx, N_GUI_SECTION::folded, N_GUI_SECTION::header_id, n_gui_button_set_label(), N_GUI_SECTIONLIST::sections, and N_GUI_SECTION::title.
Referenced by n_gui_sectionlist_relayout().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 13247 of file n_gui.c.
References N_GUI_TAB_PANEL::button_ids, n_gui_tab_set_active(), N_GUI_TAB_PANEL::nb_tabs, N_GUI_TAB_PANEL::on_tab_change, and N_GUI_TAB_PANEL::user_data.
Referenced by n_gui_tab_add().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Hit-test the mouse against the listbox's visible rows and fill the out params.
Returns 1 if the mouse is over a valid row, 0 otherwise. Points inside the scrollbar column are excluded so the user cannot start a drag by grabbing the scrollbar.
Definition at line 13632 of file n_gui.c.
References _n_gui_tree_listbox_bounds(), N_GUI_DROP_AFTER, N_GUI_DROP_BEFORE, N_GUI_DROP_INTO, N_GUI_TREE::nb_nodes, N_GUI_TREE::nb_visible, and N_GUI_TREE::visible_map.
Referenced by n_gui_tree_tick().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Return the listbox's absolute (screen-space) bounds and geometry via out params.
out_item_area_w is the row content width (total width minus the scrollbar column, when one is needed) and matches where the selection / hover highlight actually paints. out_inset is the horizontal padding applied to row highlights, kept in sync with _draw_listbox so DnD indicators line up exactly. Returns 1 on success, 0 on failure.
Definition at line 13592 of file n_gui.c.
References N_GUI_TREE::ctx, N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_LISTBOX_DATA::item_height, N_GUI_STYLE::item_selection_inset, N_GUI_TREE::listbox_id, n_gui_get_widget(), n_gui_get_window(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, N_GUI_STYLE::scrollbar_size, N_GUI_CTX::style, N_GUI_WINDOW::titlebar_h, N_GUI_WIDGET::type, N_GUI_WIDGET::w, N_GUI_TREE::window_id, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.
Referenced by _n_gui_tree_hit_row(), and n_gui_tree_draw_overlay().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 13330 of file n_gui.c.
References N_GUI_TREE_NODE::has_children, n_gui_tree_toggle_expand(), N_GUI_TREE::nb_nodes, N_GUI_TREE::nb_visible, N_GUI_TREE::nodes, N_GUI_TREE::on_select, N_GUI_TREE::user_data, and N_GUI_TREE::visible_map.
Referenced by n_gui_tree_create().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 13371 of file n_gui.c.
References N_GUI_TREE_NODE::expanded, N_GUI_TREE::nodes, and N_GUI_TREE_NODE::parent_index.
Referenced by n_gui_tree_rebuild().
Here is the caller graph for this function:
|
static |
capture normalized coords for a single widget relative to its parent window
Definition at line 1046 of file n_gui.c.
References N_GUI_WIDGET::h, N_GUI_WINDOW::h, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _n_gui_kv_apply_layout(), 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_sectionlist_relayout(), n_gui_window_attach(), and n_gui_window_detach().
Here is the caller graph for this function:
|
static |
capture normalized coords for a window and its widgets from current absolutes
Definition at line 1021 of file n_gui.c.
References N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WIN_RESIZE_SCALE, 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_CTX::ref_display_h, N_GUI_CTX::ref_display_w, N_GUI_WINDOW::resize_policy, 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 n_gui_add_window(), n_gui_maximize_window(), n_gui_process_event(), n_gui_set_resize_mode(), n_gui_window_set_resize_policy(), and n_gui_window_update_normalized().
Here is the caller graph for this function:
|
static |
helper: mirror an own-chrome window's minimised state onto its OS window by shrinking the display to the title bar and growing it back.
Allegro's ALLEGRO_MINIMIZED is documented read-only (and "very platform-dependent"), so there is no portable iconify call to use. Shrinking is the honest mapping anyway: N_GUI minimised means "title bar only", which is exactly what the user then sees on the desktop.
win->h keeps the full height throughout, it is what the window grows back to and what the layout persists. The DISPLAY_RESIZE handler skips its geometry update while the window is minimised for the same reason.
Definition at line 317 of file n_gui.c.
References _native_own_chrome(), _win_tbh(), N_GUI_WINDOW::h, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_WIN_MINIMISED, N_GUI_WINDOW::native, N_GUI_WINDOW::state, and N_GUI_WINDOW::w.
Referenced by n_gui_maximize_window(), n_gui_minimize_window(), and n_gui_restore_window().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: anchor an own-chrome window's title bar drag on the desktop cursor.
Mouse coordinates in an Allegro event are relative to the display the event came from, so moving the OS window changes the coordinate system the NEXT events are expressed in. Deriving each move from those coordinates therefore feeds every move back into the following one: the events already queued when al_set_window_position runs were generated against the OLD position, and each of them re-applies the travel the previous one already applied. Draining a burst of three motion events moves the window three times as far as the pointer went, then the correction events send it back, which is the jitter and the run-away seen when dragging a detached window around the desktop.
al_get_mouse_cursor_position reports the pointer in desktop coordinates, which no window move can alter. Capturing it once with the window position at the grab turns the drag into an absolute mapping (window = grab position + cursor travel), so a stale event carries no state and a backlog simply converges on the current pointer instead of compounding.
Definition at line 292 of file n_gui.c.
References _native_own_chrome(), N_GUI_WINDOW::native, N_GUI_WINDOW::native_drag_anchored, N_GUI_WINDOW::native_drag_cx, N_GUI_WINDOW::native_drag_cy, N_GUI_WINDOW::native_drag_wx, and N_GUI_WINDOW::native_drag_wy.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: the monitor rectangle a native window sits on.
al_get_display_adapter answers this in one call but it only exists from Allegro 5.2.10 on, and builds still target 5.2.6 (Debian 11). The window position is enough to derive it: pick the monitor whose rectangle contains the window origin, and fall back to the first adapter when the origin sits outside every reported monitor (window manager has not placed the window yet, or an adapter reports no info). Returns 1 when info was filled.
Definition at line 361 of file n_gui.c.
References display.
Referenced by n_gui_maximize_window().
Here is the caller graph for this function:
|
static |
helper: whether a window is detached AND keeps drawing its own chrome (N_GUI_DETACH_OWN_CHROME).
Such a window fills a frameless native window title bar included, so the title bar drag, the resize grip and the three title bar buttons have to act on the OS window instead of on x/y/w/h.
Definition at line 271 of file n_gui.c.
References N_GUI_WINDOW::detach_flags, N_GUI_DETACH_OWN_CHROME, and N_GUI_WINDOW::native.
Referenced by _native_apply_minimised(), _native_drag_begin(), _tb_button_action(), n_gui_maximize_window(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: allocate and initialise a base widget
Definition at line 624 of file n_gui.c.
References __n_assert, N_GUI_WIDGET::data, N_GUI_CTX::default_theme, N_GUI_WIDGET::enabled, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_WIDGET::id, Malloc, N_GUI_STATE_IDLE, N_GUI_CTX::next_widget_id, N_GUI_WIDGET::state, N_GUI_WIDGET::theme, N_GUI_WIDGET::tooltip, N_GUI_WIDGET::type, N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by 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(), and n_gui_add_textarea().
Here is the caller graph for this function:
|
static |
Definition at line 53 of file n_gui.c.
References display, n_clipboard_available(), N_CLIPBOARD_CLIPBOARD, and n_clipboard_get().
Referenced by _textarea_handle_key(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 41 of file n_gui.c.
References display, n_clipboard_available(), N_CLIPBOARD_CLIPBOARD, and n_clipboard_set().
Referenced by _ngui_publish_primary_selection(), _textarea_copy_to_clipboard(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
find (or claim) the cache slot for (font, text[len]).
On a slot miss the entry is reset to this key with both metrics marked absent. Callers must have ruled out len >= N_GUI_MEAS_KEY_MAX.
Definition at line 186 of file n_gui.c.
References _ngui_meas_cache, N_GUI_MEAS_ENTRY::font, N_GUI_MEAS_ENTRY::hash, N_GUI_MEAS_ENTRY::have_adv, N_GUI_MEAS_ENTRY::have_dims, N_GUI_MEAS_ENTRY::key, N_GUI_MEAS_ENTRY::len, N_GUI_MEAS_ENTRY::line_h, and N_GUI_MEAS_CACHE_SIZE.
Referenced by _text_dims(), and _text_w().
Here is the caller graph for this function:
|
static |
publish the active text selection (syntax view, label, or focused textarea) to the X11 PRIMARY selection, implementing select-to-copy: selecting text with the mouse or keyboard makes it available for a middle-click paste, without disturbing CLIPBOARD.
No-op when no X11 clipboard backend is present (so the CLIPBOARD fallback is never clobbered by a selection).
Definition at line 9323 of file n_gui.c.
References _ctx_io_display(), _ngui_clip_set(), _textarea_has_selection(), _textarea_sel_range(), N_GUI_WIDGET::data, N_GUI_CTX::focused_widget_id, Free, Malloc, n_clipboard_available(), N_CLIPBOARD_PRIMARY, n_gui_get_widget(), n_gui_syntaxview_get_selected_text(), N_GUI_TYPE_LABEL, N_GUI_TYPE_TEXTAREA, N_GUI_LABEL_DATA::sel_end, N_GUI_LABEL_DATA::sel_start, N_GUI_CTX::selected_label_id, N_GUI_CTX::selected_syntaxview_id, N_GUI_TEXTAREA_DATA::text, N_GUI_LABEL_DATA::text, and N_GUI_WIDGET::type.
Referenced by _textarea_handle_key(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: strip CR from a string in-place, normalizing CRLF to LF.
Used at text entry points so all rendering code only needs to handle LF.
Definition at line 137 of file n_gui.c.
Referenced by n_gui_add_label(), n_gui_label_set_text(), and n_gui_textarea_set_text().
Here is the caller graph for this function:
|
static |
helper: test if point is inside a rectangle
Definition at line 429 of file n_gui.c.
Referenced by _datagrid_resize_hover(), _pointer_over_window(), _tooltip_widget_at(), n_gui_process_event(), and n_gui_wants_mouse().
Here is the caller graph for this function:
|
static |
helper: is the pointer over any open window that takes part in the current pass? O(windows) and used to short-circuit the per-widget tooltip and datagrid-cursor scans on motion events when the pointer is over empty background (the common case when the GUI is composited over a game).
Both of those scans only ever match widgets that live inside a window, so skipping them off-window yields the same "nothing under the pointer" result.
Definition at line 439 of file n_gui.c.
References _point_in_rect(), _win_on_pass(), _win_tbh(), N_GUI_WINDOW::h, list_foreach, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WINDOW::state, N_GUI_WINDOW::w, N_GUI_CTX::windows, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: register a widget in the hash table
Definition at line 596 of file n_gui.c.
References __n_assert, N_GUI_CTX::dirty, ht_put_ptr(), N_GUI_WIDGET::id, key, and N_GUI_CTX::widgets_by_id.
Referenced by 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(), and n_gui_add_textarea().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
forward declaration: unregister and destroy a window's native display, leaving the window's geometry untouched (see the native window section)
helper: unregister and destroy a window's native display.
The window's geometry and flags are left alone, the callers decide whether the window goes back to being a pop-up (n_gui_window_attach) or simply disappears with the context (n_gui_destroy_ctx).
Definition at line 1374 of file n_gui.c.
References N_GUI_CTX::active_display, N_GUI_CTX::display, N_GUI_CTX::event_queue, N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_WINDOW::native_h, N_GUI_WINDOW::native_pos_x, N_GUI_WINDOW::native_pos_y, N_GUI_WINDOW::native_w, and N_GUI_CTX::pass_display.
Referenced by n_gui_destroy_ctx(), n_gui_draw_detached(), and n_gui_window_attach().
Here is the caller graph for this function:
|
static |
helper: compute scroll position from mouse coordinate using thumb-aware math.
This is the formula used by the window auto-scrollbar, it maps the mouse to where the center of the thumb should be, giving smooth proportional feel.
| mouse | current mouse coordinate (x or y) |
| track_start | pixel start of the scrollbar track |
| track_length | pixel length of the scrollbar track |
| viewport | visible portion size |
| content | total content size |
| thumb_min | minimum thumb size in pixels |
Definition at line 461 of file n_gui.c.
Referenced by _scrollbar_calc_scroll_int(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: integer variant of _scrollbar_calc_scroll for item-based widgets.
| mouse | current mouse coordinate |
| track_start | pixel start of the scrollbar track |
| track_length | pixel length of the scrollbar track |
| visible_items | number of visible items |
| total_items | total number of items |
| thumb_min | minimum thumb size in pixels |
Definition at line 484 of file n_gui.c.
References _scrollbar_calc_scroll().
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
handle scrollbar drag
Definition at line 9187 of file n_gui.c.
References N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_WIDGET::id, N_GUI_SCROLLBAR_V, N_GUI_SCROLLBAR_DATA::on_scroll, N_GUI_SCROLLBAR_DATA::orientation, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_SCROLLBAR_DATA::user_data, N_GUI_SCROLLBAR_DATA::viewport_size, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: select per-state bitmap with fallback chain.
Returns the appropriate bitmap for the given state, falling back to normal_bmp. Returns NULL if all pointers are NULL.
Definition at line 5003 of file n_gui.c.
References N_GUI_STATE_ACTIVE, and N_GUI_STATE_HOVER.
Referenced by _draw_scrollbar(), and _draw_slider().
Here is the caller graph for this function:
|
static |
helper: set clipping rectangle in world space, transforming to screen space.
This accounts for the current Allegro transform (e.g. global scroll) so that clipping works correctly even when a translation transform is active. The resulting clip rect is also intersected with the current (parent) clip to avoid drawing outside the parent's visible area.
Definition at line 5015 of file n_gui.c.
Referenced by _draw_label(), _draw_textarea(), and _draw_window().
Here is the caller graph for this function:
|
static |
resolve whether a shape-aware widget draws rounded: the global shape_mode override (style->shape_mode) wins when set to ROUNDED or RECT, otherwise the widget's own shape decides.
Definition at line 5686 of file n_gui.c.
References N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, and N_GUI_STYLE::shape_mode.
Referenced by _draw_button(), and _draw_combobox().
Here is the caller graph for this function:
|
static |
helper: snap a slider value to the nearest valid step from min_val.
Uses round() to avoid floating-point drift (e.g. 0.1 steps never produce 0.30000000000000004). Result is clamped to [min_val, max_val]. step <= 0 is treated as 1.
Definition at line 92 of file n_gui.c.
Referenced by _slider_update_from_mouse(), n_gui_process_event(), n_gui_slider_set_range(), n_gui_slider_set_step(), and n_gui_slider_set_value().
Here is the caller graph for this function:
|
static |
handle slider drag (horizontal or vertical)
Definition at line 9155 of file n_gui.c.
References _clamp(), _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_WIDGET::id, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, N_GUI_SLIDER_V, N_GUI_SLIDER_DATA::on_change, N_GUI_SLIDER_DATA::orientation, N_GUI_SLIDER_DATA::step, N_GUI_SLIDER_DATA::user_data, N_GUI_SLIDER_DATA::value, N_GUI_WIDGET::w, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Sort windows list by z-order: ALWAYS_BEHIND first, then FIXED (by z_value), then NORMAL, then ALWAYS_ON_TOP, then POPUP.
Within each group, preserve relative order. Uses stable insertion sort since window lists are typically small.
Definition at line 1766 of file n_gui.c.
References _destroy_window(), _zorder_group(), LIST_NODE::destroy_func, Free, list_foreach, list_push(), Malloc, LIST::nb_items, remove_list_node_f(), LIST::start, N_GUI_CTX::windows, and N_GUI_WINDOW::z_value.
Referenced by n_gui_add_window(), n_gui_lower_window(), n_gui_raise_window(), and n_gui_window_set_zorder().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw one text line with mode-specific highlighting starting at (x,y)
Definition at line 6582 of file n_gui.c.
References _syntax_js_keyword(), _syntax_js_regex_kw(), _syntax_js_regex_possible(), _syntax_run(), N_GUI_THEME::border_active, N_GUI_THEME::border_hover, mode, N_GUI_SYNTAX_HTTP, N_GUI_SYNTAX_JS, N_GUI_SYNTAX_JSON, N_GUI_SYNTAX_XML, N_GUI_SYNTAX_YAML, N_GUI_THEME::text_active, and N_GUI_THEME::text_normal.
Referenced by _draw_syntaxview().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
whether the n bytes at s form a JavaScript keyword or literal name
Definition at line 6567 of file n_gui.c.
Referenced by _syntax_draw_line().
Here is the caller graph for this function:
|
static |
whether the n bytes at s are a keyword after which an expression (and therefore a regex literal) can start, e.g.
return /re/
Definition at line 6549 of file n_gui.c.
Referenced by _syntax_draw_line().
Here is the caller graph for this function:
|
static |
whether a '/' may start a regex literal after last significant char c (start of line, after an operator, an opener, or a separator)
Definition at line 6561 of file n_gui.c.
Referenced by _syntax_draw_line().
Here is the caller graph for this function:
|
static |
pixel width of the first n bytes of s in font (bounded copy).
Definition at line 6834 of file n_gui.c.
References _text_w().
Referenced by _draw_syntaxview(), and _syntaxview_offset_from_mouse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
draw a run of text and advance the pen x by its width
Definition at line 6537 of file n_gui.c.
References _text_w().
Referenced by _syntax_draw_line().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
forward declaration: (re)build a syntaxview's cached line count and headers-end index when stale.
draw a read-only syntax-highlighted text view
Defined near the syntaxview draw code.
(re)build a syntaxview's cached line count and first-blank-line index. Both are pure functions of the text, so they are computed once per text change instead of scanning the whole buffer twice on every frame (and on every scroll/click event). Invalidated by clearing lines_valid in n_gui_syntaxview_set_text.
Definition at line 6903 of file n_gui.c.
References N_GUI_SYNTAXVIEW_DATA::cached_headers_end, N_GUI_SYNTAXVIEW_DATA::cached_nb_lines, N_GUI_SYNTAXVIEW_DATA::lines_valid, and N_GUI_SYNTAXVIEW_DATA::text.
Referenced by _draw_syntaxview(), n_gui_process_event(), and n_gui_syntaxview_scroll_to_offset().
Here is the caller graph for this function:
|
static |
Map a mouse position over a syntax view to a byte offset into its text.
The view does not wrap, so one source line maps to one display row; the row is chosen from the y position (plus the scroll offset) and the column from the x position by measuring incremental prefix widths of that line. The offset returned indexes the real text buffer (a trailing CR is treated as the end of the visible line).
Definition at line 6848 of file n_gui.c.
References _syntax_prefix_w(), N_GUI_SYNTAXVIEW_DATA::scroll_offset, and N_GUI_SYNTAXVIEW_DATA::text.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
return the effective titlebar button size (0 = auto from titlebar_h)
Definition at line 8101 of file n_gui.c.
References N_GUI_STYLE::tb_btn_size, and N_GUI_WINDOW::titlebar_h.
Referenced by _tb_button_rect(), and _tb_buttons_area_width().
Here is the caller graph for this function:
|
static |
Dispatch a titlebar button action, invoke the user callback if set, otherwise fall back to the built-in minimize / maximize / close behaviour.
| ctx | the GUI context (used for the default close/min/max paths) |
| win | the target window |
| btn_type | one of N_GUI_TB_BTN_MINIMIZE, _MAXIMIZE, _CLOSE |
Definition at line 9709 of file n_gui.c.
References _native_own_chrome(), N_GUI_WINDOW::id, n_gui_close_window(), n_gui_maximize_window(), n_gui_minimize_window(), N_GUI_TB_BTN_CLOSE, N_GUI_TB_BTN_MAXIMIZE, N_GUI_TB_BTN_MINIMIZE, N_GUI_WIN_OPEN, N_GUI_WINDOW::native, N_GUI_WINDOW::native_close_pending, N_GUI_TB_BUTTONS::on_close, N_GUI_TB_BUTTONS::on_close_user_data, N_GUI_TB_BUTTONS::on_maximize, N_GUI_TB_BUTTONS::on_maximize_user_data, N_GUI_TB_BUTTONS::on_minimize, N_GUI_TB_BUTTONS::on_minimize_user_data, N_GUI_WINDOW::state, and N_GUI_WINDOW::tb_buttons.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
compute the absolute rect for a titlebar button.
Layout right-to-left: close rightmost, maximize next, minimize leftmost. Returns 1 if the button is enabled, 0 if not.
Definition at line 8121 of file n_gui.c.
References _tb_btn_resolved_size(), N_GUI_WINDOW::flags, N_GUI_TB_BTN_CLOSE, N_GUI_TB_BTN_MAXIMIZE, N_GUI_TB_BTN_MINIMIZE, N_GUI_WIN_BTN_CLOSE, N_GUI_WIN_BTN_MAXIMIZE, N_GUI_WIN_BTN_MINIMIZE, N_GUI_WIN_FRAMELESS, N_GUI_STYLE::tb_btn_right_margin, N_GUI_STYLE::tb_btn_spacing, N_GUI_WINDOW::titlebar_h, N_GUI_WINDOW::w, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by _draw_tb_buttons(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
compute the total width consumed by enabled titlebar buttons (0 if none/frameless)
Definition at line 8107 of file n_gui.c.
References _tb_btn_resolved_size(), N_GUI_WINDOW::flags, N_GUI_WIN_BTN_CLOSE, N_GUI_WIN_BTN_MAXIMIZE, N_GUI_WIN_BTN_MINIMIZE, N_GUI_WIN_FRAMELESS, N_GUI_STYLE::tb_btn_right_margin, and N_GUI_STYLE::tb_btn_spacing.
Referenced by _draw_window().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: memoized al_get_text_dimensions (bounding box x/y/w/h).
Same result as calling al_get_text_dimensions directly; used by the per-widget label centring paths that re-measure unchanging text every frame.
Definition at line 229 of file n_gui.c.
References _ngui_meas_slot(), N_GUI_MEAS_ENTRY::dh, N_GUI_MEAS_ENTRY::dw, N_GUI_MEAS_ENTRY::dx, N_GUI_MEAS_ENTRY::dy, N_GUI_MEAS_ENTRY::have_dims, and N_GUI_MEAS_KEY_MAX.
Referenced by _draw_button(), _draw_checkbox(), _draw_combobox(), _draw_dropmenu(), _draw_label(), _draw_slider(), _draw_window(), and _label_text_origin_x().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 5659 of file n_gui.c.
References N_GUI_STATE_ACTIVE, N_GUI_STATE_HOVER, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, and N_GUI_THEME::text_normal.
Referenced by _draw_button(), _draw_checkbox(), _draw_combobox(), _draw_dropmenu(), _draw_label(), and _draw_tb_buttons().
Here is the caller graph for this function:
|
static |
helper: destroy a single widget (called by list destructor)
count the lines in a NUL-terminated text (0 for empty)
forward declaration: count the lines in a NUL-terminated text
Definition at line 6525 of file n_gui.c.
Referenced by n_gui_syntaxview_get_line_count().
Here is the caller graph for this function:
|
static |
helper: get the advance width of text.
Uses al_get_text_width which returns the advance width (includes space characters), unlike al_get_text_dimensions which returns the bounding box (zero width for spaces since they have no visible pixels). Memoized.
Definition at line 214 of file n_gui.c.
References _ngui_meas_slot(), N_GUI_MEAS_ENTRY::adv_w, N_GUI_MEAS_ENTRY::have_adv, and N_GUI_MEAS_KEY_MAX.
Referenced by _draw_combobox_dropdown(), _draw_justified_selection(), _draw_label(), _draw_text_justified(), _draw_text_truncated(), _draw_textarea(), _draw_tooltip(), _justified_char_at_pos(), _label_char_at_x(), _label_content_height(), _syntax_prefix_w(), _syntax_run(), _textarea_content_height(), _textarea_handle_key(), _textarea_pos_from_mouse(), _window_update_content_size(), n_gui_dropmenu_panel_width(), n_gui_process_event(), and n_gui_textarea_scroll_to_offset().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
clear the selection (set both anchors to cursor_pos)
Definition at line 9247 of file n_gui.c.
References N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_TEXTAREA_DATA::sel_end, and N_GUI_TEXTAREA_DATA::sel_start.
Referenced by _textarea_delete_selection(), _textarea_handle_key(), and _textarea_paste_clip().
Here is the caller graph for this function:
|
static |
helper: compute the total content height of multiline textarea text (with line-wrap), in pixels.
Mirrors the drawing logic.
Definition at line 5203 of file n_gui.c.
References _text_w(), _utf8_char_len(), N_GUI_TEXTAREA_DATA::text, and N_GUI_TEXTAREA_DATA::text_len.
Referenced by _draw_textarea(), _textarea_handle_key(), _textarea_pos_from_mouse(), n_gui_process_event(), n_gui_textarea_scroll_to_bottom(), and n_gui_textarea_scroll_to_offset().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
copy selected text to clipboard.
Returns 1 on success.
Definition at line 9267 of file n_gui.c.
References _ngui_clip_set(), _textarea_has_selection(), _textarea_sel_range(), display, FreeNoLog, Malloc, N_CLIPBOARD_CLIPBOARD, and N_GUI_TEXTAREA_DATA::text.
Referenced by _textarea_handle_key().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
delete the currently selected text, move cursor to selection start
Definition at line 9253 of file n_gui.c.
References _textarea_clear_selection(), _textarea_has_selection(), _textarea_sel_range(), N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_WIDGET::data, N_GUI_WIDGET::id, N_GUI_TEXTAREA_DATA::on_change, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_TEXTAREA_DATA::user_data.
Referenced by _textarea_handle_key(), and _textarea_paste_clip().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
handle textarea key input.
Returns 1 if the event was consumed, 0 if it should be passed through (e.g. ENTER in single-line mode falls through to button keybinds).
Definition at line 9379 of file n_gui.c.
References _ctx_io_display(), _ngui_clip_get(), _ngui_publish_primary_selection(), _text_w(), _textarea_clear_selection(), _textarea_content_height(), _textarea_copy_to_clipboard(), _textarea_delete_selection(), _textarea_has_selection(), _textarea_paste_clip(), _textarea_sel_range(), _utf8_char_len(), _utf8_encode(), N_GUI_TEXTAREA_DATA::char_limit, N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_WIDGET::id, N_GUI_TEXTAREA_DATA::multiline, N_CLIPBOARD_CLIPBOARD, N_GUI_TEXTAREA_DATA::on_change, N_GUI_TEXTAREA_DATA::scroll_from_wheel, N_GUI_TEXTAREA_DATA::sel_end, N_GUI_TEXTAREA_DATA::sel_start, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, N_GUI_TEXTAREA_DATA::user_data, and N_GUI_WIDGET::w.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
return 1 if the textarea has an active selection
Definition at line 5982 of file n_gui.c.
References N_GUI_TEXTAREA_DATA::sel_end, and N_GUI_TEXTAREA_DATA::sel_start.
Referenced by _draw_textarea(), _ngui_publish_primary_selection(), _textarea_copy_to_clipboard(), _textarea_delete_selection(), _textarea_handle_key(), and _textarea_paste_clip().
Here is the caller graph for this function:
|
static |
insert clipboard text at the cursor, replacing any selection.
Shared by Ctrl+V and middle-click paste. clip is NUL-terminated; CR is stripped and, in single-line mode, newlines are dropped. Respects the char limit and fires on_change.
Definition at line 9285 of file n_gui.c.
References _textarea_clear_selection(), _textarea_delete_selection(), _textarea_has_selection(), N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_WIDGET::id, N_GUI_TEXTAREA_DATA::multiline, N_GUI_TEXT_MAX, N_GUI_TEXTAREA_DATA::on_change, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_TEXTAREA_DATA::user_data.
Referenced by _textarea_handle_key(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
helper: find the byte position in a textarea closest to the given mouse coordinates (mx, my in screen space).
ax, ay are the widget's screen-space top-left corner. Returns the byte offset into td->text.
Definition at line 5877 of file n_gui.c.
References _text_w(), _textarea_content_height(), _utf8_char_len(), display, N_GUI_TEXTAREA_DATA::mask_char, N_GUI_TEXTAREA_DATA::multiline, N_GUI_TEXT_MAX, N_GUI_TEXTAREA_DATA::scroll_x, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_TEXTAREA_DATA::text, and N_GUI_TEXTAREA_DATA::text_len.
Referenced by n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
get the ordered selection range (lo, hi)
Definition at line 5987 of file n_gui.c.
References N_GUI_TEXTAREA_DATA::sel_end, and N_GUI_TEXTAREA_DATA::sel_start.
Referenced by _draw_textarea(), _ngui_publish_primary_selection(), _textarea_copy_to_clipboard(), _textarea_delete_selection(), and _textarea_handle_key().
Here is the caller graph for this function:
|
static |
helper: al_do_multiline_text callback that just counts the wrapped lines.
Definition at line 8448 of file n_gui.c.
Referenced by _draw_tooltip().
Here is the caller graph for this function:
|
static |
helper: top-most visible tooltip-bearing widget under a gui-space point (-1 = none)
Definition at line 2329 of file n_gui.c.
References _point_in_rect(), _win_on_pass(), _win_tbh(), N_GUI_WIDGET::h, N_GUI_WIDGET::id, list_foreach, N_GUI_WIN_OPEN, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::state, N_GUI_WIDGET::tooltip, N_GUI_WIDGET::visible, N_GUI_WIDGET::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_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
return the byte length of a UTF-8 character from its lead byte
Definition at line 5193 of file n_gui.c.
Referenced by _draw_textarea(), _justified_char_at_pos(), _label_char_at_x(), _textarea_content_height(), _textarea_handle_key(), _textarea_pos_from_mouse(), and n_gui_textarea_scroll_to_offset().
Here is the caller graph for this function:
|
static |
encode a Unicode code point into UTF-8, return the number of bytes written (0 on error)
Definition at line 9220 of file n_gui.c.
Referenced by _textarea_handle_key().
Here is the caller graph for this function:
|
static |
helper: whether a window takes part in the pass currently being processed or drawn.
Pop-up windows (native == NULL) belong to the main display's pass, detached ones only to their own display's pass. With no window detached ctx->pass_display stays NULL and this is always true, so the single-display path behaves exactly as it did before display routing existed.
Definition at line 263 of file n_gui.c.
References N_GUI_WINDOW::native, and N_GUI_CTX::pass_display.
Referenced by _compute_gui_bounds(), _datagrid_resize_hover(), _draw_combobox_dropdown(), _draw_dropmenu_panel(), _pointer_over_window(), _tooltip_widget_at(), n_gui_draw(), and n_gui_process_event().
Here is the caller graph for this function:
|
static |
helper: effective title bar height (0 for frameless windows)
Definition at line 254 of file n_gui.c.
References N_GUI_WINDOW::flags, N_GUI_WIN_FRAMELESS, and N_GUI_WINDOW::titlebar_h.
Referenced by _datagrid_resize_hover(), _find_widget_window(), _native_apply_minimised(), _pointer_over_window(), _tooltip_widget_at(), n_gui_process_event(), n_gui_wants_mouse(), n_gui_window_apply_autofit(), n_gui_window_autosize(), and n_gui_window_detach().
Here is the caller graph for this function:
|
static |
helper: recompute content extents for a window (for scrollbar support)
Definition at line 2089 of file n_gui.c.
References _text_w(), N_GUI_LABEL_DATA::align, N_GUI_WINDOW::content_h, N_GUI_WINDOW::content_w, N_GUI_WIDGET::data, N_GUI_WINDOW::flags, N_GUI_WIDGET::font, N_GUI_WIDGET::h, list_foreach, N_GUI_ALIGN_JUSTIFIED, N_GUI_TYPE_LABEL, N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_LABEL_DATA::text, N_GUI_WIDGET::type, N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WINDOW::widgets, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by _draw_window(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 1745 of file n_gui.c.
References N_GUI_ZORDER_ALWAYS_BEHIND, N_GUI_ZORDER_ALWAYS_ON_TOP, N_GUI_ZORDER_FIXED, N_GUI_ZORDER_POPUP, and N_GUI_WINDOW::z_order.
Referenced by _sort_windows_by_zorder().
Here is the caller graph for this function:
|
static |
Definition at line 181 of file n_gui.c.
Referenced by _ngui_meas_slot().