DVX Widget Reference

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/.

Table of Contents

Base WidgetT (Common Properties, Events, and Operations)

Every widget inherits from the WidgetT structure defined in core/dvxWidget.h. The fields and callbacks listed here are available on all widget types.

Common Properties

FieldTypeDescription
namechar[32] Widget name for lookup via wgtFind().
x, y, w, hint32_t Computed geometry relative to the window content area (set by layout).
minW, minHint32_t (tagged) Minimum size hints. Use wgtPixels(), wgtChars(), or wgtPercent(). 0 = auto.
maxW, maxHint32_t (tagged) Maximum size constraints. 0 = no limit.
prefW, prefHint32_t (tagged) Preferred size. 0 = auto.
weightint32_t Extra-space distribution weight. 0 = fixed, 100 = normal. A widget with weight=200 gets twice the extra space of one with weight=100.
alignWidgetAlignE Main-axis alignment for children: AlignStartE, AlignCenterE, AlignEndE.
spacingint32_t (tagged) Spacing between children (containers only). 0 = default.
paddingint32_t (tagged) Internal padding (containers only). 0 = default.
fgColoruint32_t Foreground color override. 0 = use color scheme default.
bgColoruint32_t Background color override. 0 = use color scheme default.
visiblebool Visibility state.
enabledbool Enabled state. Disabled widgets are grayed out and ignore input.
readOnlybool Read-only mode: allows scrolling/selection but blocks editing.
swallowTabbool When true, Tab key goes to the widget instead of navigating focus.
accelKeychar Lowercase accelerator character. 0 if none.
tooltipconst char * Tooltip text. NULL = none. Caller owns the string.
contextMenuMenuT * Right-click context menu. NULL = none. Caller owns.
userDatavoid * Application-defined user data pointer.

Size Specification Macros

MacroDescription
wgtPixels(v)Size in pixels.
wgtChars(v)Size in character widths (multiplied by font charWidth).
wgtPercent(v)Size as a percentage of parent dimension.

Common Events (Callbacks)

These callback function pointers are available on every WidgetT. Set them directly on the widget struct.

CallbackSignatureDescription
onClickvoid (*)(WidgetT *w) Fires on mouse click / activation.
onDblClickvoid (*)(WidgetT *w) Fires on double-click.
onChangevoid (*)(WidgetT *w) Fires when the widget's value changes (text, selection, check state, etc.).
onFocusvoid (*)(WidgetT *w) Fires when the widget receives keyboard focus.
onBlurvoid (*)(WidgetT *w) Fires when the widget loses keyboard focus.
onKeyPressvoid (*)(WidgetT *w, int32_t keyAscii) Fires on a printable key press (ASCII value).
onKeyDownvoid (*)(WidgetT *w, int32_t keyCode, int32_t shift) Fires on key down (scan code + shift state).
onKeyUpvoid (*)(WidgetT *w, int32_t keyCode, int32_t shift) Fires on key up.
onMouseDownvoid (*)(WidgetT *w, int32_t button, int32_t x, int32_t y) Fires on mouse button press.
onMouseUpvoid (*)(WidgetT *w, int32_t button, int32_t x, int32_t y) Fires on mouse button release.
onMouseMovevoid (*)(WidgetT *w, int32_t button, int32_t x, int32_t y) Fires on mouse movement over the widget.
onScrollvoid (*)(WidgetT *w, int32_t delta) Fires on mouse wheel scroll.
onValidatebool (*)(WidgetT *w) Validation callback. Return false to cancel a pending write.

Common Operations

FunctionDescription
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.

AnsiTerm

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.

Header: widgets/widgetAnsiTerm.h

Creation

WidgetT *term = wgtAnsiTerm(parent, 80, 25);

Macros

MacroDescription
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.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ColsIntegerRead-onlyNumber of columns.
RowsIntegerRead-onlyNumber of rows.
ScrollbackIntegerWrite-onlyMaximum scrollback lines.

Methods (BASIC Interface)

MethodDescription
ClearClear the terminal screen.
WriteWrite a string into the terminal.

Events

AnsiTerm uses the common events only. No widget-specific events are defined.

Box (VBox / HBox / Frame)

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.

Header: widgets/widgetBox.h

Creation

MacroDescription
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).

Properties

Box containers use the common WidgetT fields for layout control:

PropertyDescription
alignMain-axis alignment of children. HBox: Start=left, Center=center, End=right. VBox: Start=top, Center=center, End=bottom.
spacingGap between children (tagged size).
paddingInternal padding around children (tagged size).
weightControls how the box itself stretches within its parent.

Events

Containers use the common events only. No widget-specific events.

Button

A push button with a text label. Fires onClick when pressed and released. Supports keyboard activation via accelerator keys.

Header: widgets/widgetButton.h

Creation

WidgetT *btn = wgtButton(parent, "OK");

Macro

MacroDescription
wgtButton(parent, text)Create a push button with the given label text.

Properties

Uses common WidgetT properties. Set accelKey for keyboard shortcut. Use wgtSetText() / wgtGetText() to change the label.

Events

CallbackDescription
onClickFires when the button is clicked (press + release).

Label

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).

Header: widgets/widgetLabel.h

Creation

WidgetT *lbl = wgtLabel(parent, "Name:");

Macros

MacroDescription
wgtLabel(parent, text)Create a text label.
wgtLabelSetAlign(w, align)Set the text alignment (AlignStartE, AlignCenterE, AlignEndE).

Properties

Use wgtSetText() / wgtGetText() to change the text. Set accelKey for accelerator support (focus forwards to next focusable widget).

Events

Labels use the common events only. Typically no callbacks are set on labels.

Properties (BASIC Interface)

PropertyTypeAccessDescription
AlignmentEnum (Left, Center, Right)Read/WriteText alignment within the label.

TextInput / TextArea

Single-line text input, password input, masked input, and multi-line text area with optional syntax colorization, line numbers, find/replace, and gutter decorators.

Header: widgets/widgetTextInput.h

Creation

MacroDescription
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.

Methods (TextArea-specific)

MacroDescription
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.

Events

CallbackDescription
onChangeFires when the text content changes.
onKeyPressFires on each key press (ASCII value).
onValidateCalled before committing a change. Return false to cancel.

Checkbox

A toggle control with a text label. Clicking toggles between checked and unchecked states.

Header: widgets/widgetCheckbox.h

Creation

WidgetT *cb = wgtCheckbox(parent, "Enable logging");

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires when clicked (after toggle).
onChangeFires when the checked state changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ValueBooleanRead/WriteWhether the checkbox is checked.

Radio Button

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.

Header: widgets/widgetRadio.h

Creation

WidgetT *grp = wgtRadioGroup(parent);
WidgetT *r1  = wgtRadio(grp, "Option A");
WidgetT *r2  = wgtRadio(grp, "Option B");

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires on the radio button when clicked.
onChangeFires when the selection changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ValueIntegerRead-onlyIndex of the currently selected radio button in the group.

Methods (BASIC Interface)

MethodDescription
SetSelectedSet the selected radio button by index.

ComboBox

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.

Header: widgets/widgetComboBox.h

Creation

WidgetT *cb = wgtComboBox(parent, 128);
const char *items[] = { "Arial", "Courier", "Times" };
wgtComboBoxSetItems(cb, items, 3);

Macros

MacroDescription
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.

Events

CallbackDescription
onChangeFires when the text or selection changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ListIndexIntegerRead/WriteIndex of the currently selected item.

DataCtrl

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.

Header: widgets/widgetDataCtrl.h

Creation

WidgetT *data = wgtDataCtrl(parent);

Macros

MacroDescription
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).

Properties (BASIC Interface)

PropertyTypeAccessDescription
DatabaseNameStringRead/WritePath to the SQLite database file.
RecordSourceStringRead/WriteSQL query or table name for the result set.
KeyColumnStringRead/WritePrimary key column name (used for UPDATE/DELETE).
MasterSourceStringRead/WriteName of the master Data control for master-detail linking.
MasterFieldStringRead/WriteColumn in the master control to read for the filter value.
DetailFieldStringRead/WriteColumn in this table to filter by the master value.
CaptionStringRead/WriteText displayed on the navigation bar.
BOFBooleanRead-onlyTrue when the cursor is before the first row.
EOFBooleanRead-onlyTrue when the cursor is past the last row.

Methods (BASIC Interface)

MethodDescription
AddNewBegin a new row.
DeleteDelete the current row.
MoveFirstMove to the first row.
MoveLastMove to the last row.
MoveNextMove to the next row.
MovePreviousMove to the previous row.
RefreshRe-execute the query and rebuild the cache.
UpdateWrite pending changes to the database.

Events

EventDescription
RepositionFires when the current row changes (navigation, refresh, etc.). Default event.
ValidateFires before writing changes. Return false to cancel.

DbGrid

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.

Header: widgets/widgetDbGrid.h

Creation

WidgetT *grid = wgtDbGrid(parent);
wgtDbGridSetDataWidget(grid, dataCtrl);

Macros

MacroDescription
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).

Properties (BASIC Interface)

PropertyTypeAccessDescription
GridLinesBooleanRead/WriteWhether to draw grid lines between cells.

Methods (BASIC Interface)

MethodDescription
RefreshRe-read the Data control and repaint.

Events

EventDescription
ClickFires when a row is clicked.
DblClickFires when a row is double-clicked. Default event.

ListBox

A scrollable list of text items. Supports single and multi-selection modes and drag-to-reorder.

Header: widgets/widgetListBox.h

Creation

WidgetT *lb = wgtListBox(parent);
const char *items[] = { "Alpha", "Beta", "Gamma" };
wgtListBoxSetItems(lb, items, 3);

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires when an item is clicked.
onDblClickFires when an item is double-clicked.
onChangeFires when the selection changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ListIndexIntegerRead/WriteIndex of the currently selected item.

Methods (BASIC Interface)

MethodDescription
SelectAllSelect all items.
ClearSelectionDeselect all items.
SetMultiSelectEnable or disable multi-selection.
SetReorderableEnable or disable drag-to-reorder.
IsItemSelectedCheck if a specific item is selected by index.
SetItemSelectedSelect or deselect a specific item by index.

ListView

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).

Header: widgets/widgetListView.h

Creation

WidgetT *lv = wgtListView(parent);
ListViewColT cols[] = {
    { "Name", wgtChars(20), ListViewAlignLeftE },
    { "Size", wgtChars(10), ListViewAlignRightE }
};
wgtListViewSetColumns(lv, cols, 2);
const char *cells[] = { "file.txt", "1234", "readme.md", "5678" };
wgtListViewSetData(lv, cells, 2);

Column Definition

typedef struct {
    const char      *title;
    int32_t          width;   // tagged size (wgtPixels/wgtChars/wgtPercent, 0 = auto)
    ListViewAlignE   align;   // ListViewAlignLeftE, ListViewAlignCenterE, ListViewAlignRightE
} ListViewColT;

Sort Direction

typedef enum {
    ListViewSortNoneE,
    ListViewSortAscE,
    ListViewSortDescE
} ListViewSortE;

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires when a row is clicked.
onDblClickFires when a row is double-clicked.
onChangeFires when the selection changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ListIndexIntegerRead/WriteIndex of the currently selected row.

Methods (BASIC Interface)

MethodDescription
SelectAllSelect all rows.
ClearSelectionDeselect all rows.
SetMultiSelectEnable or disable multi-selection.
SetReorderableEnable or disable drag-to-reorder.
IsItemSelectedCheck if a specific row is selected by index.
SetItemSelectedSelect or deselect a specific row by index.

TreeView

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.

Header: widgets/widgetTreeView.h

Creation

WidgetT *tv    = wgtTreeView(parent);
WidgetT *root  = wgtTreeItem(tv, "Root");
WidgetT *child = wgtTreeItem(root, "Child");

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires when a tree item is clicked.
onDblClickFires when a tree item is double-clicked.
onChangeFires when the selection changes.

Methods (BASIC Interface)

MethodDescription
SetMultiSelectEnable or disable multi-selection.
SetReorderableEnable or disable drag-to-reorder.

Image

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.

Header: widgets/widgetImage.h

Creation

MacroDescription
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.

Methods

MacroDescription
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.

Events

CallbackDescription
onClickFires when the image is clicked.

Properties (BASIC Interface)

PropertyTypeAccessDescription
PictureStringWrite-onlyLoad an image from a file path.
ImageWidthIntegerRead-onlyWidth of the currently loaded image in pixels.
ImageHeightIntegerRead-onlyHeight of the currently loaded image in pixels.

ImageButton

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.

Header: widgets/widgetImageButton.h

Creation

MacroDescription
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.

Methods

MacroDescription
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.

Events

CallbackDescription
onClickFires when the image button is clicked (press + release).

Properties (BASIC Interface)

PropertyTypeAccessDescription
PictureStringWrite-onlyLoad an image from a file path.
ImageWidthIntegerRead-onlyWidth of the currently loaded image in pixels.
ImageHeightIntegerRead-onlyHeight of the currently loaded image in pixels.

Slider

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.

Header: widgets/widgetSlider.h

Creation

WidgetT *sl = wgtSlider(parent, 0, 100);

Macros

MacroDescription
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.

Events

CallbackDescription
onChangeFires when the slider value changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ValueIntegerRead/WriteCurrent slider value.

Spinner

A numeric input with up/down buttons for incrementing and decrementing a value within a range. Supports both integer and floating-point (real) modes.

Header: widgets/widgetSpinner.h

Creation

WidgetT *sp = wgtSpinner(parent, 0, 100, 1);

Macros

MacroDescription
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.

Events

CallbackDescription
onChangeFires when the value changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ValueIntegerRead/WriteCurrent integer value.
RealModeBooleanRead/WriteWhether floating-point mode is active.
DecimalsIntegerRead/WriteNumber of decimal places displayed in real mode.

Methods (BASIC Interface)

MethodDescription
SetRangeSet the integer range (min, max).
SetStepSet the integer step size.

ProgressBar

A visual indicator of progress, displayed as a filled bar. Supports both horizontal and vertical orientations. Value ranges from 0 to 100.

Header: widgets/widgetProgressBar.h

Creation

MacroDescription
wgtProgressBar(parent)Create a horizontal progress bar.
wgtProgressBarV(parent)Create a vertical progress bar.

Methods

MacroDescription
wgtProgressBarSetValue(w, value)Set the progress value (0-100).
wgtProgressBarGetValue(w)Get the current progress value.

Events

ProgressBar is a display-only widget. Typically no callbacks are set.

Properties (BASIC Interface)

PropertyTypeAccessDescription
ValueIntegerRead/WriteCurrent progress value (0-100).

Canvas

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.

Header: widgets/widgetCanvas.h

Creation

WidgetT *cv = wgtCanvas(parent, 320, 200);

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires when the canvas is clicked.
Mouse callback (set via wgtCanvasSetMouseCallback)Fires on mouse down and drag with canvas-local coordinates.

Methods (BASIC Interface)

MethodDescription
ClearClear the canvas to a given color.

Timer

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.

Header: widgets/widgetTimer.h

Creation

WidgetT *tmr = wgtTimer(parent, 1000, true);  // 1 second, repeating
tmr->onClick = onTimerTick;
wgtTimerStart(tmr);

Macros

MacroDescription
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.

Events

CallbackDescription
onClickFires each time the timer elapses.

Properties (BASIC Interface)

PropertyTypeAccessDescription
EnabledBooleanRead/WriteWhether the timer is running. Reading returns the running state; writing starts or stops it.
IntervalIntegerWrite-onlyTimer interval in milliseconds.

Methods (BASIC Interface)

MethodDescription
StartStart the timer.
StopStop the timer.

Extra Events (BASIC Interface)

EventDescription
TimerFires each time the timer elapses. Default event.

Toolbar

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.

Header: widgets/widgetToolbar.h

Creation

WidgetT *tb = wgtToolbar(parent);
wgtImageButtonFromFile(tb, "icons/save.bmp");
wgtImageButtonFromFile(tb, "icons/open.bmp");

Macro

MacroDescription
wgtToolbar(parent)Create a toolbar container.

Properties

Uses common container properties. Add children (buttons, separators, etc.) to populate the toolbar.

Events

Toolbar itself has no widget-specific events. Events fire on the child widgets.

StatusBar

A horizontal bar typically placed at the bottom of a window for displaying status text and informational widgets. Children are laid out horizontally.

Header: widgets/widgetStatusBar.h

Creation

WidgetT *sb = wgtStatusBar(parent);
wgtLabel(sb, "Ready");

Macro

MacroDescription
wgtStatusBar(parent)Create a status bar container.

Properties

Uses common container properties. Add child widgets (labels, progress bars, etc.) to populate.

Events

StatusBar itself has no widget-specific events. Events fire on the child widgets.

ScrollPane

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.

Header: widgets/widgetScrollPane.h

Creation

WidgetT *sp = wgtScrollPane(parent);
WidgetT *content = wgtVBox(sp);
// add children to content...

Macros

MacroDescription
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.

Events

CallbackDescription
onScrollFires when the scroll position changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
NoBorderBooleanRead/WriteWhether the border around the scroll pane is hidden.

Splitter

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.

Header: widgets/widgetSplitter.h

Creation

WidgetT *sp = wgtSplitter(parent, true);  // vertical = left|right
WidgetT *left  = wgtVBox(sp);
WidgetT *right = wgtVBox(sp);

Macros

MacroDescription
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.

Events

CallbackDescription
onChangeFires when the divider position changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
PositionIntegerRead/WriteDivider position in pixels.

TabControl

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.

Header: widgets/widgetTabControl.h

Creation

WidgetT *tabs = wgtTabControl(parent);
WidgetT *page1 = wgtTabPage(tabs, "General");
WidgetT *page2 = wgtTabPage(tabs, "Advanced");
// add children to page1, page2...

Macros

MacroDescription
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.

Events

CallbackDescription
onChangeFires when the active tab changes.

Properties (BASIC Interface)

PropertyTypeAccessDescription
TabIndexIntegerRead/WriteIndex of the currently active tab (0-based).

Methods (BASIC Interface)

MethodDescription
SetActiveSet the active tab by index.

Separator

A visual dividing line used to separate groups of widgets. Available in horizontal and vertical orientations.

Header: widgets/widgetSeparator.h

Creation

MacroDescription
wgtHSeparator(parent)Create a horizontal separator line.
wgtVSeparator(parent)Create a vertical separator line.

Events

Separator is a visual-only widget. No events.

Spacer

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.

Header: widgets/widgetSpacer.h

Creation

WidgetT *row = wgtHBox(parent);
wgtButton(row, "OK");
wgtSpacer(row);           // pushes Cancel to the right
wgtButton(row, "Cancel");

Macro

MacroDescription
wgtSpacer(parent)Create an invisible spacer widget.

Events

Spacer is an invisible layout widget. No events.

WrapBox

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.

Header: widgets/widgetWrapBox.h

Creation

WidgetT *wrap = wgtWrapBox(parent);
wgtButton(wrap, "Tag 1");
wgtButton(wrap, "Tag 2");
wgtButton(wrap, "Tag 3");

Macro

MacroDescription
wgtWrapBox(parent)Create a wrap box container.

Properties

WrapBox uses the common WidgetT container fields for layout control:

PropertyDescription
spacingGap between children in both the horizontal and vertical directions (tagged size). Default is 4 pixels.
paddingInternal padding around children (tagged size). Default is 2 pixels.

Properties (BASIC Interface)

PropertyTypeAccessDescription
AlignmentEnum (Left, Center, Right)Read/WriteRow alignment for rows that do not fill the full width.

Events

WrapBox is a container widget. It uses the common events only. No widget-specific events are defined.


DVX Widget Reference -- Generated from source headers in core/dvxWidget.h and widgets/*.h.