Table of Contents
- N_GUI_WINDOW
- Public Attributes
- Public Attributes Documentation
- variable z_value
- variable z_order
- variable y
- variable x
- variable widgets
- variable wheel_scrollbar
- variable want_native
- variable w
- variable titlebar_h
- variable titlebar_bitmap
- variable title
- variable theme
- variable tb_buttons
- variable state
- variable scroll_y
- variable scroll_x
- variable saved_y
- variable saved_x
- variable saved_w
- variable saved_h
- variable saved_flags
- variable resize_policy
- variable on_content_draw_data
- variable on_content_draw
- variable norm_y
- variable norm_x
- variable norm_w
- variable norm_h
- variable native_w
- variable native_pos_y
- variable native_pos_x
- variable native_halted
- variable native_h
- variable native_drag_wy
- variable native_drag_wx
- variable native_drag_cy
- variable native_drag_cx
- variable native_drag_anchored
- variable native_close_pending
- variable native
- variable min_w
- variable min_h
- variable id
- variable h
- variable font
- variable flags
- variable drag_oy
- variable drag_ox
- variable detach_flags
- variable content_w
- variable content_h
- variable caption
- variable bg_scale_mode
- variable bg_bitmap
- variable autofit_origin_y
- variable autofit_origin_x
- variable autofit_flags
- variable autofit_border
N_GUI_WINDOW
Module: GUI: allegro5 widget system with pseudo-windows
A pseudo window that contains widgets.
#include "n_gui.h"
Public Attributes
| Name | |
|---|---|
| int | z_value z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top) |
| int | z_order z-order mode (N_GUI_ZORDER_NORMAL, _ALWAYS_ON_TOP, _ALWAYS_BEHIND, _FIXED) |
| float | y position y on screen |
| float | x position x on screen |
| LIST * | widgets list of N_GUI_WIDGET* contained in this window |
| int | wheel_scrollbar the scrollbar the wheel moves anywhere over the window when no widget under the pointer takes it, or -1 (the default) for none; set by n_gui_window_set_wheel_scrollbar() |
| int | want_native 1 when the window should live in a native OS window: set by n_gui_window_detach and by a loaded layout, cleared by n_gui_window_attach. |
| float | w window width |
| float | titlebar_h title bar height |
| ALLEGRO_BITMAP * | titlebar_bitmap optional bitmap for the titlebar background (NULL = color fill) |
| char[128] | title window title. |
| N_GUI_THEME | theme color theme for this window chrome |
| N_GUI_TB_BUTTONS | tb_buttons titlebar button state (minimize, maximize, close) |
| int | state state flags (N_GUI_WIN_*) |
| float | scroll_y vertical scroll offset for auto-scrollbar (pixels) |
| float | scroll_x horizontal scroll offset for auto-scrollbar (pixels) |
| float | saved_y embedded y saved by n_gui_window_detach, restored by n_gui_window_attach |
| float | saved_x embedded x saved by n_gui_window_detach, restored by n_gui_window_attach |
| float | saved_w embedded width saved by n_gui_window_detach, restored by n_gui_window_attach |
| float | saved_h embedded height saved by n_gui_window_detach, restored by n_gui_window_attach |
| int | saved_flags embedded feature flags saved by n_gui_window_detach (a detached window is forced frameless because the OS draws the title bar) |
| int | resize_policy per-window resize policy: N_GUI_WIN_RESIZE_NONE, _MOVE, or _SCALE |
| void * | on_content_draw_data user data passed to on_content_draw |
| void(*)(int window_id, void *user_data) | on_content_draw optional callback invoked during n_gui_draw immediately after this window's own content is drawn, at the window's z-order (NULL = none). |
| float | norm_y normalized position y (0.0-1.0 fraction of reference display height) |
| float | norm_x normalized position x (0.0-1.0 fraction of reference display width) |
| float | norm_w normalized width (fraction of reference display width, used in SCALE mode) |
| float | norm_h normalized height (fraction of reference display height, used in SCALE mode) |
| float | native_w last known native window width, 0 until the window is first detached. |
| int | native_pos_y last known native window y position (see native_pos_x) |
| int | native_pos_x last known native window position on the desktop, applied when the native window is re-created. |
| int | native_halted 1 while the native window's drawing is halted. |
| float | native_h last known native window height (see native_w) |
| int | native_drag_wy native window y at the drag grab (see native_drag_wx) |
| int | native_drag_wx native window x at the drag grab, the move is native_drag_wx plus the desktop cursor travel since the grab |
| int | native_drag_cy desktop y of the mouse cursor at the drag grab (see native_drag_cx) |
| int | native_drag_cx desktop x of the mouse cursor when a native (N_GUI_DETACH_OWN_CHROME) title bar drag started. |
| int | native_drag_anchored 1 when the four native_drag_* fields hold a usable grab, that is when al_get_mouse_cursor_position worked. |
| int | native_close_pending 1 when the native window must be released at the next safe point (an ALLEGRO_EVENT_DISPLAY_CLOSE arrived, or the window was closed while detached). |
| ALLEGRO_DISPLAY * | native native OS window backing this pseudo-window, or NULL (the default) when the window is drawn as a pop-up inside the host's main display. |
| float | min_w minimum width |
| float | min_h minimum height |
| int | id unique window id |
| float | h window height |
| ALLEGRO_FONT * | font font for the title bar |
| int | flags feature flags (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, etc.) |
| float | drag_oy drag offset y (internal) |
| float | drag_ox drag offset x (internal) |
| int | detach_flags options the window was detached with (N_GUI_DETACH_*), remembered so a close/open cycle and a restored layout can re-create the same native window |
| float | content_w total content width computed from widgets (internal) |
| float | content_h total content height computed from widgets (internal) |
| char[128] | caption what the title bar shows instead of the title when not empty, set by n_gui_window_set_caption(); never saved in a layout |
| int | bg_scale_mode scale mode for bg_bitmap: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER |
| ALLEGRO_BITMAP * | bg_bitmap optional bitmap for the window body background (NULL = color fill) |
| float | autofit_origin_y original insertion point y for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit) |
| float | autofit_origin_x original insertion point x for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit) |
| int | autofit_flags bitmask of N_GUI_AUTOFIT_* flags (0 = no auto-fitting) |
| float | autofit_border padding/border around content for auto-fit (pixels, applied on each side) |
Public Attributes Documentation
variable z_value
int z_value;
z-value for N_GUI_ZORDER_FIXED mode (lower = behind, higher = on top)
variable z_order
int z_order;
z-order mode (N_GUI_ZORDER_NORMAL, _ALWAYS_ON_TOP, _ALWAYS_BEHIND, _FIXED)
variable y
float y;
position y on screen
variable x
float x;
position x on screen
variable widgets
LIST * widgets;
list of N_GUI_WIDGET* contained in this window
variable wheel_scrollbar
int wheel_scrollbar;
the scrollbar the wheel moves anywhere over the window when no widget under the pointer takes it, or -1 (the default) for none; set by n_gui_window_set_wheel_scrollbar()
variable want_native
int want_native;
1 when the window should live in a native OS window: set by n_gui_window_detach and by a loaded layout, cleared by n_gui_window_attach.
n_gui_open_window re-creates the native window when this is set.
variable w
float w;
window width
variable titlebar_h
float titlebar_h;
title bar height
variable titlebar_bitmap
ALLEGRO_BITMAP * titlebar_bitmap;
optional bitmap for the titlebar background (NULL = color fill)
variable title
char[128] title;
window title.
Also the window's name for the saved layout, which matches windows by it, so it does not change once created
variable theme
N_GUI_THEME theme;
color theme for this window chrome
variable tb_buttons
N_GUI_TB_BUTTONS tb_buttons;
titlebar button state (minimize, maximize, close)
variable state
int state;
state flags (N_GUI_WIN_*)
variable scroll_y
float scroll_y;
vertical scroll offset for auto-scrollbar (pixels)
variable scroll_x
float scroll_x;
horizontal scroll offset for auto-scrollbar (pixels)
variable saved_y
float saved_y;
embedded y saved by n_gui_window_detach, restored by n_gui_window_attach
variable saved_x
float saved_x;
embedded x saved by n_gui_window_detach, restored by n_gui_window_attach
variable saved_w
float saved_w;
embedded width saved by n_gui_window_detach, restored by n_gui_window_attach
variable saved_h
float saved_h;
embedded height saved by n_gui_window_detach, restored by n_gui_window_attach
variable saved_flags
int saved_flags;
embedded feature flags saved by n_gui_window_detach (a detached window is forced frameless because the OS draws the title bar)
variable resize_policy
int resize_policy;
per-window resize policy: N_GUI_WIN_RESIZE_NONE, _MOVE, or _SCALE
variable on_content_draw_data
void * on_content_draw_data;
user data passed to on_content_draw
variable on_content_draw
void(*)(int window_id, void *user_data) on_content_draw;
optional callback invoked during n_gui_draw immediately after this window's own content is drawn, at the window's z-order (NULL = none).
Lets a caller add custom immediate-mode rendering that is correctly occluded by any window drawn on top of this one.
variable norm_y
float norm_y;
normalized position y (0.0-1.0 fraction of reference display height)
variable norm_x
float norm_x;
normalized position x (0.0-1.0 fraction of reference display width)
variable norm_w
float norm_w;
normalized width (fraction of reference display width, used in SCALE mode)
variable norm_h
float norm_h;
normalized height (fraction of reference display height, used in SCALE mode)
variable native_w
float native_w;
last known native window width, 0 until the window is first detached.
Tracked across resizes and persisted, so a re-created native window comes back at the size the user left it rather than at the pop-up's size.
variable native_pos_y
int native_pos_y;
last known native window y position (see native_pos_x)
variable native_pos_x
int native_pos_x;
last known native window position on the desktop, applied when the native window is re-created.
INT_MIN means "unknown, let the OS place it".
variable native_halted
int native_halted;
1 while the native window's drawing is halted.
Set on ALLEGRO_EVENT_DISPLAY_HALT_DRAWING and cleared on RESUME_DRAWING, both acknowledged to Allegro. n_gui_draw_detached skips a halted window: drawing into one is undefined, and on Android the OS has taken the surface away entirely.
variable native_h
float native_h;
last known native window height (see native_w)
variable native_drag_wy
int native_drag_wy;
native window y at the drag grab (see native_drag_wx)
variable native_drag_wx
int native_drag_wx;
native window x at the drag grab, the move is native_drag_wx plus the desktop cursor travel since the grab
variable native_drag_cy
int native_drag_cy;
desktop y of the mouse cursor at the drag grab (see native_drag_cx)
variable native_drag_cx
int native_drag_cx;
desktop x of the mouse cursor when a native (N_GUI_DETACH_OWN_CHROME) title bar drag started.
Desktop coordinates are unaffected by the window moving, so the whole drag is expressed against this single grab point instead of accumulating display-local deltas.
variable native_drag_anchored
int native_drag_anchored;
1 when the four native_drag_* fields hold a usable grab, that is when al_get_mouse_cursor_position worked.
0 falls the drag back to the display-local delta, which is all a platform without desktop cursor coordinates can offer.
variable native_close_pending
int native_close_pending;
1 when the native window must be released at the next safe point (an ALLEGRO_EVENT_DISPLAY_CLOSE arrived, or the window was closed while detached).
Destroying a display from inside event processing would leave already-queued events pointing at freed memory, so n_gui_draw_detached performs the actual release once the queue has been drained.
variable native
ALLEGRO_DISPLAY * native;
native OS window backing this pseudo-window, or NULL (the default) when the window is drawn as a pop-up inside the host's main display.
Set by n_gui_window_detach, cleared by n_gui_window_attach. Owned by the context: n_gui_destroy_ctx destroys any display still attached here.
variable min_w
float min_w;
minimum width
variable min_h
float min_h;
minimum height
variable id
int id;
unique window id
variable h
float h;
window height
variable font
ALLEGRO_FONT * font;
font for the title bar
variable flags
int flags;
feature flags (N_GUI_WIN_AUTO_SCROLLBAR, N_GUI_WIN_RESIZABLE, etc.)
variable drag_oy
float drag_oy;
drag offset y (internal)
variable drag_ox
float drag_ox;
drag offset x (internal)
variable detach_flags
int detach_flags;
options the window was detached with (N_GUI_DETACH_*), remembered so a close/open cycle and a restored layout can re-create the same native window
variable content_w
float content_w;
total content width computed from widgets (internal)
variable content_h
float content_h;
total content height computed from widgets (internal)
variable caption
char[128] caption;
what the title bar shows instead of the title when not empty, set by n_gui_window_set_caption(); never saved in a layout
variable bg_scale_mode
int bg_scale_mode;
scale mode for bg_bitmap: N_GUI_IMAGE_FIT, N_GUI_IMAGE_STRETCH, or N_GUI_IMAGE_CENTER
variable bg_bitmap
ALLEGRO_BITMAP * bg_bitmap;
optional bitmap for the window body background (NULL = color fill)
variable autofit_origin_y
float autofit_origin_y;
original insertion point y for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)
variable autofit_origin_x
float autofit_origin_x;
original insertion point x for N_GUI_AUTOFIT_CENTER (set by n_gui_window_set_autofit)
variable autofit_flags
int autofit_flags;
bitmask of N_GUI_AUTOFIT_* flags (0 = no auto-fitting)
variable autofit_border
float autofit_border;
padding/border around content for auto-fit (pixels, applied on each side)
Modules
- AABB3D
- ACCEPT_POOL
- ALLEGRO4
- ALLEGRO5
- ANIM_LIB
- ASTAR
- ATLAS_LIB
- AVRO
- CLOCK_SYNC
- COMMONS
- CONFIGFILE
- CYPHER_BASE64
- CYPHER_VIGENERE
- DEAD_RECKONING
- ENUMS
- EXCEPTIONS
- GAME_ENV
- GIT
- GUI
- HASH_TABLE
- ISOMETRIC_ENGINE
- LIST
- LOG
- LOGNODUP
- LZ4
- NETWORKING
- NETWORK_MSG
- N_COOKIES
- N_DIFF
- N_DIGEST
- N_DISK_CACHE
- N_DNS
- N_ECC
- N_ENTROPY
- N_FILES
- N_FLUIDS
- N_GUI_COLOR
- N_GUI_COLORWHEEL
- N_GUI_CURVE
- N_GUI_GRID
- N_GUI_POPUP
- N_HEX
- N_HTTP3
- N_HTTP_COOKIE
- N_HTTP_FORM
- N_HTTP_MIME
- N_HTTP_REQ
- N_HTTP_RESP
- N_HTTP_ROUTER
- N_HTTP_SERVER
- N_ICC
- N_JSON
- N_KAFKA
- N_LINALG
- N_MODULE
- N_OPENSSL_COMPAT
- N_PRETTY
- N_PTH
- N_QUERY
- N_RANDOM
- N_SHA256
- N_STR
- N_TIFF
- N_TIME
- N_USER
- N_X509
- N_ZIP
- PARTICLES
- PCRE
- PHYSICS
- SIGNALS
- STACK
- THREADS
- TRAJECTORY
- TREE
- ZLIB