From b8eb83d63fbf1d78d5ed10e09109ac091b957cd1 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Mon, 16 Mar 2026 00:28:36 -0500 Subject: [PATCH] Docs update. --- dvx/README.md | 96 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 92 insertions(+), 4 deletions(-) diff --git a/dvx/README.md b/dvx/README.md index 42c9e5f..efcf718 100644 --- a/dvx/README.md +++ b/dvx/README.md @@ -6,9 +6,9 @@ VESA VBE 2.0+ linear framebuffer. Motif-style beveled chrome, dirty-rectangle compositing, draggable and resizable windows, dropdown menus, scrollbars, and a declarative widget/layout system with buttons, checkboxes, radios, text inputs, dropdowns, combo boxes, -sliders, progress bars, tab controls, tree views, toolbars, status bars, -images, image buttons, drawable canvases, password inputs, masked/formatted -inputs, and an ANSI BBS terminal emulator. +sliders, spinners, progress bars, tab controls, tree views, list views, +scroll panes, toolbars, status bars, images, image buttons, drawable canvases, +password inputs, masked/formatted inputs, and an ANSI BBS terminal emulator. ## Building @@ -515,7 +515,8 @@ be notified. WidgetT *wgtRadioGroup(WidgetT *parent); WidgetT *wgtRadio(WidgetT *parent, const char *text); ``` -Radio buttons. Create a group, then add options as children. The group +Radio buttons with diamond-shaped indicators (visually distinct from +checkboxes). Create a group, then add options as children. The group tracks the selected index in `w->as.radioGroup.selectedIdx`. Set `onChange` on the group to be notified. Radio indices are auto-assigned. @@ -618,6 +619,29 @@ Draggable slider/trackbar. Horizontal by default; set `w->as.slider.vertical = true` after creation for vertical orientation. The thumb tracks the mouse while held. Set `onChange` to be notified. +### Spinner + +```c +WidgetT *wgtSpinner(WidgetT *parent, int32_t minVal, int32_t maxVal, int32_t step); +void wgtSpinnerSetValue(WidgetT *w, int32_t value); +int32_t wgtSpinnerGetValue(const WidgetT *w); +void wgtSpinnerSetRange(WidgetT *w, int32_t minVal, int32_t maxVal); +void wgtSpinnerSetStep(WidgetT *w, int32_t step); +``` +Numeric up/down input field with increment/decrement buttons. The text +area accepts direct keyboard entry of digits (and minus sign when the +minimum is negative). Up/Down arrows increment/decrement by `step`; +Page Up/Page Down by `step * 10`. Enter commits the typed value; Escape +reverts. The value is clamped to `[minVal, maxVal]` on every change. + +Supports all single-line text editing features: cursor movement, selection +(Shift+arrows, Ctrl+A, double/triple-click), clipboard (Ctrl+C/V/X), +and single-level undo (Ctrl+Z). Non-numeric input is filtered out. + +The widget has a sunken text area with up/down arrow buttons on the right. +Clicking the top half of the button area increments; the bottom half +decrements. Set `onChange` to be notified of value changes. + ### TabControl ```c @@ -936,6 +960,70 @@ int32_t wgtListBoxGetSelected(const WidgetT *w); void wgtListBoxSetSelected(WidgetT *w, int32_t idx); ``` +### ListView + +```c +WidgetT *wgtListView(WidgetT *parent); +void wgtListViewSetColumns(WidgetT *w, const ListViewColT *cols, int32_t count); +void wgtListViewSetData(WidgetT *w, const char **cellData, int32_t rowCount); +int32_t wgtListViewGetSelected(const WidgetT *w); +void wgtListViewSetSelected(WidgetT *w, int32_t idx); +``` +Multi-column list with sortable headers, resizable columns, and single or +multi-select support. Column definitions use `ListViewColT`: + +```c +typedef struct { + const char *title; + int32_t width; // tagged size (wgtPixels/wgtChars/wgtPercent) + ListViewAlignE align; // ListViewAlignLeftE, CenterE, or RightE +} ListViewColT; +``` + +Column widths support tagged sizes (`wgtPixels`, `wgtChars`, `wgtPercent`). +Cell data is a flat array of strings in row-major order (row0col0, row0col1, +..., row1col0, ...). Both the column and data arrays must remain valid for +the widget's lifetime. + +Clicking a column header sorts the list. An arrow indicator shows the +current sort direction. Column borders can be dragged to resize. Vertical +and horizontal scrollbars appear automatically when needed. + +```c +void wgtListViewSetSort(WidgetT *w, int32_t col, ListViewSortE dir); +void wgtListViewSetHeaderClickCallback(WidgetT *w, + void (*cb)(WidgetT *w, int32_t col, ListViewSortE dir)); +``` +Programmatic sort control. The header click callback fires after the sort +direction is updated, allowing custom sort logic. + +```c +void wgtListViewSetMultiSelect(WidgetT *w, bool multi); +bool wgtListViewIsItemSelected(const WidgetT *w, int32_t idx); +void wgtListViewSetItemSelected(WidgetT *w, int32_t idx, bool selected); +void wgtListViewSelectAll(WidgetT *w); +void wgtListViewClearSelection(WidgetT *w); +``` +Multi-select mode supports Ctrl+click to toggle individual items and +Shift+click for range selection. Default weight is 100. + +### ScrollPane + +```c +WidgetT *wgtScrollPane(WidgetT *parent); +``` +Scrollable container for child widgets. Children are laid out vertically +(like a VBox) at their natural size. Vertical and horizontal scrollbars +appear automatically when the content exceeds the visible area. + +Mouse clicks on the scrollbar arrows scroll by one line/character; clicks +on the trough scroll by one page. Clicks on the content area are forwarded +to child widgets. Keyboard scrolling: Up/Down arrows, Page Up/Down, +Home/End for vertical; Left/Right arrows for horizontal. + +Set `padding` and `spacing` to control internal layout. Default weight +is 100. + --- ## Types reference (`dvxTypes.h`)