DVX_GUI/docs/dvx_widget_reference.html

1313 lines
68 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Base WidgetT (Common Properties, Events, and Operations)</title>
<style>
body { font-family: sans-serif; margin: 0; padding: 0; display: flex; }
nav { width: 250px; min-width: 250px; background: #f0f0f0; padding: 16px;
border-right: 1px solid #ccc; height: 100vh; overflow-y: auto;
position: sticky; top: 0; box-sizing: border-box; }
nav ul { list-style: none; padding-left: 16px; margin: 4px 0; }
nav > ul { padding-left: 0; }
nav a { text-decoration: none; color: #0066cc; }
nav a:hover { text-decoration: underline; }
main { flex: 1; padding: 24px 32px; max-width: 800px; }
h1 { border-bottom: 2px solid #333; padding-bottom: 4px; }
h2 { border-bottom: 1px solid #999; padding-bottom: 2px; margin-top: 32px; }
h3 { margin-top: 24px; }
pre { background: #f8f8f8; border: 1px solid #ddd; padding: 8px;
overflow-x: auto; font-size: 14px; }
blockquote { background: #fffde7; border-left: 4px solid #ffc107;
padding: 8px 12px; margin: 12px 0; }
hr { border: none; border-top: 1px solid #ccc; margin: 24px 0; }
img { max-width: 100%; }
.topic { margin-bottom: 48px; }
</style>
</head>
<body>
<nav>
<h3>Contents</h3>
<ul>
<li><a href="#widget.base">Base WidgetT</a></li>
<li><a href="#widget.ansiterm">AnsiTerm</a></li>
<li><a href="#widget.box">Layout Containers</a>
<ul>
<li><a href="#widget.box">Box (VBox / HBox / Frame)</a></li>
<li><a href="#widget.button">Button</a></li>
<li><a href="#widget.label">Label</a></li>
</ul>
</li>
<li><a href="#widget.textinput">Input Widgets</a>
<ul>
<li><a href="#widget.textinput">TextInput / TextArea</a></li>
<li><a href="#widget.checkbox">Checkbox</a></li>
<li><a href="#widget.radio">Radio Button</a></li>
<li><a href="#widget.dropdown">Dropdown</a></li>
<li><a href="#widget.combobox">ComboBox</a></li>
</ul>
</li>
<li><a href="#widget.datactrl">Data Widgets</a>
<ul>
<li><a href="#widget.datactrl">DataCtrl</a></li>
<li><a href="#widget.dbgrid">DbGrid</a></li>
<li><a href="#widget.listbox">ListBox</a></li>
<li><a href="#widget.listview">ListView</a></li>
<li><a href="#widget.treeview">TreeView</a></li>
</ul>
</li>
<li><a href="#widget.image">Display Widgets</a>
<ul>
<li><a href="#widget.image">Image</a></li>
<li><a href="#widget.imagebutton">ImageButton</a></li>
<li><a href="#widget.slider">Slider</a></li>
<li><a href="#widget.spinner">Spinner</a></li>
<li><a href="#widget.progressbar">ProgressBar</a></li>
<li><a href="#widget.canvas">Canvas</a></li>
</ul>
</li>
<li><a href="#widget.timer">Non-Visual Widgets</a>
<ul>
<li><a href="#widget.timer">Timer</a></li>
</ul>
</li>
<li><a href="#widget.toolbar">Container Widgets</a>
<ul>
<li><a href="#widget.toolbar">Toolbar</a></li>
<li><a href="#widget.statusbar">StatusBar</a></li>
<li><a href="#widget.scrollpane">ScrollPane</a></li>
<li><a href="#widget.splitter">Splitter</a></li>
<li><a href="#widget.tabcontrol">TabControl</a></li>
<li><a href="#widget.separator">Separator</a></li>
<li><a href="#widget.spacer">Spacer</a></li>
<li><a href="#widget.wrapbox">WrapBox</a></li>
</ul>
</li>
</ul>
<h3>Index</h3>
<ul>
<li><a href="#widget.base">WidgetT</a></li>
<li><a href="#widget.base">Widget Base</a></li>
<li><a href="#widget.base">Common Properties</a></li>
<li><a href="#widget.base">Common Events</a></li>
<li><a href="#widget.base">wgtPixels</a></li>
<li><a href="#widget.base">wgtChars</a></li>
<li><a href="#widget.base">wgtPercent</a></li>
<li><a href="#widget.base">onClick</a></li>
<li><a href="#widget.base">onChange</a></li>
<li><a href="#widget.base">onKeyPress</a></li>
<li><a href="#widget.base">onKeyDown</a></li>
<li><a href="#widget.base">onMouseDown</a></li>
<li><a href="#widget.base">wgtInitWindow</a></li>
<li><a href="#widget.base">wgtGetContext</a></li>
<li><a href="#widget.base">wgtInvalidate</a></li>
<li><a href="#widget.base">wgtSetText</a></li>
<li><a href="#widget.base">wgtGetText</a></li>
<li><a href="#widget.base">wgtSetEnabled</a></li>
<li><a href="#widget.base">wgtSetFocused</a></li>
<li><a href="#widget.base">wgtSetVisible</a></li>
<li><a href="#widget.base">wgtFind</a></li>
<li><a href="#widget.base">wgtDestroy</a></li>
<li><a href="#widget.ansiterm">AnsiTerm</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTerm</a></li>
<li><a href="#widget.ansiterm">Terminal</a></li>
<li><a href="#widget.ansiterm">VT100</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTermWrite</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTermClear</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTermSetComm</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTermSetScrollback</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTermPoll</a></li>
<li><a href="#widget.ansiterm">wgtAnsiTermRepaint</a></li>
<li><a href="#widget.box">VBox</a></li>
<li><a href="#widget.box">HBox</a></li>
<li><a href="#widget.box">Frame</a></li>
<li><a href="#widget.box">wgtVBox</a></li>
<li><a href="#widget.box">wgtHBox</a></li>
<li><a href="#widget.box">wgtFrame</a></li>
<li><a href="#widget.box">Layout</a></li>
<li><a href="#widget.button">Button</a></li>
<li><a href="#widget.button">wgtButton</a></li>
<li><a href="#widget.label">Label</a></li>
<li><a href="#widget.label">wgtLabel</a></li>
<li><a href="#widget.label">wgtLabelSetAlign</a></li>
<li><a href="#widget.textinput">TextInput</a></li>
<li><a href="#widget.textinput">TextArea</a></li>
<li><a href="#widget.textinput">wgtTextInput</a></li>
<li><a href="#widget.textinput">wgtTextArea</a></li>
<li><a href="#widget.textinput">wgtPasswordInput</a></li>
<li><a href="#widget.textinput">wgtMaskedInput</a></li>
<li><a href="#widget.textinput">wgtTextAreaSetColorize</a></li>
<li><a href="#widget.textinput">wgtTextAreaGoToLine</a></li>
<li><a href="#widget.textinput">wgtTextAreaSetAutoIndent</a></li>
<li><a href="#widget.textinput">wgtTextAreaSetShowLineNumbers</a></li>
<li><a href="#widget.textinput">wgtTextAreaFindNext</a></li>
<li><a href="#widget.textinput">wgtTextAreaReplaceAll</a></li>
<li><a href="#widget.checkbox">Checkbox</a></li>
<li><a href="#widget.checkbox">wgtCheckbox</a></li>
<li><a href="#widget.checkbox">wgtCheckboxIsChecked</a></li>
<li><a href="#widget.checkbox">wgtCheckboxSetChecked</a></li>
<li><a href="#widget.radio">Radio</a></li>
<li><a href="#widget.radio">RadioGroup</a></li>
<li><a href="#widget.radio">wgtRadio</a></li>
<li><a href="#widget.radio">wgtRadioGroup</a></li>
<li><a href="#widget.radio">wgtRadioGroupSetSelected</a></li>
<li><a href="#widget.radio">wgtRadioGetIndex</a></li>
<li><a href="#widget.dropdown">Dropdown</a></li>
<li><a href="#widget.dropdown">wgtDropdown</a></li>
<li><a href="#widget.dropdown">wgtDropdownSetItems</a></li>
<li><a href="#widget.dropdown">wgtDropdownGetSelected</a></li>
<li><a href="#widget.dropdown">wgtDropdownSetSelected</a></li>
<li><a href="#widget.combobox">ComboBox</a></li>
<li><a href="#widget.combobox">wgtComboBox</a></li>
<li><a href="#widget.combobox">wgtComboBoxSetItems</a></li>
<li><a href="#widget.combobox">wgtComboBoxGetSelected</a></li>
<li><a href="#widget.combobox">wgtComboBoxSetSelected</a></li>
<li><a href="#widget.datactrl">DataCtrl</a></li>
<li><a href="#widget.datactrl">wgtDataCtrl</a></li>
<li><a href="#widget.datactrl">Database Binding</a></li>
<li><a href="#widget.datactrl">Master-Detail</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlRefresh</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlMoveFirst</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlMoveNext</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlGetField</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlSetField</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlUpdate</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlAddNew</a></li>
<li><a href="#widget.datactrl">wgtDataCtrlDelete</a></li>
<li><a href="#widget.dbgrid">DbGrid</a></li>
<li><a href="#widget.dbgrid">wgtDbGrid</a></li>
<li><a href="#widget.dbgrid">wgtDbGridSetDataWidget</a></li>
<li><a href="#widget.dbgrid">Database Grid</a></li>
<li><a href="#widget.dbgrid">wgtDbGridRefresh</a></li>
<li><a href="#widget.dbgrid">wgtDbGridSetColumnVisible</a></li>
<li><a href="#widget.dbgrid">wgtDbGridSetColumnHeader</a></li>
<li><a href="#widget.dbgrid">wgtDbGridSetColumnWidth</a></li>
<li><a href="#widget.dbgrid">wgtDbGridGetSelectedRow</a></li>
<li><a href="#widget.listbox">ListBox</a></li>
<li><a href="#widget.listbox">wgtListBox</a></li>
<li><a href="#widget.listbox">wgtListBoxSetItems</a></li>
<li><a href="#widget.listbox">wgtListBoxGetSelected</a></li>
<li><a href="#widget.listbox">wgtListBoxSetSelected</a></li>
<li><a href="#widget.listbox">wgtListBoxSetMultiSelect</a></li>
<li><a href="#widget.listbox">wgtListBoxIsItemSelected</a></li>
<li><a href="#widget.listbox">wgtListBoxSetReorderable</a></li>
<li><a href="#widget.listbox">wgtListBoxSelectAll</a></li>
<li><a href="#widget.listbox">wgtListBoxClearSelection</a></li>
<li><a href="#widget.listview">ListView</a></li>
<li><a href="#widget.listview">wgtListView</a></li>
<li><a href="#widget.listview">wgtListViewSetColumns</a></li>
<li><a href="#widget.listview">wgtListViewSetData</a></li>
<li><a href="#widget.listview">ListViewColT</a></li>
<li><a href="#widget.listview">ListViewSortE</a></li>
<li><a href="#widget.listview">wgtListViewGetSelected</a></li>
<li><a href="#widget.listview">wgtListViewSetSelected</a></li>
<li><a href="#widget.listview">wgtListViewSetSort</a></li>
<li><a href="#widget.listview">wgtListViewSetHeaderClickCallback</a></li>
<li><a href="#widget.listview">wgtListViewSetMultiSelect</a></li>
<li><a href="#widget.listview">wgtListViewSelectAll</a></li>
<li><a href="#widget.listview">wgtListViewClearSelection</a></li>
<li><a href="#widget.listview">wgtListViewSetReorderable</a></li>
<li><a href="#widget.treeview">TreeView</a></li>
<li><a href="#widget.treeview">TreeItem</a></li>
<li><a href="#widget.treeview">wgtTreeView</a></li>
<li><a href="#widget.treeview">wgtTreeItem</a></li>
<li><a href="#widget.treeview">wgtTreeViewGetSelected</a></li>
<li><a href="#widget.treeview">wgtTreeViewSetSelected</a></li>
<li><a href="#widget.treeview">wgtTreeViewSetMultiSelect</a></li>
<li><a href="#widget.treeview">wgtTreeViewSetReorderable</a></li>
<li><a href="#widget.treeview">wgtTreeItemSetExpanded</a></li>
<li><a href="#widget.treeview">wgtTreeItemIsExpanded</a></li>
<li><a href="#widget.treeview">wgtTreeItemIsSelected</a></li>
<li><a href="#widget.treeview">wgtTreeItemSetSelected</a></li>
<li><a href="#widget.image">Image</a></li>
<li><a href="#widget.image">wgtImage</a></li>
<li><a href="#widget.image">wgtImageFromFile</a></li>
<li><a href="#widget.image">wgtImageSetData</a></li>
<li><a href="#widget.image">wgtImageLoadFile</a></li>
<li><a href="#widget.imagebutton">ImageButton</a></li>
<li><a href="#widget.imagebutton">wgtImageButton</a></li>
<li><a href="#widget.imagebutton">wgtImageButtonFromFile</a></li>
<li><a href="#widget.imagebutton">wgtImageButtonSetData</a></li>
<li><a href="#widget.imagebutton">wgtImageButtonLoadFile</a></li>
<li><a href="#widget.slider">Slider</a></li>
<li><a href="#widget.slider">wgtSlider</a></li>
<li><a href="#widget.slider">wgtSliderSetValue</a></li>
<li><a href="#widget.slider">wgtSliderGetValue</a></li>
<li><a href="#widget.spinner">Spinner</a></li>
<li><a href="#widget.spinner">wgtSpinner</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetValue</a></li>
<li><a href="#widget.spinner">wgtSpinnerGetValue</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetRealMode</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetRange</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetStep</a></li>
<li><a href="#widget.spinner">wgtSpinnerGetRealValue</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetRealValue</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetRealRange</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetRealStep</a></li>
<li><a href="#widget.spinner">wgtSpinnerSetDecimals</a></li>
<li><a href="#widget.progressbar">ProgressBar</a></li>
<li><a href="#widget.progressbar">wgtProgressBar</a></li>
<li><a href="#widget.progressbar">wgtProgressBarV</a></li>
<li><a href="#widget.progressbar">wgtProgressBarSetValue</a></li>
<li><a href="#widget.progressbar">wgtProgressBarGetValue</a></li>
<li><a href="#widget.canvas">Canvas</a></li>
<li><a href="#widget.canvas">wgtCanvas</a></li>
<li><a href="#widget.canvas">wgtCanvasClear</a></li>
<li><a href="#widget.canvas">wgtCanvasDrawLine</a></li>
<li><a href="#widget.canvas">wgtCanvasDrawRect</a></li>
<li><a href="#widget.canvas">wgtCanvasFillRect</a></li>
<li><a href="#widget.canvas">wgtCanvasFillCircle</a></li>
<li><a href="#widget.canvas">wgtCanvasSetPixel</a></li>
<li><a href="#widget.canvas">wgtCanvasGetPixel</a></li>
<li><a href="#widget.canvas">wgtCanvasDrawText</a></li>
<li><a href="#widget.canvas">wgtCanvasSave</a></li>
<li><a href="#widget.canvas">wgtCanvasLoad</a></li>
<li><a href="#widget.canvas">wgtCanvasSetPenColor</a></li>
<li><a href="#widget.canvas">wgtCanvasSetPenSize</a></li>
<li><a href="#widget.canvas">wgtCanvasSetMouseCallback</a></li>
<li><a href="#widget.timer">Timer</a></li>
<li><a href="#widget.timer">wgtTimer</a></li>
<li><a href="#widget.timer">wgtTimerStart</a></li>
<li><a href="#widget.timer">wgtTimerStop</a></li>
<li><a href="#widget.timer">wgtTimerSetInterval</a></li>
<li><a href="#widget.timer">wgtTimerIsRunning</a></li>
<li><a href="#widget.timer">wgtUpdateTimers</a></li>
<li><a href="#widget.toolbar">Toolbar</a></li>
<li><a href="#widget.toolbar">wgtToolbar</a></li>
<li><a href="#widget.statusbar">StatusBar</a></li>
<li><a href="#widget.statusbar">wgtStatusBar</a></li>
<li><a href="#widget.scrollpane">ScrollPane</a></li>
<li><a href="#widget.scrollpane">wgtScrollPane</a></li>
<li><a href="#widget.scrollpane">wgtScrollPaneScrollToChild</a></li>
<li><a href="#widget.scrollpane">wgtScrollPaneSetNoBorder</a></li>
<li><a href="#widget.splitter">Splitter</a></li>
<li><a href="#widget.splitter">wgtSplitter</a></li>
<li><a href="#widget.splitter">wgtSplitterSetPos</a></li>
<li><a href="#widget.splitter">wgtSplitterGetPos</a></li>
<li><a href="#widget.tabcontrol">TabControl</a></li>
<li><a href="#widget.tabcontrol">TabPage</a></li>
<li><a href="#widget.tabcontrol">wgtTabControl</a></li>
<li><a href="#widget.tabcontrol">wgtTabPage</a></li>
<li><a href="#widget.tabcontrol">wgtTabControlSetActive</a></li>
<li><a href="#widget.tabcontrol">wgtTabControlGetActive</a></li>
<li><a href="#widget.separator">Separator</a></li>
<li><a href="#widget.separator">wgtHSeparator</a></li>
<li><a href="#widget.separator">wgtVSeparator</a></li>
<li><a href="#widget.spacer">Spacer</a></li>
<li><a href="#widget.spacer">wgtSpacer</a></li>
<li><a href="#widget.wrapbox">WrapBox</a></li>
<li><a href="#widget.wrapbox">wgtWrapBox</a></li>
</ul>
</nav>
<main>
<div class="topic" id="widget.base">
<h1>Base WidgetT (Common Properties, Events, and Operations)</h1>
<h2>DVX Widget Reference</h2>
<p>Complete reference for the DVX GUI widget toolkit. All widgets are
implemented as dynamically loaded DXE modules. They are created via
convenience macros that wrap the per-widget API function tables. The base
WidgetT structure is defined in core/dvxWidget.h; individual widget headers
live in widgets/.</p>
<h3>Base WidgetT (Common Properties, Events, and Operations)</h3>
<p>Every widget inherits from the WidgetT structure defined in
core/dvxWidget.h. The fields and callbacks listed here are available on all
widget types.</p>
<h4>Common Properties</h4>
<pre> Field Type Description
----- ---- -----------
name char[32] Widget name for lookup via wgtFind().
x, y, w, h int32_t Computed geometry relative to the window content area (set by layout).
minW, minH int32_t (tagged) Minimum size hints. Use wgtPixels(), wgtChars(), or wgtPercent(). 0 = auto.
maxW, maxH int32_t (tagged) Maximum size constraints. 0 = no limit.
prefW, prefH int32_t (tagged) Preferred size. 0 = auto.
weight int32_t Extra-space distribution weight. 0 = fixed, 100 = normal. A widget with weight=200 gets twice the extra space of one with weight=100.
align WidgetAlignE Main-axis alignment for children: AlignStartE, AlignCenterE, AlignEndE.
spacing int32_t (tagged) Spacing between children (containers only). 0 = default.
padding int32_t (tagged) Internal padding (containers only). 0 = default.
fgColor uint32_t Foreground color override. 0 = use color scheme default.
bgColor uint32_t Background color override. 0 = use color scheme default.
visible bool Visibility state.
enabled bool Enabled state. Disabled widgets are grayed out and ignore input.
readOnly bool Read-only mode: allows scrolling/selection but blocks editing.
swallowTab bool When true, Tab key goes to the widget instead of navigating focus.
accelKey char Lowercase accelerator character. 0 if none.
tooltip const char * Tooltip text. NULL = none. Caller owns the string.
contextMenu MenuT * Right-click context menu. NULL = none. Caller owns.
userData void * Application-defined user data pointer.</pre>
<h4>Size Specification Macros</h4>
<pre> Macro Description
----- -----------
wgtPixels(v) Size in pixels.
wgtChars(v) Size in character widths (multiplied by font charWidth).
wgtPercent(v) Size as a percentage of parent dimension.</pre>
<h4>Common Events (Callbacks)</h4>
<p>These callback function pointers are available on every WidgetT. Set them
directly on the widget struct.</p>
<pre> Callback Signature Description
-------- --------- -----------
onClick void (*)(WidgetT *w) Fires on mouse click / activation.
onDblClick void (*)(WidgetT *w) Fires on double-click.
onChange void (*)(WidgetT *w) Fires when the widget's value changes (text, selection, check state, etc.).
onFocus void (*)(WidgetT *w) Fires when the widget receives keyboard focus.
onBlur void (*)(WidgetT *w) Fires when the widget loses keyboard focus.
onKeyPress void (*)(WidgetT *w, int32_t keyAscii) Fires on a printable key press (ASCII value).
onKeyDown void (*)(WidgetT *w, int32_t keyCode, int32_t shift) Fires on key down (scan code + shift state).
onKeyUp void (*)(WidgetT *w, int32_t keyCode, int32_t shift) Fires on key up.
onMouseDown void (*)(WidgetT *w, int32_t button, int32_t x, int32_t y) Fires on mouse button press.
onMouseUp void (*)(WidgetT *w, int32_t button, int32_t x, int32_t y) Fires on mouse button release.
onMouseMove void (*)(WidgetT *w, int32_t button, int32_t x, int32_t y) Fires on mouse movement over the widget.
onScroll void (*)(WidgetT *w, int32_t delta) Fires on mouse wheel scroll.
onValidate bool (*)(WidgetT *w) Validation callback. Return false to cancel a pending write.</pre>
<h4>Common Operations</h4>
<pre> Function Description
-------- -----------
WidgetT *wgtInitWindow(AppContextT *ctx, WindowT *win) Initialize widgets for a window. Returns the root VBox container.
AppContextT *wgtGetContext(const WidgetT *w) Walk up from any widget to retrieve the AppContextT.
void wgtInvalidate(WidgetT *w) Mark widget for re-layout and repaint. Propagates to ancestors.
void wgtInvalidatePaint(WidgetT *w) Mark widget for repaint only (no layout recalculation).
void wgtSetText(WidgetT *w, const char *text) Set widget text (label, button, textinput, etc.).
const char *wgtGetText(const WidgetT *w) Get widget text.
void wgtSetEnabled(WidgetT *w, bool enabled) Enable or disable a widget.
void wgtSetReadOnly(WidgetT *w, bool readOnly) Set read-only mode.
void wgtSetFocused(WidgetT *w) Set keyboard focus to a widget.
WidgetT *wgtGetFocused(void) Get the currently focused widget.
void wgtSetVisible(WidgetT *w, bool visible) Show or hide a widget.
void wgtSetName(WidgetT *w, const char *name) Set widget name for lookup.
WidgetT *wgtFind(WidgetT *root, const char *name) Find a widget by name in the subtree.
void wgtDestroy(WidgetT *w) Destroy a widget and all its children.
void wgtSetTooltip(WidgetT *w, const char *text) Set tooltip text. Pass NULL to remove.</pre>
<hr>
</div>
<div class="topic" id="widget.ansiterm">
<h1>AnsiTerm</h1>
<h3>AnsiTerm</h3>
<p>A VT100/ANSI-compatible terminal emulator widget designed for connecting to
BBS systems over the serial link. Uses a traditional text-mode cell buffer
(character + attribute byte pairs) with the CP437 character set and 16-color
CGA palette. Supports cursor movement, screen/line erase, scrolling regions,
SGR colors, and scrollback history. Communication is abstracted through
read/write function pointers, allowing the terminal to work with raw serial
ports, the secLink encrypted channel, or any other byte-oriented transport.</p>
<p>Header: widgets/widgetAnsiTerm.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *term = wgtAnsiTerm(parent, 80, 25);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtAnsiTerm(parent, cols, rows) Create an ANSI terminal widget with the given column and row dimensions.
wgtAnsiTermWrite(w, data, len) Write raw bytes into the terminal's ANSI parser. data is a const uint8_t * buffer, len is the byte count.
wgtAnsiTermClear(w) Clear the terminal screen and reset the cursor to the home position.
wgtAnsiTermSetComm(w, ctx, readFn, writeFn) Attach a communication channel. readFn and writeFn are I/O callbacks; ctx is passed as their first argument.
wgtAnsiTermSetScrollback(w, maxLines) Set the maximum number of scrollback lines. Lines scrolled off the top are saved in a circular buffer.
wgtAnsiTermPoll(w) Poll the communication channel for incoming data and feed it into the ANSI parser.
wgtAnsiTermRepaint(w, outY, outH) Fast repaint path that renders dirty rows directly into the window's content buffer, bypassing the widget pipeline. Returns the dirty region via outY/outH.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Cols Integer Read-only Number of columns.
Rows Integer Read-only Number of rows.
Scrollback Integer Write-only Maximum scrollback lines.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
Clear Clear the terminal screen.
Write Write a string into the terminal.</pre>
<h4>Events</h4>
<p>AnsiTerm uses the common events only. No widget-specific events are defined.</p>
<hr>
</div>
<div class="topic" id="widget.box">
<h1>Box (VBox / HBox / Frame)</h1>
<h3>Box (VBox / HBox / Frame)</h3>
<p>Container widgets that arrange their children in a vertical column (VBox),
horizontal row (HBox), or a titled group box (Frame). These are the primary
layout building blocks. Children are laid out using a flexbox-like algorithm
with weight-based extra-space distribution.</p>
<p>Header: widgets/widgetBox.h</p>
<h4>Creation</h4>
<pre> Macro Description
----- -----------
wgtVBox(parent) Create a vertical box container. Children are stacked top to bottom.
wgtHBox(parent) Create a horizontal box container. Children are placed left to right.
wgtFrame(parent, title) Create a titled group box (a VBox with a border and label).</pre>
<h4>Properties</h4>
<p>Box containers use the common WidgetT fields for layout control:</p>
<pre> Property Description
-------- -----------
align Main-axis alignment of children. HBox: Start=left, Center=center, End=right. VBox: Start=top, Center=center, End=bottom.
spacing Gap between children (tagged size).
padding Internal padding around children (tagged size).
weight Controls how the box itself stretches within its parent.</pre>
<h4>Events</h4>
<p>Containers use the common events only. No widget-specific events.</p>
<hr>
</div>
<div class="topic" id="widget.button">
<h1>Button</h1>
<h3>Button</h3>
<p>A push button with a text label. Fires onClick when pressed and released.
Supports keyboard activation via accelerator keys.</p>
<p>Header: widgets/widgetButton.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *btn = wgtButton(parent, &quot;OK&quot;);</code></pre>
<h4>Macro</h4>
<pre> Macro Description
----- -----------
wgtButton(parent, text) Create a push button with the given label text.</pre>
<h4>Properties</h4>
<p>Uses common WidgetT properties. Set accelKey for keyboard shortcut. Use
wgtSetText() / wgtGetText() to change the label.</p>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when the button is clicked (press + release).</pre>
<hr>
</div>
<div class="topic" id="widget.label">
<h1>Label</h1>
<h3>Label</h3>
<p>A static text label. Does not accept keyboard focus. Typically used to
describe other widgets. Supports text alignment and accelerator keys (with
WCLASS_FOCUS_FORWARD, the accelerator moves focus to the next focusable
sibling).</p>
<p>Header: widgets/widgetLabel.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *lbl = wgtLabel(parent, &quot;Name:&quot;);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtLabel(parent, text) Create a text label.
wgtLabelSetAlign(w, align) Set the text alignment (AlignStartE, AlignCenterE, AlignEndE).</pre>
<h4>Properties</h4>
<p>Use wgtSetText() / wgtGetText() to change the text. Set accelKey for
accelerator support (focus forwards to next focusable widget).</p>
<h4>Events</h4>
<p>Labels use the common events only. Typically no callbacks are set on labels.</p>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Alignment Enum (Left, Center, Right) Read/Write Text alignment within the label.</pre>
<hr>
</div>
<div class="topic" id="widget.textinput">
<h1>TextInput / TextArea</h1>
<h3>TextInput / TextArea</h3>
<p>Single-line text input, password input, masked input, and multi-line text
area with optional syntax colorization, line numbers, find/replace, and
gutter decorators.</p>
<p>Header: widgets/widgetTextInput.h</p>
<h4>Creation</h4>
<pre> Macro Description
----- -----------
wgtTextInput(parent, maxLen) Create a single-line text input. maxLen is the maximum number of characters.
wgtPasswordInput(parent, maxLen) Create a password input (characters displayed as bullets).
wgtMaskedInput(parent, mask) Create a masked input field. The mask string defines the input format.
wgtTextArea(parent, maxLen) Create a multi-line text area.</pre>
<h4>Methods (TextArea-specific)</h4>
<pre> Macro Description
----- -----------
wgtTextAreaSetColorize(w, fn, ctx) Set a syntax colorization callback. The callback receives each line and fills a color index array. Color indices: 0=default, 1=keyword, 2=string, 3=comment, 4=number, 5=operator, 6=type/builtin, 7=reserved.
wgtTextAreaGoToLine(w, line) Scroll to and place the cursor on the given line number.
wgtTextAreaSetAutoIndent(w, enable) Enable or disable automatic indentation on newline.
wgtTextAreaSetShowLineNumbers(w, show) Show or hide line numbers in the gutter.
wgtTextAreaSetCaptureTabs(w, capture) When true, Tab key inserts a tab/spaces instead of moving focus.
wgtTextAreaSetTabWidth(w, width) Set the tab stop width in characters.
wgtTextAreaSetUseTabChar(w, useChar) When true, insert literal tab characters; when false, insert spaces.
wgtTextAreaFindNext(w, needle, caseSens, fwd) Search for the next occurrence. Returns true if found.
wgtTextAreaReplaceAll(w, needle, repl, caseSens) Replace all occurrences. Returns the number of replacements made.
wgtTextAreaSetLineDecorator(w, fn, ctx) Set a gutter line decorator callback. The callback returns a color and receives the line number, a color output pointer, and the user context.
wgtTextAreaGetCursorLine(w) Get the current cursor line number.
wgtTextAreaSetGutterClick(w, fn) Set a callback for gutter clicks (e.g. for breakpoint toggling). Callback receives the widget and line number.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the text content changes.
onKeyPress Fires on each key press (ASCII value).
onValidate Called before committing a change. Return false to cancel.</pre>
<hr>
</div>
<div class="topic" id="widget.checkbox">
<h1>Checkbox</h1>
<h3>Checkbox</h3>
<p>A toggle control with a text label. Clicking toggles between checked and
unchecked states.</p>
<p>Header: widgets/widgetCheckbox.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *cb = wgtCheckbox(parent, &quot;Enable logging&quot;);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtCheckbox(parent, text) Create a checkbox with the given label text.
wgtCheckboxIsChecked(w) Returns true if the checkbox is checked.
wgtCheckboxSetChecked(w, checked) Set the checked state programmatically.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when clicked (after toggle).
onChange Fires when the checked state changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Value Boolean Read/Write Whether the checkbox is checked.</pre>
<hr>
</div>
<div class="topic" id="widget.radio">
<h1>Radio Button</h1>
<h3>Radio Button</h3>
<p>A mutually exclusive selection control. Radio buttons must be placed inside
a radio group container. Only one radio button within a group can be
selected at a time.</p>
<p>Header: widgets/widgetRadio.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *grp = wgtRadioGroup(parent);
WidgetT *r1 = wgtRadio(grp, &quot;Option A&quot;);
WidgetT *r2 = wgtRadio(grp, &quot;Option B&quot;);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtRadioGroup(parent) Create a radio group container.
wgtRadio(parent, text) Create a radio button inside a group.
wgtRadioGroupSetSelected(w, idx) Set the selected radio button by index within the group.
wgtRadioGetIndex(w) Get the index of the currently selected radio button.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires on the radio button when clicked.
onChange Fires when the selection changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Value Integer Read-only Index of the currently selected radio button in the group.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
SetSelected Set the selected radio button by index.</pre>
<hr>
</div>
<div class="topic" id="widget.dropdown">
<h1>Dropdown</h1>
<h3>Dropdown</h3>
<p>A drop-down list that displays a single selected item and expands to show
all options when clicked. Read-only selection (the user cannot type into
it).</p>
<p>Header: widgets/widgetDropdown.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *dd = wgtDropdown(parent);
const char *items[] = { &quot;Red&quot;, &quot;Green&quot;, &quot;Blue&quot; };
wgtDropdownSetItems(dd, items, 3);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtDropdown(parent) Create a dropdown list.
wgtDropdownSetItems(w, items, count) Set the list of items. items is a const char ** array.
wgtDropdownGetSelected(w) Get the index of the selected item (-1 if none).
wgtDropdownSetSelected(w, idx) Set the selected item by index.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the selected item changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
ListIndex Integer Read/Write Index of the currently selected item.</pre>
<hr>
</div>
<div class="topic" id="widget.combobox">
<h1>ComboBox</h1>
<h3>ComboBox</h3>
<p>A combination of a text input and a dropdown list. The user can either type
a value or select from a list of predefined options. Unlike Dropdown, the
text field is editable.</p>
<p>Header: widgets/widgetComboBox.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *cb = wgtComboBox(parent, 128);
const char *items[] = { &quot;Arial&quot;, &quot;Courier&quot;, &quot;Times&quot; };
wgtComboBoxSetItems(cb, items, 3);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtComboBox(parent, maxLen) Create a combo box. maxLen is the maximum text input length.
wgtComboBoxSetItems(w, items, count) Set the dropdown items.
wgtComboBoxGetSelected(w) Get the index of the selected item (-1 if the text does not match any item).
wgtComboBoxSetSelected(w, idx) Set the selected item by index.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the text or selection changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
ListIndex Integer Read/Write Index of the currently selected item.</pre>
<hr>
</div>
<div class="topic" id="widget.datactrl">
<h1>DataCtrl</h1>
<h3>DataCtrl</h3>
<p>A VB3-style Data control for database binding. Displays a visible navigation
bar that connects to a SQLite database via dvxSql* functions. Reads all rows
from the RecordSource query into an in-memory cache for bidirectional
navigation. Fires Reposition events when the cursor moves so bound controls
can update. Supports master-detail linking between Data controls.</p>
<p>Header: widgets/widgetDataCtrl.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *data = wgtDataCtrl(parent);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtDataCtrl(parent) Create a Data control.
wgtDataCtrlRefresh(w) Re-execute the RecordSource query and rebuild the row cache.
wgtDataCtrlMoveFirst(w) Move the cursor to the first row.
wgtDataCtrlMovePrev(w) Move the cursor to the previous row.
wgtDataCtrlMoveNext(w) Move the cursor to the next row.
wgtDataCtrlMoveLast(w) Move the cursor to the last row.
wgtDataCtrlGetField(w, colName) Get the value of a column in the current row. Returns const char *.
wgtDataCtrlSetField(w, colName, value) Set the value of a column in the current row (marks the row dirty).
wgtDataCtrlUpdateRow(w) Write the current row's pending changes back to the database.
wgtDataCtrlUpdate(w) Flush all pending changes to the database.
wgtDataCtrlAddNew(w) Begin a new row. Sets dirty state; call Update to commit.
wgtDataCtrlDelete(w) Delete the current row from the database.
wgtDataCtrlSetMasterValue(w, val) Set the master-detail filter value for this control.
wgtDataCtrlGetRowCount(w) Get the total number of cached rows.
wgtDataCtrlGetColCount(w) Get the number of columns in the result set.
wgtDataCtrlGetColName(w, col) Get the name of a column by index. Returns const char *.
wgtDataCtrlGetCellText(w, row, col) Get the text of a specific cell by row and column index. Returns const char *.
wgtDataCtrlSetCurrentRow(w, row) Set the current row by index (0-based).</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
DatabaseName String Read/Write Path to the SQLite database file.
RecordSource String Read/Write SQL query or table name for the result set.
KeyColumn String Read/Write Primary key column name (used for UPDATE/DELETE).
MasterSource String Read/Write Name of the master Data control for master-detail linking.
MasterField String Read/Write Column in the master control to read for the filter value.
DetailField String Read/Write Column in this table to filter by the master value.
Caption String Read/Write Text displayed on the navigation bar.
BOF Boolean Read-only True when the cursor is before the first row.
EOF Boolean Read-only True when the cursor is past the last row.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
AddNew Begin a new row.
Delete Delete the current row.
MoveFirst Move to the first row.
MoveLast Move to the last row.
MoveNext Move to the next row.
MovePrevious Move to the previous row.
Refresh Re-execute the query and rebuild the cache.
Update Write pending changes to the database.</pre>
<h4>Events</h4>
<pre> Event Description
----- -----------
Reposition Fires when the current row changes (navigation, refresh, etc.). Default event.
Validate Fires before writing changes. Return false to cancel.</pre>
<hr>
</div>
<div class="topic" id="widget.dbgrid">
<h1>DbGrid</h1>
<h3>DbGrid</h3>
<p>A database grid widget that displays all records from a Data control in a
scrollable, sortable table. Columns auto-populate from the Data control's
column names and can be hidden, resized, and renamed by the application.
Clicking a column header sorts the display. Selecting a row syncs the Data
control's cursor position. The grid reads directly from the Data control's
cached rows, so there is no separate copy of the data.</p>
<p>Header: widgets/widgetDbGrid.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *grid = wgtDbGrid(parent);
wgtDbGridSetDataWidget(grid, dataCtrl);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtDbGrid(parent) Create a database grid widget.
wgtDbGridSetDataWidget(w, dataWidget) Bind the grid to a Data control. The grid reads rows from this widget.
wgtDbGridRefresh(w) Re-read the Data control's state and repaint the grid.
wgtDbGridSetColumnVisible(w, fieldName, visible) Show or hide a column by field name.
wgtDbGridSetColumnHeader(w, fieldName, header) Set a display header for a column (overrides the field name).
wgtDbGridSetColumnWidth(w, fieldName, width) Set the width of a column by field name (tagged size, 0 = auto).
wgtDbGridGetSelectedRow(w) Get the index of the currently selected data row (-1 if none).</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
GridLines Boolean Read/Write Whether to draw grid lines between cells.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
Refresh Re-read the Data control and repaint.</pre>
<h4>Events</h4>
<pre> Event Description
----- -----------
Click Fires when a row is clicked.
DblClick Fires when a row is double-clicked. Default event.</pre>
<hr>
</div>
<div class="topic" id="widget.listbox">
<h1>ListBox</h1>
<h3>ListBox</h3>
<p>A scrollable list of text items. Supports single and multi-selection modes
and drag-to-reorder.</p>
<p>Header: widgets/widgetListBox.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *lb = wgtListBox(parent);
const char *items[] = { &quot;Alpha&quot;, &quot;Beta&quot;, &quot;Gamma&quot; };
wgtListBoxSetItems(lb, items, 3);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtListBox(parent) Create a list box.
wgtListBoxSetItems(w, items, count) Set the list items.
wgtListBoxGetSelected(w) Get the index of the selected item (-1 if none).
wgtListBoxSetSelected(w, idx) Set the selected item by index.
wgtListBoxSetMultiSelect(w, multi) Enable or disable multi-selection mode.
wgtListBoxIsItemSelected(w, idx) Check if a specific item is selected (multi-select mode).
wgtListBoxSetItemSelected(w, idx, selected) Select or deselect a specific item.
wgtListBoxSelectAll(w) Select all items (multi-select mode).
wgtListBoxClearSelection(w) Deselect all items.
wgtListBoxSetReorderable(w, reorderable) Enable drag-to-reorder.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when an item is clicked.
onDblClick Fires when an item is double-clicked.
onChange Fires when the selection changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
ListIndex Integer Read/Write Index of the currently selected item.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
SelectAll Select all items.
ClearSelection Deselect all items.
SetMultiSelect Enable or disable multi-selection.
SetReorderable Enable or disable drag-to-reorder.
IsItemSelected Check if a specific item is selected by index.
SetItemSelected Select or deselect a specific item by index.</pre>
<hr>
</div>
<div class="topic" id="widget.listview">
<h1>ListView</h1>
<h3>ListView</h3>
<p>A multi-column list with sortable headers. Supports single and
multi-selection, column alignment, header click sorting, and
drag-to-reorder. Data is provided as a flat array of strings (row-major
order, one string per cell).</p>
<p>Header: widgets/widgetListView.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *lv = wgtListView(parent);
ListViewColT cols[] = {
{ &quot;Name&quot;, wgtChars(20), ListViewAlignLeftE },
{ &quot;Size&quot;, wgtChars(10), ListViewAlignRightE }
};
wgtListViewSetColumns(lv, cols, 2);
const char *cells[] = { &quot;file.txt&quot;, &quot;1234&quot;, &quot;readme.md&quot;, &quot;5678&quot; };
wgtListViewSetData(lv, cells, 2);</code></pre>
<h4>Column Definition</h4>
<pre><code>typedef struct {
const char *title;
int32_t width; // tagged size (wgtPixels/wgtChars/wgtPercent, 0 = auto)
ListViewAlignE align; // ListViewAlignLeftE, ListViewAlignCenterE, ListViewAlignRightE
} ListViewColT;</code></pre>
<h4>Sort Direction</h4>
<pre><code>typedef enum {
ListViewSortNoneE,
ListViewSortAscE,
ListViewSortDescE
} ListViewSortE;</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtListView(parent) Create a list view.
wgtListViewSetColumns(w, cols, count) Define columns from an array of ListViewColT.
wgtListViewSetData(w, cellData, rowCount) Set row data. cellData is a flat const char ** array of size rowCount * colCount.
wgtListViewGetSelected(w) Get the index of the selected row (-1 if none).
wgtListViewSetSelected(w, idx) Set the selected row by index.
wgtListViewSetSort(w, col, dir) Set the sort column and direction.
wgtListViewSetHeaderClickCallback(w, cb) Set a callback for header clicks. Signature: void (*cb)(WidgetT *w, int32_t col, ListViewSortE dir).
wgtListViewSetMultiSelect(w, multi) Enable or disable multi-selection.
wgtListViewIsItemSelected(w, idx) Check if a specific row is selected.
wgtListViewSetItemSelected(w, idx, selected) Select or deselect a specific row.
wgtListViewSelectAll(w) Select all rows.
wgtListViewClearSelection(w) Deselect all rows.
wgtListViewSetReorderable(w, reorderable) Enable drag-to-reorder of rows.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when a row is clicked.
onDblClick Fires when a row is double-clicked.
onChange Fires when the selection changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
ListIndex Integer Read/Write Index of the currently selected row.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
SelectAll Select all rows.
ClearSelection Deselect all rows.
SetMultiSelect Enable or disable multi-selection.
SetReorderable Enable or disable drag-to-reorder.
IsItemSelected Check if a specific row is selected by index.
SetItemSelected Select or deselect a specific row by index.</pre>
<hr>
</div>
<div class="topic" id="widget.treeview">
<h1>TreeView</h1>
<h3>TreeView</h3>
<p>A hierarchical tree control with expandable/collapsible nodes. Supports
single and multi-selection and drag-to-reorder. Tree items are added as
children of the TreeView or of other tree items to create nested
hierarchies.</p>
<p>Header: widgets/widgetTreeView.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *tv = wgtTreeView(parent);
WidgetT *root = wgtTreeItem(tv, &quot;Root&quot;);
WidgetT *child = wgtTreeItem(root, &quot;Child&quot;);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtTreeView(parent) Create a tree view control.
wgtTreeItem(parent, text) Add a tree item as a child of the tree view or another tree item.
wgtTreeViewGetSelected(w) Get the currently selected tree item (returns WidgetT *, NULL if none).
wgtTreeViewSetSelected(w, item) Set the selected tree item.
wgtTreeViewSetMultiSelect(w, multi) Enable or disable multi-selection.
wgtTreeViewSetReorderable(w, reorderable) Enable drag-to-reorder of items.
wgtTreeItemSetExpanded(w, expanded) Expand or collapse a tree item.
wgtTreeItemIsExpanded(w) Check if a tree item is expanded.
wgtTreeItemIsSelected(w) Check if a tree item is selected (multi-select mode).
wgtTreeItemSetSelected(w, selected) Select or deselect a tree item.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when a tree item is clicked.
onDblClick Fires when a tree item is double-clicked.
onChange Fires when the selection changes.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
SetMultiSelect Enable or disable multi-selection.
SetReorderable Enable or disable drag-to-reorder.</pre>
<hr>
</div>
<div class="topic" id="widget.image">
<h1>Image</h1>
<h3>Image</h3>
<p>Displays a bitmap image. Can be created from raw pixel data or loaded from a
BMP file on disk. The image is rendered at its natural size within the
widget bounds.</p>
<p>Header: widgets/widgetImage.h</p>
<h4>Creation</h4>
<pre> Macro Description
----- -----------
wgtImage(parent, data, w, h, pitch) Create an image widget from raw pixel data. data is a uint8_t * pixel buffer, w/h are dimensions, pitch is bytes per row.
wgtImageFromFile(parent, path) Create an image widget by loading a BMP file from disk.</pre>
<h4>Methods</h4>
<pre> Macro Description
----- -----------
wgtImageSetData(w, data, imgW, imgH, pitch) Replace the displayed image with new raw pixel data.
wgtImageLoadFile(w, path) Replace the displayed image by loading a new file.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when the image is clicked.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Picture String Write-only Load an image from a file path.
ImageWidth Integer Read-only Width of the currently loaded image in pixels.
ImageHeight Integer Read-only Height of the currently loaded image in pixels.</pre>
<hr>
</div>
<div class="topic" id="widget.imagebutton">
<h1>ImageButton</h1>
<h3>ImageButton</h3>
<p>A clickable button that displays an image instead of text. Has press/release
visual feedback like a regular button. Can be created from raw pixel data or
a BMP file.</p>
<p>Header: widgets/widgetImageButton.h</p>
<h4>Creation</h4>
<pre> Macro Description
----- -----------
wgtImageButton(parent, data, w, h, pitch) Create an image button from raw pixel data.
wgtImageButtonFromFile(parent, path) Create an image button by loading a BMP file.</pre>
<h4>Methods</h4>
<pre> Macro Description
----- -----------
wgtImageButtonSetData(w, data, imgW, imgH, pitch) Replace the image with new raw pixel data.
wgtImageButtonLoadFile(w, path) Replace the image by loading a new file.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when the image button is clicked (press + release).</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Picture String Write-only Load an image from a file path.
ImageWidth Integer Read-only Width of the currently loaded image in pixels.
ImageHeight Integer Read-only Height of the currently loaded image in pixels.</pre>
<hr>
</div>
<div class="topic" id="widget.slider">
<h1>Slider</h1>
<h3>Slider</h3>
<p>A horizontal slider (track bar) for selecting an integer value within a
range. The user drags the thumb or clicks the track to change the value.</p>
<p>Header: widgets/widgetSlider.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *sl = wgtSlider(parent, 0, 100);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtSlider(parent, minVal, maxVal) Create a slider with the given integer range.
wgtSliderSetValue(w, value) Set the slider value programmatically.
wgtSliderGetValue(w) Get the current slider value.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the slider value changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Value Integer Read/Write Current slider value.</pre>
<hr>
</div>
<div class="topic" id="widget.spinner">
<h1>Spinner</h1>
<h3>Spinner</h3>
<p>A numeric input with up/down buttons for incrementing and decrementing a
value within a range. Supports both integer and floating-point (real) modes.</p>
<p>Header: widgets/widgetSpinner.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *sp = wgtSpinner(parent, 0, 100, 1);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtSpinner(parent, minVal, maxVal, step) Create a spinner with the given integer range and step size.
wgtSpinnerSetValue(w, value) Set the integer value.
wgtSpinnerGetValue(w) Get the current integer value.
wgtSpinnerSetRange(w, minVal, maxVal) Set the integer range.
wgtSpinnerSetStep(w, step) Set the integer step size.
wgtSpinnerSetRealMode(w, enable) Switch to floating-point mode.
wgtSpinnerGetRealValue(w) Get the current floating-point value.
wgtSpinnerSetRealValue(w, value) Set the floating-point value.
wgtSpinnerSetRealRange(w, minVal, maxVal) Set the floating-point range.
wgtSpinnerSetRealStep(w, step) Set the floating-point step size.
wgtSpinnerSetDecimals(w, decimals) Set the number of decimal places displayed in real mode.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the value changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Value Integer Read/Write Current integer value.
RealMode Boolean Read/Write Whether floating-point mode is active.
Decimals Integer Read/Write Number of decimal places displayed in real mode.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
SetRange Set the integer range (min, max).
SetStep Set the integer step size.</pre>
<hr>
</div>
<div class="topic" id="widget.progressbar">
<h1>ProgressBar</h1>
<h3>ProgressBar</h3>
<p>A visual indicator of progress, displayed as a filled bar. Supports both
horizontal and vertical orientations. Value ranges from 0 to 100.</p>
<p>Header: widgets/widgetProgressBar.h</p>
<h4>Creation</h4>
<pre> Macro Description
----- -----------
wgtProgressBar(parent) Create a horizontal progress bar.
wgtProgressBarV(parent) Create a vertical progress bar.</pre>
<h4>Methods</h4>
<pre> Macro Description
----- -----------
wgtProgressBarSetValue(w, value) Set the progress value (0-100).
wgtProgressBarGetValue(w) Get the current progress value.</pre>
<h4>Events</h4>
<p>ProgressBar is a display-only widget. Typically no callbacks are set.</p>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Value Integer Read/Write Current progress value (0-100).</pre>
<hr>
</div>
<div class="topic" id="widget.canvas">
<h1>Canvas</h1>
<h3>Canvas</h3>
<p>A freeform drawing surface with a fixed-size pixel buffer. Provides drawing
primitives (lines, rectangles, circles, text, individual pixels) and
supports save/load to BMP files. Mouse interaction is available via a
callback.</p>
<p>Header: widgets/widgetCanvas.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *cv = wgtCanvas(parent, 320, 200);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtCanvas(parent, w, h) Create a canvas with the given pixel dimensions.
wgtCanvasClear(w, color) Fill the entire canvas with a solid color.
wgtCanvasSetPenColor(w, color) Set the drawing pen color.
wgtCanvasSetPenSize(w, size) Set the drawing pen size in pixels.
wgtCanvasDrawLine(w, x0, y0, x1, y1) Draw a line from (x0,y0) to (x1,y1).
wgtCanvasDrawRect(w, x, y, width, height) Draw a rectangle outline.
wgtCanvasFillRect(w, x, y, width, height) Draw a filled rectangle.
wgtCanvasFillCircle(w, cx, cy, radius) Draw a filled circle.
wgtCanvasSetPixel(w, x, y, color) Set a single pixel to the given color.
wgtCanvasGetPixel(w, x, y) Get the color of a single pixel.
wgtCanvasDrawText(w, x, y, text) Draw text at the given position using the current pen color.
wgtCanvasSetMouseCallback(w, cb) Set a mouse interaction callback. Signature: void (*cb)(WidgetT *w, int32_t cx, int32_t cy, bool drag). Receives canvas-relative coordinates and whether the mouse is being dragged.
wgtCanvasSave(w, path) Save the canvas contents to a BMP file.
wgtCanvasLoad(w, path) Load a BMP file into the canvas.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires when the canvas is clicked.
Mouse callback (via wgtCanvasSetMouseCallback) Fires on mouse down and drag with canvas-local coordinates.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
Clear Clear the canvas to a given color.</pre>
<hr>
</div>
<div class="topic" id="widget.timer">
<h1>Timer</h1>
<h3>Timer</h3>
<p>A non-visual widget that fires its onClick callback at a regular interval.
Useful for animations, polling, and periodic updates. Must be explicitly
started after creation.</p>
<p>Header: widgets/widgetTimer.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *tmr = wgtTimer(parent, 1000, true); // 1 second, repeating
tmr-&gt;onClick = onTimerTick;
wgtTimerStart(tmr);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtTimer(parent, intervalMs, repeat) Create a timer. intervalMs is the interval in milliseconds. repeat: true for repeating, false for one-shot.
wgtTimerStart(w) Start the timer.
wgtTimerStop(w) Stop the timer.
wgtTimerSetInterval(w, intervalMs) Change the timer interval.
wgtTimerIsRunning(w) Returns true if the timer is currently running.
wgtUpdateTimers() Global tick function. Called by the event loop to advance all active timers.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onClick Fires each time the timer elapses.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Enabled Boolean Read/Write Whether the timer is running. Reading returns the running state; writing starts or stops it.
Interval Integer Write-only Timer interval in milliseconds.</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
Start Start the timer.
Stop Stop the timer.</pre>
<h4>Extra Events (BASIC Interface)</h4>
<pre> Event Description
----- -----------
Timer Fires each time the timer elapses. Default event.</pre>
<hr>
</div>
<div class="topic" id="widget.toolbar">
<h1>Toolbar</h1>
<h3>Toolbar</h3>
<p>A horizontal container for toolbar buttons and controls. Typically placed at
the top of a window. Children (usually ImageButtons or Buttons) are laid out
horizontally with toolbar-appropriate spacing.</p>
<p>Header: widgets/widgetToolbar.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *tb = wgtToolbar(parent);
wgtImageButtonFromFile(tb, &quot;icons/save.bmp&quot;);
wgtImageButtonFromFile(tb, &quot;icons/open.bmp&quot;);</code></pre>
<h4>Macro</h4>
<pre> Macro Description
----- -----------
wgtToolbar(parent) Create a toolbar container.</pre>
<h4>Properties</h4>
<p>Uses common container properties. Add children (buttons, separators, etc.)
to populate the toolbar.</p>
<h4>Events</h4>
<p>Toolbar itself has no widget-specific events. Events fire on the child
widgets.</p>
<hr>
</div>
<div class="topic" id="widget.statusbar">
<h1>StatusBar</h1>
<h3>StatusBar</h3>
<p>A horizontal bar typically placed at the bottom of a window for displaying
status text and informational widgets. Children are laid out horizontally.</p>
<p>Header: widgets/widgetStatusBar.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *sb = wgtStatusBar(parent);
wgtLabel(sb, &quot;Ready&quot;);</code></pre>
<h4>Macro</h4>
<pre> Macro Description
----- -----------
wgtStatusBar(parent) Create a status bar container.</pre>
<h4>Properties</h4>
<p>Uses common container properties. Add child widgets (labels, progress bars,
etc.) to populate.</p>
<h4>Events</h4>
<p>StatusBar itself has no widget-specific events. Events fire on the child
widgets.</p>
<hr>
</div>
<div class="topic" id="widget.scrollpane">
<h1>ScrollPane</h1>
<h3>ScrollPane</h3>
<p>A scrollable container that provides vertical and/or horizontal scrollbars
when its content exceeds the visible area. Place a single child (typically a
VBox or HBox) inside the scroll pane.</p>
<p>Header: widgets/widgetScrollPane.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *sp = wgtScrollPane(parent);
WidgetT *content = wgtVBox(sp);
// add children to content...</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtScrollPane(parent) Create a scroll pane container.
wgtScrollPaneScrollToChild(sp, child) Scroll so that the given child widget is visible.
wgtScrollPaneSetNoBorder(w, noBorder) When true, removes the border around the scroll pane.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onScroll Fires when the scroll position changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
NoBorder Boolean Read/Write Whether the border around the scroll pane is hidden.</pre>
<hr>
</div>
<div class="topic" id="widget.splitter">
<h1>Splitter</h1>
<h3>Splitter</h3>
<p>A two-pane container with a draggable divider. The user drags the splitter
bar to resize the two panes. Can be oriented vertically (left/right panes)
or horizontally (top/bottom panes). Add exactly two children.</p>
<p>Header: widgets/widgetSplitter.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *sp = wgtSplitter(parent, true); // vertical = left|right
WidgetT *left = wgtVBox(sp);
WidgetT *right = wgtVBox(sp);</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtSplitter(parent, vertical) Create a splitter. vertical=true for left/right panes, false for top/bottom.
wgtSplitterSetPos(w, pos) Set the divider position in pixels.
wgtSplitterGetPos(w) Get the current divider position in pixels.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the divider position changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Position Integer Read/Write Divider position in pixels.</pre>
<hr>
</div>
<div class="topic" id="widget.tabcontrol">
<h1>TabControl</h1>
<h3>TabControl</h3>
<p>A tabbed container that displays one page at a time with clickable tabs
along the top. Each tab page is a container that holds its own child
widgets.</p>
<p>Header: widgets/widgetTabControl.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *tabs = wgtTabControl(parent);
WidgetT *page1 = wgtTabPage(tabs, &quot;General&quot;);
WidgetT *page2 = wgtTabPage(tabs, &quot;Advanced&quot;);
// add children to page1, page2...</code></pre>
<h4>Macros</h4>
<pre> Macro Description
----- -----------
wgtTabControl(parent) Create a tab control.
wgtTabPage(parent, title) Add a tab page with the given title. Returns the page container widget.
wgtTabControlSetActive(w, idx) Set the active tab by index (0-based).
wgtTabControlGetActive(w) Get the index of the active tab.</pre>
<h4>Events</h4>
<pre> Callback Description
-------- -----------
onChange Fires when the active tab changes.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
TabIndex Integer Read/Write Index of the currently active tab (0-based).</pre>
<h4>Methods (BASIC Interface)</h4>
<pre> Method Description
------ -----------
SetActive Set the active tab by index.</pre>
<hr>
</div>
<div class="topic" id="widget.separator">
<h1>Separator</h1>
<h3>Separator</h3>
<p>A visual dividing line used to separate groups of widgets. Available in
horizontal and vertical orientations.</p>
<p>Header: widgets/widgetSeparator.h</p>
<h4>Creation</h4>
<pre> Macro Description
----- -----------
wgtHSeparator(parent) Create a horizontal separator line.
wgtVSeparator(parent) Create a vertical separator line.</pre>
<h4>Events</h4>
<p>Separator is a visual-only widget. No events.</p>
<hr>
</div>
<div class="topic" id="widget.spacer">
<h1>Spacer</h1>
<h3>Spacer</h3>
<p>An invisible widget used for layout purposes. By default it has weight=100,
so it absorbs available extra space. Useful for pushing other widgets apart
or aligning them to edges.</p>
<p>Header: widgets/widgetSpacer.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *row = wgtHBox(parent);
wgtButton(row, &quot;OK&quot;);
wgtSpacer(row); // pushes Cancel to the right
wgtButton(row, &quot;Cancel&quot;);</code></pre>
<h4>Macro</h4>
<pre> Macro Description
----- -----------
wgtSpacer(parent) Create an invisible spacer widget.</pre>
<h4>Events</h4>
<p>Spacer is an invisible layout widget. No events.</p>
<hr>
</div>
<div class="topic" id="widget.wrapbox">
<h1>WrapBox</h1>
<h3>WrapBox</h3>
<p>A flow/wrap layout container that arranges children left-to-right, wrapping
to the next row when the available width is exceeded. Each row's height is
the maximum child height in that row. Supports configurable spacing between
items and rows, and per-row alignment for short rows.</p>
<p>Header: widgets/widgetWrapBox.h</p>
<h4>Creation</h4>
<pre><code>WidgetT *wrap = wgtWrapBox(parent);
wgtButton(wrap, &quot;Tag 1&quot;);
wgtButton(wrap, &quot;Tag 2&quot;);
wgtButton(wrap, &quot;Tag 3&quot;);</code></pre>
<h4>Macro</h4>
<pre> Macro Description
----- -----------
wgtWrapBox(parent) Create a wrap box container.</pre>
<h4>Properties</h4>
<p>WrapBox uses the common WidgetT container fields for layout control:</p>
<pre> Property Description
-------- -----------
spacing Gap between children in both the horizontal and vertical directions (tagged size). Default is 4 pixels.
padding Internal padding around children (tagged size). Default is 2 pixels.</pre>
<h4>Properties (BASIC Interface)</h4>
<pre> Property Type Access Description
-------- ---- ------ -----------
Alignment Enum (Left, Center, Right) Read/Write Row alignment for rows that do not fill the full width.</pre>
<h4>Events</h4>
<p>WrapBox is a container widget. It uses the common events only. No
widget-specific events are defined.</p>
</div>
</main>
</body>
</html>