Table of Contents
- N_GUI_DATAGRID_DATA
- Public Attributes
- Public Attributes Documentation
- variable user_data
- variable sort_dir
- variable sort_col
- variable selected_row
- variable scroll_offset
- variable rows_cap
- variable row_sel
- variable row_has_color
- variable row_color
- variable on_select
- variable on_context
- variable on_columns_changed
- variable nb_rows
- variable nb_cols
- variable multiselect
- variable h_scroll_dragging
- variable h_scroll
- variable cols_cap
- variable cols
- variable col_resize_x0
- variable col_resize_w0
- variable col_resize_col
- variable col_order
- variable cells
- variable anchor_row
N_GUI_DATAGRID_DATA
Module: GUI: allegro5 widget system with pseudo-windows
data grid specific data: a sortable column table
#include "n_gui.h"
Public Attributes
| Name | |
|---|---|
| void * | user_data user data for callback |
| int | sort_dir sort direction: 1 ascending, -1 descending |
| int | sort_col column index used for sorting, or -1 |
| int | selected_row selected data row (the primary / last-clicked row), or -1 |
| int | scroll_offset first visible data row |
| size_t | rows_cap allocated row capacity (in rows) |
| unsigned char * | row_sel per-row selection flags (1 = selected), sized rows_cap; NULL until needed |
| unsigned char * | row_has_color per-row tint flags (1 = row_color[row] is painted), sized rows_cap; NULL until a row color is set |
| ALLEGRO_COLOR * | row_color per-row background tint, sized rows_cap; NULL until a row color is set |
| void(*)(int widget_id, int row, void *user_data) | on_select callback on row selection (widget_id, row, user_data) |
| void(*)(int widget_id, int row, int x, int y, void *user_data) | on_context callback on right-click over a data row, for a context menu (widget_id, row, x, y, user_data); x/y are the cursor position in GUI coordinates so the caller can place a popup there. |
| void(*)(int widget_id, void *user_data) | on_columns_changed callback fired after the user resizes a column by dragging its header border (widget_id, user_data), so the host can persist the new layout. |
| size_t | nb_rows number of rows |
| size_t | nb_cols number of columns |
| int | multiselect 1 = multi-row selection enabled (Ctrl/Shift-click), 0 = single-select |
| int | h_scroll_dragging 1 while the user is dragging the horizontal scrollbar thumb (so the shared scrollbar-drag handler routes the drag to h_scroll, not the vertical scroll). |
| float | h_scroll horizontal scroll offset in pixels: how far the columns are scrolled to the left when their total width exceeds the widget's pane. |
| size_t | cols_cap allocated column capacity |
| N_GUI_DATAGRID_COL * | cols column definitions (physical/storage order; cells are indexed by these) |
| float | col_resize_x0 cursor x at the start of a column-resize drag |
| float | col_resize_w0 original width of the column at the start of a resize drag |
| int | col_resize_col physical column being resized by a header-border drag, or -1 |
| size_t * | col_order display order: display_pos -> physical column index (sized cols_cap), or NULL when the display order is still the identity |
| char ** | cells row-major cell strings (nb_rows * nb_cols owned char*) |
| int | anchor_row anchor row for Shift-click range selection, or -1 |
Public Attributes Documentation
variable user_data
void * user_data;
user data for callback
variable sort_dir
int sort_dir;
sort direction: 1 ascending, -1 descending
variable sort_col
int sort_col;
column index used for sorting, or -1
variable selected_row
int selected_row;
selected data row (the primary / last-clicked row), or -1
variable scroll_offset
int scroll_offset;
first visible data row
variable rows_cap
size_t rows_cap;
allocated row capacity (in rows)
variable row_sel
unsigned char * row_sel;
per-row selection flags (1 = selected), sized rows_cap; NULL until needed
variable row_has_color
unsigned char * row_has_color;
per-row tint flags (1 = row_color[row] is painted), sized rows_cap; NULL until a row color is set
variable row_color
ALLEGRO_COLOR * row_color;
per-row background tint, sized rows_cap; NULL until a row color is set
variable on_select
void(*)(int widget_id, int row, void *user_data) on_select;
callback on row selection (widget_id, row, user_data)
variable on_context
void(*)(int widget_id, int row, int x, int y, void *user_data) on_context;
callback on right-click over a data row, for a context menu (widget_id, row, x, y, user_data); x/y are the cursor position in GUI coordinates so the caller can place a popup there.
NULL disables it.
variable on_columns_changed
void(*)(int widget_id, void *user_data) on_columns_changed;
callback fired after the user resizes a column by dragging its header border (widget_id, user_data), so the host can persist the new layout.
NULL disables it.
variable nb_rows
size_t nb_rows;
number of rows
variable nb_cols
size_t nb_cols;
number of columns
variable multiselect
int multiselect;
1 = multi-row selection enabled (Ctrl/Shift-click), 0 = single-select
variable h_scroll_dragging
int h_scroll_dragging;
1 while the user is dragging the horizontal scrollbar thumb (so the shared scrollbar-drag handler routes the drag to h_scroll, not the vertical scroll).
variable h_scroll
float h_scroll;
horizontal scroll offset in pixels: how far the columns are scrolled to the left when their total width exceeds the widget's pane.
0 = leftmost.
variable cols_cap
size_t cols_cap;
allocated column capacity
variable cols
N_GUI_DATAGRID_COL * cols;
column definitions (physical/storage order; cells are indexed by these)
variable col_resize_x0
float col_resize_x0;
cursor x at the start of a column-resize drag
variable col_resize_w0
float col_resize_w0;
original width of the column at the start of a resize drag
variable col_resize_col
int col_resize_col;
physical column being resized by a header-border drag, or -1
variable col_order
size_t * col_order;
display order: display_pos -> physical column index (sized cols_cap), or NULL when the display order is still the identity
variable cells
char ** cells;
row-major cell strings (nb_rows * nb_cols owned char*)
variable anchor_row
int anchor_row;
anchor row for Shift-click range selection, or -1
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