![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | N_GUI_BUTTON_DATA |
| button specific data More... | |
| struct | N_GUI_CHECKBOX_DATA |
| checkbox specific data More... | |
| struct | N_GUI_COMBOBOX_DATA |
| combo box specific data More... | |
| struct | N_GUI_CTX |
| The top-level GUI context that holds all windows. More... | |
| struct | N_GUI_DROPMENU_DATA |
| dropdown menu specific data More... | |
| struct | N_GUI_DROPMENU_ENTRY |
| A single entry in a dropdown menu (static or dynamic) More... | |
| struct | N_GUI_IMAGE_DATA |
| image widget specific data More... | |
| struct | N_GUI_KV_ROW |
| a single row in the KV table More... | |
| struct | N_GUI_KVTABLE |
| key-value table built from textareas, checkboxes, and buttons More... | |
| struct | N_GUI_LABEL_DATA |
| static text label specific data More... | |
| struct | N_GUI_LISTBOX_DATA |
| listbox specific data More... | |
| struct | N_GUI_LISTITEM |
| a single item in a list/radio/combo widget More... | |
| struct | N_GUI_RADIOLIST_DATA |
| radio list specific data More... | |
| struct | N_GUI_SCROLLBAR_DATA |
| scrollbar specific data More... | |
| struct | N_GUI_SLIDER_DATA |
| slider specific data More... | |
| struct | N_GUI_STYLE |
| Global style holding every configurable layout constant. More... | |
| struct | N_GUI_TAB_PANEL |
| tab panel built from toggle buttons with content window management More... | |
| struct | N_GUI_TEXT_DIMS |
| bounding box dimensions returned by n_gui_get_text_dims() More... | |
| struct | N_GUI_TEXTAREA_DATA |
| text area specific data More... | |
| struct | N_GUI_THEME |
| Color theme for a widget. More... | |
| struct | N_GUI_TREE |
| tree view built from an N_GUI listbox More... | |
| struct | N_GUI_TREE_NODE |
| a single node in the tree view More... | |
| struct | N_GUI_WIDGET |
| A single GUI widget. More... | |
| struct | N_GUI_WINDOW |
| A pseudo window that contains widgets. More... | |
Macros | |
| #define | N_GUI_ALIGN_CENTER 1 |
| center aligned text | |
| #define | N_GUI_ALIGN_JUSTIFIED 3 |
| justified text (spread words to fill width) | |
| #define | N_GUI_ALIGN_LEFT 0 |
| left aligned text | |
| #define | N_GUI_ALIGN_RIGHT 2 |
| right aligned text | |
| #define | N_GUI_AUTOFIT_CENTER 16 |
| center the window on its insertion point after auto-fit (overrides EXPAND_LEFT/EXPAND_UP for centering) | |
| #define | N_GUI_AUTOFIT_EXPAND_LEFT 4 |
| expand leftward instead of rightward when adjusting width | |
| #define | N_GUI_AUTOFIT_EXPAND_UP 8 |
| expand upward instead of downward when adjusting height | |
| #define | N_GUI_AUTOFIT_H 2 |
| auto-adjust window height to content | |
| #define | N_GUI_AUTOFIT_W 1 |
| auto-adjust window width to content | |
| #define | N_GUI_AUTOFIT_WH 3 |
| auto-adjust both width and height (convenience: W|H) | |
| #define | N_GUI_COMBOBOX_AUTO_WIDTH 1 |
| dropdown panel expands to fit the longest item text | |
| #define | N_GUI_ID_MAX 128 |
| maximum length for widget id/name strings | |
| #define | N_GUI_IMAGE_CENTER 2 |
| draw at original size, centered | |
| #define | N_GUI_IMAGE_FIT 0 |
| scale to fit within bounds, keep aspect ratio | |
| #define | N_GUI_IMAGE_STRETCH 1 |
| stretch to fill bounds | |
| #define | N_GUI_KEY_MOD_MASK (ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL | ALLEGRO_KEYMOD_ALT | ALLEGRO_KEYMOD_ALTGR) |
| mask of supported modifier flags for button keybind matching | |
| #define | N_GUI_KEY_SOURCES_MAX 8 |
| maximum number of source widgets for a focused key binding | |
| #define | N_GUI_KV_MAX 128 |
| maximum number of rows in a KV table | |
| #define | N_GUI_RESIZE_ADAPTIVE 1 |
| virtual size tracks display; windows adapt per their resize_policy | |
| #define | N_GUI_RESIZE_VIRTUAL 0 |
| fixed virtual canvas with uniform scaling (default/existing behavior) | |
| #define | N_GUI_SCROLLBAR_H 0 |
| horizontal scrollbar | |
| #define | N_GUI_SCROLLBAR_V 1 |
| vertical scrollbar | |
| #define | N_GUI_SELECT_MULTIPLE 2 |
| multiple item selection | |
| #define | N_GUI_SELECT_NONE 0 |
| no selection allowed (display only) | |
| #define | N_GUI_SELECT_SINGLE 1 |
| single item selection | |
| #define | N_GUI_SHAPE_BITMAP 2 |
| bitmap-based rendering | |
| #define | N_GUI_SHAPE_RECT 0 |
| rectangle shape (default) | |
| #define | N_GUI_SHAPE_ROUNDED 1 |
| rounded rectangle shape | |
| #define | N_GUI_SLIDER_H 0 |
| horizontal slider (default) | |
| #define | N_GUI_SLIDER_PERCENT 1 |
| slider uses 0-100 percentage | |
| #define | N_GUI_SLIDER_V 1 |
| vertical slider | |
| #define | N_GUI_SLIDER_VALUE 0 |
| slider uses raw start/end values | |
| #define | N_GUI_STATE_ACTIVE 2 |
| widget is being pressed / dragged | |
| #define | N_GUI_STATE_FOCUSED 4 |
| widget has keyboard focus | |
| #define | N_GUI_STATE_HOVER 1 |
| mouse is hovering the widget | |
| #define | N_GUI_STATE_IDLE 0 |
| widget is idle / normal state | |
| #define | N_GUI_STATE_SCROLLBAR_DRAG 8 |
| widget scrollbar is being dragged | |
| #define | N_GUI_TAB_MAX 16 |
| maximum number of tabs in a single tab panel | |
| #define | N_GUI_TEXT_MAX 4096 |
| maximum length for textarea content | |
| #define | N_GUI_TREE_MAX 512 |
| maximum number of nodes in a tree view | |
| #define | N_GUI_TYPE_BUTTON 1 |
| widget type: button | |
| #define | N_GUI_TYPE_CHECKBOX 4 |
| widget type: checkbox | |
| #define | N_GUI_TYPE_COMBOBOX 8 |
| widget type: combo box (dropdown) | |
| #define | N_GUI_TYPE_DROPMENU 11 |
| widget type: dropdown menu with static and dynamic entries | |
| #define | N_GUI_TYPE_IMAGE 9 |
| widget type: image display | |
| #define | N_GUI_TYPE_LABEL 10 |
| widget type: static text label (with optional hyperlink) | |
| #define | N_GUI_TYPE_LISTBOX 6 |
| widget type: listbox (selectable list) | |
| #define | N_GUI_TYPE_RADIOLIST 7 |
| widget type: radio list (single select radio buttons) | |
| #define | N_GUI_TYPE_SCROLLBAR 5 |
| widget type: scrollbar | |
| #define | N_GUI_TYPE_SLIDER 2 |
| widget type: slider | |
| #define | N_GUI_TYPE_TEXTAREA 3 |
| widget type: text area | |
| #define | N_GUI_WIN_AUTO_SCROLLBAR 16 |
| enable automatic scrollbars when content exceeds window size | |
| #define | N_GUI_WIN_DRAGGING 4 |
| window is being dragged | |
| #define | N_GUI_WIN_FIXED_POSITION 64 |
| disable window dragging (default:enable) | |
| #define | N_GUI_WIN_FRAMELESS 128 |
| frameless window: no title bar drawn, drag via window body unless N_GUI_WIN_FIXED_POSITION is also set | |
| #define | N_GUI_WIN_HSCROLL_DRAG 32 |
| window horizontal auto-scrollbar is being dragged | |
| #define | N_GUI_WIN_MINIMISED 2 |
| window is minimised (title bar only) | |
| #define | N_GUI_WIN_OPEN 1 |
| window is visible | |
| #define | N_GUI_WIN_RESIZABLE 32 |
| enable user-resizable window with a drag handle at bottom-right | |
| #define | N_GUI_WIN_RESIZE_MOVE 1 |
| reposition proportionally, keep pixel size | |
| #define | N_GUI_WIN_RESIZE_NONE 0 |
| no adaptation: absolute position and size unchanged | |
| #define | N_GUI_WIN_RESIZE_SCALE 2 |
| reposition AND resize proportionally, child widgets scale too | |
| #define | N_GUI_WIN_RESIZING 8 |
| window is being resized | |
| #define | N_GUI_WIN_VSCROLL_DRAG 16 |
| window vertical auto-scrollbar is being dragged | |
| #define | N_GUI_ZORDER_ALWAYS_BEHIND 2 |
| always drawn behind normal windows, cannot be raised above them | |
| #define | N_GUI_ZORDER_ALWAYS_ON_TOP 1 |
| always drawn on top of normal windows, cannot be lowered behind them | |
| #define | N_GUI_ZORDER_FIXED 3 |
| fixed z-value: window is sorted within a dedicated group between ALWAYS_BEHIND and NORMAL windows. | |
| #define | N_GUI_ZORDER_NORMAL 0 |
| default z-order: window participates in normal raise/lower ordering | |
Functions | |
| int | n_gui_add_button (N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, int shape, void(*on_click)(int, void *), void *user_data) |
| add a button widget | |
| int | n_gui_add_button_bitmap (N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, ALLEGRO_BITMAP *normal, ALLEGRO_BITMAP *hover, ALLEGRO_BITMAP *active, void(*on_click)(int, void *), void *user_data) |
| add a bitmap-based button widget | |
| int | n_gui_add_checkbox (N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, int initial_checked, void(*on_toggle)(int, int, void *), void *user_data) |
| add a checkbox widget | |
| int | n_gui_add_combobox (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, void(*on_select)(int, int, void *), void *user_data) |
| add a combo box widget | |
| int | n_gui_add_dropmenu (N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, void(*on_open)(int, void *), void *on_open_user_data) |
| add a dropdown menu widget (button that opens a menu panel with entries) | |
| int | n_gui_add_image (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, ALLEGRO_BITMAP *bitmap, int scale_mode) |
| add an image widget | |
| int | n_gui_add_label (N_GUI_CTX *ctx, int window_id, const char *text, float x, float y, float w, float h, int align) |
| add a text label widget | |
| int | n_gui_add_label_link (N_GUI_CTX *ctx, int window_id, const char *text, const char *link, float x, float y, float w, float h, int align, void(*on_link_click)(int, const char *, void *), void *user_data) |
| add a text label with hyperlink | |
| int | n_gui_add_listbox (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int selection_mode, void(*on_select)(int, int, int, void *), void *user_data) |
| add a listbox widget | |
| int | n_gui_add_radiolist (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, void(*on_select)(int, int, void *), void *user_data) |
| add a radio list widget | |
| int | n_gui_add_scrollbar (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int orientation, int shape, double content_size, double viewport_size, void(*on_scroll)(int, double, void *), void *user_data) |
| add a scrollbar widget | |
| int | n_gui_add_slider (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, double min_val, double max_val, double initial, int mode, void(*on_change)(int, double, void *), void *user_data) |
| add a horizontal slider widget | |
| int | n_gui_add_textarea (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, int multiline, size_t char_limit, void(*on_change)(int, const char *, void *), void *user_data) |
| add a text area widget | |
| int | n_gui_add_toggle_button (N_GUI_CTX *ctx, int window_id, const char *label, float x, float y, float w, float h, int shape, int initial_state, void(*on_click)(int, void *), void *user_data) |
| toggle button creation (returns widget id) | |
| int | n_gui_add_vslider (N_GUI_CTX *ctx, int window_id, float x, float y, float w, float h, double min_val, double max_val, double initial, int mode, void(*on_change)(int, double, void *), void *user_data) |
| add a vertical slider (same as n_gui_add_slider but oriented vertically) | |
| int | n_gui_add_window (N_GUI_CTX *ctx, const char *title, float x, float y, float w, float h) |
| add a window to the GUI context | |
| int | n_gui_add_window_auto (N_GUI_CTX *ctx, const char *title, float x, float y) |
| add a window that sizes itself automatically to fit its widgets (call n_gui_window_autosize after adding all widgets) | |
| void | n_gui_apply_adaptive_resize (N_GUI_CTX *ctx, float new_w, float new_h) |
| apply adaptive resize: reposition/resize all windows according to their policies for the new display dimensions. | |
| int | n_gui_button_is_toggled (N_GUI_CTX *ctx, int widget_id) |
| check if button is toggled | |
| void | n_gui_button_set_keycode (N_GUI_CTX *ctx, int widget_id, int keycode, int modifiers) |
| bind a keyboard key with optional modifier requirements to a button. | |
| void | n_gui_button_set_keycode_focused (N_GUI_CTX *ctx, int widget_id, int keycode, int modifiers, const int *sources, int source_count) |
| bind a keyboard key to a button that fires only when specific widgets have focus. | |
| void | n_gui_button_set_toggle_mode (N_GUI_CTX *ctx, int widget_id, int toggle_mode) |
| set button toggle mode | |
| void | n_gui_button_set_toggled (N_GUI_CTX *ctx, int widget_id, int toggled) |
| set button toggled state | |
| int | n_gui_checkbox_is_checked (N_GUI_CTX *ctx, int widget_id) |
| check if checkbox is checked | |
| void | n_gui_checkbox_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *box, ALLEGRO_BITMAP *box_checked, ALLEGRO_BITMAP *box_hover) |
| set optional bitmap overlays on a checkbox widget. | |
| void | n_gui_checkbox_set_checked (N_GUI_CTX *ctx, int widget_id, int checked) |
| set checkbox checked state | |
| void | n_gui_close_window (N_GUI_CTX *ctx, int window_id) |
| close (hide) a window | |
| int | n_gui_combobox_add_item (N_GUI_CTX *ctx, int widget_id, const char *text) |
| add an item to a combo box | |
| void | n_gui_combobox_clear (N_GUI_CTX *ctx, int widget_id) |
| remove all items from a combobox | |
| int | n_gui_combobox_get_selected (N_GUI_CTX *ctx, int widget_id) |
| get the selected item index | |
| void | n_gui_combobox_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *item_bg, ALLEGRO_BITMAP *item_selected) |
| set optional bitmap overlays on a combobox widget. | |
| void | n_gui_combobox_set_flags (N_GUI_CTX *ctx, int widget_id, int flags) |
| set combobox feature flags (bitmask of N_GUI_COMBOBOX_* values) | |
| void | n_gui_combobox_set_selected (N_GUI_CTX *ctx, int widget_id, int index) |
| set the selected item index | |
| N_GUI_STYLE | n_gui_default_style (void) |
| return the built-in default style | |
| N_GUI_THEME | n_gui_default_theme (void) |
| return the built-in default theme | |
| void | n_gui_destroy_ctx (N_GUI_CTX **ctx) |
| destroy a GUI context and free all resources | |
| float | n_gui_detect_dpi_scale (N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display) |
| detect and apply DPI scale from the given allegro display. | |
| void | n_gui_draw (N_GUI_CTX *ctx) |
| draw all visible GUI windows and widgets | |
| int | n_gui_dropmenu_add_dynamic_entry (N_GUI_CTX *ctx, int widget_id, const char *text, int tag, void(*on_click)(int, int, int, void *), void *user_data) |
| add a dynamic entry (rebuilt each time menu opens) | |
| int | n_gui_dropmenu_add_entry (N_GUI_CTX *ctx, int widget_id, const char *text, int tag, void(*on_click)(int, int, int, void *), void *user_data) |
| add a static entry to a dropdown menu | |
| void | n_gui_dropmenu_clear (N_GUI_CTX *ctx, int widget_id) |
| remove all entries | |
| void | n_gui_dropmenu_clear_dynamic (N_GUI_CTX *ctx, int widget_id) |
| remove all dynamic entries (call from on_open callback before re-adding) | |
| int | n_gui_dropmenu_get_count (N_GUI_CTX *ctx, int widget_id) |
| get number of entries | |
| void | n_gui_dropmenu_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *panel, ALLEGRO_BITMAP *item_hover) |
| set optional bitmap overlays on a dropmenu widget. | |
| void | n_gui_dropmenu_set_entry_text (N_GUI_CTX *ctx, int widget_id, int index, const char *text) |
| update text of an existing entry by index | |
| float | n_gui_get_dpi_scale (const N_GUI_CTX *ctx) |
| get current DPI scale factor | |
| int | n_gui_get_resize_mode (N_GUI_CTX *ctx) |
| get current resize mode | |
| 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. | |
| N_GUI_WIDGET * | n_gui_get_widget (N_GUI_CTX *ctx, int widget_id) |
| get a widget by id | |
| N_GUI_WINDOW * | n_gui_get_window (N_GUI_CTX *ctx, int window_id) |
| get a window by id | |
| void | n_gui_image_set_bitmap (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bitmap) |
| set the bitmap on an image widget | |
| int | n_gui_is_widget_enabled (N_GUI_CTX *ctx, int widget_id) |
| check if a widget is enabled | |
| int | n_gui_kvtable_add_row (N_GUI_KVTABLE *table, const char *key, const char *value, const char *description, int enabled) |
| add a row to the KV table | |
| 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 (N_GUI_KVTABLE *table) |
| get the number of active rows | |
| 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_label_set_bitmap (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg) |
| set optional background bitmap on a label widget. | |
| void | n_gui_label_set_link (N_GUI_CTX *ctx, int widget_id, const char *link) |
| set label hyperlink URL | |
| void | n_gui_label_set_text (N_GUI_CTX *ctx, int widget_id, const char *text) |
| set label text content | |
| int | n_gui_listbox_add_item (N_GUI_CTX *ctx, int widget_id, const char *text) |
| add an item to a listbox | |
| void | n_gui_listbox_clear (N_GUI_CTX *ctx, int widget_id) |
| clear all items from a listbox | |
| int | n_gui_listbox_get_count (N_GUI_CTX *ctx, int widget_id) |
| get number of items in a listbox | |
| const char * | n_gui_listbox_get_item_text (N_GUI_CTX *ctx, int widget_id, int index) |
| get item text by index | |
| int | n_gui_listbox_get_scroll_offset (N_GUI_CTX *ctx, int widget_id) |
| get the current scroll offset (in items) | |
| int | n_gui_listbox_get_selected (N_GUI_CTX *ctx, int widget_id) |
| get the first selected item index | |
| int | n_gui_listbox_is_selected (N_GUI_CTX *ctx, int widget_id, int index) |
| check if an item is selected | |
| int | n_gui_listbox_remove_item (N_GUI_CTX *ctx, int widget_id, int index) |
| remove an item from a listbox by index | |
| void | n_gui_listbox_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *item_bg, ALLEGRO_BITMAP *item_selected) |
| set optional bitmap overlays on a listbox widget. | |
| void | n_gui_listbox_set_scroll_offset (N_GUI_CTX *ctx, int widget_id, int offset) |
| set the scroll offset (in items) — clamps to valid range | |
| void | n_gui_listbox_set_selected (N_GUI_CTX *ctx, int widget_id, int index, int selected) |
| set item selection state | |
| int | n_gui_load_theme_json (N_GUI_CTX *ctx, const char *filepath) |
| Load a JSON theme file and apply it to the context. | |
| void | n_gui_lower_window (N_GUI_CTX *ctx, int window_id) |
| lower a window to the bottom of the stack (respects z-order constraints) | |
| N_GUI_THEME | n_gui_make_theme (ALLEGRO_COLOR bg, ALLEGRO_COLOR bg_hover, ALLEGRO_COLOR bg_active, ALLEGRO_COLOR border, ALLEGRO_COLOR border_hover, ALLEGRO_COLOR border_active, ALLEGRO_COLOR text, ALLEGRO_COLOR text_hover, ALLEGRO_COLOR text_active, float border_thickness, float corner_rx, float corner_ry) |
| create a custom theme from individual colors and properties | |
| void | n_gui_minimize_window (N_GUI_CTX *ctx, int window_id) |
| minimize a window (title bar only) | |
| N_GUI_CTX * | n_gui_new_ctx (ALLEGRO_FONT *default_font) |
| create a new GUI context | |
| void | n_gui_open_window (N_GUI_CTX *ctx, int window_id) |
| open (show) a window | |
| int | n_gui_process_event (N_GUI_CTX *ctx, ALLEGRO_EVENT event) |
| process an allegro event for the GUI | |
| int | n_gui_radiolist_add_item (N_GUI_CTX *ctx, int widget_id, const char *text) |
| add an item to a radio list | |
| void | n_gui_radiolist_clear (N_GUI_CTX *ctx, int widget_id) |
| remove all items from a radio list | |
| int | n_gui_radiolist_get_selected (N_GUI_CTX *ctx, int widget_id) |
| get the selected item index | |
| void | n_gui_radiolist_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg, ALLEGRO_BITMAP *item_bg, ALLEGRO_BITMAP *item_selected) |
| set optional bitmap overlays on a radiolist widget. | |
| void | n_gui_radiolist_set_selected (N_GUI_CTX *ctx, int widget_id, int index) |
| set the selected item index | |
| void | n_gui_raise_window (N_GUI_CTX *ctx, int window_id) |
| raise a window to the top of the stack (respects z-order constraints) | |
| int | n_gui_save_theme_json (N_GUI_CTX *ctx, const char *filepath) |
| Save the full theme (default_theme + style) to a JSON file. | |
| void | n_gui_screen_to_virtual (const N_GUI_CTX *ctx, float sx, float sy, float *vx, float *vy) |
| convert physical screen coordinates to virtual canvas coordinates. | |
| double | n_gui_scrollbar_get_pos (N_GUI_CTX *ctx, int widget_id) |
| get scrollbar position | |
| void | n_gui_scrollbar_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *track, ALLEGRO_BITMAP *thumb, ALLEGRO_BITMAP *thumb_hover, ALLEGRO_BITMAP *thumb_active) |
| set optional bitmap overlays on a scrollbar widget. | |
| void | n_gui_scrollbar_set_pos (N_GUI_CTX *ctx, int widget_id, double pos) |
| set scrollbar position | |
| void | n_gui_scrollbar_set_sizes (N_GUI_CTX *ctx, int widget_id, double content_size, double viewport_size) |
| set scrollbar content and viewport sizes | |
| void | n_gui_set_display (N_GUI_CTX *ctx, ALLEGRO_DISPLAY *display) |
| set the display pointer for clipboard operations (copy/paste) | |
| void | n_gui_set_display_size (N_GUI_CTX *ctx, float w, float h) |
| set the display (viewport) size so global scrollbars can be computed. | |
| void | n_gui_set_dpi_scale (N_GUI_CTX *ctx, float scale) |
| set DPI scale factor manually (default is 1.0). | |
| void | n_gui_set_focus (N_GUI_CTX *ctx, int widget_id) |
| set keyboard focus to a specific widget (-1 to clear focus) | |
| void | n_gui_set_resize_mode (N_GUI_CTX *ctx, int mode) |
| set context-level resize mode: N_GUI_RESIZE_VIRTUAL (default) or N_GUI_RESIZE_ADAPTIVE | |
| void | n_gui_set_virtual_size (N_GUI_CTX *ctx, float w, float h) |
| set the virtual canvas size for resolution-independent scaling. | |
| void | n_gui_set_widget_enabled (N_GUI_CTX *ctx, int widget_id, int enabled) |
| set widget enabled state (0 = disabled: drawn dimmed and ignores all input) | |
| void | n_gui_set_widget_theme (N_GUI_CTX *ctx, int widget_id, N_GUI_THEME theme) |
| set the theme on a widget | |
| void | n_gui_set_widget_visible (N_GUI_CTX *ctx, int widget_id, int visible) |
| set widget visibility | |
| double | n_gui_slider_get_value (N_GUI_CTX *ctx, int widget_id) |
| get slider current value | |
| void | n_gui_slider_set_bitmaps (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *track, ALLEGRO_BITMAP *fill, ALLEGRO_BITMAP *handle, ALLEGRO_BITMAP *handle_hover, ALLEGRO_BITMAP *handle_active) |
| set optional bitmap overlays on a slider widget. | |
| void | n_gui_slider_set_range (N_GUI_CTX *ctx, int widget_id, double min_val, double max_val) |
| set slider min/max range, clamping the current value if needed | |
| void | n_gui_slider_set_step (N_GUI_CTX *ctx, int widget_id, double step) |
| set slider step increment (0 is treated as 1). | |
| void | n_gui_slider_set_value (N_GUI_CTX *ctx, int widget_id, double value) |
| set slider value | |
| 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 (N_GUI_TAB_PANEL *panel) |
| get the active tab index | |
| void | n_gui_tab_set_active (N_GUI_TAB_PANEL *panel, int index) |
| set the active tab (toggles buttons, opens/closes content windows) | |
| void | n_gui_tab_set_content_window (N_GUI_TAB_PANEL *panel, int tab_index, int window_id) |
| associate a content window with a tab | |
| const char * | n_gui_textarea_get_text (N_GUI_CTX *ctx, int widget_id) |
| get text area content | |
| size_t | n_gui_textarea_get_text_length (N_GUI_CTX *ctx, int widget_id) |
| return the current text length in bytes (0 if widget is invalid) | |
| void | n_gui_textarea_scroll_to_bottom (N_GUI_CTX *ctx, int widget_id) |
| scroll a multiline textarea to the bottom | |
| void | n_gui_textarea_scroll_to_offset (N_GUI_CTX *ctx, int widget_id, size_t byte_offset) |
| scroll a multiline textarea so that the given byte offset is vertically centered | |
| void | n_gui_textarea_set_bitmap (N_GUI_CTX *ctx, int widget_id, ALLEGRO_BITMAP *bg) |
| set optional background bitmap on a textarea widget. | |
| void | n_gui_textarea_set_mask_char (N_GUI_CTX *ctx, int widget_id, char mask) |
| set a mask character for password-style input (e.g. | |
| void | n_gui_textarea_set_selection (N_GUI_CTX *ctx, int widget_id, size_t start, size_t end) |
| set the text selection range (byte offsets into text content) | |
| void | n_gui_textarea_set_text (N_GUI_CTX *ctx, int widget_id, const char *text) |
| set text area content | |
| void | n_gui_toggle_window (N_GUI_CTX *ctx, int window_id) |
| toggle window visibility (show/hide) | |
| int | n_gui_tree_add_node (N_GUI_TREE *tree, const char *label, int parent_index, void *user_data) |
| add a node to the tree | |
| 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_free (N_GUI_TREE **tree) |
| free a tree view (does not destroy the N_GUI listbox) | |
| void | n_gui_tree_rebuild (N_GUI_TREE *tree) |
| rebuild the listbox to reflect current tree state | |
| void | n_gui_tree_toggle_expand (N_GUI_TREE *tree, int node_index) |
| toggle expand/collapse of a node | |
| void | n_gui_update_transform (N_GUI_CTX *ctx) |
| recalculate scale and offset from virtual canvas to display. | |
| int | n_gui_wants_mouse (N_GUI_CTX *ctx) |
| check if the mouse is currently over any open GUI window (use to prevent click-through to the game world) | |
| void | n_gui_window_apply_autofit (N_GUI_CTX *ctx, int window_id) |
| trigger auto-fit recalculation for a window (call after adding/removing/resizing widgets) | |
| void | n_gui_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_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_open (N_GUI_CTX *ctx, int window_id) |
| check if window is visible | |
| 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_flags (N_GUI_CTX *ctx, int window_id, int flags) |
| set feature flags on a window (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, ...) | |
| void | n_gui_window_set_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_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. | |
All widgets support optional bitmap overlays for visual customization. By default, every bitmap pointer is NULL and the standard color theme is used. To skin a widget element, call the corresponding _set_bitmaps() function after widget creation.
Bitmaps are NOT owned by N_GUI — the caller is responsible for loading and destroying them. N_GUI only stores the pointer.
For widgets with per-state bitmaps (normal/hover/active):
Bitmap assignments are programmatic (via setter functions), not part of the JSON theme file. The JSON theme remains the color/layout fallback.
| struct N_GUI_BUTTON_DATA |
Collaboration diagram for N_GUI_BUTTON_DATA:Data Fields | |
| ALLEGRO_BITMAP * | bitmap |
| optional bitmap for the button (NULL = color theme) | |
| ALLEGRO_BITMAP * | bitmap_active |
| optional bitmap for active/pressed state | |
| ALLEGRO_BITMAP * | bitmap_hover |
| optional bitmap for hover state | |
| int | key_focus_only |
| if 1, keycode fires only when the button itself or a source widget has focus. | |
| int | key_modifiers |
| required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state for backward compatibility). | |
| int | key_sources [8] |
| widget IDs that can trigger this focused key binding. | |
| int | keycode |
| bound keyboard keycode (0 = none). | |
| char | label [128] |
| label displayed on the button | |
| void(* | on_click )(int widget_id, void *user_data) |
| callback on click (widget_id passed) | |
| int | shape |
| shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP | |
| int | toggle_mode |
| toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked) | |
| int | toggled |
| toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1) | |
| void * | user_data |
| user data for callback | |
| ALLEGRO_BITMAP* N_GUI_BUTTON_DATA::bitmap |
optional bitmap for the button (NULL = color theme)
Definition at line 299 of file n_gui.h.
Referenced by _draw_button(), n_gui_add_button(), and n_gui_add_button_bitmap().
| ALLEGRO_BITMAP* N_GUI_BUTTON_DATA::bitmap_active |
optional bitmap for active/pressed state
Definition at line 303 of file n_gui.h.
Referenced by _draw_button(), n_gui_add_button(), and n_gui_add_button_bitmap().
| ALLEGRO_BITMAP* N_GUI_BUTTON_DATA::bitmap_hover |
optional bitmap for hover state
Definition at line 301 of file n_gui.h.
Referenced by _draw_button(), n_gui_add_button(), and n_gui_add_button_bitmap().
| int N_GUI_BUTTON_DATA::key_focus_only |
if 1, keycode fires only when the button itself or a source widget has focus.
if 0 (default), keycode fires globally when no interactive widget has focus.
Definition at line 321 of file n_gui.h.
Referenced by n_gui_button_set_keycode_focused(), and n_gui_process_event().
| int N_GUI_BUTTON_DATA::key_modifiers |
required modifier key flags for the keybind (0 = no modifier requirement, matches any modifier state for backward compatibility).
Use ALLEGRO_KEYMOD_SHIFT, ALLEGRO_KEYMOD_CTRL, ALLEGRO_KEYMOD_ALT, ALLEGRO_KEYMOD_ALTGR ORed together. When non-zero, only the specified modifier combination triggers the keybind (exact match on N_GUI_KEY_MOD_MASK bits).
Definition at line 318 of file n_gui.h.
Referenced by n_gui_add_button(), n_gui_button_set_keycode(), n_gui_button_set_keycode_focused(), and n_gui_process_event().
| int N_GUI_BUTTON_DATA::key_sources[8] |
widget IDs that can trigger this focused key binding.
Terminated by -1. Only used when key_focus_only == 1. Up to N_GUI_KEY_SOURCES_MAX entries.
Definition at line 324 of file n_gui.h.
Referenced by n_gui_button_set_keycode_focused(), and n_gui_process_event().
| int N_GUI_BUTTON_DATA::keycode |
bound keyboard keycode (0 = none).
When this key is pressed and no text input widget has focus, the button's on_click callback is triggered.
Definition at line 312 of file n_gui.h.
Referenced by n_gui_add_button(), n_gui_button_set_keycode(), n_gui_button_set_keycode_focused(), and n_gui_process_event().
| char N_GUI_BUTTON_DATA::label[128] |
label displayed on the button
Definition at line 297 of file n_gui.h.
Referenced by _draw_button(), and n_gui_add_button().
| void(* N_GUI_BUTTON_DATA::on_click) (int widget_id, void *user_data) |
callback on click (widget_id passed)
Definition at line 326 of file n_gui.h.
Referenced by n_gui_add_button(), and n_gui_process_event().
| int N_GUI_BUTTON_DATA::shape |
shape type: N_GUI_SHAPE_RECT, N_GUI_SHAPE_ROUNDED, N_GUI_SHAPE_BITMAP
Definition at line 305 of file n_gui.h.
Referenced by _draw_button(), and n_gui_add_button().
| int N_GUI_BUTTON_DATA::toggle_mode |
toggle mode: 0 = momentary (default), 1 = toggle (stays clicked/unclicked)
Definition at line 307 of file n_gui.h.
Referenced by _draw_button(), n_gui_add_button(), n_gui_add_toggle_button(), n_gui_button_set_toggle_mode(), and n_gui_process_event().
| int N_GUI_BUTTON_DATA::toggled |
toggle state: 0 = off/unclicked, 1 = on/clicked (only used when toggle_mode=1)
Definition at line 309 of file n_gui.h.
Referenced by _draw_button(), n_gui_add_button(), n_gui_add_toggle_button(), n_gui_button_set_toggle_mode(), and n_gui_process_event().
| void* N_GUI_BUTTON_DATA::user_data |
user data for callback
Definition at line 328 of file n_gui.h.
Referenced by n_gui_add_button(), and n_gui_process_event().
| struct N_GUI_CHECKBOX_DATA |
Collaboration diagram for N_GUI_CHECKBOX_DATA:Data Fields | |
| ALLEGRO_BITMAP * | box_bitmap |
| optional bitmap for the checkbox square, unchecked state (NULL = color theme) | |
| ALLEGRO_BITMAP * | box_checked_bitmap |
| optional bitmap for the checkbox square, checked state (NULL = color theme) | |
| ALLEGRO_BITMAP * | box_hover_bitmap |
| optional bitmap for the checkbox square on hover (NULL = fallback to box_bitmap/box_checked_bitmap) | |
| int | checked |
| checked state | |
| char | label [128] |
| label displayed next to the checkbox | |
| void(* | on_toggle )(int widget_id, int checked, void *user_data) |
| callback on toggle | |
| void * | user_data |
| user data for callback | |
| ALLEGRO_BITMAP* N_GUI_CHECKBOX_DATA::box_bitmap |
optional bitmap for the checkbox square, unchecked state (NULL = color theme)
Definition at line 405 of file n_gui.h.
Referenced by _draw_checkbox(), and n_gui_checkbox_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_CHECKBOX_DATA::box_checked_bitmap |
optional bitmap for the checkbox square, checked state (NULL = color theme)
Definition at line 407 of file n_gui.h.
Referenced by _draw_checkbox(), and n_gui_checkbox_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_CHECKBOX_DATA::box_hover_bitmap |
optional bitmap for the checkbox square on hover (NULL = fallback to box_bitmap/box_checked_bitmap)
Definition at line 409 of file n_gui.h.
Referenced by _draw_checkbox(), and n_gui_checkbox_set_bitmaps().
| int N_GUI_CHECKBOX_DATA::checked |
checked state
Definition at line 403 of file n_gui.h.
Referenced by _draw_checkbox(), n_gui_add_checkbox(), and n_gui_process_event().
| char N_GUI_CHECKBOX_DATA::label[128] |
label displayed next to the checkbox
Definition at line 401 of file n_gui.h.
Referenced by _draw_checkbox(), and n_gui_add_checkbox().
callback on toggle
Definition at line 411 of file n_gui.h.
Referenced by n_gui_add_checkbox(), and n_gui_process_event().
| void* N_GUI_CHECKBOX_DATA::user_data |
user data for callback
Definition at line 413 of file n_gui.h.
Referenced by n_gui_add_checkbox(), and n_gui_process_event().
| struct N_GUI_COMBOBOX_DATA |
Collaboration diagram for N_GUI_COMBOBOX_DATA:Data Fields | |
| ALLEGRO_BITMAP * | bg_bitmap |
| optional bitmap for the combobox background (NULL = color theme) | |
| int | flags |
| bitmask of N_GUI_COMBOBOX_* flags | |
| int | is_open |
| is dropdown currently open | |
| ALLEGRO_BITMAP * | item_bg_bitmap |
| optional bitmap for per-item background, normal state (NULL = color theme) | |
| float | item_height |
| item height in dropdown | |
| ALLEGRO_BITMAP * | item_selected_bitmap |
| optional bitmap for per-item background, selected/highlighted (NULL = color theme) | |
| N_GUI_LISTITEM * | items |
| dynamic array of items | |
| size_t | items_capacity |
| allocated capacity | |
| int | max_visible |
| max visible items in dropdown | |
| size_t | nb_items |
| number of items | |
| void(* | on_select )(int widget_id, int index, void *user_data) |
| callback on selection change (widget_id, selected_index, user_data) | |
| int | scroll_offset |
| scroll offset in dropdown | |
| int | selected_index |
| currently selected index (-1 = none) | |
| void * | user_data |
| user data for callback | |
| ALLEGRO_BITMAP* N_GUI_COMBOBOX_DATA::bg_bitmap |
optional bitmap for the combobox background (NULL = color theme)
Definition at line 525 of file n_gui.h.
Referenced by _draw_combobox(), _draw_combobox_dropdown(), and n_gui_combobox_set_bitmaps().
| int N_GUI_COMBOBOX_DATA::flags |
bitmask of N_GUI_COMBOBOX_* flags
Definition at line 535 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_set_flags(), and n_gui_process_event().
| int N_GUI_COMBOBOX_DATA::is_open |
is dropdown currently open
Definition at line 517 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_clear(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_COMBOBOX_DATA::item_bg_bitmap |
optional bitmap for per-item background, normal state (NULL = color theme)
Definition at line 527 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), and n_gui_combobox_set_bitmaps().
| float N_GUI_COMBOBOX_DATA::item_height |
item height in dropdown
Definition at line 521 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_COMBOBOX_DATA::item_selected_bitmap |
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
Definition at line 529 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), and n_gui_combobox_set_bitmaps().
| N_GUI_LISTITEM* N_GUI_COMBOBOX_DATA::items |
dynamic array of items
Definition at line 509 of file n_gui.h.
Referenced by _destroy_widget(), _draw_combobox(), _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_add_item(), n_gui_combobox_clear(), and n_gui_process_event().
| size_t N_GUI_COMBOBOX_DATA::items_capacity |
allocated capacity
Definition at line 513 of file n_gui.h.
Referenced by n_gui_add_combobox(), and n_gui_combobox_add_item().
| int N_GUI_COMBOBOX_DATA::max_visible |
max visible items in dropdown
Definition at line 523 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), and n_gui_process_event().
| size_t N_GUI_COMBOBOX_DATA::nb_items |
number of items
Definition at line 511 of file n_gui.h.
Referenced by _draw_combobox(), _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_add_item(), n_gui_combobox_clear(), and n_gui_process_event().
| void(* N_GUI_COMBOBOX_DATA::on_select) (int widget_id, int index, void *user_data) |
callback on selection change (widget_id, selected_index, user_data)
Definition at line 531 of file n_gui.h.
Referenced by n_gui_add_combobox(), and n_gui_process_event().
| int N_GUI_COMBOBOX_DATA::scroll_offset |
scroll offset in dropdown
Definition at line 519 of file n_gui.h.
Referenced by _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_clear(), and n_gui_process_event().
| int N_GUI_COMBOBOX_DATA::selected_index |
currently selected index (-1 = none)
Definition at line 515 of file n_gui.h.
Referenced by _draw_combobox(), _draw_combobox_dropdown(), n_gui_add_combobox(), n_gui_combobox_clear(), n_gui_combobox_set_selected(), and n_gui_process_event().
| void* N_GUI_COMBOBOX_DATA::user_data |
user data for callback
Definition at line 533 of file n_gui.h.
Referenced by n_gui_add_combobox(), and n_gui_process_event().
| struct N_GUI_CTX |
The top-level GUI context that holds all windows.
Collaboration diagram for N_GUI_CTX:| Data Fields | ||
|---|---|---|
| ALLEGRO_FONT * | default_font | default font (must be set before adding widgets) |
| N_GUI_THEME | default_theme | default theme (applied to new widgets/windows) |
| ALLEGRO_DISPLAY * | display | display pointer for clipboard operations (set via n_gui_set_display) |
| float | display_h | display/viewport height |
| float | display_w | display/viewport width (set via n_gui_set_display_size) |
| float | dpi_scale | DPI scale factor (1.0 = normal, 1.25 = 125%, 2.0 = HiDPI, etc.) |
| int | focused_widget_id | id of the widget that currently has focus, or -1 |
| int | global_hscroll_drag | 1 if global scrollbar horizontal thumb is being dragged |
| float | global_scroll_x | global horizontal scroll offset (when GUI exceeds display) |
| float | global_scroll_y | global vertical scroll offset (when GUI exceeds display) |
| int | global_vscroll_drag | 1 if global scrollbar vertical thumb is being dragged |
| float | gui_bounds_h | total bounding box height of all windows (computed internally) |
| float | gui_bounds_w | total bounding box width of all windows (computed internally) |
| float | gui_offset_x | horizontal letterbox offset for virtual canvas |
| float | gui_offset_y | vertical letterbox offset for virtual canvas |
| float | gui_scale | computed uniform scale factor for virtual canvas |
| int | mouse_b1 | mouse button 1 state |
| int | mouse_b1_prev | previous mouse button 1 state |
| int | mouse_x | mouse state tracking |
| int | mouse_y | mouse state tracking |
| int | next_widget_id | next widget id to assign |
| int | next_window_id | next window id to assign |
| int | open_combobox_id | id of the combobox whose dropdown is currently open, or -1 |
| int | open_dropmenu_id | id of the dropdown menu whose panel is currently open, or -1 |
| float | ref_display_h | reference display height at the time normalized values were last captured |
| float | ref_display_w | reference display width at the time normalized values were last captured |
| int | resize_mode | context resize mode: N_GUI_RESIZE_VIRTUAL or N_GUI_RESIZE_ADAPTIVE |
| int | scrollbar_drag_widget_id | id of the widget whose scrollbar is being dragged, or -1 |
| int | selected_label_id | id of the label widget with the most recent text selection, or -1 |
| N_GUI_STYLE | style | configurable style (sizes, colours, paddings) |
| float | virtual_h | virtual canvas height (0 = disabled / identity transform) |
| float | virtual_w | virtual canvas width (0 = disabled / identity transform) |
| HASH_TABLE * | widgets_by_id | hash table for fast widget lookup by id |
| LIST * | windows | ordered list of N_GUI_WINDOW* (back to front) |
| struct N_GUI_DROPMENU_DATA |
Collaboration diagram for N_GUI_DROPMENU_DATA:Data Fields | |
| N_GUI_DROPMENU_ENTRY * | entries |
| dynamic array of entries | |
| size_t | entries_capacity |
| allocated capacity | |
| int | is_open |
| is the menu currently open | |
| float | item_height |
| item height | |
| ALLEGRO_BITMAP * | item_hover_bitmap |
| optional bitmap for the hovered entry background (NULL = color theme) | |
| char | label [128] |
| menu label (shown on the button) | |
| int | max_visible |
| max visible items | |
| size_t | nb_entries |
| number of entries | |
| void(* | on_open )(int widget_id, void *user_data) |
| callback to rebuild dynamic entries each time the menu is opened. | |
| void * | on_open_user_data |
| user data for on_open callback | |
| ALLEGRO_BITMAP * | panel_bitmap |
| optional bitmap for the dropdown panel background (NULL = color theme) | |
| int | scroll_offset |
| scroll offset | |
| N_GUI_DROPMENU_ENTRY* N_GUI_DROPMENU_DATA::entries |
dynamic array of entries
Definition at line 589 of file n_gui.h.
Referenced by _destroy_widget(), _draw_dropmenu_panel(), n_gui_add_dropmenu(), n_gui_dropmenu_add_dynamic_entry(), n_gui_dropmenu_add_entry(), n_gui_dropmenu_clear_dynamic(), n_gui_dropmenu_set_entry_text(), and n_gui_process_event().
| size_t N_GUI_DROPMENU_DATA::entries_capacity |
allocated capacity
Definition at line 593 of file n_gui.h.
Referenced by n_gui_add_dropmenu(), and n_gui_dropmenu_add_entry().
| int N_GUI_DROPMENU_DATA::is_open |
is the menu currently open
Definition at line 595 of file n_gui.h.
Referenced by _draw_dropmenu(), _draw_dropmenu_panel(), n_gui_add_dropmenu(), and n_gui_process_event().
| float N_GUI_DROPMENU_DATA::item_height |
item height
Definition at line 601 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_DROPMENU_DATA::item_hover_bitmap |
optional bitmap for the hovered entry background (NULL = color theme)
Definition at line 605 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), and n_gui_dropmenu_set_bitmaps().
| char N_GUI_DROPMENU_DATA::label[128] |
menu label (shown on the button)
Definition at line 587 of file n_gui.h.
Referenced by _draw_dropmenu(), and n_gui_add_dropmenu().
| int N_GUI_DROPMENU_DATA::max_visible |
max visible items
Definition at line 599 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), n_gui_dropmenu_clear_dynamic(), and n_gui_process_event().
| size_t N_GUI_DROPMENU_DATA::nb_entries |
number of entries
Definition at line 591 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), n_gui_dropmenu_add_entry(), n_gui_dropmenu_clear(), n_gui_dropmenu_clear_dynamic(), n_gui_dropmenu_set_entry_text(), and n_gui_process_event().
| void(* N_GUI_DROPMENU_DATA::on_open) (int widget_id, void *user_data) |
callback to rebuild dynamic entries each time the menu is opened.
signature: void rebuild(int widget_id, void* user_data) The callback should call n_gui_dropmenu_clear_dynamic() then add dynamic entries.
Definition at line 609 of file n_gui.h.
Referenced by n_gui_add_dropmenu(), and n_gui_process_event().
| void* N_GUI_DROPMENU_DATA::on_open_user_data |
user data for on_open callback
Definition at line 611 of file n_gui.h.
Referenced by n_gui_add_dropmenu(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_DROPMENU_DATA::panel_bitmap |
optional bitmap for the dropdown panel background (NULL = color theme)
Definition at line 603 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), and n_gui_dropmenu_set_bitmaps().
| int N_GUI_DROPMENU_DATA::scroll_offset |
scroll offset
Definition at line 597 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), n_gui_add_dropmenu(), n_gui_dropmenu_clear(), n_gui_dropmenu_clear_dynamic(), and n_gui_process_event().
| struct N_GUI_DROPMENU_ENTRY |
Collaboration diagram for N_GUI_DROPMENU_ENTRY:Data Fields | |
| int | is_dynamic |
| is this entry dynamic (rebuilt via callback each time menu opens) | |
| void(* | on_click )(int widget_id, int entry_index, int tag, void *user_data) |
| callback when this entry is clicked (widget_id, entry_index, tag, user_data) | |
| int | tag |
| user-defined tag for the entry (e.g. | |
| char | text [128] |
| display text | |
| void * | user_data |
| user data for callback | |
| int N_GUI_DROPMENU_ENTRY::is_dynamic |
is this entry dynamic (rebuilt via callback each time menu opens)
Definition at line 575 of file n_gui.h.
Referenced by n_gui_dropmenu_add_dynamic_entry(), n_gui_dropmenu_add_entry(), and n_gui_dropmenu_clear_dynamic().
callback when this entry is clicked (widget_id, entry_index, tag, user_data)
Definition at line 579 of file n_gui.h.
Referenced by n_gui_dropmenu_add_entry(), and n_gui_process_event().
| int N_GUI_DROPMENU_ENTRY::tag |
user-defined tag for the entry (e.g.
a window id)
Definition at line 577 of file n_gui.h.
Referenced by n_gui_dropmenu_add_entry(), and n_gui_process_event().
| char N_GUI_DROPMENU_ENTRY::text[128] |
display text
Definition at line 573 of file n_gui.h.
Referenced by _draw_dropmenu_panel(), n_gui_dropmenu_add_entry(), and n_gui_dropmenu_set_entry_text().
| void* N_GUI_DROPMENU_ENTRY::user_data |
user data for callback
Definition at line 581 of file n_gui.h.
Referenced by n_gui_dropmenu_add_entry(), and n_gui_process_event().
| struct N_GUI_IMAGE_DATA |
| struct N_GUI_KV_ROW |
Collaboration diagram for N_GUI_KV_ROW:| struct N_GUI_KVTABLE |
key-value table built from textareas, checkboxes, and buttons
Collaboration diagram for N_GUI_KVTABLE:Data Fields | |
| int | btn_add |
| button widget ID for "+" add row | |
| N_GUI_CTX * | ctx |
| GUI context. | |
| float | header_height |
| height of the column header row | |
| int | lbl_desc |
| label widget ID for "Description" header | |
| int | lbl_enabled |
| label widget ID for "On" header | |
| int | lbl_key |
| label widget ID for "Key" header | |
| int | lbl_value |
| label widget ID for "Value" header | |
| int | nb_active |
| active row count | |
| int | nb_rows |
| total rows (including removed) | |
| void(* | on_remove )(int, void *) |
| callback on row removal | |
| float | padding |
| horizontal padding | |
| float | row_height |
| height of each row in pixels | |
| N_GUI_KV_ROW | rows [128] |
| row storage | |
| void * | user_data |
| user data for callback | |
| int | window_id |
| parent window | |
| int N_GUI_KVTABLE::btn_add |
button widget ID for "+" add row
Definition at line 1515 of file n_gui.h.
Referenced by _n_gui_kv_reposition(), and n_gui_kvtable_create().
| N_GUI_CTX* N_GUI_KVTABLE::ctx |
GUI context.
Definition at line 1503 of file n_gui.h.
Referenced by _n_gui_kv_reposition(), n_gui_kvtable_add_row(), n_gui_kvtable_create(), and n_gui_kvtable_remove_row().
| float N_GUI_KVTABLE::header_height |
height of the column header row
Definition at line 1510 of file n_gui.h.
Referenced by _n_gui_kv_reposition(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().
| int N_GUI_KVTABLE::lbl_desc |
label widget ID for "Description" header
Definition at line 1513 of file n_gui.h.
Referenced by n_gui_kvtable_create().
| int N_GUI_KVTABLE::lbl_enabled |
label widget ID for "On" header
Definition at line 1514 of file n_gui.h.
Referenced by n_gui_kvtable_create().
| int N_GUI_KVTABLE::lbl_key |
label widget ID for "Key" header
Definition at line 1511 of file n_gui.h.
Referenced by n_gui_kvtable_create().
| int N_GUI_KVTABLE::lbl_value |
label widget ID for "Value" header
Definition at line 1512 of file n_gui.h.
Referenced by n_gui_kvtable_create().
| int N_GUI_KVTABLE::nb_active |
active row count
Definition at line 1507 of file n_gui.h.
Referenced by n_gui_kvtable_add_row(), n_gui_kvtable_create(), n_gui_kvtable_get_count(), and n_gui_kvtable_remove_row().
| int N_GUI_KVTABLE::nb_rows |
total rows (including removed)
Definition at line 1506 of file n_gui.h.
Referenced by _n_gui_kv_remove_clicked(), _n_gui_kv_reposition(), n_gui_kvtable_add_row(), n_gui_kvtable_create(), and n_gui_kvtable_remove_row().
| void(* N_GUI_KVTABLE::on_remove) (int, void *) |
callback on row removal
Definition at line 1516 of file n_gui.h.
Referenced by _n_gui_kv_remove_clicked(), and n_gui_kvtable_create().
| float N_GUI_KVTABLE::padding |
horizontal padding
Definition at line 1509 of file n_gui.h.
Referenced by _n_gui_kv_reposition(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().
| float N_GUI_KVTABLE::row_height |
height of each row in pixels
Definition at line 1508 of file n_gui.h.
Referenced by _n_gui_kv_reposition(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().
| N_GUI_KV_ROW N_GUI_KVTABLE::rows[128] |
row storage
Definition at line 1505 of file n_gui.h.
Referenced by _n_gui_kv_remove_clicked(), _n_gui_kv_reposition(), n_gui_kvtable_add_row(), and n_gui_kvtable_remove_row().
| void* N_GUI_KVTABLE::user_data |
user data for callback
Definition at line 1517 of file n_gui.h.
Referenced by _n_gui_kv_remove_clicked(), and n_gui_kvtable_create().
| int N_GUI_KVTABLE::window_id |
parent window
Definition at line 1504 of file n_gui.h.
Referenced by n_gui_kvtable_add_row(), and n_gui_kvtable_create().
| struct N_GUI_LABEL_DATA |
Collaboration diagram for N_GUI_LABEL_DATA:Data Fields | |
| int | align |
| text alignment: N_GUI_ALIGN_LEFT, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_RIGHT | |
| ALLEGRO_BITMAP * | bg_bitmap |
| optional bitmap for the label background (NULL = no background) | |
| char | link [4096] |
| optional hyperlink URL (empty string = no link) | |
| void(* | on_link_click )(int widget_id, const char *link, void *user_data) |
| callback when link is clicked (widget_id, link_url, user_data) | |
| float | scroll_y |
| vertical scroll offset for overflowing text (pixels) | |
| int | sel_dragging |
| 1 if mouse is actively dragging to select text | |
| int | sel_end |
| selection end byte offset (-1 = no selection) | |
| int | sel_start |
| selection start byte offset (-1 = no selection) | |
| char | text [4096] |
| text to display | |
| void * | user_data |
| user data for callback | |
| int N_GUI_LABEL_DATA::align |
text alignment: N_GUI_ALIGN_LEFT, N_GUI_ALIGN_CENTER, N_GUI_ALIGN_RIGHT
Definition at line 553 of file n_gui.h.
Referenced by _draw_label(), _label_text_origin_x(), _window_update_content_size(), n_gui_add_label(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_LABEL_DATA::bg_bitmap |
optional bitmap for the label background (NULL = no background)
Definition at line 563 of file n_gui.h.
Referenced by _draw_label().
| char N_GUI_LABEL_DATA::link[4096] |
optional hyperlink URL (empty string = no link)
Definition at line 551 of file n_gui.h.
Referenced by _draw_label(), n_gui_add_label(), n_gui_add_label_link(), n_gui_label_set_link(), and n_gui_process_event().
callback when link is clicked (widget_id, link_url, user_data)
Definition at line 565 of file n_gui.h.
Referenced by n_gui_add_label(), n_gui_add_label_link(), and n_gui_process_event().
| float N_GUI_LABEL_DATA::scroll_y |
vertical scroll offset for overflowing text (pixels)
Definition at line 555 of file n_gui.h.
Referenced by _draw_label(), n_gui_add_label(), and n_gui_process_event().
| int N_GUI_LABEL_DATA::sel_dragging |
1 if mouse is actively dragging to select text
Definition at line 561 of file n_gui.h.
Referenced by n_gui_add_label(), and n_gui_process_event().
| int N_GUI_LABEL_DATA::sel_end |
selection end byte offset (-1 = no selection)
Definition at line 559 of file n_gui.h.
Referenced by _draw_label(), n_gui_add_label(), and n_gui_process_event().
| int N_GUI_LABEL_DATA::sel_start |
selection start byte offset (-1 = no selection)
Definition at line 557 of file n_gui.h.
Referenced by _draw_label(), n_gui_add_label(), and n_gui_process_event().
| char N_GUI_LABEL_DATA::text[4096] |
text to display
Definition at line 549 of file n_gui.h.
Referenced by _draw_label(), _label_char_at_x(), _label_text_origin_x(), _window_update_content_size(), n_gui_add_label(), n_gui_label_set_text(), and n_gui_process_event().
| void* N_GUI_LABEL_DATA::user_data |
user data for callback
Definition at line 567 of file n_gui.h.
Referenced by n_gui_add_label(), n_gui_add_label_link(), and n_gui_process_event().
| struct N_GUI_LISTBOX_DATA |
Collaboration diagram for N_GUI_LISTBOX_DATA:Data Fields | |
| ALLEGRO_BITMAP * | bg_bitmap |
| optional bitmap for the listbox background (NULL = color theme) | |
| ALLEGRO_BITMAP * | item_bg_bitmap |
| optional bitmap for per-item background, normal state (NULL = color theme) | |
| float | item_height |
| item height in pixels | |
| ALLEGRO_BITMAP * | item_selected_bitmap |
| optional bitmap for per-item background, selected/highlighted (NULL = color theme) | |
| N_GUI_LISTITEM * | items |
| dynamic array of items | |
| size_t | items_capacity |
| allocated capacity | |
| size_t | nb_items |
| number of items | |
| void(* | on_select )(int widget_id, int index, int selected, void *user_data) |
| callback on selection change (widget_id, item_index, selected, user_data) | |
| int | scroll_offset |
| scroll offset in items | |
| int | selection_mode |
| selection mode: N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, N_GUI_SELECT_MULTIPLE | |
| void * | user_data |
| user data for callback | |
| ALLEGRO_BITMAP* N_GUI_LISTBOX_DATA::bg_bitmap |
optional bitmap for the listbox background (NULL = color theme)
Definition at line 465 of file n_gui.h.
Referenced by _draw_listbox(), and n_gui_listbox_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_LISTBOX_DATA::item_bg_bitmap |
optional bitmap for per-item background, normal state (NULL = color theme)
Definition at line 467 of file n_gui.h.
Referenced by _draw_listbox(), and n_gui_listbox_set_bitmaps().
| float N_GUI_LISTBOX_DATA::item_height |
item height in pixels
Definition at line 463 of file n_gui.h.
Referenced by _draw_listbox(), n_gui_add_listbox(), n_gui_listbox_set_scroll_offset(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_LISTBOX_DATA::item_selected_bitmap |
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
Definition at line 469 of file n_gui.h.
Referenced by _draw_listbox(), and n_gui_listbox_set_bitmaps().
| N_GUI_LISTITEM* N_GUI_LISTBOX_DATA::items |
dynamic array of items
Definition at line 453 of file n_gui.h.
Referenced by _destroy_widget(), _draw_listbox(), n_gui_add_listbox(), n_gui_listbox_add_item(), n_gui_listbox_get_item_text(), n_gui_listbox_get_selected(), n_gui_listbox_is_selected(), n_gui_listbox_remove_item(), n_gui_listbox_set_selected(), and n_gui_process_event().
| size_t N_GUI_LISTBOX_DATA::items_capacity |
allocated capacity
Definition at line 457 of file n_gui.h.
Referenced by n_gui_add_listbox(), and n_gui_listbox_add_item().
| size_t N_GUI_LISTBOX_DATA::nb_items |
number of items
Definition at line 455 of file n_gui.h.
Referenced by _draw_listbox(), n_gui_add_listbox(), n_gui_listbox_add_item(), n_gui_listbox_clear(), n_gui_listbox_get_selected(), n_gui_listbox_remove_item(), n_gui_listbox_set_scroll_offset(), n_gui_listbox_set_selected(), and n_gui_process_event().
| void(* N_GUI_LISTBOX_DATA::on_select) (int widget_id, int index, int selected, void *user_data) |
callback on selection change (widget_id, item_index, selected, user_data)
Definition at line 471 of file n_gui.h.
Referenced by n_gui_add_listbox(), and n_gui_process_event().
| int N_GUI_LISTBOX_DATA::scroll_offset |
scroll offset in items
Definition at line 461 of file n_gui.h.
Referenced by _draw_listbox(), n_gui_add_listbox(), n_gui_listbox_clear(), n_gui_listbox_get_scroll_offset(), n_gui_listbox_remove_item(), n_gui_listbox_set_scroll_offset(), and n_gui_process_event().
| int N_GUI_LISTBOX_DATA::selection_mode |
selection mode: N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, N_GUI_SELECT_MULTIPLE
Definition at line 459 of file n_gui.h.
Referenced by n_gui_add_listbox(), n_gui_listbox_set_selected(), and n_gui_process_event().
| void* N_GUI_LISTBOX_DATA::user_data |
user data for callback
Definition at line 473 of file n_gui.h.
Referenced by n_gui_add_listbox(), and n_gui_process_event().
| struct N_GUI_LISTITEM |
| struct N_GUI_RADIOLIST_DATA |
Collaboration diagram for N_GUI_RADIOLIST_DATA:Data Fields | |
| ALLEGRO_BITMAP * | bg_bitmap |
| optional bitmap for the radiolist background (NULL = color theme) | |
| ALLEGRO_BITMAP * | item_bg_bitmap |
| optional bitmap for per-item background, normal state (NULL = color theme) | |
| float | item_height |
| item height in pixels | |
| ALLEGRO_BITMAP * | item_selected_bitmap |
| optional bitmap for per-item background, selected/highlighted (NULL = color theme) | |
| N_GUI_LISTITEM * | items |
| dynamic array of items | |
| size_t | items_capacity |
| allocated capacity | |
| size_t | nb_items |
| number of items | |
| void(* | on_select )(int widget_id, int index, void *user_data) |
| callback on selection change (widget_id, selected_index, user_data) | |
| int | scroll_offset |
| scroll offset in items | |
| int | selected_index |
| currently selected index (-1 = none) | |
| void * | user_data |
| user data for callback | |
| ALLEGRO_BITMAP* N_GUI_RADIOLIST_DATA::bg_bitmap |
optional bitmap for the radiolist background (NULL = color theme)
Definition at line 491 of file n_gui.h.
Referenced by _draw_radiolist(), and n_gui_radiolist_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_RADIOLIST_DATA::item_bg_bitmap |
optional bitmap for per-item background, normal state (NULL = color theme)
Definition at line 493 of file n_gui.h.
Referenced by _draw_radiolist(), and n_gui_radiolist_set_bitmaps().
| float N_GUI_RADIOLIST_DATA::item_height |
item height in pixels
Definition at line 489 of file n_gui.h.
Referenced by _draw_radiolist(), n_gui_add_radiolist(), and n_gui_process_event().
| ALLEGRO_BITMAP* N_GUI_RADIOLIST_DATA::item_selected_bitmap |
optional bitmap for per-item background, selected/highlighted (NULL = color theme)
Definition at line 495 of file n_gui.h.
Referenced by _draw_radiolist(), and n_gui_radiolist_set_bitmaps().
| N_GUI_LISTITEM* N_GUI_RADIOLIST_DATA::items |
dynamic array of items
Definition at line 479 of file n_gui.h.
Referenced by _destroy_widget(), _draw_radiolist(), n_gui_add_radiolist(), and n_gui_radiolist_add_item().
| size_t N_GUI_RADIOLIST_DATA::items_capacity |
allocated capacity
Definition at line 483 of file n_gui.h.
Referenced by n_gui_add_radiolist(), and n_gui_radiolist_add_item().
| size_t N_GUI_RADIOLIST_DATA::nb_items |
number of items
Definition at line 481 of file n_gui.h.
Referenced by _draw_radiolist(), n_gui_add_radiolist(), n_gui_process_event(), n_gui_radiolist_add_item(), and n_gui_radiolist_clear().
| void(* N_GUI_RADIOLIST_DATA::on_select) (int widget_id, int index, void *user_data) |
callback on selection change (widget_id, selected_index, user_data)
Definition at line 497 of file n_gui.h.
Referenced by n_gui_add_radiolist(), and n_gui_process_event().
| int N_GUI_RADIOLIST_DATA::scroll_offset |
scroll offset in items
Definition at line 487 of file n_gui.h.
Referenced by _draw_radiolist(), n_gui_add_radiolist(), n_gui_process_event(), and n_gui_radiolist_clear().
| int N_GUI_RADIOLIST_DATA::selected_index |
currently selected index (-1 = none)
Definition at line 485 of file n_gui.h.
Referenced by _draw_radiolist(), n_gui_add_radiolist(), n_gui_process_event(), n_gui_radiolist_clear(), and n_gui_radiolist_set_selected().
| void* N_GUI_RADIOLIST_DATA::user_data |
user data for callback
Definition at line 499 of file n_gui.h.
Referenced by n_gui_add_radiolist(), and n_gui_process_event().
| struct N_GUI_SCROLLBAR_DATA |
Collaboration diagram for N_GUI_SCROLLBAR_DATA:Data Fields | |
| double | content_size |
| total content size | |
| void(* | on_scroll )(int widget_id, double scroll_pos, void *user_data) |
| callback on scroll | |
| int | orientation |
| orientation: N_GUI_SCROLLBAR_H or N_GUI_SCROLLBAR_V | |
| double | scroll_pos |
| current scroll position | |
| int | shape |
| shape type: N_GUI_SHAPE_RECT or N_GUI_SHAPE_ROUNDED | |
| ALLEGRO_BITMAP * | thumb_active_bitmap |
| optional bitmap for the thumb while dragging (NULL = fallback to thumb_bitmap) | |
| ALLEGRO_BITMAP * | thumb_bitmap |
| optional bitmap for the thumb/handle, normal state (NULL = color theme) | |
| ALLEGRO_BITMAP * | thumb_hover_bitmap |
| optional bitmap for the thumb on hover (NULL = fallback to thumb_bitmap) | |
| ALLEGRO_BITMAP * | track_bitmap |
| optional bitmap for the scrollbar track background (NULL = color theme) | |
| void * | user_data |
| user data for callback | |
| double | viewport_size |
| visible viewport size | |
| double N_GUI_SCROLLBAR_DATA::content_size |
total content size
Definition at line 421 of file n_gui.h.
Referenced by _draw_scrollbar(), _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), n_gui_process_event(), n_gui_scrollbar_set_pos(), and n_gui_scrollbar_set_sizes().
| void(* N_GUI_SCROLLBAR_DATA::on_scroll) (int widget_id, double scroll_pos, void *user_data) |
callback on scroll
Definition at line 437 of file n_gui.h.
Referenced by _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), and n_gui_process_event().
| int N_GUI_SCROLLBAR_DATA::orientation |
orientation: N_GUI_SCROLLBAR_H or N_GUI_SCROLLBAR_V
Definition at line 419 of file n_gui.h.
Referenced by _draw_scrollbar(), _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), and n_gui_process_event().
| double N_GUI_SCROLLBAR_DATA::scroll_pos |
current scroll position
Definition at line 425 of file n_gui.h.
Referenced by _draw_scrollbar(), _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), n_gui_process_event(), n_gui_scrollbar_set_pos(), and n_gui_scrollbar_set_sizes().
| int N_GUI_SCROLLBAR_DATA::shape |
shape type: N_GUI_SHAPE_RECT or N_GUI_SHAPE_ROUNDED
Definition at line 427 of file n_gui.h.
Referenced by _draw_scrollbar(), and n_gui_add_scrollbar().
| ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::thumb_active_bitmap |
optional bitmap for the thumb while dragging (NULL = fallback to thumb_bitmap)
Definition at line 435 of file n_gui.h.
Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::thumb_bitmap |
optional bitmap for the thumb/handle, normal state (NULL = color theme)
Definition at line 431 of file n_gui.h.
Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::thumb_hover_bitmap |
optional bitmap for the thumb on hover (NULL = fallback to thumb_bitmap)
Definition at line 433 of file n_gui.h.
Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_SCROLLBAR_DATA::track_bitmap |
optional bitmap for the scrollbar track background (NULL = color theme)
Definition at line 429 of file n_gui.h.
Referenced by _draw_scrollbar(), and n_gui_scrollbar_set_bitmaps().
| void* N_GUI_SCROLLBAR_DATA::user_data |
user data for callback
Definition at line 439 of file n_gui.h.
Referenced by _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), and n_gui_process_event().
| double N_GUI_SCROLLBAR_DATA::viewport_size |
visible viewport size
Definition at line 423 of file n_gui.h.
Referenced by _draw_scrollbar(), _scrollbar_update_from_mouse(), n_gui_add_scrollbar(), n_gui_process_event(), n_gui_scrollbar_set_pos(), and n_gui_scrollbar_set_sizes().
| struct N_GUI_SLIDER_DATA |
Collaboration diagram for N_GUI_SLIDER_DATA:Data Fields | |
| ALLEGRO_BITMAP * | fill_bitmap |
| optional bitmap for the filled portion of the track (NULL = color theme) | |
| ALLEGRO_BITMAP * | handle_active_bitmap |
| optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap) | |
| ALLEGRO_BITMAP * | handle_bitmap |
| optional bitmap for the draggable handle, normal state (NULL = color theme) | |
| ALLEGRO_BITMAP * | handle_hover_bitmap |
| optional bitmap for the handle on hover (NULL = fallback to handle_bitmap) | |
| double | max_val |
| maximum value | |
| double | min_val |
| minimum value | |
| int | mode |
| mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT | |
| void(* | on_change )(int widget_id, double value, void *user_data) |
| callback on value change | |
| int | orientation |
| orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V | |
| double | step |
| step increment (0 is treated as 1). | |
| ALLEGRO_BITMAP * | track_bitmap |
| optional bitmap for the track/rail background (NULL = color theme) | |
| void * | user_data |
| user data for callback | |
| double | value |
| current value (always snapped to step) | |
| ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::fill_bitmap |
optional bitmap for the filled portion of the track (NULL = color theme)
Definition at line 348 of file n_gui.h.
Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::handle_active_bitmap |
optional bitmap for the handle while dragging (NULL = fallback to handle_bitmap)
Definition at line 354 of file n_gui.h.
Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::handle_bitmap |
optional bitmap for the draggable handle, normal state (NULL = color theme)
Definition at line 350 of file n_gui.h.
Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().
| ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::handle_hover_bitmap |
optional bitmap for the handle on hover (NULL = fallback to handle_bitmap)
Definition at line 352 of file n_gui.h.
Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().
| double N_GUI_SLIDER_DATA::max_val |
maximum value
Definition at line 336 of file n_gui.h.
Referenced by _draw_slider(), _slider_update_from_mouse(), n_gui_add_slider(), n_gui_process_event(), n_gui_slider_set_range(), n_gui_slider_set_step(), and n_gui_slider_set_value().
| double N_GUI_SLIDER_DATA::min_val |
minimum value
Definition at line 334 of file n_gui.h.
Referenced by _draw_slider(), _slider_update_from_mouse(), n_gui_add_slider(), n_gui_process_event(), n_gui_slider_set_range(), n_gui_slider_set_step(), and n_gui_slider_set_value().
| int N_GUI_SLIDER_DATA::mode |
mode: N_GUI_SLIDER_VALUE or N_GUI_SLIDER_PERCENT
Definition at line 342 of file n_gui.h.
Referenced by _draw_slider(), and n_gui_add_slider().
callback on value change
Definition at line 356 of file n_gui.h.
Referenced by _slider_update_from_mouse(), n_gui_add_slider(), and n_gui_process_event().
| int N_GUI_SLIDER_DATA::orientation |
orientation: N_GUI_SLIDER_H or N_GUI_SLIDER_V
Definition at line 344 of file n_gui.h.
Referenced by _draw_slider(), _slider_update_from_mouse(), n_gui_add_slider(), and n_gui_process_event().
| double N_GUI_SLIDER_DATA::step |
step increment (0 is treated as 1).
All values snap to nearest multiple of step from min_val.
Definition at line 340 of file n_gui.h.
Referenced by _slider_update_from_mouse(), n_gui_add_slider(), n_gui_process_event(), n_gui_slider_set_range(), n_gui_slider_set_step(), and n_gui_slider_set_value().
| ALLEGRO_BITMAP* N_GUI_SLIDER_DATA::track_bitmap |
optional bitmap for the track/rail background (NULL = color theme)
Definition at line 346 of file n_gui.h.
Referenced by _draw_slider(), and n_gui_slider_set_bitmaps().
| void* N_GUI_SLIDER_DATA::user_data |
user data for callback
Definition at line 358 of file n_gui.h.
Referenced by _slider_update_from_mouse(), n_gui_add_slider(), and n_gui_process_event().
| double N_GUI_SLIDER_DATA::value |
current value (always snapped to step)
Definition at line 338 of file n_gui.h.
Referenced by _draw_slider(), _slider_update_from_mouse(), n_gui_add_slider(), n_gui_process_event(), n_gui_slider_set_range(), n_gui_slider_set_step(), and n_gui_slider_set_value().
| struct N_GUI_STYLE |
Global style holding every configurable layout constant.
Initialised with sensible defaults by n_gui_default_style(). Can be serialised/deserialised to/from JSON with n_gui_style_to_json / n_gui_style_from_json.
Collaboration diagram for N_GUI_STYLE:| struct N_GUI_TAB_PANEL |
tab panel built from toggle buttons with content window management
Collaboration diagram for N_GUI_TAB_PANEL:Data Fields | |
| int | active_tab |
| currently active tab index | |
| float | button_h |
| height of each tab button | |
| int | button_ids [16] |
| toggle button widget IDs | |
| float | button_w |
| width of each tab button | |
| int | content_window_ids [16] |
| content window IDs (-1 = none) | |
| N_GUI_CTX * | ctx |
| GUI context. | |
| int | nb_tabs |
| number of tabs | |
| void(* | on_tab_change )(int, void *) |
| callback on tab switch (may be NULL) | |
| int | parent_window_id |
| parent window for tab buttons | |
| void * | user_data |
| user data for callback | |
| float | x |
| x origin of first tab button | |
| float | y |
| y origin of tab button row | |
| int N_GUI_TAB_PANEL::active_tab |
currently active tab index
Definition at line 1430 of file n_gui.h.
Referenced by n_gui_tab_add(), n_gui_tab_create(), n_gui_tab_get_active(), and n_gui_tab_set_active().
| float N_GUI_TAB_PANEL::button_h |
height of each tab button
Definition at line 1434 of file n_gui.h.
Referenced by n_gui_tab_add(), and n_gui_tab_create().
| int N_GUI_TAB_PANEL::button_ids[16] |
toggle button widget IDs
Definition at line 1427 of file n_gui.h.
Referenced by _n_gui_tab_button_clicked(), n_gui_tab_add(), n_gui_tab_create(), and n_gui_tab_set_active().
| float N_GUI_TAB_PANEL::button_w |
width of each tab button
Definition at line 1433 of file n_gui.h.
Referenced by n_gui_tab_add(), and n_gui_tab_create().
| int N_GUI_TAB_PANEL::content_window_ids[16] |
content window IDs (-1 = none)
Definition at line 1428 of file n_gui.h.
Referenced by n_gui_tab_create(), n_gui_tab_set_active(), and n_gui_tab_set_content_window().
| N_GUI_CTX* N_GUI_TAB_PANEL::ctx |
GUI context.
Definition at line 1425 of file n_gui.h.
Referenced by n_gui_tab_add(), n_gui_tab_create(), and n_gui_tab_set_active().
| int N_GUI_TAB_PANEL::nb_tabs |
number of tabs
Definition at line 1429 of file n_gui.h.
Referenced by _n_gui_tab_button_clicked(), n_gui_tab_add(), n_gui_tab_create(), n_gui_tab_set_active(), and n_gui_tab_set_content_window().
callback on tab switch (may be NULL)
Definition at line 1435 of file n_gui.h.
Referenced by _n_gui_tab_button_clicked(), and n_gui_tab_create().
| int N_GUI_TAB_PANEL::parent_window_id |
parent window for tab buttons
Definition at line 1426 of file n_gui.h.
Referenced by n_gui_tab_add(), and n_gui_tab_create().
| void* N_GUI_TAB_PANEL::user_data |
user data for callback
Definition at line 1436 of file n_gui.h.
Referenced by _n_gui_tab_button_clicked(), and n_gui_tab_create().
| float N_GUI_TAB_PANEL::x |
x origin of first tab button
Definition at line 1431 of file n_gui.h.
Referenced by n_gui_tab_add(), and n_gui_tab_create().
| float N_GUI_TAB_PANEL::y |
y origin of tab button row
Definition at line 1432 of file n_gui.h.
Referenced by n_gui_tab_add(), and n_gui_tab_create().
| struct N_GUI_TEXT_DIMS |
bounding box dimensions returned by n_gui_get_text_dims()
Collaboration diagram for N_GUI_TEXT_DIMS:| Data Fields | ||
|---|---|---|
| int | h | bounding box height in pixels |
| int | w | bounding box width in pixels |
| int | x | bounding box x offset from draw origin |
| int | y | bounding box y offset from draw origin |
| struct N_GUI_TEXTAREA_DATA |
Collaboration diagram for N_GUI_TEXTAREA_DATA:Data Fields | |
| ALLEGRO_BITMAP * | bg_bitmap |
| optional bitmap for the text area background (NULL = color theme) | |
| size_t | char_limit |
| maximum character limit (0 = N_GUI_TEXT_MAX) | |
| size_t | cursor_pos |
| cursor position in text | |
| double | cursor_time |
| timestamp of last cursor activity (for blink reset) | |
| char | mask_char |
| mask character for password fields (0 = no masking, e.g. | |
| int | multiline |
| 0 = single line, 1 = multiline | |
| void(* | on_change )(int widget_id, const char *text, void *user_data) |
| callback on text change | |
| int | scroll_from_wheel |
| set to 1 when scroll was changed by mouse wheel, cleared on key input | |
| float | scroll_x |
| horizontal scroll offset for single-line text (pixels) | |
| int | scroll_y |
| scroll offset for long text | |
| size_t | sel_end |
| selection end position (tracks cursor during selection) | |
| size_t | sel_start |
| selection anchor position (where shift-click/shift-arrow started). | |
| char * | text |
| text content (dynamically allocated, text_alloc bytes) | |
| size_t | text_alloc |
| allocated buffer size (char_limit + 1) | |
| size_t | text_len |
| current text length | |
| void * | user_data |
| user data for callback | |
| ALLEGRO_BITMAP* N_GUI_TEXTAREA_DATA::bg_bitmap |
optional bitmap for the text area background (NULL = color theme)
Definition at line 389 of file n_gui.h.
Referenced by _draw_textarea(), and n_gui_add_textarea().
| size_t N_GUI_TEXTAREA_DATA::char_limit |
maximum character limit (0 = N_GUI_TEXT_MAX)
Definition at line 370 of file n_gui.h.
Referenced by _textarea_handle_key(), n_gui_add_textarea(), and n_gui_textarea_set_text().
| size_t N_GUI_TEXTAREA_DATA::cursor_pos |
cursor position in text
Definition at line 374 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_clear_selection(), _textarea_delete_selection(), _textarea_handle_key(), n_gui_add_textarea(), n_gui_process_event(), n_gui_textarea_set_selection(), and n_gui_textarea_set_text().
| double N_GUI_TEXTAREA_DATA::cursor_time |
timestamp of last cursor activity (for blink reset)
Definition at line 387 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_handle_key(), n_gui_add_textarea(), n_gui_process_event(), and n_gui_set_focus().
| char N_GUI_TEXTAREA_DATA::mask_char |
mask character for password fields (0 = no masking, e.g.
'*')
Definition at line 391 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_pos_from_mouse(), and n_gui_add_textarea().
| int N_GUI_TEXTAREA_DATA::multiline |
0 = single line, 1 = multiline
Definition at line 372 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_handle_key(), _textarea_pos_from_mouse(), n_gui_add_textarea(), n_gui_process_event(), n_gui_textarea_scroll_to_bottom(), and n_gui_textarea_scroll_to_offset().
callback on text change
Definition at line 393 of file n_gui.h.
Referenced by _textarea_delete_selection(), _textarea_handle_key(), and n_gui_add_textarea().
| int N_GUI_TEXTAREA_DATA::scroll_from_wheel |
set to 1 when scroll was changed by mouse wheel, cleared on key input
Definition at line 385 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_handle_key(), n_gui_process_event(), and n_gui_textarea_scroll_to_offset().
| float N_GUI_TEXTAREA_DATA::scroll_x |
horizontal scroll offset for single-line text (pixels)
Definition at line 383 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_pos_from_mouse(), n_gui_add_textarea(), and n_gui_textarea_set_text().
| int N_GUI_TEXTAREA_DATA::scroll_y |
scroll offset for long text
Definition at line 381 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_pos_from_mouse(), n_gui_add_textarea(), n_gui_process_event(), n_gui_textarea_scroll_to_bottom(), and n_gui_textarea_scroll_to_offset().
| size_t N_GUI_TEXTAREA_DATA::sel_end |
selection end position (tracks cursor during selection)
Definition at line 379 of file n_gui.h.
Referenced by _textarea_clear_selection(), _textarea_handle_key(), _textarea_has_selection(), _textarea_sel_range(), n_gui_add_textarea(), n_gui_process_event(), and n_gui_textarea_set_selection().
| size_t N_GUI_TEXTAREA_DATA::sel_start |
selection anchor position (where shift-click/shift-arrow started).
When sel_start == sel_end, no selection is active.
Definition at line 377 of file n_gui.h.
Referenced by _textarea_clear_selection(), _textarea_handle_key(), _textarea_has_selection(), _textarea_sel_range(), n_gui_add_textarea(), n_gui_process_event(), and n_gui_textarea_set_selection().
| char* N_GUI_TEXTAREA_DATA::text |
text content (dynamically allocated, text_alloc bytes)
Definition at line 364 of file n_gui.h.
Referenced by _destroy_widget(), _draw_textarea(), _textarea_content_height(), _textarea_copy_to_clipboard(), _textarea_delete_selection(), _textarea_handle_key(), _textarea_pos_from_mouse(), n_gui_add_textarea(), n_gui_textarea_scroll_to_offset(), and n_gui_textarea_set_text().
| size_t N_GUI_TEXTAREA_DATA::text_alloc |
allocated buffer size (char_limit + 1)
Definition at line 368 of file n_gui.h.
Referenced by n_gui_add_textarea().
| size_t N_GUI_TEXTAREA_DATA::text_len |
current text length
Definition at line 366 of file n_gui.h.
Referenced by _draw_textarea(), _textarea_content_height(), _textarea_delete_selection(), _textarea_handle_key(), _textarea_pos_from_mouse(), n_gui_add_textarea(), n_gui_textarea_get_text_length(), n_gui_textarea_scroll_to_bottom(), n_gui_textarea_scroll_to_offset(), n_gui_textarea_set_selection(), and n_gui_textarea_set_text().
| void* N_GUI_TEXTAREA_DATA::user_data |
user data for callback
Definition at line 395 of file n_gui.h.
Referenced by _textarea_delete_selection(), _textarea_handle_key(), and n_gui_add_textarea().
| struct N_GUI_THEME |
Collaboration diagram for N_GUI_THEME:| struct N_GUI_TREE |
Collaboration diagram for N_GUI_TREE:Data Fields | |
| N_GUI_CTX * | ctx |
| GUI context. | |
| int | listbox_id |
| listbox widget ID | |
| int | nb_nodes |
| number of nodes | |
| int | nb_visible |
| number of visible rows | |
| N_GUI_TREE_NODE | nodes [512] |
| node storage | |
| void(* | on_select )(int, void *) |
| selection callback | |
| void * | user_data |
| user data for callback | |
| int | visible_map [512] |
| visible row to node index | |
| N_GUI_CTX* N_GUI_TREE::ctx |
GUI context.
Definition at line 1467 of file n_gui.h.
Referenced by n_gui_tree_create(), and n_gui_tree_rebuild().
| int N_GUI_TREE::listbox_id |
listbox widget ID
Definition at line 1468 of file n_gui.h.
Referenced by n_gui_tree_create(), and n_gui_tree_rebuild().
| int N_GUI_TREE::nb_nodes |
number of nodes
Definition at line 1470 of file n_gui.h.
Referenced by _n_gui_tree_listbox_selected(), n_gui_tree_add_node(), n_gui_tree_create(), n_gui_tree_rebuild(), and n_gui_tree_toggle_expand().
| int N_GUI_TREE::nb_visible |
number of visible rows
Definition at line 1472 of file n_gui.h.
Referenced by _n_gui_tree_listbox_selected(), n_gui_tree_create(), and n_gui_tree_rebuild().
| N_GUI_TREE_NODE N_GUI_TREE::nodes[512] |
node storage
Definition at line 1469 of file n_gui.h.
Referenced by _n_gui_tree_listbox_selected(), _n_gui_tree_node_visible(), n_gui_tree_add_node(), n_gui_tree_rebuild(), and n_gui_tree_toggle_expand().
| void(* N_GUI_TREE::on_select) (int, void *) |
selection callback
Definition at line 1473 of file n_gui.h.
Referenced by _n_gui_tree_listbox_selected(), and n_gui_tree_create().
| void* N_GUI_TREE::user_data |
user data for callback
Definition at line 1474 of file n_gui.h.
Referenced by _n_gui_tree_listbox_selected(), and n_gui_tree_create().
| int N_GUI_TREE::visible_map[512] |
visible row to node index
Definition at line 1471 of file n_gui.h.
Referenced by _n_gui_tree_listbox_selected(), and n_gui_tree_rebuild().
| struct N_GUI_TREE_NODE |
| struct N_GUI_WIDGET |
Collaboration diagram for N_GUI_WIDGET:| Data Fields | ||
|---|---|---|
| void * | data | widget-specific data (union via void pointer) |
| int | enabled | enabled flag (1 = enabled, 0 = disabled: drawn dimmed and ignores input) |
| ALLEGRO_FONT * | font | font used by this widget (NULL = context default) |
| float | h | height |
| int | id | unique widget id |
| float | norm_h | normalized height (fraction of parent window h) |
| float | norm_w | normalized width (fraction of parent window w) |
| float | norm_x | normalized position x (fraction of parent window w, used for SCALE resize) |
| float | norm_y | normalized position y (fraction of parent window h, used for SCALE resize) |
| int | state | current state flags (N_GUI_STATE_*) |
| N_GUI_THEME | theme | color theme for this widget |
| int | type | widget type (N_GUI_TYPE_*) |
| int | visible | visibility flag |
| float | w | width |
| float | x | position x relative to parent window |
| float | y | position y relative to parent window |
| struct N_GUI_WINDOW |
Collaboration diagram for N_GUI_WINDOW:| Data Fields | ||
|---|---|---|
| float | autofit_border | padding/border around content for auto-fit (pixels, applied on each side) |
| int | autofit_flags | bitmask of N_GUI_AUTOFIT_* flags (0 = no auto-fitting) |
| float | autofit_origin_x | original insertion point x for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit) |
| float | autofit_origin_y | original insertion point y for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit) |
| ALLEGRO_BITMAP * | bg_bitmap | optional bitmap for the window body background (NULL = color fill) |
| int | bg_scale_mode | scale mode for bg_bitmap: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER |
| float | content_h | total content height computed from widgets (internal) |
| float | content_w | total content width computed from widgets (internal) |
| float | drag_ox | drag offset x (internal) |
| float | drag_oy | drag offset y (internal) |
| int | flags | feature flags (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, etc.) |
| ALLEGRO_FONT * | font | font for the title bar |
| float | h | window height |
| int | id | unique window id |
| float | min_h | minimum height |
| float | min_w | minimum width |
| float | norm_h | normalized height (fraction of reference display height, used in SCALE mode) |
| float | norm_w | normalized width (fraction of reference display width, used in SCALE mode) |
| float | norm_x | normalized position x (0.0–1.0 fraction of reference display width) |
| float | norm_y | normalized position y (0.0–1.0 fraction of reference display height) |
| int | resize_policy | per-window resize policy: N_GUI_WIN_RESIZE_NONE, _MOVE, or _SCALE |
| float | scroll_x | horizontal scroll offset for auto-scrollbar (pixels) |
| float | scroll_y | vertical scroll offset for auto-scrollbar (pixels) |
| int | state | state flags (N_GUI_WIN_*) |
| N_GUI_THEME | theme | color theme for this window chrome |
| char | title[128] | window title |
| ALLEGRO_BITMAP * | titlebar_bitmap | optional bitmap for the titlebar background (NULL = color fill) |
| float | titlebar_h | title bar height |
| float | w | window width |
| LIST * | widgets | list of N_GUI_WIDGET* contained in this window |
| float | x | position x on screen |
| float | y | position y on screen |
| int | z_order | z-order mode (N_GUI_ZORDER_NORMAL, _ALWAYS_ON_TOP, _ALWAYS_BEHIND, _FIXED) |
| int | z_value | z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top) |
| #define N_GUI_ALIGN_CENTER 1 |
| #define N_GUI_ALIGN_JUSTIFIED 3 |
justified text (spread words to fill width)
| #define N_GUI_ALIGN_LEFT 0 |
left aligned text
| #define N_GUI_ALIGN_RIGHT 2 |
| #define N_GUI_AUTOFIT_CENTER 16 |
| #define N_GUI_AUTOFIT_EXPAND_LEFT 4 |
| #define N_GUI_AUTOFIT_EXPAND_UP 8 |
| #define N_GUI_AUTOFIT_H 2 |
| #define N_GUI_AUTOFIT_W 1 |
| #define N_GUI_AUTOFIT_WH 3 |
| #define N_GUI_COMBOBOX_AUTO_WIDTH 1 |
| #define N_GUI_ID_MAX 128 |
| #define N_GUI_IMAGE_CENTER 2 |
| #define N_GUI_IMAGE_FIT 0 |
| #define N_GUI_IMAGE_STRETCH 1 |
| #define N_GUI_KEY_MOD_MASK (ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL | ALLEGRO_KEYMOD_ALT | ALLEGRO_KEYMOD_ALTGR) |
| #define N_GUI_KEY_SOURCES_MAX 8 |
| #define N_GUI_KV_MAX 128 |
| #define N_GUI_RESIZE_ADAPTIVE 1 |
| #define N_GUI_RESIZE_VIRTUAL 0 |
| #define N_GUI_SCROLLBAR_H 0 |
| #define N_GUI_SCROLLBAR_V 1 |
| #define N_GUI_SELECT_MULTIPLE 2 |
| #define N_GUI_SELECT_NONE 0 |
no selection allowed (display only)
| #define N_GUI_SELECT_SINGLE 1 |
single item selection
| #define N_GUI_SHAPE_RECT 0 |
| #define N_GUI_SHAPE_ROUNDED 1 |
rounded rectangle shape
| #define N_GUI_SLIDER_PERCENT 1 |
| #define N_GUI_SLIDER_VALUE 0 |
slider uses raw start/end values
| #define N_GUI_STATE_ACTIVE 2 |
| #define N_GUI_STATE_SCROLLBAR_DRAG 8 |
| #define N_GUI_TAB_MAX 16 |
| #define N_GUI_TEXT_MAX 4096 |
| #define N_GUI_TREE_MAX 512 |
| #define N_GUI_TYPE_COMBOBOX 8 |
| #define N_GUI_TYPE_DROPMENU 11 |
| #define N_GUI_TYPE_LABEL 10 |
| #define N_GUI_TYPE_LISTBOX 6 |
| #define N_GUI_TYPE_RADIOLIST 7 |
| #define N_GUI_WIN_AUTO_SCROLLBAR 16 |
| #define N_GUI_WIN_FIXED_POSITION 64 |
disable window dragging (default:enable)
| #define N_GUI_WIN_FRAMELESS 128 |
| #define N_GUI_WIN_HSCROLL_DRAG 32 |
| #define N_GUI_WIN_MINIMISED 2 |
| #define N_GUI_WIN_RESIZABLE 32 |
enable user-resizable window with a drag handle at bottom-right
| #define N_GUI_WIN_RESIZE_MOVE 1 |
| #define N_GUI_WIN_RESIZE_NONE 0 |
| #define N_GUI_WIN_RESIZE_SCALE 2 |
| #define N_GUI_WIN_VSCROLL_DRAG 16 |
| #define N_GUI_ZORDER_ALWAYS_BEHIND 2 |
| #define N_GUI_ZORDER_ALWAYS_ON_TOP 1 |
| #define N_GUI_ZORDER_FIXED 3 |
fixed z-value: window is sorted within a dedicated group between ALWAYS_BEHIND and NORMAL windows.
The draw order of groups is: ALWAYS_BEHIND < FIXED < NORMAL < ALWAYS_ON_TOP. Within the FIXED group, windows are ordered by z_value (lower = drawn first / behind, higher = drawn last / on top). z_value has no effect on other z-order modes. Windows with the same z_value preserve their relative list order (stable sort).
| #define N_GUI_ZORDER_NORMAL 0 |
| 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(*)(int, void *) | on_click, | ||
| void * | user_data | ||
| ) |
add a button widget
add a button widget
Definition at line 1001 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_BUTTON_DATA::bitmap, N_GUI_BUTTON_DATA::bitmap_active, N_GUI_BUTTON_DATA::bitmap_hover, N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::keycode, N_GUI_BUTTON_DATA::label, list_push(), Malloc, n_gui_get_window(), N_GUI_ID_MAX, N_GUI_TYPE_BUTTON, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_BUTTON_DATA::on_click, N_GUI_BUTTON_DATA::shape, N_GUI_BUTTON_DATA::toggle_mode, N_GUI_BUTTON_DATA::toggled, N_GUI_BUTTON_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main(), main(), n_gui_add_button_bitmap(), n_gui_add_toggle_button(), n_gui_kvtable_add_row(), and n_gui_kvtable_create().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_button_bitmap | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| const char * | label, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| ALLEGRO_BITMAP * | normal, | ||
| ALLEGRO_BITMAP * | hover, | ||
| ALLEGRO_BITMAP * | active, | ||
| void(*)(int, void *) | on_click, | ||
| void * | user_data | ||
| ) |
add a bitmap-based button widget
add a bitmap-based button widget
Definition at line 1042 of file n_gui.c.
References N_GUI_BUTTON_DATA::bitmap, N_GUI_BUTTON_DATA::bitmap_active, N_GUI_BUTTON_DATA::bitmap_hover, N_GUI_WIDGET::data, n_gui_add_button(), n_gui_get_widget(), and N_GUI_SHAPE_BITMAP.
Here is the call graph for this function:| int n_gui_add_checkbox | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| const char * | label, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| int | initial_checked, | ||
| void(*)(int, int, void *) | on_toggle, | ||
| void * | user_data | ||
| ) |
add a checkbox widget
add a checkbox widget
Definition at line 1259 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_CHECKBOX_DATA::checked, N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_CHECKBOX_DATA::label, list_push(), Malloc, n_gui_get_window(), N_GUI_ID_MAX, N_GUI_TYPE_CHECKBOX, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_CHECKBOX_DATA::on_toggle, N_GUI_CHECKBOX_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main(), and n_gui_kvtable_add_row().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_combobox | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| void(*)(int, int, void *) | on_select, | ||
| void * | user_data | ||
| ) |
add a combo box widget
add a combo box widget
Definition at line 1406 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_STYLE::combobox_max_visible, N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::flags, Free, N_GUI_WIDGET::id, N_GUI_COMBOBOX_DATA::is_open, N_GUI_COMBOBOX_DATA::item_height, N_GUI_COMBOBOX_DATA::items, N_GUI_COMBOBOX_DATA::items_capacity, list_push(), Malloc, N_GUI_COMBOBOX_DATA::max_visible, n_gui_get_window(), N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::nb_items, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_COMBOBOX_DATA::on_select, N_GUI_COMBOBOX_DATA::scroll_offset, N_GUI_COMBOBOX_DATA::selected_index, N_GUI_CTX::style, N_GUI_COMBOBOX_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_dropmenu | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| const char * | label, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| void(*)(int, void *) | on_open, | ||
| void * | on_open_user_data | ||
| ) |
add a dropdown menu widget (button that opens a menu panel with entries)
| ctx | the GUI context |
| window_id | id of the parent window |
| label | button label text |
| x | horizontal position |
| y | vertical position |
| w | widget width |
| h | widget height |
| on_open | callback invoked when the menu is opened (or NULL) |
| on_open_user_data | user data passed to on_open callback |
add a dropdown menu widget (button that opens a menu panel with entries)
Definition at line 2237 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, N_GUI_STYLE::dropmenu_max_visible, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_DATA::entries_capacity, Free, N_GUI_WIDGET::id, N_GUI_DROPMENU_DATA::is_open, N_GUI_DROPMENU_DATA::item_height, N_GUI_DROPMENU_DATA::label, list_push(), Malloc, N_GUI_DROPMENU_DATA::max_visible, n_gui_get_window(), N_GUI_ID_MAX, N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_DROPMENU_DATA::on_open, N_GUI_DROPMENU_DATA::on_open_user_data, N_GUI_DROPMENU_DATA::scroll_offset, N_GUI_CTX::style, and N_GUI_WINDOW::widgets.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_image | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| ALLEGRO_BITMAP * | bitmap, | ||
| int | scale_mode | ||
| ) |
add an image widget
add an image widget
| ctx | the GUI context |
| window_id | id of the parent window |
| x | horizontal position |
| y | vertical position |
| w | widget width |
| h | widget height |
| bitmap | the bitmap to display (not owned by the widget) |
| scale_mode | N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER |
Definition at line 1468 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_IMAGE, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, and N_GUI_WINDOW::widgets.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_label | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| const char * | text, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| int | align | ||
| ) |
add a text label widget
add a text label widget
Definition at line 1497 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _normalize_crlf(), _register_widget(), N_GUI_LABEL_DATA::align, N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_LABEL_DATA::link, list_push(), Malloc, n_gui_get_window(), N_GUI_TEXT_MAX, N_GUI_TYPE_LABEL, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_LABEL_DATA::on_link_click, N_GUI_LABEL_DATA::scroll_y, N_GUI_LABEL_DATA::sel_dragging, N_GUI_LABEL_DATA::sel_end, N_GUI_LABEL_DATA::sel_start, N_GUI_LABEL_DATA::text, N_GUI_LABEL_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main(), main(), n_gui_add_label_link(), and n_gui_kvtable_create().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_label_link | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| const char * | text, | ||
| const char * | link, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| int | align, | ||
| void(*)(int, const char *, void *) | on_link_click, | ||
| void * | user_data | ||
| ) |
add a text label with hyperlink
add a text label with hyperlink
Definition at line 1538 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LABEL_DATA::link, n_gui_add_label(), n_gui_get_widget(), N_GUI_TEXT_MAX, on_link_click(), N_GUI_LABEL_DATA::on_link_click, and N_GUI_LABEL_DATA::user_data.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_listbox | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| int | selection_mode, | ||
| void(*)(int, int, int, void *) | on_select, | ||
| void * | user_data | ||
| ) |
add a listbox widget
add a listbox widget
| ctx | the GUI context |
| window_id | id of the parent window |
| x | horizontal position |
| y | vertical position |
| w | widget width |
| h | widget height |
| selection_mode | N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, or N_GUI_SELECT_MULTIPLE |
| on_select | callback invoked when an item is selected (or NULL) |
| user_data | user data passed to on_select callback |
Definition at line 1336 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_LISTBOX_DATA::item_height, N_GUI_LISTBOX_DATA::items, N_GUI_LISTBOX_DATA::items_capacity, list_push(), N_GUI_STYLE::listbox_default_item_height, Malloc, n_gui_get_window(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_LISTBOX_DATA::on_select, N_GUI_LISTBOX_DATA::scroll_offset, N_GUI_LISTBOX_DATA::selection_mode, N_GUI_CTX::style, N_GUI_LISTBOX_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main(), main(), and n_gui_tree_create().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_radiolist | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| void(*)(int, int, void *) | on_select, | ||
| void * | user_data | ||
| ) |
add a radio list widget
add a radio list widget
Definition at line 1371 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, N_GUI_RADIOLIST_DATA::item_height, N_GUI_RADIOLIST_DATA::items, N_GUI_RADIOLIST_DATA::items_capacity, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_RADIOLIST_DATA::on_select, N_GUI_STYLE::radiolist_default_item_height, N_GUI_RADIOLIST_DATA::scroll_offset, N_GUI_RADIOLIST_DATA::selected_index, N_GUI_CTX::style, N_GUI_RADIOLIST_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_scrollbar | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| int | orientation, | ||
| int | shape, | ||
| double | content_size, | ||
| double | viewport_size, | ||
| void(*)(int, double, void *) | on_scroll, | ||
| void * | user_data | ||
| ) |
add a scrollbar widget
add a scrollbar widget
Definition at line 1293 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, list_push(), Malloc, n_gui_get_window(), N_GUI_TYPE_SCROLLBAR, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, on_scroll(), N_GUI_SCROLLBAR_DATA::on_scroll, N_GUI_SCROLLBAR_DATA::orientation, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_SCROLLBAR_DATA::shape, N_GUI_SCROLLBAR_DATA::user_data, N_GUI_SCROLLBAR_DATA::viewport_size, and N_GUI_WINDOW::widgets.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_slider | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| double | min_val, | ||
| double | max_val, | ||
| double | initial, | ||
| int | mode, | ||
| void(*)(int, double, void *) | on_change, | ||
| void * | user_data | ||
| ) |
add a horizontal slider widget
add a horizontal slider widget
Definition at line 1160 of file n_gui.c.
References __n_assert, _clamp(), _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, list_push(), Malloc, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, mode, N_GUI_SLIDER_DATA::mode, n_gui_get_window(), N_GUI_SLIDER_H, N_GUI_SLIDER_PERCENT, N_GUI_TYPE_SLIDER, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_SLIDER_DATA::on_change, N_GUI_SLIDER_DATA::orientation, N_GUI_SLIDER_DATA::step, N_GUI_SLIDER_DATA::user_data, N_GUI_SLIDER_DATA::value, and N_GUI_WINDOW::widgets.
Referenced by main(), and n_gui_add_vslider().
Here is the call graph for this function:
Here is the caller graph for this function:| 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(*)(int, const char *, void *) | on_change, | ||
| void * | user_data | ||
| ) |
add a text area widget
add a text area widget
Definition at line 1214 of file n_gui.c.
References __n_assert, _destroy_widget(), _n_gui_widget_capture_normalized(), _new_widget(), _register_widget(), N_GUI_TEXTAREA_DATA::bg_bitmap, N_GUI_TEXTAREA_DATA::char_limit, N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, Free, N_GUI_WIDGET::id, list_push(), Malloc, N_GUI_TEXTAREA_DATA::mask_char, N_GUI_TEXTAREA_DATA::multiline, n_gui_get_window(), N_GUI_TEXT_MAX, N_GUI_TYPE_TEXTAREA, N_GUI_WIDGET::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WIDGET::norm_y, N_GUI_TEXTAREA_DATA::on_change, N_GUI_TEXTAREA_DATA::scroll_x, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_TEXTAREA_DATA::sel_end, N_GUI_TEXTAREA_DATA::sel_start, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_alloc, N_GUI_TEXTAREA_DATA::text_len, N_GUI_TEXTAREA_DATA::user_data, and N_GUI_WINDOW::widgets.
Referenced by main(), main(), and n_gui_kvtable_add_row().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_toggle_button | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| const char * | label, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| int | shape, | ||
| int | initial_state, | ||
| void(*)(int, void *) | on_click, | ||
| void * | user_data | ||
| ) |
toggle button creation (returns widget id)
toggle button creation (returns widget id)
| ctx | the GUI context |
| window_id | id of the parent window |
| label | button label text |
| x | horizontal position |
| y | vertical position |
| w | widget width |
| h | widget height |
| shape | button shape (N_GUI_SHAPE_*) |
| initial_state | 0 = off, 1 = on |
| on_click | callback invoked on click (or NULL) |
| user_data | user data passed to on_click callback |
Definition at line 1070 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_add_button(), n_gui_get_widget(), N_GUI_BUTTON_DATA::toggle_mode, and N_GUI_BUTTON_DATA::toggled.
Referenced by main(), and n_gui_tab_add().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_vslider | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| double | min_val, | ||
| double | max_val, | ||
| double | initial, | ||
| int | mode, | ||
| void(*)(int, double, void *) | on_change, | ||
| void * | user_data | ||
| ) |
add a vertical slider (same as n_gui_add_slider but oriented vertically)
add a vertical slider (same as n_gui_add_slider but oriented vertically)
Definition at line 1200 of file n_gui.c.
References N_GUI_WIDGET::data, mode, n_gui_add_slider(), n_gui_get_widget(), and N_GUI_SLIDER_V.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_window | ( | N_GUI_CTX * | ctx, |
| const char * | title, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h | ||
| ) |
add a window to the GUI context
add a window to the GUI context
Definition at line 581 of file n_gui.c.
References __n_assert, _destroy_window(), _n_gui_window_capture_normalized(), N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WINDOW::autofit_origin_x, N_GUI_WINDOW::autofit_origin_y, N_GUI_WINDOW::content_h, N_GUI_WINDOW::content_w, N_GUI_CTX::default_theme, N_GUI_WINDOW::drag_ox, N_GUI_WINDOW::drag_oy, N_GUI_WINDOW::flags, N_GUI_WINDOW::font, Free, N_GUI_WINDOW::h, N_GUI_WINDOW::id, list_push(), LOG_ERR, Malloc, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_ID_MAX, N_GUI_RESIZE_ADAPTIVE, N_GUI_WIN_OPEN, N_GUI_WIN_RESIZE_NONE, N_GUI_ZORDER_NORMAL, n_log, new_generic_list(), N_GUI_CTX::next_window_id, N_GUI_WINDOW::norm_h, N_GUI_WINDOW::norm_w, N_GUI_WINDOW::norm_x, N_GUI_WINDOW::norm_y, N_GUI_CTX::resize_mode, N_GUI_WINDOW::resize_policy, N_GUI_WINDOW::scroll_x, N_GUI_WINDOW::scroll_y, N_GUI_WINDOW::state, N_GUI_CTX::style, N_GUI_WINDOW::theme, N_GUI_WINDOW::title, N_GUI_WINDOW::titlebar_h, N_GUI_STYLE::titlebar_h, UNLIMITED_LIST_ITEMS, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WINDOW::x, N_GUI_WINDOW::y, N_GUI_WINDOW::z_order, and N_GUI_WINDOW::z_value.
Referenced by main(), main(), and n_gui_add_window_auto().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_add_window_auto | ( | N_GUI_CTX * | ctx, |
| const char * | title, | ||
| float | x, | ||
| float | y | ||
| ) |
add a window that sizes itself automatically to fit its widgets (call n_gui_window_autosize after adding all widgets)
add a window that sizes itself automatically to fit its widgets (call n_gui_window_autosize after adding all widgets)
Definition at line 817 of file n_gui.c.
References N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, n_gui_add_window(), and N_GUI_CTX::style.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_apply_adaptive_resize | ( | N_GUI_CTX * | ctx, |
| float | new_w, | ||
| float | new_h | ||
| ) |
apply adaptive resize: reposition/resize all windows according to their policies for the new display dimensions.
Called automatically from n_gui_set_display_size() when in ADAPTIVE mode, but can also be called manually.
apply adaptive resize: reposition/resize all windows according to their policies for the new display dimensions.
Called automatically from n_gui_set_display_size() when in ADAPTIVE mode, but can also be called manually.
Definition at line 5123 of file n_gui.c.
References __n_assert, N_GUI_WINDOW::flags, N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_WIN_FRAMELESS, N_GUI_WIN_RESIZE_MOVE, N_GUI_WIN_RESIZE_NONE, N_GUI_WIN_RESIZE_SCALE, N_GUI_WIDGET::norm_h, N_GUI_WINDOW::norm_h, N_GUI_WIDGET::norm_w, N_GUI_WINDOW::norm_w, N_GUI_WIDGET::norm_x, N_GUI_WINDOW::norm_x, N_GUI_WIDGET::norm_y, N_GUI_WINDOW::norm_y, N_GUI_WINDOW::resize_policy, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.
Referenced by n_gui_set_display_size().
Here is the caller graph for this function:| int n_gui_button_is_toggled | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
check if button is toggled
check if button is toggled
Definition at line 1086 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.
Referenced by main(), on_ghost_toggle(), on_ghost_toggle(), on_grid_toggle(), on_grid_toggle(), on_height_toggle(), on_height_toggle(), on_player_toggle(), on_player_toggle(), on_smooth_toggle(), and on_smooth_toggle().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_button_set_keycode | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | keycode, | ||
| int | modifiers | ||
| ) |
bind a keyboard key with optional modifier requirements to a button.
When the key is pressed (with matching modifiers) and no text input widget has focus, the button's on_click callback is triggered. Pass keycode 0 to unbind. Use ALLEGRO_KEY_* constants for the keycode. When modifiers is 0, any modifier state matches (no modifier requirement). When modifiers is non-zero, only an exact match of the specified modifiers (masked by N_GUI_KEY_MOD_MASK) triggers the keybind. Example: n_gui_button_set_keycode(ctx, id, ALLEGRO_KEY_A, ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL)
| ctx | GUI context |
| widget_id | button widget id |
| keycode | ALLEGRO_KEY_* constant, or 0 to unbind |
| modifiers | ALLEGRO_KEYMOD_* flags ORed together, or 0 for no requirement |
bind a keyboard key with optional modifier requirements to a button.
When the key is pressed (with matching modifiers) and no text input widget has focus, the button's on_click callback is triggered (and toggle state flipped for toggle buttons). Pass keycode 0 to unbind. When modifiers is 0, any modifier state matches (no modifier requirement). When modifiers is non-zero, only an exact match triggers the keybind. Example: ALLEGRO_KEY_A with ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL
Definition at line 1129 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::keycode, n_gui_get_widget(), N_GUI_KEY_MOD_MASK, N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_button_set_keycode_focused | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | keycode, | ||
| int | modifiers, | ||
| const int * | sources, | ||
| int | source_count | ||
| ) |
bind a keyboard key to a button that fires only when specific widgets have focus.
Unlike n_gui_button_set_keycode (global), this binding triggers only when the button itself or one of the listed source widgets currently has focus. This allows e.g. ENTER in a URL textarea to trigger a Send button without interfering with ENTER in other textareas.
| ctx | GUI context |
| widget_id | button widget id |
| keycode | ALLEGRO_KEY_* constant, or 0 to unbind |
| modifiers | ALLEGRO_KEYMOD_* flags ORed together, or 0 for no requirement |
| sources | array of widget IDs whose focus can trigger this binding |
| source_count | number of entries in sources (max N_GUI_KEY_SOURCES_MAX) |
bind a keyboard key to a button that fires only when specific widgets have focus.
Definition at line 1139 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_BUTTON_DATA::key_focus_only, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::key_sources, N_GUI_BUTTON_DATA::keycode, n_gui_get_widget(), N_GUI_KEY_MOD_MASK, N_GUI_KEY_SOURCES_MAX, N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_button_set_toggle_mode | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | toggle_mode | ||
| ) |
set button toggle mode
set button toggle mode
| ctx | the GUI context |
| widget_id | id of the target button widget |
| toggle_mode | 0 = momentary, 1 = toggle |
Definition at line 1110 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_BUTTON, N_GUI_BUTTON_DATA::toggle_mode, N_GUI_BUTTON_DATA::toggled, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_button_set_toggled | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | toggled | ||
| ) |
set button toggled state
set button toggled state
Definition at line 1097 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_BUTTON, and N_GUI_WIDGET::type.
Referenced by main(), n_gui_tab_set_active(), on_height_toggle(), on_player_toggle(), on_proj_select(), and on_proj_select().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_checkbox_is_checked | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
check if checkbox is checked
check if checkbox is checked
| ctx | GUI context |
| widget_id | id of the checkbox widget |
Definition at line 1779 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_CHECKBOX, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_checkbox_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | box, | ||
| ALLEGRO_BITMAP * | box_checked, | ||
| ALLEGRO_BITMAP * | box_hover | ||
| ) |
set optional bitmap overlays on a checkbox widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a checkbox widget.
Definition at line 2447 of file n_gui.c.
References N_GUI_CHECKBOX_DATA::box_bitmap, N_GUI_CHECKBOX_DATA::box_checked_bitmap, N_GUI_CHECKBOX_DATA::box_hover_bitmap, N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_CHECKBOX, n_log, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_checkbox_set_checked | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | checked | ||
| ) |
set checkbox checked state
set checkbox checked state
| ctx | GUI context |
| widget_id | id of the checkbox widget |
| checked | 1 to check, 0 to uncheck |
Definition at line 1793 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_CHECKBOX, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_close_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
close (hide) a window
close (hide) a window
Definition at line 646 of file n_gui.c.
References n_gui_get_window(), and N_GUI_WINDOW::state.
Referenced by main(), n_gui_tab_set_active(), and on_ghost_toggle().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_combobox_add_item | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text | ||
| ) |
add an item to a combo box
Definition at line 2109 of file n_gui.c.
References _items_grow(), N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::items, N_GUI_COMBOBOX_DATA::items_capacity, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_combobox_clear | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
remove all items from a combobox
remove all items from a combobox
| ctx | GUI context |
| widget_id | id of the combobox widget |
Definition at line 2096 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::is_open, N_GUI_COMBOBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::nb_items, N_GUI_COMBOBOX_DATA::scroll_offset, N_GUI_COMBOBOX_DATA::selected_index, and N_GUI_WIDGET::type.
Here is the call graph for this function:| int n_gui_combobox_get_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get the selected item index
get the selected item index
| ctx | GUI context |
| widget_id | id of the combobox widget |
Definition at line 2131 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_combobox_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | bg, | ||
| ALLEGRO_BITMAP * | item_bg, | ||
| ALLEGRO_BITMAP * | item_selected | ||
| ) |
set optional bitmap overlays on a combobox widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a combobox widget.
Definition at line 2522 of file n_gui.c.
References N_GUI_COMBOBOX_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::item_bg_bitmap, N_GUI_COMBOBOX_DATA::item_selected_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, n_log, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_combobox_set_flags | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | flags | ||
| ) |
set combobox feature flags (bitmask of N_GUI_COMBOBOX_* values)
set combobox feature flags (bitmask of N_GUI_COMBOBOX_* values)
| ctx | GUI context. Must not be NULL. |
| widget_id | Combobox widget id. |
| flags | Bitmask of N_GUI_COMBOBOX_* values. |
Definition at line 1446 of file n_gui.c.
References __n_assert, N_GUI_WIDGET::data, N_GUI_COMBOBOX_DATA::flags, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_combobox_set_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index | ||
| ) |
set the selected item index
set the selected item index
| ctx | GUI context |
| widget_id | id of the combobox widget |
| index | index of the item to select, or -1 for none |
Definition at line 2145 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_COMBOBOX, N_GUI_COMBOBOX_DATA::selected_index, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| N_GUI_STYLE n_gui_default_style | ( | void | ) |
return the built-in default style
return the built-in default style
Definition at line 365 of file n_gui.c.
References N_GUI_STYLE::checkbox_label_gap, N_GUI_STYLE::checkbox_label_offset, N_GUI_STYLE::checkbox_mark_margin, N_GUI_STYLE::checkbox_mark_thickness, N_GUI_STYLE::checkbox_max_size, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_STYLE::combobox_max_visible, N_GUI_STYLE::dropdown_arrow_half_h, N_GUI_STYLE::dropdown_arrow_half_w, N_GUI_STYLE::dropdown_arrow_reserve, N_GUI_STYLE::dropdown_arrow_thickness, N_GUI_STYLE::dropdown_border_thickness, N_GUI_STYLE::dropmenu_max_visible, N_GUI_STYLE::global_scroll_step, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_STYLE::label_padding, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, N_GUI_STYLE::listbox_default_item_height, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_STYLE::radio_circle_border_thickness, N_GUI_STYLE::radio_circle_min_r, N_GUI_STYLE::radio_inner_offset, N_GUI_STYLE::radio_label_gap, N_GUI_STYLE::radiolist_default_item_height, N_GUI_STYLE::scroll_step, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_thumb_corner_r, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_STYLE::scrollbar_track_color, N_GUI_STYLE::slider_handle_border_thickness, N_GUI_STYLE::slider_handle_edge_offset, N_GUI_STYLE::slider_handle_min_r, N_GUI_STYLE::slider_track_border_thickness, N_GUI_STYLE::slider_track_corner_r, N_GUI_STYLE::slider_track_size, N_GUI_STYLE::slider_value_label_offset, N_GUI_STYLE::textarea_cursor_blink_period, N_GUI_STYLE::textarea_cursor_width, N_GUI_STYLE::textarea_padding, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, and N_GUI_STYLE::titlebar_h.
Referenced by n_gui_new_ctx().
Here is the caller graph for this function:| N_GUI_THEME n_gui_default_theme | ( | void | ) |
return the built-in default theme
return the built-in default theme
Definition at line 294 of file n_gui.c.
References N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_THEME::selection_color, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, and N_GUI_THEME::text_normal.
Referenced by n_gui_new_ctx().
Here is the caller graph for this function:| void n_gui_destroy_ctx | ( | N_GUI_CTX ** | ctx | ) |
destroy a GUI context and free all resources
destroy a GUI context and free all resources
| ctx | pointer to the context pointer (set to NULL) |
Definition at line 523 of file n_gui.c.
References __n_assert, destroy_ht(), Free, and list_destroy().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| float n_gui_detect_dpi_scale | ( | N_GUI_CTX * | ctx, |
| ALLEGRO_DISPLAY * | display | ||
| ) |
detect and apply DPI scale from the given allegro display.
Works on Linux (X11/Wayland), Windows, and Android. Returns the detected scale factor.
detect and apply DPI scale from the given allegro display.
Detection strategy (cross-platform):
If the framebuffer and window sizes are both reported identically (no HiDPI support from the Allegro build), the function falls back to 1.0.
Definition at line 5234 of file n_gui.c.
References __n_assert, display, and N_GUI_CTX::dpi_scale.
Referenced by main().
Here is the caller graph for this function:| void n_gui_draw | ( | N_GUI_CTX * | ctx | ) |
draw all visible GUI windows and widgets
draw all visible GUI windows and widgets
When a display size has been set (via n_gui_set_display_size) and the total GUI bounding box exceeds it, global scrollbars are drawn at the edges of the display and all windows are offset by the global scroll position.
| ctx | the GUI context |
Definition at line 4800 of file n_gui.c.
References __n_assert, _compute_gui_bounds(), _draw_combobox_dropdown(), _draw_dropmenu_panel(), _draw_window(), N_GUI_WINDOW::autofit_flags, N_GUI_CTX::default_font, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::global_scroll_x, N_GUI_CTX::global_scroll_y, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_WINDOW::id, list_foreach, n_gui_window_apply_autofit(), N_GUI_CTX::style, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, and N_GUI_CTX::windows.
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_dropmenu_add_dynamic_entry | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text, | ||
| int | tag, | ||
| void(*)(int, int, int, void *) | on_click, | ||
| void * | user_data | ||
| ) |
add a dynamic entry (rebuilt each time menu opens)
add a dynamic entry (rebuilt each time menu opens)
Definition at line 2301 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_ENTRY::is_dynamic, LOG_ERR, n_gui_dropmenu_add_entry(), n_gui_get_widget(), and n_log.
Referenced by on_windows_menu_open().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_dropmenu_add_entry | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text, | ||
| int | tag, | ||
| void(*)(int, int, int, void *) | on_click, | ||
| void * | user_data | ||
| ) |
add a static entry to a dropdown menu
add a static entry to a dropdown menu
Definition at line 2278 of file n_gui.c.
References _dropmenu_entries_grow(), N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_DATA::entries_capacity, N_GUI_DROPMENU_ENTRY::is_dynamic, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_ENTRY::on_click, N_GUI_DROPMENU_ENTRY::tag, N_GUI_DROPMENU_ENTRY::text, N_GUI_WIDGET::type, and N_GUI_DROPMENU_ENTRY::user_data.
Referenced by main(), and n_gui_dropmenu_add_dynamic_entry().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_dropmenu_clear | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
remove all entries
remove all entries
Definition at line 2355 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_DATA::scroll_offset, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_dropmenu_clear_dynamic | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
remove all dynamic entries (call from on_open callback before re-adding)
remove all dynamic entries (call from on_open callback before re-adding)
Definition at line 2326 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, N_GUI_DROPMENU_ENTRY::is_dynamic, N_GUI_DROPMENU_DATA::max_visible, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_DATA::scroll_offset, and N_GUI_WIDGET::type.
Referenced by on_windows_menu_open().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_dropmenu_get_count | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get number of entries
get number of entries
Definition at line 2380 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_dropmenu_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | panel, | ||
| ALLEGRO_BITMAP * | item_hover | ||
| ) |
set optional bitmap overlays on a dropmenu widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a dropmenu widget.
Definition at line 2538 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::item_hover_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_DROPMENU, n_log, N_GUI_DROPMENU_DATA::panel_bitmap, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_dropmenu_set_entry_text | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index, | ||
| const char * | text | ||
| ) |
update text of an existing entry by index
update text of an existing entry by index
Definition at line 2366 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_DROPMENU_DATA::entries, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_DROPMENU, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_DROPMENU_ENTRY::text, and N_GUI_WIDGET::type.
Here is the call graph for this function:| float n_gui_get_dpi_scale | ( | const N_GUI_CTX * | ctx | ) |
get current DPI scale factor
get current DPI scale factor
Definition at line 5210 of file n_gui.c.
References __n_assert, and N_GUI_CTX::dpi_scale.
| int n_gui_get_resize_mode | ( | N_GUI_CTX * | ctx | ) |
get current resize mode
get current resize mode
Definition at line 5071 of file n_gui.c.
References __n_assert, and N_GUI_CTX::resize_mode.
| N_GUI_TEXT_DIMS n_gui_get_text_dims | ( | ALLEGRO_FONT * | font, |
| const char * | text | ||
| ) |
get the bounding box dimensions of text rendered with the given font.
Uses al_get_text_dimensions for accurate measurement including glyph overhangs.
Definition at line 58 of file n_gui.c.
References N_GUI_TEXT_DIMS::h, N_GUI_TEXT_DIMS::w, N_GUI_TEXT_DIMS::x, and N_GUI_TEXT_DIMS::y.
| N_GUI_WIDGET * n_gui_get_widget | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get a widget by id
get a widget by id
Definition at line 1561 of file n_gui.c.
References __n_assert, ht_get_ptr(), key, and N_GUI_CTX::widgets_by_id.
Referenced by _draw_combobox_dropdown(), _draw_dropmenu_panel(), _n_gui_kv_reposition(), n_gui_add_button_bitmap(), n_gui_add_label_link(), n_gui_add_toggle_button(), n_gui_add_vslider(), n_gui_button_is_toggled(), n_gui_button_set_keycode(), n_gui_button_set_keycode_focused(), n_gui_button_set_toggle_mode(), n_gui_button_set_toggled(), n_gui_checkbox_is_checked(), n_gui_checkbox_set_bitmaps(), n_gui_checkbox_set_checked(), n_gui_combobox_add_item(), n_gui_combobox_clear(), n_gui_combobox_get_selected(), n_gui_combobox_set_bitmaps(), n_gui_combobox_set_flags(), n_gui_combobox_set_selected(), n_gui_dropmenu_add_dynamic_entry(), n_gui_dropmenu_add_entry(), n_gui_dropmenu_clear(), n_gui_dropmenu_clear_dynamic(), n_gui_dropmenu_get_count(), n_gui_dropmenu_set_bitmaps(), n_gui_dropmenu_set_entry_text(), n_gui_image_set_bitmap(), n_gui_is_widget_enabled(), n_gui_label_set_bitmap(), n_gui_label_set_link(), n_gui_label_set_text(), n_gui_listbox_add_item(), n_gui_listbox_clear(), n_gui_listbox_get_count(), n_gui_listbox_get_item_text(), n_gui_listbox_get_scroll_offset(), n_gui_listbox_get_selected(), n_gui_listbox_is_selected(), n_gui_listbox_remove_item(), n_gui_listbox_set_bitmaps(), n_gui_listbox_set_scroll_offset(), n_gui_listbox_set_selected(), n_gui_process_event(), n_gui_radiolist_add_item(), n_gui_radiolist_clear(), n_gui_radiolist_get_selected(), n_gui_radiolist_set_bitmaps(), n_gui_radiolist_set_selected(), n_gui_scrollbar_get_pos(), n_gui_scrollbar_set_bitmaps(), n_gui_scrollbar_set_pos(), n_gui_scrollbar_set_sizes(), n_gui_set_focus(), n_gui_set_widget_enabled(), n_gui_set_widget_theme(), n_gui_set_widget_visible(), n_gui_slider_get_value(), n_gui_slider_set_bitmaps(), n_gui_slider_set_range(), n_gui_slider_set_step(), n_gui_slider_set_value(), n_gui_textarea_get_text(), n_gui_textarea_get_text_length(), n_gui_textarea_scroll_to_bottom(), n_gui_textarea_scroll_to_offset(), n_gui_textarea_set_bitmap(), n_gui_textarea_set_mask_char(), n_gui_textarea_set_selection(), and n_gui_textarea_set_text().
Here is the call graph for this function:
Here is the caller graph for this function:| N_GUI_WINDOW * n_gui_get_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
get a window by id
get a window by id
Definition at line 637 of file n_gui.c.
References _find_window_node(), and LIST_NODE::ptr.
Referenced by n_gui_add_button(), n_gui_add_checkbox(), n_gui_add_combobox(), n_gui_add_dropmenu(), n_gui_add_image(), n_gui_add_label(), n_gui_add_listbox(), n_gui_add_radiolist(), n_gui_add_scrollbar(), n_gui_add_slider(), n_gui_add_textarea(), n_gui_close_window(), n_gui_kvtable_add_row(), n_gui_kvtable_create(), n_gui_minimize_window(), n_gui_open_window(), n_gui_process_event(), n_gui_toggle_window(), n_gui_window_apply_autofit(), n_gui_window_autosize(), n_gui_window_get_flags(), n_gui_window_get_resize_policy(), n_gui_window_get_zorder(), n_gui_window_get_zvalue(), n_gui_window_is_open(), n_gui_window_set_autofit(), n_gui_window_set_bitmaps(), n_gui_window_set_flags(), n_gui_window_set_resize_policy(), n_gui_window_set_zorder(), and n_gui_window_update_normalized().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_image_set_bitmap | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | bitmap | ||
| ) |
set the bitmap on an image widget
set the bitmap on an image widget
| ctx | GUI context |
| widget_id | id of the image widget |
| bitmap | pointer to the ALLEGRO_BITMAP to set |
Definition at line 2163 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_IMAGE, and N_GUI_WIDGET::type.
Here is the call graph for this function:| int n_gui_is_widget_enabled | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
check if a widget is enabled
check if a widget is enabled
Definition at line 1601 of file n_gui.c.
References N_GUI_WIDGET::enabled, and n_gui_get_widget().
Here is the call graph for this function:| 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
Definition at line 7972 of file n_gui.c.
References _n_gui_kv_remove_clicked(), _n_gui_kv_reposition(), N_GUI_KV_ROW::active, N_GUI_KVTABLE::ctx, N_GUI_KV_ROW::desc_id, N_GUI_KV_ROW::enabled_id, N_GUI_KVTABLE::header_height, key, N_GUI_KV_ROW::key_id, n_gui_add_button(), n_gui_add_checkbox(), n_gui_add_textarea(), n_gui_get_window(), N_GUI_KV_MAX, N_GUI_SHAPE_RECT, n_gui_textarea_set_text(), N_GUI_KVTABLE::nb_active, N_GUI_KVTABLE::nb_rows, N_GUI_KVTABLE::padding, N_GUI_KV_ROW::remove_id, N_GUI_KVTABLE::row_height, N_GUI_KVTABLE::rows, N_GUI_KV_ROW::value_id, N_GUI_WINDOW::w, and N_GUI_KVTABLE::window_id.
Referenced by _n_gui_kv_add_clicked().
Here is the call graph for this function:
Here is the caller graph for this function:| N_GUI_KVTABLE * n_gui_kvtable_create | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | row_height, | ||
| float | padding, | ||
| void(*)(int, void *) | on_remove, | ||
| void * | user_data | ||
| ) |
create a KV table in an existing window
Definition at line 7928 of file n_gui.c.
References _n_gui_kv_add_clicked(), N_GUI_KVTABLE::btn_add, N_GUI_KVTABLE::ctx, N_GUI_KVTABLE::header_height, N_GUI_KVTABLE::lbl_desc, N_GUI_KVTABLE::lbl_enabled, N_GUI_KVTABLE::lbl_key, N_GUI_KVTABLE::lbl_value, Malloc, n_gui_add_button(), n_gui_add_label(), N_GUI_ALIGN_LEFT, n_gui_get_window(), N_GUI_SHAPE_ROUNDED, N_GUI_KVTABLE::nb_active, N_GUI_KVTABLE::nb_rows, N_GUI_KVTABLE::on_remove, N_GUI_KVTABLE::padding, N_GUI_KVTABLE::row_height, N_GUI_KVTABLE::user_data, N_GUI_WINDOW::w, and N_GUI_KVTABLE::window_id.
Here is the call graph for this function:| void n_gui_kvtable_free | ( | N_GUI_KVTABLE ** | table | ) |
| int n_gui_kvtable_get_count | ( | N_GUI_KVTABLE * | table | ) |
get the number of active rows
Definition at line 8024 of file n_gui.c.
References N_GUI_KVTABLE::nb_active.
| void n_gui_kvtable_remove_row | ( | N_GUI_KVTABLE * | table, |
| int | row_index | ||
| ) |
remove a row by index (hides widgets, marks inactive)
Definition at line 8010 of file n_gui.c.
References _n_gui_kv_reposition(), N_GUI_KV_ROW::active, N_GUI_KVTABLE::ctx, N_GUI_KV_ROW::desc_id, N_GUI_KV_ROW::enabled_id, N_GUI_KV_ROW::key_id, n_gui_set_widget_visible(), N_GUI_KVTABLE::nb_active, N_GUI_KVTABLE::nb_rows, N_GUI_KV_ROW::remove_id, N_GUI_KVTABLE::rows, and N_GUI_KV_ROW::value_id.
Referenced by _n_gui_kv_remove_clicked().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_label_set_bitmap | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | bg | ||
| ) |
set optional background bitmap on a label widget.
set optional background bitmap on a label widget.
Definition at line 2553 of file n_gui.c.
References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_LABEL, n_log, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_label_set_link | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | link | ||
| ) |
set label hyperlink URL
set label hyperlink URL
| ctx | GUI context |
| widget_id | id of the label widget |
| link | the URL to set, or NULL to clear |
Definition at line 2198 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LABEL_DATA::link, n_gui_get_widget(), N_GUI_TEXT_MAX, N_GUI_TYPE_LABEL, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_label_set_text | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text | ||
| ) |
set label text content
set label text content
| ctx | GUI context |
| widget_id | id of the label widget |
| text | the text to set, or NULL to clear |
Definition at line 2178 of file n_gui.c.
References _normalize_crlf(), N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TEXT_MAX, N_GUI_TYPE_LABEL, N_GUI_LABEL_DATA::text, and N_GUI_WIDGET::type.
Referenced by main(), main(), and update_definitions().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_listbox_add_item | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text | ||
| ) |
add an item to a listbox
add an item to a listbox
| ctx | GUI context |
| widget_id | id of the listbox widget |
| text | text of the item to add |
Definition at line 1860 of file n_gui.c.
References _items_grow(), N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, N_GUI_LISTBOX_DATA::items_capacity, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.
Referenced by chat_log_add(), main(), n_gui_tree_rebuild(), and update_completion().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_listbox_clear | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
clear all items from a listbox
clear all items from a listbox
| ctx | GUI context |
| widget_id | id of the listbox widget |
Definition at line 1907 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.
Referenced by n_gui_tree_rebuild(), refresh_clients_list(), and update_completion().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_listbox_get_count | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get number of items in a listbox
get number of items in a listbox
| ctx | GUI context |
| widget_id | id of the listbox widget |
Definition at line 1922 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, and N_GUI_WIDGET::type.
Here is the call graph for this function:| const char * n_gui_listbox_get_item_text | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index | ||
| ) |
get item text by index
get item text by index
| ctx | GUI context |
| widget_id | id of the listbox widget |
| index | index of the item |
Definition at line 1937 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.
Referenced by on_completion_select().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_listbox_get_scroll_offset | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get the current scroll offset (in items)
Definition at line 2001 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.
Here is the call graph for this function:| int n_gui_listbox_get_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get the first selected item index
get the first selected item index
| ctx | GUI context |
| widget_id | id of the listbox widget |
Definition at line 1954 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTITEM::selected, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_listbox_is_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index | ||
| ) |
check if an item is selected
check if an item is selected
| ctx | GUI context |
| widget_id | id of the listbox widget |
| index | index of the item to check |
Definition at line 1972 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTITEM::selected, and N_GUI_WIDGET::type.
Here is the call graph for this function:| int n_gui_listbox_remove_item | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index | ||
| ) |
remove an item from a listbox by index
remove an item from a listbox by index
| ctx | GUI context |
| widget_id | id of the listbox widget |
| index | index of the item to remove |
Definition at line 1883 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_listbox_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | bg, | ||
| ALLEGRO_BITMAP * | item_bg, | ||
| ALLEGRO_BITMAP * | item_selected | ||
| ) |
set optional bitmap overlays on a listbox widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a listbox widget.
Definition at line 2490 of file n_gui.c.
References N_GUI_LISTBOX_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::item_bg_bitmap, N_GUI_LISTBOX_DATA::item_selected_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, n_log, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_listbox_set_scroll_offset | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | offset | ||
| ) |
set the scroll offset (in items) — clamps to valid range
Definition at line 2008 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_WIDGET::h, N_GUI_LISTBOX_DATA::item_height, n_gui_get_widget(), N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTBOX_DATA::scroll_offset, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_listbox_set_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index, | ||
| int | selected | ||
| ) |
set item selection state
set item selection state
| ctx | GUI context |
| widget_id | id of the listbox widget |
| index | index of the item |
| selected | 1 to select, 0 to deselect |
Definition at line 1990 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_LISTBOX_DATA::items, n_gui_get_widget(), N_GUI_SELECT_SINGLE, N_GUI_TYPE_LISTBOX, N_GUI_LISTBOX_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTBOX_DATA::selection_mode, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_load_theme_json | ( | N_GUI_CTX * | ctx, |
| const char * | filepath | ||
| ) |
Load a JSON theme file and apply it to the context.
Returns 0 on success, -1 on error.
Load a JSON theme file and apply it to the context.
| ctx | GUI context |
| filepath | path to the input JSON file |
Definition at line 7536 of file n_gui.c.
References __n_assert, _json_get_color(), _json_get_float(), _json_get_int(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_STYLE::checkbox_label_gap, N_GUI_STYLE::checkbox_label_offset, N_GUI_STYLE::checkbox_mark_margin, N_GUI_STYLE::checkbox_mark_thickness, N_GUI_STYLE::checkbox_max_size, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_STYLE::combobox_max_visible, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_CTX::default_theme, N_GUI_STYLE::dropdown_arrow_half_h, N_GUI_STYLE::dropdown_arrow_half_w, N_GUI_STYLE::dropdown_arrow_reserve, N_GUI_STYLE::dropdown_arrow_thickness, N_GUI_STYLE::dropdown_border_thickness, N_GUI_STYLE::dropmenu_max_visible, FreeNoLog, N_GUI_STYLE::global_scroll_step, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_STYLE::label_padding, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, list_foreach, N_GUI_STYLE::listbox_default_item_height, Malloc, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_STYLE::radio_circle_border_thickness, N_GUI_STYLE::radio_circle_min_r, N_GUI_STYLE::radio_inner_offset, N_GUI_STYLE::radio_label_gap, N_GUI_STYLE::radiolist_default_item_height, N_GUI_STYLE::scroll_step, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_thumb_corner_r, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_STYLE::scrollbar_track_color, N_GUI_THEME::selection_color, N_GUI_STYLE::slider_handle_border_thickness, N_GUI_STYLE::slider_handle_edge_offset, N_GUI_STYLE::slider_handle_min_r, N_GUI_STYLE::slider_track_border_thickness, N_GUI_STYLE::slider_track_corner_r, N_GUI_STYLE::slider_track_size, N_GUI_STYLE::slider_value_label_offset, N_GUI_CTX::style, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, N_GUI_THEME::text_normal, N_GUI_STYLE::textarea_cursor_blink_period, N_GUI_STYLE::textarea_cursor_width, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::theme, N_GUI_WINDOW::theme, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, N_GUI_STYLE::titlebar_h, N_GUI_WINDOW::widgets, and N_GUI_CTX::windows.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_lower_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
lower a window to the bottom of the stack (respects z-order constraints)
lower a window to the bottom of the stack (respects z-order constraints)
Only NORMAL windows can be lowered.
Definition at line 763 of file n_gui.c.
References __n_assert, _destroy_window(), _find_window_node(), _sort_windows_by_zorder(), LIST_NODE::destroy_func, list_unshift(), N_GUI_ZORDER_NORMAL, LIST_NODE::ptr, remove_list_node_f(), N_GUI_CTX::windows, and N_GUI_WINDOW::z_order.
Here is the call graph for this function:| N_GUI_THEME n_gui_make_theme | ( | ALLEGRO_COLOR | bg, |
| ALLEGRO_COLOR | bg_hover, | ||
| ALLEGRO_COLOR | bg_active, | ||
| ALLEGRO_COLOR | border, | ||
| ALLEGRO_COLOR | border_hover, | ||
| ALLEGRO_COLOR | border_active, | ||
| ALLEGRO_COLOR | text, | ||
| ALLEGRO_COLOR | text_hover, | ||
| ALLEGRO_COLOR | text_active, | ||
| float | border_thickness, | ||
| float | corner_rx, | ||
| float | corner_ry | ||
| ) |
create a custom theme from individual colors and properties
create a custom theme from individual colors and properties
| bg | background colour |
| bg_hover | background colour on hover |
| bg_active | background colour when active |
| border | border colour |
| border_hover | border colour on hover |
| border_active | border colour when active |
| text | text colour |
| text_hover | text colour on hover |
| text_active | text colour when active |
| border_thickness | border thickness in pixels |
| corner_rx | horizontal corner radius |
| corner_ry | vertical corner radius |
Definition at line 328 of file n_gui.c.
References N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_THEME::selection_color, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, and N_GUI_THEME::text_normal.
Referenced by main().
Here is the caller graph for this function:| void n_gui_minimize_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
minimize a window (title bar only)
minimize a window (title bar only)
Definition at line 662 of file n_gui.c.
References n_gui_get_window(), N_GUI_WIN_MINIMISED, and N_GUI_WINDOW::state.
Here is the call graph for this function:| N_GUI_CTX * n_gui_new_ctx | ( | ALLEGRO_FONT * | default_font | ) |
create a new GUI context
create a new GUI context
| default_font | the default ALLEGRO_FONT to use |
Definition at line 466 of file n_gui.c.
References __n_assert, N_GUI_CTX::default_font, N_GUI_CTX::default_theme, N_GUI_CTX::display, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::dpi_scale, N_GUI_CTX::focused_widget_id, Free, N_GUI_CTX::global_hscroll_drag, N_GUI_CTX::global_scroll_x, N_GUI_CTX::global_scroll_y, N_GUI_CTX::global_vscroll_drag, N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, list_destroy(), LOG_ERR, Malloc, N_GUI_CTX::mouse_b1, N_GUI_CTX::mouse_b1_prev, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, n_gui_default_style(), n_gui_default_theme(), N_GUI_RESIZE_VIRTUAL, n_log, new_generic_list(), new_ht(), N_GUI_CTX::next_widget_id, N_GUI_CTX::next_window_id, N_GUI_CTX::open_combobox_id, N_GUI_CTX::open_dropmenu_id, N_GUI_CTX::ref_display_h, N_GUI_CTX::ref_display_w, N_GUI_CTX::resize_mode, N_GUI_CTX::scrollbar_drag_widget_id, N_GUI_CTX::selected_label_id, N_GUI_CTX::style, UNLIMITED_LIST_ITEMS, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_CTX::widgets_by_id, and N_GUI_CTX::windows.
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_open_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
open (show) a window
open (show) a window
Definition at line 654 of file n_gui.c.
References n_gui_get_window(), N_GUI_WIN_OPEN, and N_GUI_WINDOW::state.
Referenced by main(), n_gui_tab_set_active(), and on_ghost_toggle().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_process_event | ( | N_GUI_CTX * | ctx, |
| ALLEGRO_EVENT | event | ||
| ) |
process an allegro event for the GUI
process an allegro event for the GUI
| ctx | the GUI context |
| event | the allegro event to process |
Definition at line 5767 of file n_gui.c.
References __n_assert, _clamp(), _compute_gui_bounds(), _find_focused_window(), _find_widget_window(), _is_focusable_type(), _justified_char_at_pos(), _label_char_at_x(), _label_content_height(), _label_text_origin_x(), _n_gui_window_capture_normalized(), _point_in_rect(), _scrollbar_calc_scroll(), _scrollbar_calc_scroll_int(), _scrollbar_update_from_mouse(), _slider_snap_value(), _slider_update_from_mouse(), _text_w(), _textarea_content_height(), _textarea_handle_key(), _textarea_pos_from_mouse(), _win_tbh(), _window_update_content_size(), N_GUI_LABEL_DATA::align, N_GUI_CHECKBOX_DATA::checked, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_WINDOW::content_h, N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WINDOW::content_w, N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_CTX::display, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_WINDOW::drag_ox, N_GUI_WINDOW::drag_oy, N_GUI_WIDGET::enabled, LIST::end, N_GUI_DROPMENU_DATA::entries, N_GUI_COMBOBOX_DATA::flags, N_GUI_WINDOW::flags, N_GUI_CTX::focused_widget_id, N_GUI_WIDGET::font, N_GUI_CTX::global_hscroll_drag, N_GUI_STYLE::global_scroll_step, N_GUI_CTX::global_scroll_x, N_GUI_CTX::global_scroll_y, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_CTX::global_vscroll_drag, N_GUI_STYLE::grip_size, N_GUI_CTX::gui_bounds_h, N_GUI_CTX::gui_bounds_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_WIDGET::h, N_GUI_WINDOW::h, N_GUI_WIDGET::id, N_GUI_WINDOW::id, N_GUI_COMBOBOX_DATA::is_open, N_GUI_DROPMENU_DATA::is_open, N_GUI_LISTBOX_DATA::item_height, N_GUI_RADIOLIST_DATA::item_height, N_GUI_COMBOBOX_DATA::item_height, N_GUI_DROPMENU_DATA::item_height, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_text_padding, N_GUI_LISTBOX_DATA::items, N_GUI_COMBOBOX_DATA::items, N_GUI_BUTTON_DATA::key_focus_only, N_GUI_BUTTON_DATA::key_modifiers, N_GUI_BUTTON_DATA::key_sources, N_GUI_BUTTON_DATA::keycode, N_GUI_STYLE::label_padding, N_GUI_LABEL_DATA::link, list_foreach, N_GUI_SLIDER_DATA::max_val, N_GUI_COMBOBOX_DATA::max_visible, N_GUI_DROPMENU_DATA::max_visible, N_GUI_WINDOW::min_h, N_GUI_SLIDER_DATA::min_val, N_GUI_WINDOW::min_w, N_GUI_CTX::mouse_b1, N_GUI_CTX::mouse_b1_prev, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, N_GUI_TEXTAREA_DATA::multiline, N_GUI_ALIGN_JUSTIFIED, N_GUI_COMBOBOX_AUTO_WIDTH, n_gui_get_widget(), n_gui_get_window(), N_GUI_KEY_MOD_MASK, N_GUI_KEY_SOURCES_MAX, n_gui_raise_window(), N_GUI_RESIZE_ADAPTIVE, N_GUI_SCROLLBAR_V, N_GUI_SELECT_MULTIPLE, N_GUI_SELECT_NONE, N_GUI_SELECT_SINGLE, n_gui_set_focus(), N_GUI_SLIDER_H, N_GUI_STATE_ACTIVE, N_GUI_STATE_FOCUSED, N_GUI_STATE_HOVER, N_GUI_TEXT_MAX, N_GUI_TYPE_BUTTON, N_GUI_TYPE_CHECKBOX, N_GUI_TYPE_COMBOBOX, N_GUI_TYPE_DROPMENU, N_GUI_TYPE_LABEL, N_GUI_TYPE_LISTBOX, N_GUI_TYPE_RADIOLIST, N_GUI_TYPE_SCROLLBAR, N_GUI_TYPE_SLIDER, N_GUI_TYPE_TEXTAREA, N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_DRAGGING, N_GUI_WIN_FIXED_POSITION, N_GUI_WIN_FRAMELESS, N_GUI_WIN_HSCROLL_DRAG, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WIN_RESIZABLE, N_GUI_WIN_RESIZING, N_GUI_WIN_VSCROLL_DRAG, N_GUI_DROPMENU_DATA::nb_entries, N_GUI_LISTBOX_DATA::nb_items, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_COMBOBOX_DATA::nb_items, LIST::nb_items, N_GUI_SLIDER_DATA::on_change, N_GUI_DROPMENU_ENTRY::on_click, N_GUI_BUTTON_DATA::on_click, N_GUI_LABEL_DATA::on_link_click, N_GUI_DROPMENU_DATA::on_open, N_GUI_DROPMENU_DATA::on_open_user_data, N_GUI_SCROLLBAR_DATA::on_scroll, N_GUI_LISTBOX_DATA::on_select, N_GUI_RADIOLIST_DATA::on_select, N_GUI_COMBOBOX_DATA::on_select, N_GUI_CHECKBOX_DATA::on_toggle, N_GUI_CTX::open_combobox_id, N_GUI_CTX::open_dropmenu_id, N_GUI_SLIDER_DATA::orientation, N_GUI_SCROLLBAR_DATA::orientation, LIST_NODE::ptr, N_GUI_CTX::resize_mode, N_GUI_TEXTAREA_DATA::scroll_from_wheel, N_GUI_LISTBOX_DATA::scroll_offset, N_GUI_RADIOLIST_DATA::scroll_offset, N_GUI_COMBOBOX_DATA::scroll_offset, N_GUI_DROPMENU_DATA::scroll_offset, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_STYLE::scroll_step, N_GUI_WINDOW::scroll_x, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_LABEL_DATA::scroll_y, N_GUI_WINDOW::scroll_y, N_GUI_CTX::scrollbar_drag_widget_id, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_LABEL_DATA::sel_dragging, N_GUI_TEXTAREA_DATA::sel_end, N_GUI_LABEL_DATA::sel_end, N_GUI_TEXTAREA_DATA::sel_start, N_GUI_LABEL_DATA::sel_start, N_GUI_LISTITEM::selected, N_GUI_RADIOLIST_DATA::selected_index, N_GUI_COMBOBOX_DATA::selected_index, N_GUI_CTX::selected_label_id, N_GUI_LISTBOX_DATA::selection_mode, N_GUI_WIDGET::state, N_GUI_WINDOW::state, N_GUI_SLIDER_DATA::step, N_GUI_CTX::style, N_GUI_DROPMENU_ENTRY::tag, N_GUI_LISTITEM::text, N_GUI_LABEL_DATA::text, N_GUI_STYLE::textarea_padding, N_GUI_STYLE::title_max_w_reserve, N_GUI_BUTTON_DATA::toggle_mode, N_GUI_BUTTON_DATA::toggled, N_GUI_WIDGET::type, N_GUI_BUTTON_DATA::user_data, N_GUI_SLIDER_DATA::user_data, N_GUI_CHECKBOX_DATA::user_data, N_GUI_SCROLLBAR_DATA::user_data, N_GUI_LISTBOX_DATA::user_data, N_GUI_RADIOLIST_DATA::user_data, N_GUI_COMBOBOX_DATA::user_data, N_GUI_LABEL_DATA::user_data, N_GUI_DROPMENU_ENTRY::user_data, N_GUI_SLIDER_DATA::value, N_GUI_SCROLLBAR_DATA::viewport_size, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_CTX::windows, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_radiolist_add_item | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text | ||
| ) |
add an item to a radio list
add an item to a radio list
| ctx | GUI context |
| widget_id | id of the radiolist widget |
| text | text of the item to add |
Definition at line 2028 of file n_gui.c.
References _items_grow(), N_GUI_WIDGET::data, N_GUI_RADIOLIST_DATA::items, N_GUI_RADIOLIST_DATA::items_capacity, n_gui_get_widget(), N_GUI_ID_MAX, N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_LISTITEM::selected, N_GUI_LISTITEM::text, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_radiolist_clear | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
remove all items from a radio list
remove all items from a radio list
| ctx | GUI context |
| widget_id | id of the radiolist widget |
Definition at line 2049 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::nb_items, N_GUI_RADIOLIST_DATA::scroll_offset, N_GUI_RADIOLIST_DATA::selected_index, and N_GUI_WIDGET::type.
Here is the call graph for this function:| int n_gui_radiolist_get_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get the selected item index
get the selected item index
| ctx | GUI context |
| widget_id | id of the radiolist widget |
Definition at line 2065 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_radiolist_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | bg, | ||
| ALLEGRO_BITMAP * | item_bg, | ||
| ALLEGRO_BITMAP * | item_selected | ||
| ) |
set optional bitmap overlays on a radiolist widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a radiolist widget.
Definition at line 2506 of file n_gui.c.
References N_GUI_RADIOLIST_DATA::bg_bitmap, N_GUI_WIDGET::data, N_GUI_RADIOLIST_DATA::item_bg_bitmap, N_GUI_RADIOLIST_DATA::item_selected_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, n_log, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_radiolist_set_selected | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | index | ||
| ) |
set the selected item index
set the selected item index
| ctx | GUI context |
| widget_id | id of the radiolist widget |
| index | index of the item to select, or -1 for none |
Definition at line 2079 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_RADIOLIST, N_GUI_RADIOLIST_DATA::selected_index, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_raise_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
raise a window to the top of the stack (respects z-order constraints)
raise a window to the top of the stack (respects z-order constraints)
Respects z-order constraints: ALWAYS_BEHIND and FIXED windows are not moved. After raising, the window list is re-sorted.
Definition at line 745 of file n_gui.c.
References __n_assert, _destroy_window(), _find_window_node(), _sort_windows_by_zorder(), LIST_NODE::destroy_func, list_push(), N_GUI_ZORDER_NORMAL, LIST_NODE::ptr, remove_list_node_f(), N_GUI_CTX::windows, and N_GUI_WINDOW::z_order.
Referenced by n_gui_process_event(), and n_gui_set_focus().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_save_theme_json | ( | N_GUI_CTX * | ctx, |
| const char * | filepath | ||
| ) |
Save the full theme (default_theme + style) to a JSON file.
Returns 0 on success, -1 on error.
Save the full theme (default_theme + style) to a JSON file.
| ctx | GUI context |
| filepath | path to the output JSON file |
Definition at line 7413 of file n_gui.c.
References __n_assert, _json_add_color(), N_GUI_THEME::bg_active, N_GUI_THEME::bg_hover, N_GUI_THEME::bg_normal, N_GUI_THEME::border_active, N_GUI_THEME::border_hover, N_GUI_THEME::border_normal, N_GUI_THEME::border_thickness, N_GUI_STYLE::checkbox_label_gap, N_GUI_STYLE::checkbox_label_offset, N_GUI_STYLE::checkbox_mark_margin, N_GUI_STYLE::checkbox_mark_thickness, N_GUI_STYLE::checkbox_max_size, N_GUI_STYLE::combobox_max_dropdown_width, N_GUI_STYLE::combobox_max_visible, N_GUI_THEME::corner_rx, N_GUI_THEME::corner_ry, N_GUI_CTX::default_theme, N_GUI_STYLE::dropdown_arrow_half_h, N_GUI_STYLE::dropdown_arrow_half_w, N_GUI_STYLE::dropdown_arrow_reserve, N_GUI_STYLE::dropdown_arrow_thickness, N_GUI_STYLE::dropdown_border_thickness, N_GUI_STYLE::dropmenu_max_visible, N_GUI_STYLE::global_scroll_step, N_GUI_STYLE::global_scrollbar_border_thickness, N_GUI_STYLE::global_scrollbar_size, N_GUI_STYLE::global_scrollbar_thumb_border_color, N_GUI_STYLE::global_scrollbar_thumb_color, N_GUI_STYLE::global_scrollbar_thumb_corner_r, N_GUI_STYLE::global_scrollbar_thumb_min, N_GUI_STYLE::global_scrollbar_thumb_padding, N_GUI_STYLE::global_scrollbar_track_color, N_GUI_STYLE::grip_color, N_GUI_STYLE::grip_line_thickness, N_GUI_STYLE::grip_size, N_GUI_STYLE::item_height_pad, N_GUI_STYLE::item_selection_inset, N_GUI_STYLE::item_text_padding, N_GUI_STYLE::label_padding, N_GUI_STYLE::link_color_hover, N_GUI_STYLE::link_color_normal, N_GUI_STYLE::link_underline_thickness, N_GUI_STYLE::listbox_default_item_height, N_GUI_STYLE::min_win_h, N_GUI_STYLE::min_win_w, N_GUI_STYLE::radio_circle_border_thickness, N_GUI_STYLE::radio_circle_min_r, N_GUI_STYLE::radio_inner_offset, N_GUI_STYLE::radio_label_gap, N_GUI_STYLE::radiolist_default_item_height, N_GUI_STYLE::scroll_step, N_GUI_STYLE::scrollbar_size, N_GUI_STYLE::scrollbar_thumb_color, N_GUI_STYLE::scrollbar_thumb_corner_r, N_GUI_STYLE::scrollbar_thumb_min, N_GUI_STYLE::scrollbar_thumb_padding, N_GUI_STYLE::scrollbar_track_color, N_GUI_THEME::selection_color, N_GUI_STYLE::slider_handle_border_thickness, N_GUI_STYLE::slider_handle_edge_offset, N_GUI_STYLE::slider_handle_min_r, N_GUI_STYLE::slider_track_border_thickness, N_GUI_STYLE::slider_track_corner_r, N_GUI_STYLE::slider_track_size, N_GUI_STYLE::slider_value_label_offset, N_GUI_CTX::style, N_GUI_THEME::text_active, N_GUI_THEME::text_hover, N_GUI_THEME::text_normal, N_GUI_STYLE::textarea_cursor_blink_period, N_GUI_STYLE::textarea_cursor_width, N_GUI_STYLE::textarea_padding, N_GUI_STYLE::title_max_w_reserve, N_GUI_STYLE::title_padding, and N_GUI_STYLE::titlebar_h.
Here is the call graph for this function:| void n_gui_screen_to_virtual | ( | const N_GUI_CTX * | ctx, |
| float | sx, | ||
| float | sy, | ||
| float * | vx, | ||
| float * | vy | ||
| ) |
convert physical screen coordinates to virtual canvas coordinates.
If virtual canvas is disabled, outputs equal inputs.
| ctx | GUI context |
| sx | screen X (physical pixels) |
| sy | screen Y (physical pixels) |
| vx | output virtual X (may be NULL) |
| vy | output virtual Y (may be NULL) |
convert physical screen coordinates to virtual canvas coordinates.
If virtual canvas is disabled (virtual_w/virtual_h == 0), outputs equal inputs.
Definition at line 5019 of file n_gui.c.
References __n_assert, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.
Referenced by main().
Here is the caller graph for this function:| double n_gui_scrollbar_get_pos | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get scrollbar position
get scrollbar position
| ctx | GUI context |
| widget_id | id of the scrollbar widget |
Definition at line 1808 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_scrollbar_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | track, | ||
| ALLEGRO_BITMAP * | thumb, | ||
| ALLEGRO_BITMAP * | thumb_hover, | ||
| ALLEGRO_BITMAP * | thumb_active | ||
| ) |
set optional bitmap overlays on a scrollbar widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a scrollbar widget.
Definition at line 2430 of file n_gui.c.
References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, n_log, N_GUI_SCROLLBAR_DATA::thumb_active_bitmap, N_GUI_SCROLLBAR_DATA::thumb_bitmap, N_GUI_SCROLLBAR_DATA::thumb_hover_bitmap, N_GUI_SCROLLBAR_DATA::track_bitmap, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_scrollbar_set_pos | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| double | pos | ||
| ) |
set scrollbar position
set scrollbar position
| ctx | GUI context |
| widget_id | id of the scrollbar widget |
| pos | new scroll position |
Definition at line 1822 of file n_gui.c.
References _clamp(), N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_WIDGET::type, and N_GUI_SCROLLBAR_DATA::viewport_size.
Here is the call graph for this function:| void n_gui_scrollbar_set_sizes | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| double | content_size, | ||
| double | viewport_size | ||
| ) |
set scrollbar content and viewport sizes
set scrollbar content and viewport sizes
| ctx | GUI context |
| widget_id | id of the scrollbar widget |
| content_size | total size of the content |
| viewport_size | visible viewport size |
Definition at line 1839 of file n_gui.c.
References _clamp(), N_GUI_SCROLLBAR_DATA::content_size, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SCROLLBAR, N_GUI_SCROLLBAR_DATA::scroll_pos, N_GUI_WIDGET::type, and N_GUI_SCROLLBAR_DATA::viewport_size.
Here is the call graph for this function:| void n_gui_set_display | ( | N_GUI_CTX * | ctx, |
| ALLEGRO_DISPLAY * | display | ||
| ) |
set the display pointer for clipboard operations (copy/paste)
set the display pointer for clipboard operations (copy/paste)
Definition at line 5192 of file n_gui.c.
References __n_assert, display, and N_GUI_CTX::display.
Referenced by main().
Here is the caller graph for this function:| void n_gui_set_display_size | ( | N_GUI_CTX * | ctx, |
| float | w, | ||
| float | h | ||
| ) |
set the display (viewport) size so global scrollbars can be computed.
Call this on startup and whenever the display is resized. When virtual canvas is enabled, also updates the virtual-to-display transform.
set the display (viewport) size so global scrollbars can be computed.
Call on startup and whenever ALLEGRO_EVENT_DISPLAY_RESIZE is received. When virtual canvas is enabled, also recalculates the virtual-to-display transform.
Definition at line 5176 of file n_gui.c.
References __n_assert, N_GUI_CTX::display_h, N_GUI_CTX::display_w, n_gui_apply_adaptive_resize(), N_GUI_RESIZE_ADAPTIVE, n_gui_update_transform(), N_GUI_CTX::resize_mode, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_set_dpi_scale | ( | N_GUI_CTX * | ctx, |
| float | scale | ||
| ) |
set DPI scale factor manually (default is 1.0).
Affects global scrollbar rendering and can be queried by the application.
set DPI scale factor manually (default is 1.0).
Definition at line 5200 of file n_gui.c.
References __n_assert, and N_GUI_CTX::dpi_scale.
| void n_gui_set_focus | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
set keyboard focus to a specific widget (-1 to clear focus)
| ctx | the GUI context |
| widget_id | the widget to focus (-1 to clear focus) |
set keyboard focus to a specific widget (-1 to clear focus)
Pass widget_id = -1 to clear focus. If the widget is a textarea, resets cursor blink timer. Raises the parent window if it exists and is open.
Definition at line 1613 of file n_gui.c.
References __n_assert, N_GUI_TEXTAREA_DATA::cursor_time, N_GUI_WIDGET::data, N_GUI_CTX::focused_widget_id, N_GUI_WIDGET::id, N_GUI_WINDOW::id, list_foreach, LOG_ERR, n_gui_get_widget(), n_gui_raise_window(), N_GUI_STATE_FOCUSED, N_GUI_TYPE_TEXTAREA, N_GUI_WIN_OPEN, n_log, N_GUI_WIDGET::state, N_GUI_WINDOW::state, N_GUI_WIDGET::type, N_GUI_WINDOW::widgets, and N_GUI_CTX::windows.
Referenced by main(), and n_gui_process_event().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_set_resize_mode | ( | N_GUI_CTX * | ctx, |
| int | mode | ||
| ) |
set context-level resize mode: N_GUI_RESIZE_VIRTUAL (default) or N_GUI_RESIZE_ADAPTIVE
set context-level resize mode: N_GUI_RESIZE_VIRTUAL (default) or N_GUI_RESIZE_ADAPTIVE
When switching to ADAPTIVE, the virtual canvas is disabled and normalized coordinates are captured for all existing windows.
Definition at line 5042 of file n_gui.c.
References __n_assert, _n_gui_window_capture_normalized(), N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, list_foreach, mode, N_GUI_RESIZE_ADAPTIVE, N_GUI_CTX::ref_display_h, N_GUI_CTX::ref_display_w, N_GUI_CTX::resize_mode, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, and N_GUI_CTX::windows.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_set_virtual_size | ( | N_GUI_CTX * | ctx, |
| float | w, | ||
| float | h | ||
| ) |
set the virtual canvas size for resolution-independent scaling.
When set (w > 0 && h > 0), all widget coordinates are in virtual space. An ALLEGRO_TRANSFORM is applied during draw and mouse input is reverse- transformed automatically. Pass (0, 0) to disable (identity transform). This is opt-in: the virtual canvas is enabled only when both w and h are > 0, and disabled when both are 0 (legacy behaviour).
set the virtual canvas size for resolution-independent scaling.
When enabled (w > 0 && h > 0), all widget coordinates are treated as virtual pixels. An ALLEGRO_TRANSFORM is applied in n_gui_draw() and mouse input is reverse-transformed in n_gui_process_event(). Pass (0, 0) to disable (identity transform, legacy behaviour).
Definition at line 4974 of file n_gui.c.
References __n_assert, LOG_ERR, n_gui_update_transform(), n_log, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_set_widget_enabled | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | enabled | ||
| ) |
set widget enabled state (0 = disabled: drawn dimmed and ignores all input)
set widget enabled state (0 = disabled: drawn dimmed and ignores all input)
Disabled widgets are drawn dimmed and ignore all mouse/keyboard input.
Definition at line 1592 of file n_gui.c.
References N_GUI_WIDGET::enabled, and n_gui_get_widget().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_set_widget_theme | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| N_GUI_THEME | theme | ||
| ) |
set the theme on a widget
set the theme on a widget
Definition at line 1575 of file n_gui.c.
References n_gui_get_widget(), and N_GUI_WIDGET::theme.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_set_widget_visible | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| int | visible | ||
| ) |
set widget visibility
set widget visibility
Definition at line 1583 of file n_gui.c.
References n_gui_get_widget(), and N_GUI_WIDGET::visible.
Referenced by main(), and n_gui_kvtable_remove_row().
Here is the call graph for this function:
Here is the caller graph for this function:| double n_gui_slider_get_value | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get slider current value
get slider current value
| ctx | GUI context |
| widget_id | id of the slider widget |
Definition at line 1667 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_SLIDER, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_slider_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | track, | ||
| ALLEGRO_BITMAP * | fill, | ||
| ALLEGRO_BITMAP * | handle, | ||
| ALLEGRO_BITMAP * | handle_hover, | ||
| ALLEGRO_BITMAP * | handle_active | ||
| ) |
set optional bitmap overlays on a slider widget.
Pass NULL for any bitmap you don't want to set.
set optional bitmap overlays on a slider widget.
Definition at line 2412 of file n_gui.c.
References N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::fill_bitmap, N_GUI_SLIDER_DATA::handle_active_bitmap, N_GUI_SLIDER_DATA::handle_bitmap, N_GUI_SLIDER_DATA::handle_hover_bitmap, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_SLIDER, n_log, N_GUI_SLIDER_DATA::track_bitmap, and N_GUI_WIDGET::type.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| 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
| ctx | GUI context |
| widget_id | id of the slider widget |
| min_val | new minimum value |
| max_val | new maximum value |
Definition at line 1699 of file n_gui.c.
References _clamp(), _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_SLIDER_DATA::step, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value.
Here is the call graph for this function:| void n_gui_slider_set_step | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| double | step | ||
| ) |
set slider step increment (0 is treated as 1).
Value is re-snapped.
set slider step increment (0 is treated as 1).
0 means continuous (no snapping). When step > 0, the current value is immediately snapped.
| ctx | GUI context |
| widget_id | id of the slider widget |
| step | step increment (0 = continuous) |
Definition at line 1719 of file n_gui.c.
References _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_SLIDER_DATA::step, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value.
Here is the call graph for this function:| void n_gui_slider_set_value | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| double | value | ||
| ) |
set slider value
set slider value
| ctx | GUI context |
| widget_id | id of the slider widget |
| value | new value to set |
Definition at line 1681 of file n_gui.c.
References _clamp(), _slider_snap_value(), N_GUI_WIDGET::data, N_GUI_SLIDER_DATA::max_val, N_GUI_SLIDER_DATA::min_val, n_gui_get_widget(), N_GUI_TYPE_SLIDER, N_GUI_SLIDER_DATA::step, N_GUI_WIDGET::type, and N_GUI_SLIDER_DATA::value.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_tab_add | ( | N_GUI_TAB_PANEL * | panel, |
| const char * | label | ||
| ) |
add a tab to the panel, returns tab index
Definition at line 7742 of file n_gui.c.
References _n_gui_tab_button_clicked(), N_GUI_TAB_PANEL::active_tab, N_GUI_TAB_PANEL::button_h, N_GUI_TAB_PANEL::button_ids, N_GUI_TAB_PANEL::button_w, N_GUI_TAB_PANEL::ctx, n_gui_add_toggle_button(), N_GUI_SHAPE_RECT, N_GUI_TAB_MAX, N_GUI_TAB_PANEL::nb_tabs, N_GUI_TAB_PANEL::parent_window_id, N_GUI_TAB_PANEL::x, and N_GUI_TAB_PANEL::y.
Here is the call graph for this function:| N_GUI_TAB_PANEL * n_gui_tab_create | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | button_w, | ||
| float | button_h, | ||
| void(*)(int, void *) | on_tab_change, | ||
| void * | user_data | ||
| ) |
create a tab panel in an existing window
Definition at line 7720 of file n_gui.c.
References N_GUI_TAB_PANEL::active_tab, N_GUI_TAB_PANEL::button_h, N_GUI_TAB_PANEL::button_ids, N_GUI_TAB_PANEL::button_w, N_GUI_TAB_PANEL::content_window_ids, N_GUI_TAB_PANEL::ctx, Malloc, N_GUI_TAB_MAX, N_GUI_TAB_PANEL::nb_tabs, N_GUI_TAB_PANEL::on_tab_change, N_GUI_TAB_PANEL::parent_window_id, N_GUI_TAB_PANEL::user_data, N_GUI_TAB_PANEL::x, and N_GUI_TAB_PANEL::y.
| void n_gui_tab_free | ( | N_GUI_TAB_PANEL ** | panel | ) |
| int n_gui_tab_get_active | ( | N_GUI_TAB_PANEL * | panel | ) |
get the active tab index
Definition at line 7776 of file n_gui.c.
References N_GUI_TAB_PANEL::active_tab.
| void n_gui_tab_set_active | ( | N_GUI_TAB_PANEL * | panel, |
| int | index | ||
| ) |
set the active tab (toggles buttons, opens/closes content windows)
Definition at line 7762 of file n_gui.c.
References N_GUI_TAB_PANEL::active_tab, N_GUI_TAB_PANEL::button_ids, N_GUI_TAB_PANEL::content_window_ids, N_GUI_TAB_PANEL::ctx, n_gui_button_set_toggled(), n_gui_close_window(), n_gui_open_window(), and N_GUI_TAB_PANEL::nb_tabs.
Referenced by _n_gui_tab_button_clicked().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_tab_set_content_window | ( | N_GUI_TAB_PANEL * | panel, |
| int | tab_index, | ||
| int | window_id | ||
| ) |
associate a content window with a tab
Definition at line 7757 of file n_gui.c.
References N_GUI_TAB_PANEL::content_window_ids, and N_GUI_TAB_PANEL::nb_tabs.
| const char * n_gui_textarea_get_text | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
get text area content
get text area content
| ctx | GUI context |
| widget_id | id of the textarea widget |
Definition at line 1738 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, and N_GUI_WIDGET::type.
Referenced by on_send_click().
Here is the call graph for this function:
Here is the caller graph for this function:| size_t n_gui_textarea_get_text_length | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
return the current text length in bytes (0 if widget is invalid)
return the current text length in bytes (0 if widget is invalid)
| ctx | GUI context |
| widget_id | id of the textarea widget |
Definition at line 2910 of file n_gui.c.
References N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_textarea_scroll_to_bottom | ( | N_GUI_CTX * | ctx, |
| int | widget_id | ||
| ) |
scroll a multiline textarea to the bottom
| ctx | GUI context |
| widget_id | id of the textarea widget |
Definition at line 2810 of file n_gui.c.
References _textarea_content_height(), N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_TEXTAREA_DATA::multiline, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_CTX::style, N_GUI_TEXTAREA_DATA::text_len, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::type, and N_GUI_WIDGET::w.
Here is the call graph for this function:| 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
| ctx | GUI context |
| widget_id | id of the textarea widget |
| byte_offset | byte offset in text to center on screen |
Definition at line 2849 of file n_gui.c.
References _text_w(), _textarea_content_height(), _utf8_char_len(), N_GUI_WIDGET::data, N_GUI_CTX::default_font, N_GUI_WIDGET::font, N_GUI_WIDGET::h, N_GUI_TEXTAREA_DATA::multiline, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::scroll_from_wheel, N_GUI_TEXTAREA_DATA::scroll_y, N_GUI_STYLE::scrollbar_size, N_GUI_CTX::style, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, N_GUI_STYLE::textarea_padding, N_GUI_WIDGET::type, and N_GUI_WIDGET::w.
Here is the call graph for this function:| void n_gui_textarea_set_bitmap | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| ALLEGRO_BITMAP * | bg | ||
| ) |
set optional background bitmap on a textarea widget.
set optional background bitmap on a textarea widget.
Definition at line 2463 of file n_gui.c.
References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, n_log, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_textarea_set_mask_char | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| char | mask | ||
| ) |
set a mask character for password-style input (e.g.
'*'). Set to '\0' to disable masking. Only affects single-line textareas.
| ctx | the GUI context |
| widget_id | id of the textarea widget |
set a mask character for password-style input (e.g.
| mask | The character to display instead of actual text (e.g. '*'). Set to '\0' to disable masking. |
Definition at line 2477 of file n_gui.c.
References N_GUI_WIDGET::data, LOG_WARNING, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, n_log, and N_GUI_WIDGET::type.
Here is the call graph for this function:| 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)
| ctx | GUI context |
| widget_id | id of the textarea widget |
| start | selection start byte offset |
| end | selection end byte offset |
Definition at line 2832 of file n_gui.c.
References N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::sel_end, N_GUI_TEXTAREA_DATA::sel_start, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_WIDGET::type.
Here is the call graph for this function:| void n_gui_textarea_set_text | ( | N_GUI_CTX * | ctx, |
| int | widget_id, | ||
| const char * | text | ||
| ) |
set text area content
set text area content
| ctx | GUI context |
| widget_id | id of the textarea widget |
| text | the text to set, or NULL to clear |
Definition at line 1752 of file n_gui.c.
References _normalize_crlf(), N_GUI_TEXTAREA_DATA::char_limit, N_GUI_TEXTAREA_DATA::cursor_pos, N_GUI_WIDGET::data, n_gui_get_widget(), N_GUI_TYPE_TEXTAREA, N_GUI_TEXTAREA_DATA::scroll_x, N_GUI_TEXTAREA_DATA::text, N_GUI_TEXTAREA_DATA::text_len, and N_GUI_WIDGET::type.
Referenced by main(), n_gui_kvtable_add_row(), on_clear_click(), on_completion_select(), and on_send_click().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_toggle_window | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
toggle window visibility (show/hide)
toggle window visibility (show/hide)
Definition at line 825 of file n_gui.c.
References n_gui_get_window(), N_GUI_WIN_OPEN, and N_GUI_WINDOW::state.
Referenced by on_window_toggle_click().
Here is the call graph for this function:
Here is the caller graph for this function:| 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
Definition at line 7827 of file n_gui.c.
References N_GUI_TREE_NODE::depth, N_GUI_TREE_NODE::expanded, N_GUI_TREE_NODE::has_children, N_GUI_TREE_NODE::label, N_GUI_TREE_MAX, n_gui_tree_rebuild(), N_GUI_TREE::nb_nodes, N_GUI_TREE::nodes, N_GUI_TREE_NODE::parent_index, and N_GUI_TREE_NODE::user_data.
Here is the call graph for this function:| N_GUI_TREE * n_gui_tree_create | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| void(*)(int, void *) | on_select, | ||
| void * | user_data | ||
| ) |
create a tree view in an existing window
Definition at line 7799 of file n_gui.c.
References _n_gui_tree_listbox_selected(), N_GUI_TREE::ctx, FreeNoLog, N_GUI_TREE::listbox_id, Malloc, n_gui_add_listbox(), N_GUI_SELECT_SINGLE, N_GUI_TREE::nb_nodes, N_GUI_TREE::nb_visible, N_GUI_TREE::on_select, and N_GUI_TREE::user_data.
Here is the call graph for this function:| void n_gui_tree_free | ( | N_GUI_TREE ** | tree | ) |
| void n_gui_tree_rebuild | ( | N_GUI_TREE * | tree | ) |
rebuild the listbox to reflect current tree state
Definition at line 7855 of file n_gui.c.
References _n_gui_tree_node_visible(), N_GUI_TREE::ctx, N_GUI_TREE_NODE::depth, display, N_GUI_TREE_NODE::expanded, N_GUI_TREE_NODE::has_children, N_GUI_TREE_NODE::label, N_GUI_TREE::listbox_id, n_gui_listbox_add_item(), n_gui_listbox_clear(), N_GUI_TREE_MAX, N_GUI_TREE::nb_nodes, N_GUI_TREE::nb_visible, N_GUI_TREE::nodes, and N_GUI_TREE::visible_map.
Referenced by n_gui_tree_add_node(), and n_gui_tree_toggle_expand().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_tree_toggle_expand | ( | N_GUI_TREE * | tree, |
| int | node_index | ||
| ) |
toggle expand/collapse of a node
Definition at line 7848 of file n_gui.c.
References N_GUI_TREE_NODE::expanded, N_GUI_TREE_NODE::has_children, n_gui_tree_rebuild(), N_GUI_TREE::nb_nodes, and N_GUI_TREE::nodes.
Referenced by _n_gui_tree_listbox_selected().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_update_transform | ( | N_GUI_CTX * | ctx | ) |
recalculate scale and offset from virtual canvas to display.
Called automatically by n_gui_set_display_size when virtual canvas is set. You should not normally need to call this directly.
recalculate scale and offset from virtual canvas to display.
Uses uniform (aspect-preserving) scaling with centred letterboxing, identical to the approach used by BlockBlaster's update_view_offset(). Called automatically by n_gui_set_display_size() when virtual canvas is set.
Definition at line 4992 of file n_gui.c.
References __n_assert, N_GUI_CTX::display_h, N_GUI_CTX::display_w, N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_CTX::virtual_h, and N_GUI_CTX::virtual_w.
Referenced by n_gui_set_display_size(), and n_gui_set_virtual_size().
Here is the caller graph for this function:| int n_gui_wants_mouse | ( | N_GUI_CTX * | ctx | ) |
check if the mouse is currently over any open GUI window (use to prevent click-through to the game world)
check if the mouse is currently over any open GUI window (use to prevent click-through to the game world)
Use this to prevent mouse clicks from passing through the GUI to the game.
| ctx | the GUI context |
Definition at line 7344 of file n_gui.c.
References __n_assert, _point_in_rect(), _win_tbh(), N_GUI_CTX::gui_offset_x, N_GUI_CTX::gui_offset_y, N_GUI_CTX::gui_scale, N_GUI_WINDOW::h, list_foreach, N_GUI_CTX::mouse_x, N_GUI_CTX::mouse_y, N_GUI_WIN_MINIMISED, N_GUI_WIN_OPEN, N_GUI_WINDOW::state, N_GUI_CTX::virtual_h, N_GUI_CTX::virtual_w, N_GUI_WINDOW::w, N_GUI_CTX::windows, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_window_apply_autofit | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
trigger auto-fit recalculation for a window (call after adding/removing/resizing widgets)
| ctx | the GUI context |
| window_id | the window to recalculate |
trigger auto-fit recalculation for a window (call after adding/removing/resizing widgets)
Computes content bounding box from visible widgets and adjusts window dimensions based on autofit_flags and autofit_border.
Definition at line 910 of file n_gui.c.
References __n_assert, _win_tbh(), N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WINDOW::autofit_origin_x, N_GUI_WINDOW::autofit_origin_y, N_GUI_WINDOW::content_h, N_GUI_WINDOW::content_w, N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, N_GUI_AUTOFIT_CENTER, N_GUI_AUTOFIT_EXPAND_LEFT, N_GUI_AUTOFIT_EXPAND_UP, N_GUI_AUTOFIT_H, N_GUI_AUTOFIT_W, n_gui_get_window(), N_GUI_WIDGET::visible, N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_WIDGET::x, N_GUI_WINDOW::x, N_GUI_WIDGET::y, and N_GUI_WINDOW::y.
Referenced by main(), and n_gui_draw().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_window_autosize | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
recompute and apply minimum-fit size for a window based on its current widgets
recompute and apply minimum-fit size for a window based on its current widgets
Adds padding around the furthest widget extents.
Definition at line 862 of file n_gui.c.
References _win_tbh(), N_GUI_WIDGET::h, N_GUI_WINDOW::h, list_foreach, N_GUI_WINDOW::min_h, N_GUI_WINDOW::min_w, n_gui_get_window(), N_GUI_WIDGET::w, N_GUI_WINDOW::w, N_GUI_WINDOW::widgets, N_GUI_WIDGET::x, and N_GUI_WIDGET::y.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int n_gui_window_get_flags | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
get feature flags of a window
get feature flags of a window
Definition at line 852 of file n_gui.c.
References N_GUI_WINDOW::flags, and n_gui_get_window().
Here is the call graph for this function:| int n_gui_window_get_resize_policy | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
get per-window resize policy
get per-window resize policy
Definition at line 5094 of file n_gui.c.
References __n_assert, n_gui_get_window(), and N_GUI_WINDOW::resize_policy.
Here is the call graph for this function:| int n_gui_window_get_zorder | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
get window z-order mode
get window z-order mode
Definition at line 796 of file n_gui.c.
References __n_assert, n_gui_get_window(), N_GUI_ZORDER_NORMAL, and N_GUI_WINDOW::z_order.
Here is the call graph for this function:| int n_gui_window_get_zvalue | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
get window z-value (for N_GUI_ZORDER_FIXED mode)
get window z-value (for N_GUI_ZORDER_FIXED mode)
Definition at line 806 of file n_gui.c.
References __n_assert, n_gui_get_window(), and N_GUI_WINDOW::z_value.
Here is the call graph for this function:| int n_gui_window_is_open | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
check if window is visible
check if window is visible
Definition at line 834 of file n_gui.c.
References n_gui_get_window(), N_GUI_WIN_OPEN, and N_GUI_WINDOW::state.
Referenced by on_windows_menu_open().
Here is the call graph for this function:
Here is the caller graph for this function:| 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
| ctx | the GUI context |
| window_id | the window to configure |
| autofit_flags | bitmask of N_GUI_AUTOFIT_W, N_GUI_AUTOFIT_H, N_GUI_AUTOFIT_EXPAND_LEFT, N_GUI_AUTOFIT_EXPAND_UP |
| border | padding in pixels between content bounding box and window edge (on each side) |
configure auto-fit behavior for a dialog window
Store the flags and border value in the window struct.
Definition at line 891 of file n_gui.c.
References __n_assert, N_GUI_WINDOW::autofit_border, N_GUI_WINDOW::autofit_flags, N_GUI_WINDOW::autofit_origin_x, N_GUI_WINDOW::autofit_origin_y, LOG_ERR, n_gui_get_window(), n_log, N_GUI_WINDOW::x, and N_GUI_WINDOW::y.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_window_set_bitmaps | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| ALLEGRO_BITMAP * | bg, | ||
| ALLEGRO_BITMAP * | titlebar, | ||
| int | bg_scale_mode | ||
| ) |
set optional bitmap overlays on a window's body and titlebar.
Pass NULL for any bitmap you don't want to set.
| ctx | the GUI context |
| window_id | id of the target window |
| bg | body background bitmap (NULL = color fill) |
| titlebar | titlebar background bitmap (NULL = color fill) |
| bg_scale_mode | scale mode for bg: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER |
set optional bitmap overlays on a window's body and titlebar.
Definition at line 2397 of file n_gui.c.
References N_GUI_WINDOW::bg_bitmap, N_GUI_WINDOW::bg_scale_mode, LOG_WARNING, n_gui_get_window(), n_log, and N_GUI_WINDOW::titlebar_bitmap.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_window_set_flags | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| int | flags | ||
| ) |
set feature flags on a window (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, ...)
| ctx | the GUI context |
| window_id | id of the target window |
| flags | bitmask of N_GUI_WIN_* flags to set |
set feature flags on a window (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, ...)
Definition at line 843 of file n_gui.c.
References N_GUI_WINDOW::flags, and n_gui_get_window().
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| void n_gui_window_set_resize_policy | ( | N_GUI_CTX * | ctx, |
| int | window_id, | ||
| int | policy | ||
| ) |
set per-window resize policy (N_GUI_WIN_RESIZE_NONE / _MOVE / _SCALE).
Automatically captures normalized coordinates from the window's current position/size relative to the current display size.
set per-window resize policy (N_GUI_WIN_RESIZE_NONE / _MOVE / _SCALE).
Automatically captures normalized coordinates from the window's current position/size relative to the current display size.
Definition at line 5081 of file n_gui.c.
References __n_assert, _n_gui_window_capture_normalized(), n_gui_get_window(), and N_GUI_WINDOW::resize_policy.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| 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
| ctx | the GUI context |
| window_id | the window to configure |
| z_mode | one of N_GUI_ZORDER_NORMAL, N_GUI_ZORDER_ALWAYS_ON_TOP, N_GUI_ZORDER_ALWAYS_BEHIND, N_GUI_ZORDER_FIXED |
| z_value | z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top), ignored for other modes |
set window z-order mode and value
Re-sorts the window list after changing.
Definition at line 779 of file n_gui.c.
References __n_assert, _sort_windows_by_zorder(), LOG_ERR, n_gui_get_window(), N_GUI_ZORDER_ALWAYS_BEHIND, N_GUI_ZORDER_ALWAYS_ON_TOP, N_GUI_ZORDER_FIXED, N_GUI_ZORDER_NORMAL, n_log, N_GUI_WINDOW::z_order, and N_GUI_WINDOW::z_value.
Here is the call graph for this function:| void n_gui_window_update_normalized | ( | N_GUI_CTX * | ctx, |
| int | window_id | ||
| ) |
recapture normalized coordinates for a window from its current absolute position/size.
Call after programmatically moving/resizing a window if you want the new position to be the adaptive reference point.
recapture normalized coordinates for a window from its current absolute position/size.
Call after programmatically moving/resizing a window if you want the new position to be the adaptive reference point.
Definition at line 5107 of file n_gui.c.
References __n_assert, _n_gui_window_capture_normalized(), N_GUI_CTX::display_h, N_GUI_CTX::display_w, n_gui_get_window(), N_GUI_CTX::ref_display_h, and N_GUI_CTX::ref_display_w.
Here is the call graph for this function: