From 5ece172ad0f31b5aa410545e556b0240182a61ab Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Thu, 9 Apr 2026 01:27:40 -0500 Subject: [PATCH] Reorganizing things preparing for next testing release. SDK added! --- Makefile | 74 +- apps/Makefile | 14 +- apps/clock/clock.c | 4 +- apps/cpanel/cpanel.c | 24 +- apps/dvxbasic/Makefile | 2 +- apps/dvxbasic/formrt/formrt.c | 8 +- apps/dvxbasic/formrt/formrt.h | 2 +- apps/dvxbasic/ide/ideDesigner.h | 4 +- apps/dvxbasic/ide/ideMain.c | 36 +- apps/dvxbasic/ide/ideMenuEditor.c | 14 +- apps/dvxbasic/ide/ideProject.c | 16 +- apps/dvxbasic/ide/ideProperties.c | 10 +- apps/dvxbasic/ide/ideToolbox.c | 8 +- apps/dvxbasic/runtime/vm.h | 2 +- apps/dvxdemo/dvxdemo.c | 54 +- apps/dvxhelp/dvxhelp.c | 22 +- apps/imgview/imgview.c | 4 +- apps/notepad/notepad.c | 8 +- apps/progman/progman.c | 26 +- core/Makefile | 16 +- core/dvxApp.c | 14 +- core/dvxApp.h | 4 +- core/dvxComp.c | 2 +- core/{dvxCursor.h => dvxCur.h} | 8 +- core/dvxDialog.c | 24 +- core/{dvxDialog.h => dvxDlg.h} | 8 +- core/dvxDraw.c | 4 +- core/{dvxPalette.h => dvxPal.h} | 8 +- core/{dvxResource.h => dvxRes.h} | 10 +- core/dvxResource.c | 2 +- core/dvxVideo.c | 4 +- core/{dvxWidget.h => dvxWgt.h} | 8 +- core/{dvxWidgetPlugin.h => dvxWgtP.h} | 10 +- core/dvxWm.c | 4 +- core/platform/{dvxPlatform.h => dvxPlat.h} | 8 +- core/platform/dvxPlatformDos.c | 4 +- core/widgetClass.c | 2 +- core/widgetCore.c | 4 +- core/widgetEvent.c | 4 +- core/widgetLayout.c | 2 +- core/widgetOps.c | 6 +- core/widgetScrollbar.c | 2 +- docs/dvx_basic_reference.html | 2824 +++++++++ docs/dvx_help_viewer.html | 175 + docs/dvx_system_reference.html | 5348 +++++++++++++++++ listhelp/Makefile | 2 +- listhelp/listHelp.h | 2 +- loader/Makefile | 4 +- loader/loaderMain.c | 2 +- sdk/readme.txt | 75 + sdk/samples/hello/hello.c | 83 + sdk/samples/hello/hello.res | 22 + sdk/samples/hello/icon32.bmp | 3 + sdk/samples/hello/makefile | 28 + sdk/samples/library/makefile | 23 + sdk/samples/library/mylib.c | 27 + sdk/samples/library/mylib.h | 21 + sdk/samples/widget/icon24.bmp | 3 + sdk/samples/widget/makefile | 27 + sdk/samples/widget/mywgt.c | 239 + sdk/samples/widget/mywgt.res | 15 + shell/Makefile | 4 +- shell/shellApp.c | 4 +- shell/shellApp.h | 4 +- shell/{shellInfo.h => shellInf.h} | 0 shell/shellInfo.c | 4 +- shell/shellMain.c | 6 +- taskmgr/Makefile | 2 +- taskmgr/shellTaskMgr.c | 14 +- tasks/Makefile | 2 +- tasks/{taskswitch.h => taskSwch.h} | 8 +- tasks/taskswitch.c | 2 +- termdemo/Makefile | 2 +- termdemo/termdemo.c | 2 +- texthelp/Makefile | 2 +- texthelp/textHelp.h | 2 +- tools/Makefile | 26 +- tools/dvxres.c | 2 +- widgets/Makefile | 4 +- .../{widgetAnsiTerm.h => ansiTerm/ansiTerm.h} | 10 +- widgets/ansiTerm/widgetAnsiTerm.c | 2 +- widgets/{widgetBox.h => box/box.h} | 10 +- widgets/box/widgetBox.c | 2 +- widgets/{widgetButton.h => button/button.h} | 10 +- widgets/button/widgetButton.c | 2 +- widgets/{widgetCanvas.h => canvas/canvas.h} | 10 +- widgets/canvas/widgetCanvas.c | 2 +- .../{widgetCheckbox.h => checkbox/checkbox.h} | 10 +- widgets/checkbox/widgetCheckbox.c | 2 +- .../{widgetComboBox.h => comboBox/comboBox.h} | 10 +- widgets/comboBox/widgetComboBox.c | 2 +- .../{widgetDataCtrl.h => dataCtrl/dataCtrl.h} | 10 +- widgets/dataCtrl/widgetDataCtrl.c | 2 +- widgets/{widgetDbGrid.h => dbGrid/dbGrid.h} | 10 +- widgets/dbGrid/widgetDbGrid.c | 4 +- .../{widgetDropdown.h => dropdown/dropdown.h} | 10 +- widgets/dropdown/widgetDropdown.c | 2 +- widgets/{widgetImage.h => image/image.h} | 10 +- widgets/image/widgetImage.c | 2 +- .../imgBtn.h} | 10 +- widgets/imageButton/widgetImageButton.c | 2 +- widgets/{widgetLabel.h => label/label.h} | 10 +- widgets/label/widgetLabel.c | 2 +- .../{widgetListBox.h => listBox/listBox.h} | 10 +- widgets/listBox/widgetListBox.c | 2 +- .../{widgetListView.h => listView/listView.h} | 12 +- widgets/listView/widgetListView.c | 2 +- .../progress.h} | 10 +- widgets/progressBar/widgetProgressBar.c | 2 +- widgets/{widgetRadio.h => radio/radio.h} | 10 +- widgets/radio/widgetRadio.c | 2 +- .../scrlPane.h} | 10 +- widgets/scrollPane/widgetScrollPane.c | 2 +- .../separatr.h} | 10 +- widgets/separator/widgetSeparator.c | 2 +- widgets/{widgetSlider.h => slider/slider.h} | 10 +- widgets/slider/widgetSlider.c | 2 +- widgets/{widgetSpacer.h => spacer/spacer.h} | 10 +- widgets/spacer/widgetSpacer.c | 2 +- .../{widgetSpinner.h => spinner/spinner.h} | 10 +- widgets/spinner/widgetSpinner.c | 2 +- .../{widgetSplitter.h => splitter/splitter.h} | 10 +- widgets/splitter/widgetSplitter.c | 2 +- .../statBar.h} | 10 +- widgets/statusBar/widgetStatusBar.c | 2 +- .../tabCtrl.h} | 10 +- widgets/tabControl/widgetTabControl.c | 2 +- .../textInpt.h} | 10 +- widgets/textInput/widgetTextInput.c | 2 +- widgets/{widgetTimer.h => timer/timer.h} | 10 +- widgets/timer/widgetTimer.c | 2 +- .../{widgetToolbar.h => toolbar/toolbar.h} | 10 +- widgets/toolbar/widgetToolbar.c | 2 +- .../{widgetTreeView.h => treeView/treeView.h} | 10 +- widgets/treeView/widgetTreeView.c | 2 +- widgets/wrapBox/widgetWrapBox.c | 2 +- .../{widgetWrapBox.h => wrapBox/wrapBox.h} | 10 +- 137 files changed, 9409 insertions(+), 446 deletions(-) rename core/{dvxCursor.h => dvxCur.h} (99%) rename core/{dvxDialog.h => dvxDlg.h} (97%) rename core/{dvxPalette.h => dvxPal.h} (97%) rename core/{dvxResource.h => dvxRes.h} (94%) rename core/{dvxWidget.h => dvxWgt.h} (99%) rename core/{dvxWidgetPlugin.h => dvxWgtP.h} (97%) rename core/platform/{dvxPlatform.h => dvxPlat.h} (99%) create mode 100644 docs/dvx_basic_reference.html create mode 100644 docs/dvx_help_viewer.html create mode 100644 docs/dvx_system_reference.html create mode 100644 sdk/readme.txt create mode 100644 sdk/samples/hello/hello.c create mode 100644 sdk/samples/hello/hello.res create mode 100644 sdk/samples/hello/icon32.bmp create mode 100644 sdk/samples/hello/makefile create mode 100644 sdk/samples/library/makefile create mode 100644 sdk/samples/library/mylib.c create mode 100644 sdk/samples/library/mylib.h create mode 100644 sdk/samples/widget/icon24.bmp create mode 100644 sdk/samples/widget/makefile create mode 100644 sdk/samples/widget/mywgt.c create mode 100644 sdk/samples/widget/mywgt.res rename shell/{shellInfo.h => shellInf.h} (100%) rename tasks/{taskswitch.h => taskSwch.h} (97%) rename widgets/{widgetAnsiTerm.h => ansiTerm/ansiTerm.h} (89%) rename widgets/{widgetBox.h => box/box.h} (76%) rename widgets/{widgetButton.h => button/button.h} (69%) rename widgets/{widgetCanvas.h => canvas/canvas.h} (94%) rename widgets/{widgetCheckbox.h => checkbox/checkbox.h} (80%) rename widgets/{widgetComboBox.h => comboBox/comboBox.h} (83%) rename widgets/{widgetDataCtrl.h => dataCtrl/dataCtrl.h} (93%) rename widgets/{widgetDbGrid.h => dbGrid/dbGrid.h} (89%) rename widgets/{widgetDropdown.h => dropdown/dropdown.h} (83%) rename widgets/{widgetImage.h => image/image.h} (86%) rename widgets/{widgetImageButton.h => imageButton/imgBtn.h} (85%) rename widgets/{widgetLabel.h => label/label.h} (76%) rename widgets/{widgetListBox.h => listBox/listBox.h} (91%) rename widgets/{widgetListView.h => listView/listView.h} (91%) rename widgets/{widgetProgressBar.h => progressBar/progress.h} (81%) rename widgets/{widgetRadio.h => radio/radio.h} (83%) rename widgets/{widgetScrollPane.h => scrollPane/scrlPane.h} (82%) rename widgets/{widgetSeparator.h => separator/separatr.h} (73%) rename widgets/{widgetSlider.h => slider/slider.h} (80%) rename widgets/{widgetSpacer.h => spacer/spacer.h} (67%) rename widgets/{widgetSpinner.h => spinner/spinner.h} (92%) rename widgets/{widgetSplitter.h => splitter/splitter.h} (79%) rename widgets/{widgetStatusBar.h => statusBar/statBar.h} (67%) rename widgets/{widgetTabControl.h => tabControl/tabCtrl.h} (81%) rename widgets/{widgetTextInput.h => textInput/textInpt.h} (95%) rename widgets/{widgetTimer.h => timer/timer.h} (87%) rename widgets/{widgetToolbar.h => toolbar/toolbar.h} (67%) rename widgets/{widgetTreeView.h => treeView/treeView.h} (91%) rename widgets/{widgetWrapBox.h => wrapBox/wrapBox.h} (70%) diff --git a/Makefile b/Makefile index 5a3bd72..039859b 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,9 @@ # Builds the full DVX stack: core library, task switcher, # bootstrap loader, text help library, widgets, shell, and apps. -.PHONY: all clean core tasks loader texthelp listhelp widgets shell taskmgr serial sql apps tools deploy-helpsrc compile-help +.PHONY: all clean core tasks loader texthelp listhelp widgets shell taskmgr serial sql apps tools deploy-helpsrc compile-help deploy-sdk -all: core tasks loader texthelp listhelp tools widgets shell taskmgr serial sql apps deploy-helpsrc compile-help +all: core tasks loader texthelp listhelp tools widgets shell taskmgr serial sql apps deploy-helpsrc compile-help deploy-sdk core: $(MAKE) -C core @@ -46,23 +46,68 @@ apps: core tasks shell tools deploy-helpsrc: $(MAKE) -C tools deploy-helpsrc -HLPC = bin/dvxhlpc +HLPC = bin/host/dvxhlpc + +SYSTEM_DHS = core/arch.dhs core/apiref.dhs \ + tasks/libtasks.dhs shell/dvxshell.dhs sql/dvxsql.dhs \ + texthelp/texthelp.dhs listhelp/listhelp.dhs \ + taskmgr/taskmgr.dhs serial/serial.dhs \ + apps/dvxbasic/basrt.dhs \ + widgets/wgtsys.dhs + +BASIC_DHS = apps/dvxbasic/ideguide.dhs apps/dvxbasic/langref.dhs \ + apps/dvxbasic/ctrlover.dhs apps/dvxbasic/form.dhs compile-help: - $(HLPC) -o bin/apps/kpunch/dvxhelp/dvxhelp.hlp apps/dvxhelp/help.dhs + @mkdir -p docs + $(HLPC) -o bin/apps/kpunch/dvxhelp/dvxhelp.hlp \ + --html docs/dvx_help_viewer.html \ + apps/dvxhelp/help.dhs $(HLPC) -o bin/apps/kpunch/progman/dvxhelp.hlp \ - core/arch.dhs core/apiref.dhs \ - tasks/libtasks.dhs shell/dvxshell.dhs sql/dvxsql.dhs \ - texthelp/texthelp.dhs listhelp/listhelp.dhs \ - taskmgr/taskmgr.dhs serial/serial.dhs \ - apps/dvxbasic/basrt.dhs \ - widgets/wgtsys.dhs \ + --html docs/dvx_system_reference.html \ + $(SYSTEM_DHS) \ $$(find widgets -name "*.dhs" ! -path "widgets/wgtsys.dhs" | sort) $(HLPC) -o bin/apps/kpunch/dvxbasic/dvxbasic.hlp \ - apps/dvxbasic/ideguide.dhs apps/dvxbasic/langref.dhs \ - apps/dvxbasic/ctrlover.dhs apps/dvxbasic/form.dhs \ + --html docs/dvx_basic_reference.html \ + $(BASIC_DHS) \ $$(find widgets -name "*.bhs" | sort) +SDKDIR = bin/sdk + +deploy-sdk: + @echo "Building SDK..." + @mkdir -p $(SDKDIR)/include/core $(SDKDIR)/include/shell $(SDKDIR)/include/tasks $(SDKDIR)/include/sql + @mkdir -p $(SDKDIR)/samples/hello $(SDKDIR)/samples/widget + @# Core headers + @for f in core/dvxApp.h core/dvxTypes.h core/dvxWgt.h core/dvxWgtP.h \ + core/dvxWm.h core/dvxDraw.h core/dvxVideo.h core/dvxComp.h \ + core/dvxPrefs.h core/dvxDlg.h core/dvxRes.h core/dvxFont.h \ + core/dvxCur.h core/dvxPal.h core/dvxPlat.h; do \ + [ -f "$$f" ] || continue; \ + cp "$$f" $(SDKDIR)/include/core/; \ + done + @# Shell header + @cp shell/shellApp.h $(SDKDIR)/include/shell/ 2>/dev/null || true + @# Tasks header + @for f in tasks/taskSwch.h tasks/taskswitch.h; do \ + [ -f "$$f" ] && cp "$$f" $(SDKDIR)/include/tasks/ && break; \ + done + @# SQL header + @cp sql/dvxSql.h $(SDKDIR)/include/sql/ 2>/dev/null || true + @# Widget headers — one per widget + @for d in widgets/*/; do \ + for h in "$$d"*.h; do \ + [ -f "$$h" ] || continue; \ + base=$$(basename "$$h"); \ + wgt=$$(basename "$$d"); \ + mkdir -p $(SDKDIR)/include/widget/"$$wgt"; \ + cp "$$h" $(SDKDIR)/include/widget/"$$wgt"/; \ + done; \ + done + @# Samples and readme + @cp -r sdk/samples $(SDKDIR)/ + @cp sdk/readme.txt $(SDKDIR)/README.TXT + clean: $(MAKE) -C core clean $(MAKE) -C tasks clean @@ -77,5 +122,6 @@ clean: $(MAKE) -C apps clean $(MAKE) -C tools clean -rmdir obj 2>/dev/null - -rm -rf bin/config bin/widgets bin/libs - -rmdir bin/apps/cpanel bin/apps/imgview bin/apps/progman bin/apps/notepad bin/apps/clock bin/apps/dvxdemo bin/apps bin 2>/dev/null + -rm -rf bin/config bin/widgets bin/libs bin/sdk + -rm -f docs/*.html + -rmdir bin/apps/kpunch/cpanel bin/apps/kpunch/imgview bin/apps/kpunch/progman bin/apps/kpunch/notepad bin/apps/kpunch/clock bin/apps/kpunch/dvxdemo bin/apps/kpunch bin/apps bin 2>/dev/null diff --git a/apps/Makefile b/apps/Makefile index 9553e3d..a228a01 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -8,7 +8,7 @@ CFLAGS = -O2 -Wall -Wextra -Werror -Wno-type-limits -Wno-sign-compare -Wn OBJDIR = ../obj/apps BINDIR = ../bin/apps -DVXRES = ../bin/dvxres +DVXRES = ../bin/host/dvxres # App definitions: each is a subdir with a single .c file APPS = progman notepad clock dvxdemo cpanel imgview dvxhelp @@ -104,12 +104,12 @@ $(BINDIR)/kpunch/dvxhelp: mkdir -p $(BINDIR)/kpunch/dvxhelp # Dependencies -$(OBJDIR)/imgview.o: imgview/imgview.c ../core/dvxApp.h ../core/dvxDialog.h ../core/dvxWidget.h ../core/dvxWm.h ../core/dvxVideo.h ../shell/shellApp.h -$(OBJDIR)/cpanel.o: cpanel/cpanel.c ../core/dvxApp.h ../core/dvxDialog.h ../core/dvxPrefs.h ../core/dvxWidget.h ../core/dvxWm.h ../core/platform/dvxPlatform.h ../shell/shellApp.h -$(OBJDIR)/progman.o: progman/progman.c ../core/dvxApp.h ../core/dvxDialog.h ../core/dvxWidget.h ../core/dvxWm.h ../shell/shellApp.h ../shell/shellInfo.h -$(OBJDIR)/notepad.o: notepad/notepad.c ../core/dvxApp.h ../core/dvxDialog.h ../core/dvxWidget.h ../core/dvxWm.h ../shell/shellApp.h -$(OBJDIR)/clock.o: clock/clock.c ../core/dvxApp.h ../core/dvxWidget.h ../core/dvxDraw.h ../core/dvxVideo.h ../shell/shellApp.h ../tasks/taskswitch.h -$(OBJDIR)/dvxdemo.o: dvxdemo/dvxdemo.c ../core/dvxApp.h ../core/dvxDialog.h ../core/dvxWidget.h ../core/dvxWm.h ../core/dvxVideo.h ../shell/shellApp.h +$(OBJDIR)/imgview.o: imgview/imgview.c ../core/dvxApp.h ../core/dvxDlg.h ../core/dvxWgt.h ../core/dvxWm.h ../core/dvxVideo.h ../shell/shellApp.h +$(OBJDIR)/cpanel.o: cpanel/cpanel.c ../core/dvxApp.h ../core/dvxDlg.h ../core/dvxPrefs.h ../core/dvxWgt.h ../core/dvxWm.h ../core/platform/dvxPlat.h ../shell/shellApp.h +$(OBJDIR)/progman.o: progman/progman.c ../core/dvxApp.h ../core/dvxDlg.h ../core/dvxWgt.h ../core/dvxWm.h ../shell/shellApp.h ../shell/shellInf.h +$(OBJDIR)/notepad.o: notepad/notepad.c ../core/dvxApp.h ../core/dvxDlg.h ../core/dvxWgt.h ../core/dvxWm.h ../shell/shellApp.h +$(OBJDIR)/clock.o: clock/clock.c ../core/dvxApp.h ../core/dvxWgt.h ../core/dvxDraw.h ../core/dvxVideo.h ../shell/shellApp.h ../tasks/taskSwch.h +$(OBJDIR)/dvxdemo.o: dvxdemo/dvxdemo.c ../core/dvxApp.h ../core/dvxDlg.h ../core/dvxWgt.h ../core/dvxWm.h ../core/dvxVideo.h ../shell/shellApp.h clean: rm -f $(OBJDIR)/cpanel.o $(OBJDIR)/imgview.o $(OBJDIR)/progman.o $(OBJDIR)/notepad.o $(OBJDIR)/clock.o $(OBJDIR)/dvxdemo.o diff --git a/apps/clock/clock.c b/apps/clock/clock.c index d15c809..7d0c07a 100644 --- a/apps/clock/clock.c +++ b/apps/clock/clock.c @@ -19,11 +19,11 @@ // would starve the shell and all other apps. #include "dvxApp.h" -#include "dvxWidget.h" +#include "dvxWgt.h" #include "dvxDraw.h" #include "dvxVideo.h" #include "shellApp.h" -#include "taskswitch.h" +#include "taskSwch.h" #include #include diff --git a/apps/cpanel/cpanel.c b/apps/cpanel/cpanel.c index b3c83aa..5db729f 100644 --- a/apps/cpanel/cpanel.c +++ b/apps/cpanel/cpanel.c @@ -10,20 +10,20 @@ // state captured when the control panel was opened. #include "dvxApp.h" -#include "dvxDialog.h" +#include "dvxDlg.h" #include "dvxPrefs.h" -#include "dvxWidget.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetCanvas.h" -#include "widgetDropdown.h" -#include "widgetLabel.h" -#include "widgetListBox.h" -#include "widgetSlider.h" -#include "widgetSpacer.h" -#include "widgetTabControl.h" +#include "dvxWgt.h" +#include "box/box.h" +#include "button/button.h" +#include "canvas/canvas.h" +#include "dropdown/dropdown.h" +#include "label/label.h" +#include "listBox/listBox.h" +#include "slider/slider.h" +#include "spacer/spacer.h" +#include "tabControl/tabCtrl.h" #include "dvxWm.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "shellApp.h" #include "stb_ds_wrap.h" diff --git a/apps/dvxbasic/Makefile b/apps/dvxbasic/Makefile index a3a969a..ba21090 100644 --- a/apps/dvxbasic/Makefile +++ b/apps/dvxbasic/Makefile @@ -17,7 +17,7 @@ CFLAGS = -O2 -Wall -Wextra -Werror -Wno-type-limits -Wno-sign-compare -Wn OBJDIR = ../../obj/dvxbasic LIBSDIR = ../../bin/libs APPDIR = ../../bin/apps/kpunch/dvxbasic -DVXRES = ../../bin/dvxres +DVXRES = ../../bin/host/dvxres SAMPLES = samples/hello.bas samples/formtest.bas samples/clickme.bas samples/clickme.frm samples/input.bas # Runtime library objects (VM + values) diff --git a/apps/dvxbasic/formrt/formrt.c b/apps/dvxbasic/formrt/formrt.c index 43431f0..dfa76c7 100644 --- a/apps/dvxbasic/formrt/formrt.c +++ b/apps/dvxbasic/formrt/formrt.c @@ -7,11 +7,11 @@ #include "formrt.h" #include "../compiler/codegen.h" #include "../compiler/opcodes.h" -#include "dvxDialog.h" +#include "dvxDlg.h" #include "dvxWm.h" -#include "widgetBox.h" -#include "widgetDataCtrl.h" -#include "widgetDbGrid.h" +#include "box/box.h" +#include "dataCtrl/dataCtrl.h" +#include "dbGrid/dbGrid.h" #include "thirdparty/stb_ds_wrap.h" #include diff --git a/apps/dvxbasic/formrt/formrt.h b/apps/dvxbasic/formrt/formrt.h index fbc4984..bfc5679 100644 --- a/apps/dvxbasic/formrt/formrt.h +++ b/apps/dvxbasic/formrt/formrt.h @@ -13,7 +13,7 @@ #include "../runtime/vm.h" #include "../runtime/values.h" #include "dvxApp.h" -#include "dvxWidget.h" +#include "dvxWgt.h" // ============================================================ // Forward declarations diff --git a/apps/dvxbasic/ide/ideDesigner.h b/apps/dvxbasic/ide/ideDesigner.h index 75574b1..12160bd 100644 --- a/apps/dvxbasic/ide/ideDesigner.h +++ b/apps/dvxbasic/ide/ideDesigner.h @@ -8,8 +8,8 @@ #define IDE_DESIGNER_H #include "dvxApp.h" -#include "dvxWidget.h" -#include "widgetCanvas.h" +#include "dvxWgt.h" +#include "canvas/canvas.h" #include "stb_ds_wrap.h" diff --git a/apps/dvxbasic/ide/ideMain.c b/apps/dvxbasic/ide/ideMain.c index 80955ae..6f56926 100644 --- a/apps/dvxbasic/ide/ideMain.c +++ b/apps/dvxbasic/ide/ideMain.c @@ -8,27 +8,27 @@ // work on real hardware inside the DVX windowing system. #include "dvxApp.h" -#include "dvxCursor.h" -#include "dvxPlatform.h" -#include "dvxDialog.h" +#include "dvxCur.h" +#include "dvxPlat.h" +#include "dvxDlg.h" #include "dvxPrefs.h" -#include "dvxWidget.h" -#include "dvxWidgetPlugin.h" +#include "dvxWgt.h" +#include "dvxWgtP.h" #include "dvxWm.h" #include "shellApp.h" -#include "widgetBox.h" -#include "widgetCheckbox.h" -#include "widgetImageButton.h" -#include "widgetLabel.h" -#include "widgetRadio.h" -#include "widgetTextInput.h" -#include "widgetDropdown.h" -#include "widgetButton.h" -#include "widgetSplitter.h" -#include "widgetStatusBar.h" -#include "widgetListView.h" -#include "widgetSeparator.h" -#include "widgetToolbar.h" +#include "box/box.h" +#include "checkbox/checkbox.h" +#include "imageButton/imgBtn.h" +#include "label/label.h" +#include "radio/radio.h" +#include "textInput/textInpt.h" +#include "dropdown/dropdown.h" +#include "button/button.h" +#include "splitter/splitter.h" +#include "statusBar/statBar.h" +#include "listView/listView.h" +#include "separator/separatr.h" +#include "toolbar/toolbar.h" #include "ideDesigner.h" #include "ideProject.h" diff --git a/apps/dvxbasic/ide/ideMenuEditor.c b/apps/dvxbasic/ide/ideMenuEditor.c index b258950..404a861 100644 --- a/apps/dvxbasic/ide/ideMenuEditor.c +++ b/apps/dvxbasic/ide/ideMenuEditor.c @@ -5,14 +5,14 @@ // when the user clicks OK. #include "ideMenuEditor.h" -#include "dvxDialog.h" +#include "dvxDlg.h" #include "dvxWm.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetCheckbox.h" -#include "widgetLabel.h" -#include "widgetListBox.h" -#include "widgetTextInput.h" +#include "box/box.h" +#include "button/button.h" +#include "checkbox/checkbox.h" +#include "label/label.h" +#include "listBox/listBox.h" +#include "textInput/textInpt.h" #include #include diff --git a/apps/dvxbasic/ide/ideProject.c b/apps/dvxbasic/ide/ideProject.c index 4fc57be..3230ec9 100644 --- a/apps/dvxbasic/ide/ideProject.c +++ b/apps/dvxbasic/ide/ideProject.c @@ -23,16 +23,16 @@ #include "ideProject.h" #include "dvxApp.h" -#include "dvxDialog.h" +#include "dvxDlg.h" #include "dvxPrefs.h" #include "dvxWm.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetDropdown.h" -#include "widgetImage.h" -#include "widgetLabel.h" -#include "widgetTextInput.h" -#include "widgetTreeView.h" +#include "box/box.h" +#include "button/button.h" +#include "dropdown/dropdown.h" +#include "image/image.h" +#include "label/label.h" +#include "textInput/textInpt.h" +#include "treeView/treeView.h" #include "thirdparty/stb_ds_wrap.h" diff --git a/apps/dvxbasic/ide/ideProperties.c b/apps/dvxbasic/ide/ideProperties.c index d86089e..b6df0b6 100644 --- a/apps/dvxbasic/ide/ideProperties.c +++ b/apps/dvxbasic/ide/ideProperties.c @@ -6,12 +6,12 @@ // property value to edit it via an InputBox dialog. #include "ideProperties.h" -#include "dvxDialog.h" +#include "dvxDlg.h" #include "dvxWm.h" -#include "widgetBox.h" -#include "widgetListView.h" -#include "widgetSplitter.h" -#include "widgetTreeView.h" +#include "box/box.h" +#include "listView/listView.h" +#include "splitter/splitter.h" +#include "treeView/treeView.h" #include #include diff --git a/apps/dvxbasic/ide/ideToolbox.c b/apps/dvxbasic/ide/ideToolbox.c index 73bddd5..28491dc 100644 --- a/apps/dvxbasic/ide/ideToolbox.c +++ b/apps/dvxbasic/ide/ideToolbox.c @@ -6,11 +6,11 @@ #include "ideToolbox.h" #include "dvxApp.h" -#include "dvxResource.h" +#include "dvxRes.h" #include "dvxWm.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetImageButton.h" +#include "box/box.h" +#include "button/button.h" +#include "imageButton/imgBtn.h" #include #include diff --git a/apps/dvxbasic/runtime/vm.h b/apps/dvxbasic/runtime/vm.h index b87b899..ea4360e 100644 --- a/apps/dvxbasic/runtime/vm.h +++ b/apps/dvxbasic/runtime/vm.h @@ -16,7 +16,7 @@ #include "values.h" #include "dvxTypes.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include #include diff --git a/apps/dvxdemo/dvxdemo.c b/apps/dvxdemo/dvxdemo.c index e985632..ac2d85d 100644 --- a/apps/dvxdemo/dvxdemo.c +++ b/apps/dvxdemo/dvxdemo.c @@ -15,33 +15,33 @@ // The app has no persistent state -- it's purely a showcase. #include "dvxApp.h" -#include "dvxDialog.h" -#include "dvxWidget.h" -#include "widgetAnsiTerm.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetCanvas.h" -#include "widgetCheckbox.h" -#include "widgetComboBox.h" -#include "widgetDropdown.h" -#include "widgetImage.h" -#include "widgetImageButton.h" -#include "widgetLabel.h" -#include "widgetListBox.h" -#include "widgetListView.h" -#include "widgetProgressBar.h" -#include "widgetRadio.h" -#include "widgetScrollPane.h" -#include "widgetSeparator.h" -#include "widgetSlider.h" -#include "widgetSpacer.h" -#include "widgetSpinner.h" -#include "widgetSplitter.h" -#include "widgetStatusBar.h" -#include "widgetTabControl.h" -#include "widgetTextInput.h" -#include "widgetToolbar.h" -#include "widgetTreeView.h" +#include "dvxDlg.h" +#include "dvxWgt.h" +#include "ansiTerm/ansiTerm.h" +#include "box/box.h" +#include "button/button.h" +#include "canvas/canvas.h" +#include "checkbox/checkbox.h" +#include "comboBox/comboBox.h" +#include "dropdown/dropdown.h" +#include "image/image.h" +#include "imageButton/imgBtn.h" +#include "label/label.h" +#include "listBox/listBox.h" +#include "listView/listView.h" +#include "progressBar/progress.h" +#include "radio/radio.h" +#include "scrollPane/scrlPane.h" +#include "separator/separatr.h" +#include "slider/slider.h" +#include "spacer/spacer.h" +#include "spinner/spinner.h" +#include "splitter/splitter.h" +#include "statusBar/statBar.h" +#include "tabControl/tabCtrl.h" +#include "textInput/textInpt.h" +#include "toolbar/toolbar.h" +#include "treeView/treeView.h" #include "dvxWm.h" #include "shellApp.h" diff --git a/apps/dvxhelp/dvxhelp.c b/apps/dvxhelp/dvxhelp.c index 80aa92e..1ae2be6 100644 --- a/apps/dvxhelp/dvxhelp.c +++ b/apps/dvxhelp/dvxhelp.c @@ -12,21 +12,21 @@ #include "hlpformat.h" #include "dvxApp.h" -#include "dvxDialog.h" -#include "dvxWidget.h" -#include "dvxWidgetPlugin.h" +#include "dvxDlg.h" +#include "dvxWgt.h" +#include "dvxWgtP.h" #include "dvxWm.h" #include "dvxDraw.h" #include "dvxVideo.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "shellApp.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetSplitter.h" -#include "widgetTreeView.h" -#include "widgetScrollPane.h" -#include "widgetToolbar.h" -#include "widgetImage.h" +#include "box/box.h" +#include "button/button.h" +#include "splitter/splitter.h" +#include "treeView/treeView.h" +#include "scrollPane/scrlPane.h" +#include "toolbar/toolbar.h" +#include "image/image.h" #include #include diff --git a/apps/imgview/imgview.c b/apps/imgview/imgview.c index 6d10233..de76ad9 100644 --- a/apps/imgview/imgview.c +++ b/apps/imgview/imgview.c @@ -5,8 +5,8 @@ // Open files via the File menu or by launching with Run in the Task Manager. #include "dvxApp.h" -#include "dvxDialog.h" -#include "dvxWidget.h" +#include "dvxDlg.h" +#include "dvxWgt.h" #include "dvxWm.h" #include "shellApp.h" #include "stb_image_wrap.h" diff --git a/apps/notepad/notepad.c b/apps/notepad/notepad.c index e374e26..c9aff87 100644 --- a/apps/notepad/notepad.c +++ b/apps/notepad/notepad.c @@ -11,11 +11,11 @@ // up menus and file I/O around it. #include "dvxApp.h" -#include "dvxDialog.h" -#include "dvxWidget.h" -#include "widgetTextInput.h" +#include "dvxDlg.h" +#include "dvxWgt.h" +#include "textInput/textInpt.h" #include "dvxWm.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "shellApp.h" #include diff --git a/apps/progman/progman.c b/apps/progman/progman.c index 5f9b916..3aa8dc2 100644 --- a/apps/progman/progman.c +++ b/apps/progman/progman.c @@ -19,22 +19,22 @@ // list current without polling. #include "dvxApp.h" -#include "dvxDialog.h" +#include "dvxDlg.h" #include "dvxPrefs.h" -#include "dvxWidget.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetLabel.h" -#include "widgetStatusBar.h" -#include "widgetTextInput.h" +#include "dvxWgt.h" +#include "box/box.h" +#include "button/button.h" +#include "label/label.h" +#include "statusBar/statBar.h" +#include "textInput/textInpt.h" #include "dvxWm.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "shellApp.h" -#include "shellInfo.h" -#include "dvxResource.h" -#include "widgetImageButton.h" -#include "widgetScrollPane.h" -#include "widgetWrapBox.h" +#include "shellInf.h" +#include "dvxRes.h" +#include "imageButton/imgBtn.h" +#include "scrollPane/scrlPane.h" +#include "wrapBox/wrapBox.h" #include #include diff --git a/core/Makefile b/core/Makefile index 7409459..7dc734c 100644 --- a/core/Makefile +++ b/core/Makefile @@ -55,18 +55,18 @@ $(TARGETDIR): mkdir -p $(TARGETDIR) # Dependencies -CORE_HDRS = dvxTypes.h dvxApp.h dvxDraw.h dvxWm.h dvxVideo.h dvxWidget.h platform/dvxPlatform.h -$(OBJDIR)/dvxVideo.o: dvxVideo.c dvxVideo.h platform/dvxPlatform.h dvxTypes.h dvxPalette.h -$(OBJDIR)/dvxDraw.o: dvxDraw.c dvxDraw.h platform/dvxPlatform.h dvxTypes.h -$(OBJDIR)/dvxComp.o: dvxComp.c dvxComp.h platform/dvxPlatform.h dvxTypes.h -$(OBJDIR)/dvxWm.o: dvxWm.c dvxWm.h dvxTypes.h dvxDraw.h dvxComp.h dvxVideo.h dvxWidget.h platform/dvxPlatform.h thirdparty/stb_image.h +CORE_HDRS = dvxTypes.h dvxApp.h dvxDraw.h dvxWm.h dvxVideo.h dvxWgt.h platform/dvxPlat.h +$(OBJDIR)/dvxVideo.o: dvxVideo.c dvxVideo.h platform/dvxPlat.h dvxTypes.h dvxPal.h +$(OBJDIR)/dvxDraw.o: dvxDraw.c dvxDraw.h platform/dvxPlat.h dvxTypes.h +$(OBJDIR)/dvxComp.o: dvxComp.c dvxComp.h platform/dvxPlat.h dvxTypes.h +$(OBJDIR)/dvxWm.o: dvxWm.c dvxWm.h dvxTypes.h dvxDraw.h dvxComp.h dvxVideo.h dvxWgt.h platform/dvxPlat.h thirdparty/stb_image.h $(OBJDIR)/dvxImage.o: dvxImage.c thirdparty/stb_image.h $(OBJDIR)/dvxImageWrite.o: dvxImageWrite.c thirdparty/stb_image_write.h -$(OBJDIR)/dvxApp.o: dvxApp.c dvxApp.h platform/dvxPlatform.h dvxTypes.h dvxVideo.h dvxDraw.h dvxComp.h dvxWm.h dvxFont.h dvxCursor.h -$(OBJDIR)/dvxDialog.o: dvxDialog.c dvxDialog.h platform/dvxPlatform.h dvxApp.h dvxWidget.h dvxWidgetPlugin.h dvxTypes.h dvxDraw.h +$(OBJDIR)/dvxApp.o: dvxApp.c dvxApp.h platform/dvxPlat.h dvxTypes.h dvxVideo.h dvxDraw.h dvxComp.h dvxWm.h dvxFont.h dvxCur.h +$(OBJDIR)/dvxDialog.o: dvxDialog.c dvxDlg.h platform/dvxPlat.h dvxApp.h dvxWgt.h dvxWgtP.h dvxTypes.h dvxDraw.h $(OBJDIR)/dvxPrefs.o: dvxPrefs.c dvxPrefs.h -WIDGET_DEPS = dvxWidgetPlugin.h dvxWidget.h dvxTypes.h dvxApp.h dvxDraw.h dvxWm.h dvxVideo.h platform/dvxPlatform.h +WIDGET_DEPS = dvxWgtP.h dvxWgt.h dvxTypes.h dvxApp.h dvxDraw.h dvxWm.h dvxVideo.h platform/dvxPlat.h $(OBJDIR)/widgetClass.o: widgetClass.c $(WIDGET_DEPS) $(OBJDIR)/widgetCore.o: widgetCore.c $(WIDGET_DEPS) $(OBJDIR)/widgetScrollbar.o: widgetScrollbar.c $(WIDGET_DEPS) diff --git a/core/dvxApp.c b/core/dvxApp.c index 8626bf1..5083725 100644 --- a/core/dvxApp.c +++ b/core/dvxApp.c @@ -30,15 +30,15 @@ // order of magnitude slower than system RAM writes on period hardware. #include "dvxApp.h" -#include "dvxDialog.h" -#include "dvxWidget.h" -#include "dvxWidgetPlugin.h" -#include "../widgets/widgetTimer.h" +#include "dvxDlg.h" +#include "dvxWgt.h" +#include "dvxWgtP.h" +#include "../widgets/timer/timer.h" #include "dvxFont.h" -#include "dvxCursor.h" +#include "dvxCur.h" -#include "dvxPlatform.h" -#include "dvxResource.h" +#include "dvxPlat.h" +#include "dvxRes.h" #include "thirdparty/stb_ds_wrap.h" #include diff --git a/core/dvxApp.h b/core/dvxApp.h index d2e55fc..465d29a 100644 --- a/core/dvxApp.h +++ b/core/dvxApp.h @@ -13,9 +13,9 @@ #ifndef DVX_APP_H #define DVX_APP_H -#include "dvxCursor.h" +#include "dvxCur.h" #include "dvxTypes.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "dvxVideo.h" #include "dvxDraw.h" #include "dvxComp.h" diff --git a/core/dvxComp.c b/core/dvxComp.c index 3b29815..273b138 100644 --- a/core/dvxComp.c +++ b/core/dvxComp.c @@ -18,7 +18,7 @@ // exactly once per pixel per frame. #include "dvxComp.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include #include diff --git a/core/dvxCursor.h b/core/dvxCur.h similarity index 99% rename from core/dvxCursor.h rename to core/dvxCur.h index a9adf5e..e7bdb39 100644 --- a/core/dvxCursor.h +++ b/core/dvxCur.h @@ -1,4 +1,4 @@ -// dvxCursor.h -- Embedded mouse cursor bitmaps for DVX GUI +// dvxCur.h -- Embedded mouse cursor bitmaps for DVX GUI // // All cursor shapes are compiled in as static const data -- no external // cursor files to load. This is intentional: the cursors are needed @@ -14,8 +14,8 @@ // The cursor table (dvxCursors[]) at the bottom provides all five shapes // in an array indexed by CURSOR_xxx constants, with hotspot coordinates // set appropriately (arrow hot spot at tip, resize cursors at center). -#ifndef DVX_CURSOR_H -#define DVX_CURSOR_H +#ifndef DVX_CUR_H +#define DVX_CUR_H #include "dvxTypes.h" @@ -417,4 +417,4 @@ static const CursorT dvxCursors[CURSOR_COUNT] = { // the multi-cursor support. static const CursorT dvxCursor = { 16, 16, 0, 0, cursorArrowAnd, cursorArrowXor }; -#endif // DVX_CURSOR_H +#endif // DVX_CUR_H diff --git a/core/dvxDialog.c b/core/dvxDialog.c index bf83e65..2df3da0 100644 --- a/core/dvxDialog.c +++ b/core/dvxDialog.c @@ -20,18 +20,18 @@ // keeps the state accessible to callback functions without threading // context pointers through every widget callback. -#include "dvxDialog.h" -#include "dvxPlatform.h" -#include "dvxWidget.h" -#include "dvxWidgetPlugin.h" -#include "../widgets/widgetBox.h" -#include "../widgets/widgetButton.h" -#include "../widgets/widgetDropdown.h" -#include "../widgets/widgetLabel.h" -#include "../widgets/widgetListBox.h" -#include "../widgets/widgetSpacer.h" -#include "../widgets/widgetSpinner.h" -#include "../widgets/widgetTextInput.h" +#include "dvxDlg.h" +#include "dvxPlat.h" +#include "dvxWgt.h" +#include "dvxWgtP.h" +#include "../widgets/box/box.h" +#include "../widgets/button/button.h" +#include "../widgets/dropdown/dropdown.h" +#include "../widgets/label/label.h" +#include "../widgets/listBox/listBox.h" +#include "../widgets/spacer/spacer.h" +#include "../widgets/spinner/spinner.h" +#include "../widgets/textInput/textInpt.h" #include #include diff --git a/core/dvxDialog.h b/core/dvxDlg.h similarity index 97% rename from core/dvxDialog.h rename to core/dvxDlg.h index 5d8b259..9c59496 100644 --- a/core/dvxDialog.h +++ b/core/dvxDlg.h @@ -1,4 +1,4 @@ -// dvxDialog.h -- Modal dialogs for DVX GUI +// dvxDlg.h -- Modal dialogs for DVX GUI // // Provides pre-built modal dialog boxes (message box, file dialog) that // block the caller and run their own event loop via dvxUpdate() until the @@ -8,8 +8,8 @@ // The flag encoding uses separate bit fields for button configuration // (low nibble) and icon type (high nibble) so they can be OR'd together // in a single int32_t argument, matching the Win16 MessageBox() convention. -#ifndef DVX_DIALOG_H -#define DVX_DIALOG_H +#ifndef DVX_DLG_H +#define DVX_DLG_H #include "dvxApp.h" @@ -114,4 +114,4 @@ int32_t dvxPromptSave(AppContextT *ctx, const char *title); bool dvxChoiceDialog(AppContextT *ctx, const char *title, const char *prompt, const char **items, int32_t itemCount, int32_t defaultIdx, int32_t *outIdx); -#endif // DVX_DIALOG_H +#endif // DVX_DLG_H diff --git a/core/dvxDraw.c b/core/dvxDraw.c index 70bed79..6bb2a62 100644 --- a/core/dvxDraw.c +++ b/core/dvxDraw.c @@ -50,8 +50,8 @@ // unlikely, helping the branch predictor on Pentium and later. #include "dvxDraw.h" -#include "dvxPalette.h" -#include "dvxPlatform.h" +#include "dvxPal.h" +#include "dvxPlat.h" #include #include diff --git a/core/dvxPalette.h b/core/dvxPal.h similarity index 97% rename from core/dvxPalette.h rename to core/dvxPal.h index 350f68f..bc8f3df 100644 --- a/core/dvxPalette.h +++ b/core/dvxPal.h @@ -1,4 +1,4 @@ -// dvx_palette.h -- 8-bit mode palette definition for DVX GUI +// dvxPal.h -- 8-bit mode palette definition for DVX GUI // // Defines the 256-color palette used in 8-bit (VGA Mode 13h / VESA 8bpp) // video modes. The palette layout follows the same strategy as the X11 @@ -15,8 +15,8 @@ // // This partition gives good general-purpose color reproduction while // guaranteeing the UI has pixel-perfect colors for its chrome elements. -#ifndef DVX_PALETTE_H -#define DVX_PALETTE_H +#ifndef DVX_PAL_H +#define DVX_PAL_H #include @@ -156,4 +156,4 @@ static inline uint8_t dvxNearestPalEntry(const uint8_t *pal, uint8_t r, uint8_t return bestIdx; } -#endif // DVX_PALETTE_H +#endif // DVX_PAL_H diff --git a/core/dvxResource.h b/core/dvxRes.h similarity index 94% rename from core/dvxResource.h rename to core/dvxRes.h index bab79c7..b19c6c1 100644 --- a/core/dvxResource.h +++ b/core/dvxRes.h @@ -1,4 +1,4 @@ -// dvxResource.h -- DVX resource format and runtime API +// dvxRes.h -- DVX resource format and runtime API // // Resources are appended to DXE3 files (.app, .wgt, .lib) after the // normal DXE content. dlopen never reads past the DXE header-specified @@ -13,12 +13,12 @@ // Reading starts from the end: seek to EOF - sizeof(footer), verify // the magic, then seek to the directory and read entries. -#ifndef DVX_RESOURCE_H -#define DVX_RESOURCE_H +#ifndef DVX_RES_H +#define DVX_RES_H #include -#include "dvxPlatform.h" +#include "dvxPlat.h" // Resource type IDs #define DVX_RES_ICON 1 // image data (BMP icon: 16x16, 32x32, etc.) @@ -72,4 +72,4 @@ const DvxResDirEntryT *dvxResFind(DvxResHandleT *h, const char *name); // Close the handle and free all associated memory. void dvxResClose(DvxResHandleT *h); -#endif // DVX_RESOURCE_H +#endif // DVX_RES_H diff --git a/core/dvxResource.c b/core/dvxResource.c index 486d496..e0e474d 100644 --- a/core/dvxResource.c +++ b/core/dvxResource.c @@ -3,7 +3,7 @@ // Reads the resource block appended to DXE3 files. The resource // block is located by reading the footer at the end of the file. -#include "dvxResource.h" +#include "dvxRes.h" #include #include diff --git a/core/dvxVideo.c b/core/dvxVideo.c index f738f43..5c4483c 100644 --- a/core/dvxVideo.c +++ b/core/dvxVideo.c @@ -42,8 +42,8 @@ // shuffling. #include "dvxVideo.h" -#include "dvxPlatform.h" -#include "dvxPalette.h" +#include "dvxPlat.h" +#include "dvxPal.h" #include #include diff --git a/core/dvxWidget.h b/core/dvxWgt.h similarity index 99% rename from core/dvxWidget.h rename to core/dvxWgt.h index b78781d..f8985d8 100644 --- a/core/dvxWidget.h +++ b/core/dvxWgt.h @@ -1,4 +1,4 @@ -// dvxWidget.h -- Widget system for DVX GUI +// dvxWgt.h -- Widget system for DVX GUI // // A retained-mode widget toolkit layered on top of the DVX window manager. // Widgets form a tree (parent-child via firstChild/lastChild/nextSibling @@ -27,8 +27,8 @@ // this halves the pointer overhead per widget and insertion/removal is // still O(n) in the worst case, which is acceptable given typical tree // depths of 5-10 nodes. -#ifndef DVX_WIDGET_H -#define DVX_WIDGET_H +#ifndef DVX_WGT_H +#define DVX_WGT_H #include "dvxTypes.h" @@ -646,4 +646,4 @@ void wgtIfaceSetPath(const char *name, const char *path); // Used to construct suffixed resource names (e.g. "name-2", "icon16-2"). int32_t wgtIfaceGetPathIndex(const char *name); -#endif // DVX_WIDGET_H +#endif // DVX_WGT_H diff --git a/core/dvxWidgetPlugin.h b/core/dvxWgtP.h similarity index 97% rename from core/dvxWidgetPlugin.h rename to core/dvxWgtP.h index 1422f4e..35b84d0 100644 --- a/core/dvxWidgetPlugin.h +++ b/core/dvxWgtP.h @@ -1,4 +1,4 @@ -// dvxWidgetPlugin.h -- Plugin API for DVX widget DXE modules +// dvxWgtP.h -- Plugin API for DVX widget DXE modules // // Included by widget .c files to access core infrastructure. // Provides: widget allocation, tree ops, class table, shared @@ -9,10 +9,10 @@ // internal functions (paint, onMouse, onKey, calcMinSize, etc.) // are private to its own .c file and referenced only through // the WidgetClassT vtable. -#ifndef DVX_WIDGET_PLUGIN_H -#define DVX_WIDGET_PLUGIN_H +#ifndef DVX_WGT_P_H +#define DVX_WGT_P_H -#include "dvxWidget.h" +#include "dvxWgt.h" #include "dvxApp.h" #include "dvxDraw.h" #include "dvxWm.h" @@ -191,4 +191,4 @@ void widgetPaintOverlays(WidgetT *root, DisplayT *d, const BlitOpsT *ops, const // listhelp/listHelp.h -- dropdown arrow, popup list, keyboard nav // Widget DXEs that use these include the headers directly. -#endif // DVX_WIDGET_PLUGIN_H +#endif // DVX_WGT_P_H diff --git a/core/dvxWm.c b/core/dvxWm.c index d112858..3fa2ac3 100644 --- a/core/dvxWm.c +++ b/core/dvxWm.c @@ -33,8 +33,8 @@ #include "dvxVideo.h" #include "dvxDraw.h" #include "dvxComp.h" -#include "dvxWidget.h" -#include "dvxPlatform.h" +#include "dvxWgt.h" +#include "dvxPlat.h" #include "thirdparty/stb_image_wrap.h" #include diff --git a/core/platform/dvxPlatform.h b/core/platform/dvxPlat.h similarity index 99% rename from core/platform/dvxPlatform.h rename to core/platform/dvxPlat.h index 949819b..ef15ad9 100644 --- a/core/platform/dvxPlatform.h +++ b/core/platform/dvxPlat.h @@ -1,4 +1,4 @@ -// dvxPlatform.h -- Platform abstraction layer for DVX GUI +// dvxPlat.h -- Platform abstraction layer for DVX GUI // // All OS-specific and CPU-specific code is isolated behind this // interface. To port DVX to a new platform, implement a new @@ -17,8 +17,8 @@ // own internal state. They must not reference AppContextT or any layer // above dvxTypes.h. This ensures the platform layer can be compiled and // tested independently. -#ifndef DVX_PLATFORM_H -#define DVX_PLATFORM_H +#ifndef DVX_PLAT_H +#define DVX_PLAT_H #include "dvxTypes.h" @@ -345,4 +345,4 @@ typedef struct { // no-op (RTLD_GLOBAL or equivalent handles symbol resolution). void platformRegisterSymOverrides(const PlatformSymOverrideT *entries); -#endif // DVX_PLATFORM_H +#endif // DVX_PLAT_H diff --git a/core/platform/dvxPlatformDos.c b/core/platform/dvxPlatformDos.c index 6c2e989..f8a938b 100644 --- a/core/platform/dvxPlatformDos.c +++ b/core/platform/dvxPlatformDos.c @@ -26,8 +26,8 @@ // a compatible driver. Polling via function 03h avoids the complexity // of installing a real-mode callback for mouse events. -#include "dvxPlatform.h" -#include "dvxPalette.h" +#include "dvxPlat.h" +#include "dvxPal.h" #include #include diff --git a/core/widgetClass.c b/core/widgetClass.c index 54f2f9d..67e11e1 100644 --- a/core/widgetClass.c +++ b/core/widgetClass.c @@ -11,7 +11,7 @@ // wgtRegister(). App/core code calls wgtGetApi("name") to get // the API pointer, then casts and calls through it. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "stb_ds_wrap.h" #include diff --git a/core/widgetCore.c b/core/widgetCore.c index d0eda3a..51c0c06 100644 --- a/core/widgetCore.c +++ b/core/widgetCore.c @@ -18,8 +18,8 @@ // created and destroyed at runtime (dialog dynamics, tree item insertion), // which doesn't map cleanly to an arena pattern. -#include "dvxWidgetPlugin.h" -#include "dvxPlatform.h" +#include "dvxWgtP.h" +#include "dvxPlat.h" #include "stb_ds_wrap.h" #include diff --git a/core/widgetEvent.c b/core/widgetEvent.c index 374ae03..817fdcc 100644 --- a/core/widgetEvent.c +++ b/core/widgetEvent.c @@ -18,8 +18,8 @@ // still adjusts the value, because sDragSlider captures the event // before hit testing runs. -#include "dvxWidgetPlugin.h" -#include "platform/dvxPlatform.h" +#include "dvxWgtP.h" +#include "platform/dvxPlat.h" // Widget whose popup was just closed by click-outside -- prevents // immediate re-open on the same click. Without this, clicking the diff --git a/core/widgetLayout.c b/core/widgetLayout.c index b0470d3..e1f8a8e 100644 --- a/core/widgetLayout.c +++ b/core/widgetLayout.c @@ -27,7 +27,7 @@ // unit types into a single int32_t without needing a separate struct. // The wgtResolveSize() function decodes the tag and converts to pixels. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" // ============================================================ diff --git a/core/widgetOps.c b/core/widgetOps.c index 5added2..b7cc0b1 100644 --- a/core/widgetOps.c +++ b/core/widgetOps.c @@ -11,9 +11,9 @@ // because they share the same invalidation infrastructure (wgtInvalidate // and wgtInvalidatePaint). -#include "dvxWidgetPlugin.h" -#include "dvxPlatform.h" -#include "../widgets/widgetBox.h" +#include "dvxWgtP.h" +#include "dvxPlat.h" +#include "../widgets/box/box.h" // ============================================================ diff --git a/core/widgetScrollbar.c b/core/widgetScrollbar.c index 5527f65..c53ba31 100644 --- a/core/widgetScrollbar.c +++ b/core/widgetScrollbar.c @@ -21,7 +21,7 @@ // If the container is too small, the scrollbar is simply not drawn // rather than rendering a corrupted mess. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" // ============================================================ diff --git a/docs/dvx_basic_reference.html b/docs/dvx_basic_reference.html new file mode 100644 index 0000000..9d6a448 --- /dev/null +++ b/docs/dvx_basic_reference.html @@ -0,0 +1,2824 @@ + + + + +DVX BASIC IDE Guide + + + + +
+
+

DVX BASIC IDE Guide

+

DVX BASIC IDE Guide

+

DVX BASIC is a Visual BASIC development environment for the DVX GUI System. It provides a VB3-style integrated development environment with a code editor, form designer, project system, and a full interactive debugger -- all running natively on DOS under the DVX windowing system.

+

This guide covers every feature of the IDE: menus, toolbar, editor, form designer, project management, debugger, and auxiliary windows.

+

IDE Windows

+

The DVX BASIC IDE is modeled after Visual Basic 3.0. It consists of several floating windows arranged on the DVX desktop:

+
    +
  • Main Toolbar Window -- anchored at the top of the screen. Contains the menu bar, toolbar buttons, and status bar.
  • +
  • Code Editor -- the primary editing surface for BASIC source code, with Object/Event dropdowns, syntax highlighting, and line numbers.
  • +
  • Form Designer -- a visual design surface for .frm files, showing a WYSIWYG preview of the form with grab handles for resizing controls.
  • +
  • Project Explorer -- a tree view listing all files in the project.
  • +
  • Toolbox -- a palette of available controls for placing on forms.
  • +
  • Properties Panel -- a tree of controls and a list of editable properties for the selected control.
  • +
  • Output Window -- displays PRINT output and runtime errors.
  • +
  • Immediate Window -- an interactive REPL for evaluating expressions and modifying variables at runtime.
  • +
+

Debug Windows -- Locals, Call Stack, Watch, and Breakpoints windows that appear automatically when debugging.

+

The IDE compiles BASIC source into bytecode and runs it in an integrated virtual machine (VM). Programs execute in cooperative slices (10,000 VM steps per slice), yielding to the DVX event loop between slices so the GUI remains responsive.

+

File Menu

+

Edit Menu

+

Run Menu

+

View Menu

+

Window Menu

+

Tools Menu

+

Help Menu

+

Toolbar

+

Code Editor

+

Form Designer

+

Project System

+

Properties Panel

+

Toolbox

+

Debugger

+

Locals Window

+

Call Stack Window

+

Watch Window

+

Breakpoints Window

+

Immediate Window

+

Output Window

+

Find / Replace

+

Preferences

+

Keyboard Shortcuts

+
+
+

File Menu

+

File Menu

+
  Menu Item              Shortcut   Description
+  ---------              --------   -----------
+  New Project...                    Create a new DVX BASIC project.
+  Open Project...                   Open an existing .dbp project file.
+  Save Project                      Save the current project file to disk.
+  Close Project                     Close the current project (prompts to save unsaved changes).
+  ---
+  Project Properties...             Edit project metadata (name, author, version, startup form, icon, etc.).
+  ---
+  Add File...            Ctrl+O     Add a .bas or .frm file to the project. If no project is open, creates an implicit project from the file.
+  Save File              Ctrl+S     Save the active file to disk.
+  Save All                          Save all modified files in the project.
+  ---
+  Remove File                       Remove the selected file from the project (prompts to save if modified).
+  ---
+  Exit                              Close the IDE (prompts to save unsaved changes).
+

Edit Menu

+

Back to Overview

+
+
+

Edit Menu

+

Edit Menu

+
  Menu Item    Shortcut   Description
+  ---------    --------   -----------
+  Cut          Ctrl+X     Cut selected text to the clipboard.
+  Copy         Ctrl+C     Copy selected text to the clipboard.
+  Paste        Ctrl+V     Paste text from the clipboard.
+  ---
+  Select All   Ctrl+A     Select all text in the active editor.
+  ---
+  Delete       Del        Delete the selected text or control (in the form designer).
+  ---
+  Find...      Ctrl+F     Open the Find/Replace dialog.
+  Find Next    F3         Find the next occurrence of the search text.
+  Replace...   Ctrl+H     Open the Find/Replace dialog with replace enabled.
+

Run Menu

+

Back to Overview

+
+
+

Run Menu

+

Run Menu

+
  Menu Item                Shortcut         Description
+  ---------                --------         -----------
+  Run                      F5               Compile and run the program. If paused at a breakpoint, resumes execution with debugging disabled (runs free).
+  Debug                    Shift+F5         Compile and run with the debugger active. Breakpoints are active but execution does not pause at the first statement. If paused, resumes to the next breakpoint.
+  Run Without Recompile    Ctrl+F5          Re-run the last compiled module without recompiling.
+  Stop                     Esc              Stop the running program immediately.
+  ---
+  Step Into                F8               Execute one statement, stepping into SUB/FUNCTION calls. If idle, starts a debug session and breaks at the first statement.
+  Step Over                Shift+F8         Execute one statement, stepping over SUB/FUNCTION calls.
+  Step Out                 Ctrl+Shift+F8    Run until the current SUB/FUNCTION returns.
+  Run to Cursor            Ctrl+F8          Run until execution reaches the line where the cursor is positioned.
+  ---
+  Toggle Breakpoint        F9               Toggle a breakpoint on the current editor line.
+  ---
+  Clear Output                              Clear the Output window.
+  ---
+  Save on Run                               Checkbox: when enabled, all modified files are saved automatically before compiling. Persisted in preferences.
+

View Menu

+

Back to Overview

+
+
+

View Menu

+

View Menu

+
  Menu Item        Shortcut   Description
+  ---------        --------   -----------
+  Code             F7         Switch to Code view for the active file (or the file selected in the Project Explorer).
+  Designer         Shift+F7   Switch to Design view for the active form file.
+  ---
+  Toolbar                     Checkbox: show or hide the toolbar. Persisted in preferences.
+  Status Bar                  Checkbox: show or hide the status bar. Persisted in preferences.
+  ---
+  Menu Editor...   Ctrl+E     Open the Menu Editor dialog for the active form. Allows designing menu bars with captions, names, levels, checked state, and enabled state.
+

Window Menu

+

Back to Overview

+
+
+

Window Menu

+

Window Menu

+
  Menu Item          Description
+  ---------          -----------
+  Code Editor        Show or raise the Code Editor window.
+  Output             Show or raise the Output window.
+  Immediate          Show or raise the Immediate window.
+  Locals             Show or raise the Locals debug window.
+  Call Stack         Show or raise the Call Stack debug window.
+  Watch              Show or raise the Watch debug window.
+  Breakpoints        Show or raise the Breakpoints window.
+  ---
+  Project Explorer   Show or raise the Project Explorer window.
+  Toolbox            Show or raise the Toolbox window.
+  Properties         Show or raise the Properties panel.
+

Tools Menu

+

Back to Overview

+
+
+

Tools Menu

+

Tools Menu

+
  Menu Item        Description
+  ---------        -----------
+  Preferences...   Open the Preferences dialog (editor settings and project defaults).
+  ---
+  Debug Layout     Checkbox: toggle a debug overlay that shows widget layout boundaries. Useful for diagnosing widget layout issues.
+

Help Menu

+

Back to Overview

+
+
+

Help Menu

+

Help Menu

+
  Menu Item            Description
+  ---------            -----------
+  About DVX BASIC...   Show the About dialog with version and copyright information.
+

Back to Overview

+
+
+

Toolbar

+

Toolbar

+

The toolbar is organized into four groups separated by vertical dividers. Each button has a tooltip showing its name and keyboard shortcut.

+

File Group

+
  Button   Shortcut   Action
+  ------   --------   ------
+  Open     Ctrl+O     Add a file to the project (same as File > Add File).
+  Save     Ctrl+S     Save the active file.
+

Run Group

+
  Button   Shortcut   Action
+  ------   --------   ------
+  Run      F5         Compile and run the program.
+  Stop     Esc        Stop the running program.
+

Debug Group

+
  Button          Shortcut         Action
+  ------          --------         ------
+  Debug           Shift+F5         Start or resume a debug session.
+  Step Into       F8               Step into the next statement.
+  Step Over       Shift+F8         Step over the next statement.
+  Step Out        Ctrl+Shift+F8    Step out of the current procedure.
+  Run to Cursor   Ctrl+F8          Run to the cursor position.
+

View Group

+
  Button   Shortcut   Action
+  ------   --------   ------
+  Code     F7         Switch to Code view.
+  Design   Shift+F7   Switch to Design view.
+

Back to Overview

+
+
+

Code Editor

+

Code Editor

+

The Code Editor is the primary editing window for BASIC source code. It occupies the center of the screen, below the toolbar and above the Output and Immediate windows.

+

Object and Function Dropdowns

+

At the top of the Code Editor are two dropdown lists:

+
    +
  • Object -- lists (General) plus all objects (form name, control names, menu item names). Selecting an object filters the Function dropdown.
  • +
+

Function -- lists all event handlers (procedures) for the selected object. Implemented handlers are listed first (plain text); unimplemented handlers follow in brackets (e.g., [Click]). Selecting an unimplemented event creates a new event handler stub.

+

The editor shows one procedure at a time. Each procedure has its own buffer, and switching between them is instantaneous. The (General) section contains module-level declarations and code.

+

Syntax Highlighting

+

The editor applies real-time syntax coloring as you type. The following categories are highlighted in distinct colors:

+
  Category          Examples
+  --------          --------
+  Keywords          IF, THEN, FOR, NEXT, SUB, FUNCTION, DIM, PRINT, SELECT, CASE, DO, LOOP, WHILE, WEND, END, EXIT, CALL, GOSUB, GOTO, RETURN, DECLARE, CONST, TYPE, AND, OR, NOT, XOR, MOD, etc.
+  Type names        INTEGER, LONG, SINGLE, DOUBLE, STRING, BOOLEAN, BYTE, TRUE, FALSE
+  String literals   "Hello, World!"
+  Comments          ' This is a comment, REM This is a comment
+  Numbers           42, 3.14
+  Operators         =, <, >, +, -, *, /, \, &
+

Editor Features

+
    +
  • Line numbers -- displayed in the gutter on the left side.
  • +
  • Auto-indent -- new lines are automatically indented to match the previous line.
  • +
  • Tab handling -- the Tab key is captured by the editor. Tab width and whether to insert spaces or tab characters are configurable in Preferences (default: 3 spaces).
  • +
  • Gutter click -- clicking in the line number gutter toggles a breakpoint on that line.
  • +
+

Line decorations -- breakpoint lines show a red dot in the gutter. The current debug line (when paused) is highlighted with a yellow background.

+

Back to Overview

+
+
+

Form Designer

+

Form Designer

+

The Form Designer provides a visual design surface for editing .frm files. Switch to it with Shift+F7 or the Design toolbar button. It opens in a separate window showing a WYSIWYG preview of the form.

+

Design Surface

+
    +
  • Grid snapping -- controls snap to an 8-pixel grid (DSGN_GRID_SIZE) when placed or resized.
  • +
  • Selection -- click a control to select it. The selected control is highlighted with grab handles.
  • +
  • Grab handles -- 6x6 pixel handles appear on the right edge (E), bottom edge (S), and bottom-right corner (SE) of the selected control. Drag a handle to resize the control.
  • +
  • Reordering -- drag a control vertically to reorder it within the form's layout (VBox/HBox).
  • +
  • Placing controls -- select a control type in the Toolbox, then click on the form to place a new instance. The control is auto-named (e.g., Command1, Command2). Clicking the same tool again deselects it (toggles back to pointer mode).
  • +
  • Menu bar preview -- if the form has menu items (defined via the Menu Editor), a preview menu bar is rendered on the design window.
  • +
+

Delete key -- removes the selected control from the form.

+

Form Properties

+

Forms have the following design-time properties: Name, Caption, Width, Height, Left, Top, Layout (VBox or HBox), Centered, AutoSize, and Resizable.

+

Properties Panel

+

Toolbox

+

Back to Overview

+
+
+

Project System

+

Project System

+

Project Files (.dbp)

+

A DVX BASIC project is stored as a .dbp file (DVX BASIC Project). The project file records:

+
    +
  • Name -- the project display name (up to 32 characters).
  • +
  • Startup Form -- which form to show automatically when the program starts.
  • +
  • Metadata -- Author, Company, Version, Copyright, Description, and Icon Path (for compiled binaries).
  • +
+

File list -- relative paths (8.3 DOS names) of all .bas and .frm files in the project. Each entry tracks whether it is a form file.

+

Source Map

+

When the project is compiled, all files are concatenated into a single source stream. A source map tracks which lines belong to which file, enabling accurate error reporting and debugger navigation across multiple files. For .frm files, an injected BEGINFORM directive is prepended to the code section.

+

Project Operations

+
  Operation             Description
+  ---------             -----------
+  New Project           Creates a blank project with a name and directory. A default .frm file is added automatically.
+  Open Project          Opens a .dbp file and loads all referenced files into memory.
+  Save Project          Writes the .dbp file to disk.
+  Close Project         Closes the project, prompting to save unsaved changes.
+  Add File              Adds a .bas or .frm file to the project. Opening a file without a project auto-creates an implicit project.
+  Remove File           Removes a file from the project (prompts to save if modified).
+  Project Properties    Opens a dialog for editing project metadata (name, author, company, version, copyright, description, icon, startup form).
+

Project Explorer

+

The Project Explorer is a tree view window listing all project files. Double-click a file to open it: .bas files open in Code view, .frm files open in Design view. The selected file in the Project Explorer determines the target for View > Code and View > Designer commands.

+

Back to Overview

+
+
+

Properties Panel

+

Properties Panel

+

The Properties panel (Window > Properties) has two sections:

+
    +
  • Control tree -- a TreeView at the top listing the form and all its controls in layout order. Click a control name to select it in both the Properties panel and the Form Designer. Drag items in the tree to reorder controls in the form's layout.
  • +
+

Property list -- a two-column ListView below the tree showing property names and values for the selected control. Double-click a property value to edit it via an InputBox dialog. Changes take effect immediately in the designer preview.

+

Each control type exposes different properties (e.g., Caption, Text, Width, Height, MaxWidth, MaxHeight, Weight, Alignment, Enabled, Visible, and type-specific properties like DataSource and DataField for data-bound controls).

+

Form Designer

+

Back to Overview

+
+
+

Toolbox

+

Toolbox

+

The Toolbox (Window > Toolbox) is a floating palette of buttons, one for each available control type. Controls are loaded dynamically from the widget plugin registry -- any widget DXE that provides a basName appears in the toolbox.

+

Click a tool to select it (the active tool name is stored in the designer state), then click on the form to place a new instance. Click the same tool again to deselect it and return to pointer mode.

+

Available Controls

+
  VB Name         Description
+  -------         -----------
+  CommandButton   Push button that triggers a Click event.
+  Label           Static text label.
+  TextBox         Single-line text input field.
+  TextArea        Multi-line text editor.
+  CheckBox        On/off checkbox.
+  OptionButton    Radio button (mutually exclusive within a group).
+  ListBox         Scrollable list of items.
+  ComboBox        Drop-down combo box.
+  DropDown        Simple drop-down list.
+  PictureBox      Canvas for drawing and images.
+  Image           Static image display.
+  ImageButton     Clickable image button.
+  Frame           Grouping container with a labeled border.
+  VBox            Vertical layout container.
+  HBox            Horizontal layout container.
+  WrapBox         Flow layout container that wraps items to the next row.
+  Splitter        Resizable split between two child panes.
+  ScrollPane      Scrollable container for large content.
+  TabStrip        Tabbed container with multiple pages.
+  ListView        Multi-column list with headers.
+  TreeView        Hierarchical tree control.
+  ProgressBar     Progress indicator bar.
+  HScrollBar      Horizontal slider/scrollbar.
+  SpinButton      Numeric up/down spinner.
+  Line            Horizontal or vertical separator line.
+  Spacer          Invisible spacing element for layout.
+  Timer           Non-visual timer that fires periodic events.
+  Toolbar         Toolbar container for buttons.
+  StatusBar       Status bar at the bottom of a form.
+  Terminal        ANSI terminal emulator control.
+  Data            Data control for binding to a database.
+  DBGrid          Data-bound grid for displaying database query results.
+

Form Designer

+

Back to Overview

+
+
+

Debugger

+

Debugger

+

The DVX BASIC IDE includes a full interactive debugger. The debugger operates as a state machine with three states:

+
  State          Description
+  -----          -----------
+  DBG_IDLE       No program loaded or running.
+  DBG_RUNNING    Program is executing (VM running in slices).
+  DBG_PAUSED     Execution is paused at a breakpoint or step point. The IDE GUI is fully interactive.
+

Starting a Debug Session

+
    +
  • Shift+F5 (Debug) -- compiles the project and starts execution in debug mode. Breakpoints are active but execution does not pause at the first statement.
  • +
  • F8 (Step Into) -- if idle, starts a debug session and breaks at the first statement.
  • +
+

F5 (Run) -- compiles and runs without the debugger. No breakpoints are active. If already paused, resumes execution with debugging disabled.

+

Breakpoints

+

Setting Breakpoints

+
    +
  • Press F9 to toggle a breakpoint on the current editor line.
  • +
+

Click in the line number gutter to toggle a breakpoint on that line.

+

Breakpoint Validation

+

Not every line can have a breakpoint. The IDE validates the line content and silently refuses to set breakpoints on:

+
    +
  • Blank lines
  • +
  • Comment lines (' or REM)
  • +
  • SUB and FUNCTION declaration lines
  • +
+

END SUB and END FUNCTION lines

+

Breakpoint Storage

+

Each breakpoint records the project file index, the code line number within the file, the procedure index, and the procedure name (as Object.Event). When the project is compiled, breakpoints are converted to concatenated source line numbers that match the VM's OP_LINE opcodes.

+

Visual Indicators

+
    +
  • Breakpoint lines show a red dot in the gutter.
  • +
+

The current debug line (when paused) has a yellow background.

+

Breakpoint Adjustment on Edit

+

When lines are added or removed in the editor, breakpoints below the edit point are automatically shifted to stay on the correct line.

+

Stepping

+
  Action          Shortcut         Behavior
+  ------          --------         --------
+  Step Into       F8               Execute one statement. If the statement is a SUB/FUNCTION call, step into it.
+  Step Over       Shift+F8         Execute one statement. If the statement is a SUB/FUNCTION call, execute the entire call and break at the next line in the current scope.
+  Step Out        Ctrl+Shift+F8    Run until the current SUB/FUNCTION returns to its caller.
+  Run to Cursor   Ctrl+F8          Run until execution reaches the line under the cursor.
+

The Debug Run Loop

+

When a program is running in debug mode, the IDE enters a cooperative loop:

+
    +
  • The VM executes up to 10,000 steps per slice.
  • +
  • If the VM hits a breakpoint (BAS_VM_BREAKPOINT), the state transitions to DBG_PAUSED. The IDE navigates the code editor to the breakpoint line, highlights it in yellow, auto-opens the Locals and Call Stack windows, and updates all debug windows.
  • +
  • While paused, the IDE pumps dvxUpdate() continuously, keeping the GUI responsive. The user can inspect variables, modify them in the Immediate window, step, continue, or stop.
  • +
+

When the user resumes (F5/Shift+F5/F8/etc.), the state transitions back to DBG_RUNNING and the loop continues.

+

Stopping

+

Press Esc or click the Stop toolbar button at any time to halt execution. The VM is destroyed, debug state resets to DBG_IDLE, and the IDE restores the designer windows that were hidden at run start.

+

Locals Window

+

Call Stack Window

+

Watch Window

+

Breakpoints Window

+

Back to Overview

+
+
+

Locals Window

+

Locals Window

+

When the debugger pauses, the Locals and Call Stack windows are auto-opened (if not already visible). The Watch and Breakpoints windows can be opened manually from the Window menu.

+

Shows variables for the current execution scope. Displayed as a three-column ListView:

+
  Column   Content
+  ------   -------
+  Name     Variable name (internal mangled names like static variable placeholders are filtered out).
+  Type     Data type: Integer, Long, Single, Double, String, Boolean, Array, UDT. Array types show the element type (e.g., Integer()).
+  Value    Current value. Strings are shown in quotes. Booleans as True/False. Arrays show bounds and element count (e.g., Integer(0 To 9) [10]). Uninitialized arrays show (uninitialized).
+

The Locals window displays:

+
    +
  • Local variables for the current procedure (matched by proc index).
  • +
  • Global (module-level) variables.
  • +
+

Form-scoped variables for the current form (if the program is executing within a form context).

+

Up to 64 variables are displayed. The window is resizable.

+

Call Stack Window

+

Back to Overview

+
+
+

Call Stack Window

+

Call Stack Window

+

Shows the current call chain as a two-column ListView:

+
  Column      Content
+  ------      -------
+  Procedure   Procedure name (or (module) for module-level code).
+  Line        Line number where execution is paused (shown for the topmost frame).
+

The current location is shown first, followed by each caller in the call stack (walking from the deepest frame back to the module entry point). Up to 32 frames are displayed.

+

Watch Window

+

Back to Overview

+
+
+

Watch Window

+

Watch Window

+

Allows monitoring arbitrary expressions while debugging. The window has a text input at the top and a two-column ListView below:

+
  Column       Content
+  ------       -------
+  Expression   The watch expression text.
+  Value        Evaluated result (or <error> if evaluation fails). Blank when not paused.
+

Adding Watch Expressions

+

Type an expression in the text input and press Enter. Up to 16 watch expressions can be active at once.

+

Watch Expression Syntax

+

Watch expressions support:

+
    +
  • Simple variable names: x, count
  • +
  • Array subscripts: arr(5), matrix(2, 3)
  • +
  • UDT field access: player.name
  • +
  • Combined: items(i).price
  • +
+

Arbitrary BASIC expressions (compiled and evaluated against the paused VM's state): x + y * 2, Len(name$)

+

Editing and Deleting

+
    +
  • Double-click or press Enter on a watch entry to move it back into the input box for editing.
  • +
+

Press Delete to remove the selected watch expression.

+

Breakpoints Window

+

Back to Overview

+
+
+

Breakpoints Window

+

Breakpoints Window

+

Lists all set breakpoints as a three-column ListView:

+
  Column      Content
+  ------      -------
+  File        Project file path.
+  Procedure   Procedure name (Object.Event format, or (General)).
+  Line        Code line number within the file.
+
    +
  • Double-click a breakpoint to navigate the code editor to that location.
  • +
+

Press Delete to remove selected breakpoints (multi-select is supported).

+

Debugger

+

Back to Overview

+
+
+

Immediate Window

+

Immediate Window

+

The Immediate window is an interactive REPL at the bottom-right of the screen. Type a line of BASIC and press Enter to evaluate it. Results appear inline below your input.

+

Expression Evaluation

+

If the input is not a recognized statement keyword, it is automatically wrapped in a PRINT statement. For example, typing 2 + 2 evaluates as PRINT 2 + 2 and displays 4.

+

You can also type full statements:

+
    +
  • PRINT x * 2 -- evaluate and print an expression.
  • +
  • DIM tmp As Integer -- declare a temporary variable.
  • +
+

LET x = 42 -- explicit assignment (see below).

+

Parse or runtime errors are displayed inline with an Error: prefix.

+

Inspecting Variables While Paused

+

When the debugger is paused at a breakpoint, the Immediate window has access to the running VM's state. Global variable values are copied into the evaluation VM, so expressions like count or name$ & " test" display live values.

+

Assigning Variables While Paused

+

When paused, you can modify variables in the running program directly from the Immediate window using assignment syntax:

+
variableName = newValue
+

The optional LET keyword is also accepted:

+
LET variableName = newValue
+

Assignment works for:

+
    +
  • Scalar variables -- x = 42, name$ = "test"
  • +
  • Array elements -- arr(5) = 100, matrix(2, 3) = 7.5
  • +
  • UDT fields -- player.score = 1000
  • +
+

Combined -- items(0).price = 9.99

+

The new value is written directly into the VM's live variable slot (local, global, or form scope). A confirmation message is displayed, and the Locals and Watch windows update automatically to reflect the change.

+

If the assignment target cannot be resolved (unknown variable, out-of-bounds index, wrong type), an error message is displayed.

+

Back to Overview

+
+
+

Output Window

+

Output Window

+

The Output window is a read-only TextArea at the bottom-left of the screen. It displays:

+
    +
  • PRINT output -- all PRINT statement output from the running program is appended here.
  • +
  • Runtime errors -- if the VM encounters a runtime error (division by zero, out-of-bounds, etc.), the error message and line number are displayed in the output with an Error on line N: prefix.
  • +
+

Compile errors -- if compilation fails, the error message and location are shown.

+

The output buffer holds up to 32,768 characters. Use Run > Clear Output to clear it.

+

INPUT statements prompt the user via a modal InputBox dialog; the prompt text is also echoed to the Output window.

+

Back to Overview

+
+
+

Find / Replace

+

Find / Replace

+

Open with Ctrl+F (Find) or Ctrl+H (Replace). The Find/Replace dialog is modeless -- it stays open while you continue editing.

+

Dialog Controls

+
  Control                    Description
+  -------                    -----------
+  Find input                 The text to search for.
+  Replace checkbox + input   Enable replacement mode and enter replacement text.
+  Scope                      Radio group: Function, Object, File, or Project. Default is Project.
+  Direction                  Radio group: Forward or Backward.
+  Match Case                 Checkbox: case-sensitive search.
+

Buttons

+
  Button        Action
+  ------        ------
+  Find Next     Find the next occurrence. Wraps across procedures, files, and the entire project depending on the scope setting.
+  Replace       Replace the current match and find the next one.
+  Replace All   Replace all occurrences within the selected scope.
+  Close         Close the dialog.
+

Keyboard Shortcut

+

F3 repeats the last search (Find Next) without opening the dialog.

+

Back to Overview

+
+
+

Preferences

+

Preferences

+

Open via Tools > Preferences. Settings are saved to dvxbasic.ini in the app's config directory.

+

Editor Section

+
  Setting                                      Description                                                                               Default
+  -------                                      -----------                                                                               -------
+  Skip comments/strings when renaming          When renaming a control or form, skip occurrences inside comments and string literals.     On
+  Require variable declaration (OPTION EXPLICIT)   When enabled, variables must be declared with DIM before use.                          Off
+  Tab width                                    Number of spaces per tab stop (1-8).                                                      3
+  Insert spaces instead of tabs                When enabled, pressing Tab inserts spaces. When disabled, inserts a real tab character.     On
+

New Project Defaults Section

+

These fields set the default values for new project metadata:

+
  Field         Description                              Default
+  -----         -----------                              -------
+  Author        Default author name.                     (empty)
+  Company       Default company name.                    (empty)
+  Version       Default version string.                  1.0
+  Copyright     Default copyright notice.                (empty)
+  Description   Default project description (multi-line).   (empty)
+

Back to Overview

+
+
+

Keyboard Shortcuts

+

Keyboard Shortcuts

+
  Shortcut         Action
+  --------         ------
+  Ctrl+O           Add File
+  Ctrl+S           Save File
+  Ctrl+A           Select All
+  Ctrl+X           Cut
+  Ctrl+C           Copy
+  Ctrl+V           Paste
+  Ctrl+F           Find
+  Ctrl+H           Replace
+  Ctrl+E           Menu Editor
+  F3               Find Next
+  F5               Run
+  Shift+F5         Debug
+  Ctrl+F5          Run Without Recompile
+  Esc              Stop
+  F7               Code View
+  Shift+F7         Design View
+  F8               Step Into
+  Shift+F8         Step Over
+  Ctrl+Shift+F8    Step Out
+  Ctrl+F8          Run to Cursor
+  F9               Toggle Breakpoint
+  Del              Delete
+
+

DVX BASIC 1.0 -- Copyright 2026 Scott Duensing

+
+
+

Data Types

+

Data Types

+

DVX BASIC supports the following data types. Each type has a corresponding type suffix character that can be appended to variable names.

+

Primary Types

+
  Type       Size       Suffix   Range / Description
+  ----       ----       ------   -------------------
+  Integer    2 bytes    %        -32768 to 32767
+  Long       4 bytes    &        -2147483648 to 2147483647
+  Single     4 bytes    !        32-bit float, approximately 7 digits precision
+  Double     8 bytes    #        64-bit float, approximately 15 digits precision
+  String     variable   $        Variable-length, reference-counted, dynamic string
+  Boolean    2 bytes    (none)   True (-1) or False (0)
+

Internal Types

+

These types are not directly declarable but are used internally by the runtime.

+
  Internal Type   Description
+  -------------   -----------
+  Array           Reference-counted multi-dimensional array (up to 8 dimensions)
+  UDT             User-defined type instance (created with TYPE...END TYPE)
+  Object          Opaque host object (form reference, control reference)
+  Ref             ByRef pointer to a variable slot (used for ByRef parameters)
+

Type Suffixes

+

Type suffixes can be appended to variable names to declare their type implicitly:

+
count%  = 42         ' Integer
+total&  = 100000     ' Long
+rate!   = 3.14       ' Single
+pi#     = 3.14159265 ' Double
+name$   = "Hello"    ' String
+

Numeric Literals

+
  Form               Example          Description
+  ----               -------          -----------
+  Decimal integer    42               Values -32768..32767 are Integer; larger are Long
+  Hex integer        &HFF             Hexadecimal literal
+  Long suffix        42&, &HFF&       Force Long type
+  Floating-point     3.14, 1.5E10     Double by default
+  Single suffix      3.14!            Force Single type
+  Double suffix      3.14#            Force Double type
+

Type Promotion

+

When mixing types in expressions, values are automatically promoted to a common type: Integer -> Long -> Single -> Double. Strings are not automatically converted to numbers (use VAL and STR$).

+

See also: Conversion Functions

+
+
+

Operators

+

Operators

+

Operators listed from highest precedence (evaluated first) to lowest precedence (evaluated last).

+
  Precedence     Operator                  Description
+  ----------     --------                  -----------
+  1 (highest)    ^                         Exponentiation
+  2              - (unary)                 Negation
+  3              *  /  \  MOD              Multiply, float div, integer div, modulus
+  4              +  -                      Addition, subtraction
+  5              &                         String concatenation
+  6              =  <>  <  >  <=  >=       Comparison (returns Boolean)
+  7              NOT                       Logical/bitwise NOT
+  8              AND                       Logical/bitwise AND
+  9              XOR                       Logical/bitwise XOR
+  10             OR                        Logical/bitwise OR
+  11             EQV                       Logical/bitwise equivalence
+  12 (lowest)    IMP                       Logical/bitwise implication
+

String Concatenation

+

Use & to concatenate strings. The + operator also concatenates when both operands are strings.

+
result$ = "Hello" & " " & "World"
+result$ = firstName$ & " " & lastName$
+
+
+

Statements Overview

+

Statements

+

Multiple statements can appear on one line separated by :. Lines can be continued with _ at the end. Comments start with ' or REM.

+

Declaration Statements (DIM, REDIM, CONST, TYPE)

+

Conditional Statements (IF, SELECT CASE)

+

Loop Statements (FOR, DO, WHILE)

+

Procedures (SUB, FUNCTION, DEF FN)

+

Flow Control (EXIT, CALL, GOTO, GOSUB, ON)

+

Input/Output (PRINT, INPUT, DATA/READ)

+

Miscellaneous Statements

+
+
+

Declaration Statements

+

Declaration Statements

+

DIM

+

Declares variables and arrays with an explicit type.

+
DIM variable AS type
+DIM variable(upperBound) AS type
+DIM variable(lower TO upper) AS type
+DIM variable(dim1, dim2, ...) AS type
+DIM variable AS UdtName
+DIM variable AS STRING * n
+DIM SHARED variable AS type
+

Examples:

+
Dim name As String
+Dim count As Integer
+Dim values(100) As Double
+Dim matrix(1 To 10, 1 To 10) As Single
+Dim Shared globalFlag As Boolean
+Dim record As PersonType
+Dim fixedStr As String * 20
+
Note: DIM SHARED makes a variable accessible from all procedures without passing it as a parameter.
+

REDIM

+

Reallocates a dynamic array, optionally preserving existing data.

+
REDIM array(newBounds) AS type
+REDIM PRESERVE array(newBounds) AS type
+
ReDim items(newSize) As String
+ReDim Preserve scores(1 To newCount) As Integer
+

CONST

+

Declares a named constant. The value must be a literal (integer, float, string, or boolean).

+
CONST name = value
+
Const MAX_SIZE = 100
+Const PI = 3.14159265
+Const APP_NAME = "DVX App"
+Const DEBUG_MODE = True
+

TYPE...END TYPE

+

Defines a user-defined type (record/structure).

+
TYPE TypeName
+    fieldName AS type
+    ...
+END TYPE
+
Type PersonType
+    firstName As String
+    lastName  As String
+    age       As Integer
+End Type
+
+Dim p As PersonType
+p.firstName = "Scott"
+p.age = 30
+

UDT fields can themselves be UDTs (nested types).

+

DECLARE

+

Forward-declares a SUB or FUNCTION. Required when a procedure is called before it is defined.

+
DECLARE SUB name ([BYVAL] param AS type, ...)
+DECLARE FUNCTION name ([BYVAL] param AS type, ...) AS returnType
+

DECLARE LIBRARY

+

Declares external native functions from a dynamically loaded library. This allows BASIC programs to call functions exported by DXE libraries.

+
DECLARE LIBRARY "libraryName"
+    DECLARE SUB name ([BYVAL] param AS type, ...)
+    DECLARE FUNCTION name ([BYVAL] param AS type, ...) AS returnType
+END DECLARE
+
Declare Library "rs232"
+    Declare Function ComOpen(ByVal port As Integer) As Integer
+    Declare Sub ComClose(ByVal port As Integer)
+    Declare Sub ComSend(ByVal port As Integer, ByVal data$ As String)
+End Declare
+

STATIC

+

Declares a local variable that retains its value between calls.

+
STATIC variable AS type
+
Sub Counter()
+    Static count As Integer
+    count = count + 1
+    Print count
+End Sub
+

OPTION

+

Sets compiler options. Must appear before any executable code.

+
OPTION BASE 0          ' Arrays start at index 0 (default)
+OPTION BASE 1          ' Arrays start at index 1
+OPTION COMPARE BINARY  ' Case-sensitive string comparisons (default)
+OPTION COMPARE TEXT    ' Case-insensitive string comparisons
+OPTION EXPLICIT        ' All variables must be declared with DIM
+

DEFtype Statements

+

Set the default type for variables based on their first letter.

+
DEFINT letterRange
+DEFLNG letterRange
+DEFSNG letterRange
+DEFDBL letterRange
+DEFSTR letterRange
+
DefInt I-N     ' Variables starting with I through N default to Integer
+DefStr S       ' Variables starting with S default to String
+

Assignment

+

Assigns a value to a variable, array element, or UDT field.

+
variable = expression
+array(index) = expression
+udt.field = expression
+LET variable = expression
+

The LET keyword is optional and supported for compatibility.

+

SWAP

+

Exchanges the values of two variables.

+
SWAP variable1, variable2
+
Swap a, b
+

ERASE

+

Frees the memory of an array and resets it.

+
ERASE arrayName
+
+
+

Conditional Statements

+

Conditional Statements

+

IF...THEN...ELSE...END IF

+

Conditional execution. Supports single-line and multi-line forms.

+

Single-line form

+
IF condition THEN statement
+IF condition THEN statement ELSE statement
+

Multi-line form

+
IF condition THEN
+    statements
+ELSEIF condition THEN
+    statements
+ELSE
+    statements
+END IF
+
If x > 10 Then
+    Print "Large"
+ElseIf x > 5 Then
+    Print "Medium"
+Else
+    Print "Small"
+End If
+
+If ready Then Print "Go!"
+

SELECT CASE

+

Multi-way branch based on an expression value.

+
SELECT CASE expression
+    CASE value
+        statements
+    CASE value1, value2
+        statements
+    CASE low TO high
+        statements
+    CASE IS operator value
+        statements
+    CASE ELSE
+        statements
+END SELECT
+
Select Case grade
+    Case 90 To 100
+        Print "A"
+    Case 80 To 89
+        Print "B"
+    Case Is >= 70
+        Print "C"
+    Case 60, 65
+        Print "D (borderline)"
+    Case Else
+        Print "F"
+End Select
+

CASE items can be combined with commas. The IS keyword allows comparison operators: <, >, <=, >=, =, <>.

+
+
+

Loop Statements

+

Loop Statements

+

FOR...NEXT

+

Counted loop with an optional step value.

+
FOR variable = start TO limit [STEP step]
+    statements
+NEXT [variable]
+
For i = 1 To 10
+    Print i
+Next i
+
+For x = 10 To 0 Step -2
+    Print x
+Next
+

The variable name after NEXT is optional. Use EXIT FOR to break out early.

+

DO...LOOP

+

General-purpose loop with pre-test, post-test, or infinite forms.

+
DO [WHILE condition | UNTIL condition]
+    statements
+LOOP [WHILE condition | UNTIL condition]
+
' Pre-test
+Do While count < 10
+    count = count + 1
+Loop
+
+' Post-test
+Do
+    line$ = ReadLine()
+Loop Until line$ = "quit"
+
+' Infinite loop (exit with EXIT DO)
+Do
+    DoEvents
+    If done Then Exit Do
+Loop
+

WHILE...WEND

+

Simple pre-test loop (legacy form; prefer DO...LOOP).

+
WHILE condition
+    statements
+WEND
+
While Not EOF(1)
+    Line Input #1, line$
+    Print line$
+Wend
+
+
+

Procedures

+

Procedures

+

SUB...END SUB

+

Defines a subroutine (no return value).

+
SUB name ([BYVAL] param AS type, ...)
+    statements
+END SUB
+
Sub Greet(ByVal name As String)
+    Print "Hello, " & name
+End Sub
+

Parameters are passed ByRef by default. Use ByVal for value semantics. Use EXIT SUB to return early.

+

FUNCTION...END FUNCTION

+

Defines a function with a return value.

+
FUNCTION name ([BYVAL] param AS type, ...) AS returnType
+    statements
+    name = returnValue
+END FUNCTION
+
Function Square(ByVal n As Double) As Double
+    Square = n * n
+End Function
+

Assign to the function name to set the return value. Use EXIT FUNCTION to return early.

+

DEF FN

+

Defines a single-expression function.

+
DEF FNname(params) = expression
+
Def FnSquare(x) = x * x
+Print FnSquare(5)     ' prints 25
+
+
+

Flow Control

+

Flow Control

+

EXIT

+

Exits the current block early.

+
EXIT FOR
+EXIT DO
+EXIT SUB
+EXIT FUNCTION
+

CALL

+

Explicitly calls a subroutine or function. The return value (if any) is discarded.

+
CALL name
+CALL name(args)
+

Normally you can omit CALL and just use the name directly.

+

GOTO / GOSUB / RETURN

+
GOTO label
+GOSUB label
+RETURN
+

GOSUB pushes the return address, executes code at the label, and RETURN jumps back. At module level, RETURN returns from a GOSUB. Inside a SUB/FUNCTION, RETURN returns from the procedure.

+
GoSub Initialize
+Print "Done"
+End
+
+Initialize:
+    count = 0
+    name$ = ""
+Return
+

ON...GOTO / ON...GOSUB

+

Computed branch based on an integer expression.

+
ON expression GOTO label1, label2, ...
+ON expression GOSUB label1, label2, ...
+

If the expression evaluates to 1, control goes to the first label; 2, the second; and so on. If out of range, execution falls through.

+
+
+

Input/Output Statements

+

Input/Output Statements

+

PRINT

+

Outputs text to the console or to a file channel.

+
PRINT [expression] [{; | ,} expression] ...
+PRINT #channel, expression
+PRINT USING format$; expression [; expression] ...
+
    +
  • ; between items -- no separator (items are concatenated)
  • +
  • , between items -- advance to the next 14-column tab zone
  • +
  • Trailing ; or , suppresses the newline
  • +
+

? is an alias for PRINT

+

Special functions inside PRINT:

+
    +
  • SPC(n) -- print n spaces
  • +
+

TAB(n) -- advance to column n

+
Print "Name:"; Tab(20); name$
+Print Using "###.##"; total
+Print #1, "Written to file"
+

INPUT

+

Reads a line of text from the user or from a file channel.

+
INPUT variable
+INPUT "prompt"; variable
+INPUT #channel, variable
+
Input "Enter your name: "; name$
+Input #1, line$
+

DATA / READ / RESTORE

+

Inline data pool for constants.

+
DATA value1, value2, "string", ...
+READ variable1, variable2, ...
+RESTORE
+

DATA statements define a pool of values. READ reads the next value from the pool into a variable. RESTORE resets the read pointer to the beginning.

+
Data 10, 20, 30, "Hello"
+Read a, b, c, msg$
+Print a; b; c; msg$
+Restore
+
+
+

Miscellaneous Statements

+

Miscellaneous Statements

+

Error Handling

+
ON ERROR GOTO label     ' Enable error handler
+ON ERROR GOTO 0          ' Disable error handler
+RESUME                   ' Retry the statement that caused the error
+RESUME NEXT              ' Continue at the next statement after the error
+ERROR n                  ' Raise a runtime error with error number n
+

The ERR keyword returns the current error number in expressions.

+
On Error GoTo ErrorHandler
+Open "missing.txt" For Input As #1
+Exit Sub
+
+ErrorHandler:
+    Print "Error number:"; Err
+    Resume Next
+

SHELL

+

Executes an operating system command.

+
SHELL "command"
+

When used as a function, returns the exit code of the command.

+
Shell "DIR /B"
+exitCode = Shell("COPY A.TXT B.TXT")
+

SLEEP

+

Pauses execution for a specified number of seconds.

+
SLEEP seconds
+

RANDOMIZE

+

Seeds the random number generator.

+
RANDOMIZE seed
+RANDOMIZE TIMER          ' Seed from system clock
+

END

+

Terminates program execution immediately.

+
END
+
+
+

File I/O

+

File I/O

+

OPEN

+

Opens a file for reading, writing, or appending.

+
OPEN filename$ FOR INPUT AS #channel
+OPEN filename$ FOR OUTPUT AS #channel
+OPEN filename$ FOR APPEND AS #channel
+OPEN filename$ FOR RANDOM AS #channel [LEN = recordSize]
+OPEN filename$ FOR BINARY AS #channel
+
  Mode      Description
+  ----      -----------
+  INPUT     Open for sequential reading. File must exist.
+  OUTPUT    Open for sequential writing. Creates or truncates.
+  APPEND    Open for sequential writing at end of file.
+  RANDOM    Open for random-access record I/O.
+  BINARY    Open for raw binary I/O.
+

CLOSE

+

Closes an open file channel.

+
CLOSE #channel
+

PRINT #

+

Writes text to a file.

+
PRINT #channel, expression
+

INPUT #

+

Reads comma-delimited data from a file.

+
INPUT #channel, variable
+

LINE INPUT #

+

Reads an entire line from a file into a string variable.

+
LINE INPUT #channel, variable$
+

WRITE #

+

Writes comma-delimited data to a file. Strings are enclosed in quotes, numbers are undecorated. Each statement writes a newline at the end.

+
WRITE #channel, expr1, expr2, ...
+
Write #1, "Scott", 42, 3.14
+' Output: "Scott",42,3.14
+

GET / PUT

+

Read and write records in RANDOM or BINARY mode files.

+
GET #channel, [recordNum], variable
+PUT #channel, [recordNum], variable
+

SEEK

+

Sets the file position. As a function, returns the current position.

+
SEEK #channel, position      ' Statement: set position
+pos = SEEK(channel)           ' Function: get current position
+
+
+

String Functions

+

String Functions

+
  Function                          Returns   Description
+  --------                          -------   -----------
+  ASC(s$)                           Integer   ASCII code of first character of s$
+  CHR$(n)                           String    Character with ASCII code n
+  FORMAT$(value, fmt$)              String    Formats a numeric value using format string
+  HEX$(n)                           String    Hexadecimal representation of n
+  INSTR(s$, find$)                  Integer   Position of find$ in s$ (1-based), 0 if not found
+  INSTR(start, s$, find$)          Integer   Search starting at position start
+  LCASE$(s$)                        String    Converts s$ to lowercase
+  LEFT$(s$, n)                      String    Leftmost n characters of s$
+  LEN(s$)                           Integer   Length of s$
+  LTRIM$(s$)                        String    Removes leading spaces from s$
+  MID$(s$, start [, length])        String    Substring from position start (1-based)
+  RIGHT$(s$, n)                     String    Rightmost n characters of s$
+  RTRIM$(s$)                        String    Removes trailing spaces from s$
+  SPACE$(n)                         String    String of n spaces
+  STR$(n)                           String    Converts number n to string
+  STRING$(n, char)                  String    String of n copies of char
+  TRIM$(s$)                         String    Removes leading and trailing spaces from s$
+  UCASE$(s$)                        String    Converts s$ to uppercase
+  VAL(s$)                           Double    Converts string s$ to a numeric value
+

MID$ Assignment

+

MID$ can also be used on the left side of an assignment to replace a portion of a string:

+
Mid$(s$, 3, 2) = "XY"    ' Replace 2 characters starting at position 3
+
+
+

Math Functions

+

Math Functions

+
  Function   Returns   Description
+  --------   -------   -----------
+  ABS(n)     Double    Absolute value of n
+  ATN(n)     Double    Arctangent of n (in radians)
+  COS(n)     Double    Cosine of n (radians)
+  EXP(n)     Double    e raised to the power n
+  FIX(n)     Integer   Truncates n toward zero (removes fractional part)
+  INT(n)     Integer   Largest integer less than or equal to n (floor)
+  LOG(n)     Double    Natural logarithm (base e) of n
+  RND[(n)]   Double    Random number between 0 (inclusive) and 1 (exclusive)
+  SGN(n)     Integer   Sign of n: -1, 0, or 1
+  SIN(n)     Double    Sine of n (radians)
+  SQR(n)     Double    Square root of n
+  TAN(n)     Double    Tangent of n (radians)
+  TIMER      Double    Number of seconds since midnight
+
Note: RND with a negative argument seeds and returns. RND(0) returns the previous value. Use RANDOMIZE to seed the generator.
+
+
+

Conversion Functions

+

Conversion Functions

+
  Function   Returns   Description
+  --------   -------   -----------
+  CDBL(n)    Double    Converts n to Double
+  CINT(n)    Integer   Converts n to Integer (with banker's rounding)
+  CLNG(n)    Long      Converts n to Long
+  CSNG(n)    Single    Converts n to Single
+  CSTR(n)    String    Converts n to its String representation
+
+
+

File I/O Functions

+

File I/O Functions

+
  Function                    Returns   Description
+  --------                    -------   -----------
+  EOF(channel)                Boolean   True if file pointer is at end of file
+  FREEFILE                    Integer   Next available file channel number
+  INPUT$(n, #channel)         String    Reads n characters from the file
+  LOC(channel)                Long      Current read/write position in the file
+  LOF(channel)                Long      Length of the file in bytes
+  SEEK(channel)               Long      Current file position (function form)
+  LBOUND(array [, dim])       Integer   Lower bound of an array dimension
+  UBOUND(array [, dim])       Integer   Upper bound of an array dimension
+
+
+

Miscellaneous Functions

+

Miscellaneous Functions

+
  Function          Returns   Description
+  --------          -------   -----------
+  DATE$             String    Current date as "MM-DD-YYYY"
+  TIME$             String    Current time as "HH:MM:SS"
+  ENVIRON$(name$)   String    Value of environment variable name$
+  ERR               Integer   Current runtime error number (0 if no error)
+
+
+

Form and Control Statements

+

Form and Control Statements

+

DVX BASIC supports Visual Basic-style forms and controls for building graphical user interfaces. Forms are defined in .frm files and loaded at runtime.

+

Loading and Unloading Forms

+
LOAD FormName
+UNLOAD FormName
+

LOAD creates the form and its controls in memory. UNLOAD destroys the form and frees its resources.

+

Showing and Hiding Forms

+
FormName.Show [modal]
+FormName.Hide
+Me.Show [modal]
+Me.Hide
+

Pass vbModal (1) to Show for a modal dialog.

+
Form2.Show vbModal
+Me.Hide
+

Property Access

+

Read and write control properties using dot notation:

+
ControlName.Property = value
+value = ControlName.Property
+
Text1.Text = "Hello"
+label1.Caption = "Name: " & name$
+x = Text1.Left
+

Method Calls

+
ControlName.Method [args]
+
List1.AddItem "New entry"
+List1.Clear
+

Me Keyword

+

Me refers to the current form. Use it to access the form's own properties, controls, and methods from within event handlers.

+
Me.Caption = "Updated Title"
+Me.Text1.Text = ""
+Me.Hide
+

Control Arrays

+

Multiple controls can share a name with unique indices. Access individual controls with parenthesized indices:

+
Option1(0).Value = True
+Label1(idx).Caption = "Item " & Str$(idx)
+Me.Label1(i).Visible = True
+

DoEvents

+

Yields control to the DVX event loop, allowing the GUI to process pending events. Call this in long-running loops to keep the UI responsive.

+
DOEVENTS
+
For i = 1 To 10000
+    ' process data
+    If i Mod 100 = 0 Then DoEvents
+Next
+

MsgBox

+

Displays a message box dialog. Can be used as a statement (discards result) or as a function (returns the button clicked).

+
MSGBOX message$ [, flags]
+result = MSGBOX(message$ [, flags])
+
MsgBox "Operation complete"
+answer = MsgBox("Continue?", vbYesNo + vbQuestion)
+If answer = vbYes Then
+    ' proceed
+End If
+

InputBox$

+

Displays an input dialog and returns the user's text entry.

+
result$ = INPUTBOX$(prompt$ [, title$ [, default$]])
+
name$ = InputBox$("Enter your name:", "Name Entry", "")
+

Event Handler Convention

+

Event handlers are named ControlName_EventName and defined as SUBs:

+
Sub Command1_Click()
+    MsgBox "Button clicked!"
+End Sub
+
+Sub Form_Load()
+    Me.Caption = "My App"
+End Sub
+
+Sub Text1_Change()
+    Label1.Caption = "You typed: " & Text1.Text
+End Sub
+

Common Events

+
  Event          Description
+  -----          -----------
+  Click          Control was clicked
+  DblClick       Control was double-clicked
+  Change         Control value/text changed
+  KeyPress       Key was pressed (receives key code)
+  KeyDown        Key went down (receives key code and shift state)
+  KeyUp          Key was released
+  MouseDown      Mouse button pressed
+  MouseUp        Mouse button released
+  MouseMove      Mouse moved over control
+  GotFocus       Control received input focus
+  LostFocus      Control lost input focus
+  Form_Load      Form is being loaded
+  Form_Unload    Form is being unloaded
+  Form_Resize    Form was resized
+  Timer          Timer interval elapsed
+
+
+

SQL Functions

+

SQL Functions

+

DVX BASIC includes built-in SQLite database support through a set of SQL functions. All functions use database handles and result set handles (integers) returned by SQLOpen and SQLQuery.

+

Opening and Closing Databases

+

SQLOpen

+

Opens a SQLite database file and returns a database handle.

+
db = SQLOPEN(path$)
+
db = SQLOpen(App.Data & "\mydata.db")
+

SQLClose

+

Closes an open database.

+
SQLCLOSE db
+

Executing SQL

+

SQLExec

+

Executes a SQL statement that does not return data (INSERT, UPDATE, DELETE, CREATE TABLE, etc.). Can be used as a statement or as a function returning a Boolean success flag.

+
SQLEXEC db, sql$
+ok = SQLEXEC(db, sql$)
+
SQLExec db, "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)"
+SQLExec db, "INSERT INTO users (name) VALUES ('Scott')"
+ok = SQLExec(db, "DELETE FROM users WHERE id = 5")
+

SQLAffected

+

Returns the number of rows affected by the last INSERT, UPDATE, or DELETE.

+
count = SQLAFFECTED(db)
+

Querying Data

+

SQLQuery

+

Executes a SELECT query and returns a result set handle.

+
rs = SQLQUERY(db, sql$)
+
rs = SQLQuery(db, "SELECT id, name FROM users ORDER BY name")
+

SQLNext

+

Advances to the next row in the result set. Can be used as a statement or as a function returning True if a row is available.

+
SQLNEXT rs
+hasRow = SQLNEXT(rs)
+

SQLEof

+

Returns True if there are no more rows in the result set.

+
done = SQLEOF(rs)
+

Reading Fields

+

SQLField$

+

Returns a field value as a string. The field can be specified by column index (0-based) or by column name.

+
value$ = SQLFIELD$(rs, columnIndex)
+value$ = SQLFIELD$(rs, "columnName")
+
name$ = SQLField$(rs, "name")
+first$ = SQLField$(rs, 0)
+

SQLFieldInt

+

Returns a field value as an integer.

+
value = SQLFIELDINT(rs, columnIndex)
+

SQLFieldDbl

+

Returns a field value as a double.

+
value# = SQLFIELDDBL(rs, columnIndex)
+

SQLFieldCount

+

Returns the number of columns in the result set.

+
count = SQLFIELDCOUNT(rs)
+

Result Set Cleanup

+

SQLFreeResult

+

Frees a result set. Always call this when done iterating a query.

+
SQLFREERESULT rs
+

Error Information

+

SQLError$

+

Returns the last error message for the database.

+
msg$ = SQLERROR$(db)
+

Complete SQL Example

+
Dim db As Long
+Dim rs As Long
+
+db = SQLOpen(App.Data & "\contacts.db")
+SQLExec db, "CREATE TABLE IF NOT EXISTS contacts (name TEXT, phone TEXT)"
+SQLExec db, "INSERT INTO contacts VALUES ('Alice', '555-1234')"
+
+rs = SQLQuery(db, "SELECT name, phone FROM contacts")
+Do While Not SQLEof(rs)
+    SQLNext rs
+    Print SQLField$(rs, "name"); Tab(20); SQLField$(rs, "phone")
+Loop
+SQLFreeResult rs
+SQLClose db
+
+
+

App Object

+

App Object

+

The App object provides read-only properties for the application's directory paths.

+
  Property      Returns   Description
+  --------      -------   -----------
+  App.Path      String    Directory containing the application's executable
+  App.Config    String    Directory for application configuration files
+  App.Data      String    Directory for application data files (databases, etc.)
+
configFile$ = App.Config & "\settings.ini"
+dbPath$ = App.Data & "\myapp.db"
+Print "Running from: " & App.Path
+
+
+

INI Functions

+

INI Functions

+

DVX BASIC provides built-in functions for reading and writing standard INI configuration files.

+

IniRead

+

Reads a value from an INI file. Returns the default value if the key is not found.

+
value$ = INIREAD(file$, section$, key$, default$)
+
name$ = IniRead(App.Config & "\app.ini", "User", "Name", "Unknown")
+fontSize = Val(IniRead(App.Config & "\app.ini", "Display", "FontSize", "12"))
+

IniWrite

+

Writes a value to an INI file. Creates the file, section, or key if they do not exist.

+
INIWRITE file$, section$, key$, value$
+
IniWrite App.Config & "\app.ini", "User", "Name", "Scott"
+IniWrite App.Config & "\app.ini", "Display", "FontSize", Str$(fontSize)
+
+
+

Predefined Constants

+

Predefined Constants

+

The following constants are predefined by the compiler and available in all programs.

+

MsgBox Button Style Flags

+
  Constant        Value   Description
+  --------        -----   -----------
+  vbOKOnly        0       OK button only (default)
+  vbOKCancel      1       OK and Cancel buttons
+  vbYesNo         2       Yes and No buttons
+  vbYesNoCancel   3       Yes, No, and Cancel buttons
+  vbRetryCancel   4       Retry and Cancel buttons
+

MsgBox Icon Flags

+

Add an icon flag to the button style to display an icon in the message box.

+
  Constant        Value   Description
+  --------        -----   -----------
+  vbInformation   &H10    Information icon
+  vbExclamation   &H20    Warning icon
+  vbCritical      &H30    Error/critical icon
+  vbQuestion      &H40    Question mark icon
+

MsgBox Return Values

+
  Constant   Value   Description
+  --------   -----   -----------
+  vbOK       1       User clicked OK
+  vbCancel   2       User clicked Cancel
+  vbYes      3       User clicked Yes
+  vbNo       4       User clicked No
+  vbRetry    5       User clicked Retry
+

Show Mode Flags

+
  Constant   Value   Description
+  --------   -----   -----------
+  vbModal    1       Show form as modal dialog
+

Boolean Constants

+
  Constant   Value   Description
+  --------   -----   -----------
+  True       -1      Boolean true
+  False      0       Boolean false
+
+
+

Common Properties, Events, and Methods

+

Common Properties, Events, and Methods

+

Every control in DVX BASIC inherits a set of common properties, events, and methods. These are handled by the form runtime before dispatching to widget-specific interface descriptors.

+

Common Properties

+
  Property     Type      R/W   Description
+  ----------   -------   ---   -------------------------------------------
+  Name         String    R     The control's name (e.g. "Command1"). Read-only at runtime.
+  Left         Integer   R/W   X position in pixels relative to the parent container.
+  Top          Integer   R/W   Y position in pixels relative to the parent container.
+  Width        Integer   R/W   Current width in pixels. Setting this changes the minimum width constraint.
+  Height       Integer   R/W   Current height in pixels. Setting this changes the minimum height constraint.
+  MinWidth     Integer   R/W   Minimum width for layout. Alias for Width in the setter.
+  MinHeight    Integer   R/W   Minimum height for layout. Alias for Height in the setter.
+  MaxWidth     Integer   R/W   Maximum width cap (0 = no limit, stretch to fill).
+  MaxHeight    Integer   R/W   Maximum height cap (0 = no limit, stretch to fill).
+  Weight       Integer   R/W   Layout weight. 0 = fixed size, >0 = share extra space proportionally.
+  Visible      Boolean   R/W   Whether the control is visible.
+  Enabled      Boolean   R/W   Whether the control accepts user input.
+  BackColor    Long      R/W   Background color as a 32-bit ARGB value.
+  ForeColor    Long      R/W   Foreground (text) color as a 32-bit ARGB value.
+  TabIndex     Integer   R     Accepted for VB compatibility but ignored. DVX has no tab order.
+

Common Events

+

These events are wired on every control loaded from a .frm file. Controls created dynamically at runtime via code only receive Click, DblClick, Change, GotFocus, and LostFocus; the keyboard, mouse, and scroll events below require the control to be defined in the .frm file.

+
  Event       Parameters                                    Description
+  ---------   -------------------------------------------   -------------------------------------------
+  Click       (none)                                        Fires when the control is clicked.
+  DblClick    (none)                                        Fires when the control is double-clicked.
+  Change      (none)                                        Fires when the control's value or text changes.
+  GotFocus    (none)                                        Fires when the control receives keyboard focus.
+  LostFocus   (none)                                        Fires when the control loses keyboard focus.
+  KeyPress    KeyAscii As Integer                           Fires when a printable key is pressed. KeyAscii is the ASCII code.
+  KeyDown     KeyCode As Integer, Shift As Integer          Fires when any key is pressed down. KeyCode is the scan code; Shift indicates modifier keys.
+  KeyUp       KeyCode As Integer, Shift As Integer          Fires when a key is released.
+  MouseDown   Button As Integer, X As Integer, Y As Integer Fires when a mouse button is pressed over the control.
+  MouseUp     Button As Integer, X As Integer, Y As Integer Fires when a mouse button is released over the control.
+  MouseMove   Button As Integer, X As Integer, Y As Integer Fires when the mouse moves over the control.
+  Scroll      Delta As Integer                              Fires when the control is scrolled (mouse wheel or scrollbar).
+

Common Methods

+
  Method     Parameters   Description
+  --------   ----------   -------------------------------------------
+  SetFocus   (none)       Gives keyboard focus to this control.
+  Refresh    (none)       Forces the control to repaint.
+

Form

+

Data Binding

+

FRM File Format

+
+
+

Data Binding

+

Data Binding

+

DVX BASIC provides VB3-style data binding through three properties that can be set on most controls:

+
  Property     Set On        Description
+  ----------   -----------   -------------------------------------------
+  DataSource   Any control   Name of the Data control to bind to (e.g. "Data1").
+  DataField    Any control   Column name from the Data control's recordset to display.
+

How It Works

+
    +
  • Place a Data control on the form and set its DatabaseName and RecordSource properties.
  • +
  • Place one or more display/edit controls (TextBox, Label, etc.) and set their DataSource to the Data control's name and DataField to a column name.
  • +
  • When the form loads, the Data control auto-refreshes: it opens the database, runs the query, and navigates to the first record.
  • +
  • Bound controls are updated automatically each time the Data control repositions (the Reposition event fires, and the runtime pushes the current record's field values into all bound controls).
  • +
+

When a bound control loses focus (LostFocus), its current text is written back to the Data control's record cache, and Update is called automatically to persist changes.

+

Master-Detail Binding

+

For hierarchical data (e.g. orders and order items), use two Data controls:

+
    +
  • A master Data control bound to the parent table.
  • +
+

A detail Data control with its MasterSource set to the master's name, MasterField set to the key column in the master, and DetailField set to the foreign key column in the detail table.

+

When the master record changes, the detail Data control automatically re-queries using the master's current value for filtering. All controls bound to the detail are refreshed.

+

DBGrid Binding

+

Set the DBGrid's DataSource to a Data control name. The grid auto-populates columns from the query results and refreshes whenever the Data control refreshes.

+

Example

+
VERSION DVX 1.00
+Begin Form frmData
+    Caption      = "Data Binding Example"
+    AutoSize     = False
+    Width        = 400
+    Height       = 280
+    Begin Data Data1
+        DatabaseName = "myapp.db"
+        RecordSource = "customers"
+    End
+    Begin Label lblName
+        Caption = "Name:"
+    End
+    Begin TextBox txtName
+        DataSource = "Data1"
+        DataField  = "name"
+    End
+    Begin Label lblEmail
+        Caption = "Email:"
+    End
+    Begin TextBox txtEmail
+        DataSource = "Data1"
+        DataField  = "email"
+    End
+End
+
+Sub Data1_Reposition ()
+    Print "Current record changed"
+End Sub
+
+Sub Data1_Validate (Cancel As Integer)
+    If txtName.Text = "" Then
+        MsgBox "Name cannot be empty!"
+        Cancel = 1
+    End If
+End Sub
+

Data

+

DBGrid

+
+
+

Menu System

+

Menu System

+

Menus are defined in the .frm file using Begin Menu blocks. Each menu item has a name, caption, and nesting level. Menu items fire Click events dispatched as MenuName_Click.

+

FRM Syntax

+
Begin Form Form1
+    Caption = "Menu Demo"
+
+    Begin Menu mnuFile
+        Caption = "&File"
+        Begin Menu mnuOpen
+            Caption = "&Open"
+        End
+        Begin Menu mnuSave
+            Caption = "&Save"
+        End
+        Begin Menu mnuSep1
+            Caption = "-"
+        End
+        Begin Menu mnuExit
+            Caption = "E&xit"
+        End
+    End
+
+    Begin Menu mnuEdit
+        Caption = "&Edit"
+        Begin Menu mnuCopy
+            Caption = "&Copy"
+        End
+        Begin Menu mnuPaste
+            Caption = "&Paste"
+        End
+    End
+End
+

Menu Item Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Caption    String    The text displayed. Use & for accelerator key. Set to "-" for a separator.
+  Checked    Boolean   Whether the menu item shows a checkmark.
+  Enabled    Boolean   Whether the menu item is enabled (default True).
+

Nesting

+

Menu items are nested by placing Begin Menu blocks inside other Begin Menu blocks:

+
    +
  • Level 0: top-level menu bar headers (e.g. "File", "Edit").
  • +
  • Level 1: items within a top-level menu.
  • +
+

Level 2+: submenu items.

+

A level-0 menu that contains children becomes a top-level menu header. A non-level-0 menu that contains children becomes a submenu.

+

Event Dispatch

+

Each clickable menu item (not headers, not separators) receives a unique numeric ID at load time. When clicked, the form's onMenu handler maps the ID to the menu item's name and fires MenuName_Click.

+
Sub mnuOpen_Click ()
+    MsgBox "Open was clicked"
+End Sub
+
+Sub mnuExit_Click ()
+    Unload Form1
+End Sub
+

Form

+

FRM File Format

+
+
+

Control Arrays

+

Control Arrays

+

DVX BASIC supports VB-style control arrays. Multiple controls can share the same name, differentiated by an Index property. When an event fires on a control array element, the element's index is passed as the first parameter.

+

Defining Control Arrays in FRM

+
Begin CommandButton Command1
+    Caption = "Button A"
+    Index   = 0
+End
+Begin CommandButton Command1
+    Caption = "Button B"
+    Index   = 1
+End
+Begin CommandButton Command1
+    Caption = "Button C"
+    Index   = 2
+End
+

Event Handler Convention

+

When a control has an Index property (>= 0), the event handler receives Index As Integer as the first parameter, before any event-specific parameters.

+
Sub Command1_Click (Index As Integer)
+    Select Case Index
+        Case 0
+            MsgBox "Button A clicked"
+        Case 1
+            MsgBox "Button B clicked"
+        Case 2
+            MsgBox "Button C clicked"
+    End Select
+End Sub
+

Accessing Array Elements in Code

+

Use the indexed form ControlName(Index) to access a specific element:

+
Command1(0).Caption = "New Text"
+Command1(1).Enabled = False
+
Note: Control array elements share the same event handler Sub. The runtime prepends the Index argument automatically. If you define parameters on the Sub, Index comes first, followed by the event's own parameters (e.g. KeyPress would be Sub Ctrl1_KeyPress (Index As Integer, KeyAscii As Integer)).
+

Common Properties, Events, and Methods

+

FRM File Format

+
+
+

FRM File Format

+

FRM File Format

+

The .frm file is a text file that describes a form's layout, controls, menus, and code. It follows a format compatible with VB3 .frm files, with DVX-specific extensions.

+

Structure

+
VERSION DVX 1.00
+Begin Form FormName
+    form-level properties...
+
+    Begin Menu mnuFile
+        Caption = "&File"
+        Begin Menu mnuOpen
+            Caption = "&Open"
+        End
+    End
+
+    Begin TypeName ControlName
+        property = value
+        ...
+    End
+
+    Begin Frame Frame1
+        Caption = "Group"
+        Begin TypeName ChildName
+            ...
+        End
+    End
+End
+
+BASIC code follows...
+
+Sub FormName_Load ()
+    ...
+End Sub
+

Rules

+
    +
  • The VERSION line is optional. VERSION DVX 1.00 marks a native DVX form. VB forms with version <= 2.0 are accepted for import.
  • +
  • The form block begins with Begin Form Name and ends with End.
  • +
  • Controls are nested with Begin TypeName Name / End.
  • +
  • Container controls (Frame, VBox, HBox, Toolbar, TabStrip, ScrollPane, Splitter, WrapBox) can have child controls nested inside them.
  • +
  • Properties are assigned as Key = Value. String values are optionally quoted.
  • +
  • Everything after the form's closing End is BASIC source code.
  • +
  • Comments in the form section use ' (single quote).
  • +
+

Blank lines are ignored in the form section.

+

Common FRM Properties

+
  Property                  Applies To        Description
+  -----------------------   ---------------   -------------------------------------------
+  Caption                   Form, controls    Display text or window title.
+  Text                      TextBox, ComboBox Initial text content.
+  MinWidth / Width          Controls          Minimum width. Both names are accepted.
+  MinHeight / Height        Controls          Minimum height. Both names are accepted.
+  MaxWidth                  Controls          Maximum width (0 = no cap).
+  MaxHeight                 Controls          Maximum height (0 = no cap).
+  Weight                    Controls          Layout weight for flexible sizing.
+  Left                      Form, controls    X position (used by Form when Centered=False; informational for controls).
+  Top                       Form, controls    Y position.
+  Index                     Controls          Control array index (-1 or absent = not in array).
+  Visible                   Controls          Initial visibility.
+  Enabled                   Controls          Initial enabled state.
+  Layout                    Form              "VBox" or "HBox".
+  AutoSize                  Form              Auto-fit window to content.
+  Resizable                 Form              Allow runtime resizing.
+  Centered                  Form              Center window on screen.
+  DatabaseName              Data              SQLite database file path.
+  RecordSource              Data              Table name or SQL query.
+  DataSource                Bound controls    Name of the Data control.
+  DataField                 Bound controls    Column name in the recordset.
+

Form

+

Common Properties, Events, and Methods

+

Menu System

+

Control Arrays

+
+
+

Form

+

Form

+

VB Equivalent: Form -- DVX Widget: Window + VBox/HBox root

+

The Form is the top-level container representing a DVX window. It is declared in the .frm file with Begin Form FormName. All controls are children of the form's content box, which uses either VBox (default) or HBox layout.

+

Form Properties

+
  Property    Type      Default          Description
+  ----------  -------   --------------   -------------------------------------------
+  Name        String    "Form1"          The form's name, used for event dispatch and Load statement.
+  Caption     String    (same as Name)   Window title bar text.
+  Width       Integer   400              Window width in pixels. Setting this disables AutoSize.
+  Height      Integer   300              Window height in pixels. Setting this disables AutoSize.
+  Left        Integer   0                Initial X position. Used when Centered is False.
+  Top         Integer   0                Initial Y position. Used when Centered is False.
+  Layout      String    "VBox"           Content box layout: "VBox" (vertical) or "HBox" (horizontal).
+  AutoSize    Boolean   True             When True, the window shrink-wraps to fit its content.
+  Resizable   Boolean   True             Whether the user can resize the window at runtime.
+  Centered    Boolean   True             When True, the window is centered on screen. When False, Left/Top are used.
+

Form Events

+
  Event         Parameters              Description
+  -----------   ---------------------   -------------------------------------------
+  Load          (none)                  Fires after the form and all controls are created. This is the default event.
+  Unload        (none)                  Fires when the form is being closed or unloaded.
+  QueryUnload   Cancel As Integer       Fires before Unload. Set Cancel = 1 to abort the close.
+  Resize        (none)                  Fires when the window is resized by the user.
+  Activate      (none)                  Fires when the window gains focus.
+  Deactivate    (none)                  Fires when the window loses focus.
+

Form Methods

+
  Statement           Description
+  ------------------  -------------------------------------------
+  Load FormName       Load the form (creates the window and controls, fires Load event).
+  Unload FormName     Unload the form (fires Unload, destroys window).
+  FormName.Show       Make the form visible.
+  FormName.Show 1     Show as modal dialog (blocks until closed).
+  FormName.Hide       Hide the form without unloading it.
+

Example

+
Sub Form_Load ()
+    Form1.Caption = "Hello World"
+    Print "Form loaded!"
+End Sub
+
+Sub Form_QueryUnload (Cancel As Integer)
+    If MsgBox("Really quit?", 4) <> 6 Then
+        Cancel = 1
+    End If
+End Sub
+
+Sub Form_Resize ()
+    Print "Window resized"
+End Sub
+

Common Properties, Events, and Methods

+

FRM File Format

+
+
+

Terminal

+

Terminal

+

DVX Extension -- DVX Widget: ansiterm (ANSI terminal emulator)

+

A VT100/ANSI terminal emulator widget. Supports ANSI escape sequences, scrollback buffer, and serial communication. Default size is 80 columns by 25 rows.

+

Type-Specific Properties

+
  Property     Type      Description
+  ----------   -------   -------------------------------------------
+  Cols         Integer   Number of character columns (read-only).
+  Rows         Integer   Number of character rows (read-only).
+  Scrollback   Integer   Number of scrollback lines (write-only).
+

Type-Specific Methods

+
  Method   Parameters        Description
+  ------   ---------------   -------------------------------------------
+  Clear    (none)            Clear the terminal screen.
+  Write    Text As String    Write text (with ANSI escape processing) to the terminal.
+

No default event.

+

Common Properties, Events, and Methods

+
+
+

Frame

+

Frame

+

VB Equivalent: Frame -- DVX Widget: frame (titled VBox container)

+

A container with a titled border. Child controls are placed inside the frame using VBox layout. In the .frm file, nest Begin/End blocks inside the Frame block.

+

Type-Specific Properties

+
  Property   Type     Description
+  --------   ------   -------------------------------------------
+  Caption    String   The title displayed in the frame border.
+

Container: Yes

+

Default Event: Click

+

Example

+
Begin Frame Frame1
+    Caption = "Options"
+    Begin CheckBox Check1
+        Caption = "Option A"
+    End
+    Begin CheckBox Check2
+        Caption = "Option B"
+    End
+End
+

Common Properties, Events, and Methods

+
+
+

HBox

+

HBox

+

DVX Extension -- DVX Widget: hbox (horizontal layout container)

+

A container that arranges its children horizontally, left to right. Use Weight on children to distribute extra space.

+

Container: Yes

+

Default Event: Click

+

No type-specific properties.

+

Common Properties, Events, and Methods

+

VBox

+
+
+

VBox

+

VBox

+

DVX Extension -- DVX Widget: vbox (vertical layout container)

+

A container that arranges its children vertically, top to bottom. No title or border. Use Weight on children to distribute extra space.

+

Container: Yes

+

Default Event: Click

+

No type-specific properties.

+

Common Properties, Events, and Methods

+

HBox

+
+
+

CommandButton

+

CommandButton

+

VB Equivalent: CommandButton -- DVX Widget: button | Name Prefix: Command

+

A push button that triggers an action when clicked. Created with wgtButton(parent, text).

+

Type-Specific Properties

+
  Property   Type     Description
+  --------   ------   -------------------------------------------
+  Caption    String   The text displayed on the button. Use & for accelerator keys (e.g. "&OK").
+

No additional type-specific properties beyond common properties and Caption.

+

Default Event: Click

+

Example

+
Begin Form Form1
+    Caption = "Button Demo"
+    Begin CommandButton Command1
+        Caption = "&Click Me!"
+    End
+End
+
+Sub Command1_Click ()
+    MsgBox "Button was clicked!"
+End Sub
+

Common Properties, Events, and Methods

+
+
+

PictureBox

+

PictureBox

+

VB Equivalent: PictureBox -- DVX Widget: canvas | Name Prefix: Picture

+

A drawing surface (canvas). Supports drawing lines, rectangles, circles, text, and individual pixels. Can save and load BMP images. The default canvas size is 64x64 pixels.

+

Type-Specific Methods

+
  Method   Parameters         Description
+  ------   ----------------   -------------------------------------------
+  Clear    Color As Integer   Fill the entire canvas with the specified color.
+

Additional drawing methods (DrawLine, DrawRect, FillRect, FillCircle, SetPixel, GetPixel, DrawText, Save, Load) are available through the C API but not currently exposed through BASIC interface descriptors.

+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

CheckBox

+

CheckBox

+

VB Equivalent: CheckBox -- DVX Widget: checkbox

+

A toggle control with a label. Checked state is exposed as a Boolean.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Caption    String    The text displayed next to the checkbox.
+  Value      Boolean   True if checked, False if unchecked.
+

Default Event: Click

+

Example

+
Begin CheckBox Check1
+    Caption = "Enable feature"
+End
+
+Sub Check1_Click ()
+    If Check1.Value Then
+        Label1.Caption = "Feature ON"
+    Else
+        Label1.Caption = "Feature OFF"
+    End If
+End Sub
+

Common Properties, Events, and Methods

+
+
+

ComboBox

+

ComboBox

+

VB Equivalent: ComboBox -- DVX Widget: combobox (editable text field + drop-down list, max 256 chars)

+

A combination of a text input and a drop-down list. The user can type text or select from the list. Supports the same AddItem/RemoveItem/Clear/List methods as ListBox.

+

Type-Specific Properties

+
  Property    Type      Description
+  ---------   -------   -------------------------------------------
+  Text        String    The text in the editable field.
+  ListIndex   Integer   Index of the currently selected list item (-1 = none).
+  ListCount   Integer   Number of items in the drop-down list (read-only).
+

Type-Specific Methods

+

Same as ListBox: AddItem, RemoveItem, Clear, List.

+

See ListBox for details

+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

Data

+

Data

+

VB Equivalent: Data -- DVX Widget: data (database record navigator)

+

A data access control that connects to a SQLite database and provides record navigation. Other controls can bind to a Data control via their DataSource and DataField properties.

+

See Data Binding for details

+

Type-Specific Properties

+
  Property       Type      R/W   Description
+  ------------   -------   ---   -------------------------------------------
+  DatabaseName   String    R/W   Path to the SQLite database file.
+  RecordSource   String    R/W   Table name or SQL SELECT query for the recordset.
+  KeyColumn      String    R/W   Primary key column name (used for UPDATE/DELETE operations).
+  Caption        String    R/W   Text displayed on the navigator bar.
+  BOF            Boolean   R     True if the current position is before the first record (read-only).
+  EOF            Boolean   R     True if the current position is past the last record (read-only).
+  MasterSource   String    R/W   Name of a master Data control (for master-detail binding).
+  MasterField    String    R/W   Column in the master recordset to filter by.
+  DetailField    String    R/W   Column in this recordset that matches the master field.
+

Type-Specific Methods

+
  Method         Parameters   Description
+  ------------   ----------   -------------------------------------------
+  MoveFirst      (none)       Navigate to the first record.
+  MoveLast       (none)       Navigate to the last record.
+  MoveNext       (none)       Navigate to the next record.
+  MovePrevious   (none)       Navigate to the previous record.
+  AddNew         (none)       Add a new blank record.
+  Delete         (none)       Delete the current record.
+  Refresh        (none)       Re-query the database and reload records.
+  Update         (none)       Write pending changes to the database.
+

Type-Specific Events

+
  Event        Parameters          Description
+  ----------   -----------------   -------------------------------------------
+  Reposition   (none)              Fires after the current record changes (navigation). This is the default event.
+  Validate     Cancel As Integer   Fires before writing a record. Set Cancel = 1 to abort.
+

Common Properties, Events, and Methods

+

Data Binding

+

DBGrid

+
+
+

DBGrid

+

DBGrid

+

VB Equivalent: DBGrid -- DVX Widget: dbgrid

+

A data-bound grid that displays records from a Data control in a tabular format. Columns are auto-generated from the query results. Bind it using the DataSource property.

+

Type-Specific Properties

+
  Property     Type      Description
+  ----------   -------   -------------------------------------------
+  DataSource   String    Name of the Data control that supplies records.
+  GridLines    Boolean   Show or hide grid lines between cells.
+

Type-Specific Methods

+
  Method    Parameters   Description
+  -------   ----------   -------------------------------------------
+  Refresh   (none)       Reload and redraw the grid from the Data control.
+

Type-Specific Events

+
  Event      Parameters   Description
+  --------   ----------   -------------------------------------------
+  Click      (none)       Fires when a cell is clicked.
+  DblClick   (none)       Fires when a cell is double-clicked. This is the default event.
+

Common Properties, Events, and Methods

+

Data

+

Data Binding

+
+
+

DropDown

+

DropDown

+

DVX Extension -- DVX Widget: dropdown (non-editable drop-down list)

+

A read-only drop-down list. Unlike ComboBox, the user cannot type free text; they can only select from the provided items. Supports AddItem/RemoveItem/Clear/List.

+

Type-Specific Properties

+
  Property    Type      Description
+  ---------   -------   -------------------------------------------
+  ListIndex   Integer   Index of the currently selected item.
+  ListCount   Integer   Number of items (read-only).
+

Type-Specific Methods

+

Same as ListBox: AddItem, RemoveItem, Clear, List.

+

See ListBox for details

+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

ImageButton

+

ImageButton

+

DVX Extension -- DVX Widget: imagebutton

+

A button that displays an image instead of text. Like Image, it requires pixel data at creation time and is typically loaded via the Picture property.

+

Type-Specific Properties

+
  Property      Type      Description
+  -----------   -------   -------------------------------------------
+  Picture       String    Path to a BMP file to load (write-only).
+  ImageWidth    Integer   Width of the loaded image in pixels (read-only).
+  ImageHeight   Integer   Height of the loaded image in pixels (read-only).
+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

Image

+

Image

+

VB Equivalent: Image -- DVX Widget: image

+

A static image display control. Loads BMP images from file. Cannot be placed via the designer toolbox (requires pixel data at creation time); typically created in code or loaded via the Picture property.

+

Type-Specific Properties

+
  Property      Type      Description
+  -----------   -------   -------------------------------------------
+  Picture       String    Path to a BMP file to load (write-only).
+  ImageWidth    Integer   Width of the loaded image in pixels (read-only).
+  ImageHeight   Integer   Height of the loaded image in pixels (read-only).
+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

Label

+

Label

+

VB Equivalent: Label -- DVX Widget: label

+

A static text label. Supports left, center, and right alignment.

+

Type-Specific Properties

+
  Property    Type   Description
+  ---------   ----   -------------------------------------------
+  Caption     String The text displayed by the label.
+  Alignment   Enum   Text alignment: Left (default), Center, or Right.
+

Default Event: Click

+

Example

+
Begin Label Label1
+    Caption   = "Hello, World!"
+    Alignment = "Center"
+End
+

Common Properties, Events, and Methods

+
+
+

ListBox

+

ListBox

+

VB Equivalent: ListBox -- DVX Widget: listbox

+

A scrollable list of selectable items. Items are managed via methods (AddItem, RemoveItem, Clear). Supports single and multi-select modes.

+

Type-Specific Properties

+
  Property    Type      Description
+  ---------   -------   -------------------------------------------
+  ListIndex   Integer   Index of the currently selected item (-1 = no selection).
+  ListCount   Integer   Number of items in the list (read-only).
+

Type-Specific Methods

+
  Method            Parameters                                Description
+  ---------------   ---------------------------------------   -------------------------------------------
+  AddItem           Text As String                            Add an item to the end of the list.
+  RemoveItem        Index As Integer                          Remove the item at the given index.
+  Clear             (none)                                    Remove all items from the list.
+  List              Index As Integer                          Return the text of the item at the given index.
+  SelectAll         (none)                                    Select all items (multi-select mode).
+  ClearSelection    (none)                                    Deselect all items.
+  SetMultiSelect    Multi As Boolean                          Enable or disable multi-select mode.
+  SetReorderable    Reorderable As Boolean                    Enable or disable drag-to-reorder.
+  IsItemSelected    Index As Integer                          Returns True if the item at Index is selected.
+  SetItemSelected   Index As Integer, Selected As Boolean     Select or deselect a specific item.
+

Default Event: Click

+

Example

+
Sub Form_Load ()
+    List1.AddItem "Apple"
+    List1.AddItem "Banana"
+    List1.AddItem "Cherry"
+End Sub
+
+Sub List1_Click ()
+    Dim idx As Integer
+    idx = List1.ListIndex
+    If idx >= 0 Then
+        Label1.Caption = "Selected: " & List1.List(idx)
+    End If
+End Sub
+

Common Properties, Events, and Methods

+

ComboBox

+

DropDown

+
+
+

ListView

+

ListView

+

VB Equivalent: ListView -- DVX Widget: listview

+

A multi-column list with column headers. Supports sorting, multi-select, and drag-to-reorder. Columns are configured via the C API (SetColumns, SetData).

+

Type-Specific Properties

+
  Property    Type      Description
+  ---------   -------   -------------------------------------------
+  ListIndex   Integer   Index of the currently selected row (-1 = none).
+

Type-Specific Methods

+
  Method            Parameters                                Description
+  ---------------   ---------------------------------------   -------------------------------------------
+  SelectAll         (none)                                    Select all rows.
+  ClearSelection    (none)                                    Deselect all rows.
+  SetMultiSelect    Multi As Boolean                          Enable or disable multi-select.
+  SetReorderable    Reorderable As Boolean                    Enable or disable row reordering.
+  IsItemSelected    Index As Integer                          Returns True if the row at Index is selected.
+  SetItemSelected   Index As Integer, Selected As Boolean     Select or deselect a specific row.
+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

ProgressBar

+

ProgressBar

+

VB Equivalent: ProgressBar -- DVX Widget: progressbar

+

A horizontal progress indicator bar.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Value      Integer   Current progress value (0-100).
+

No type-specific events or methods. No default event.

+

Common Properties, Events, and Methods

+
+
+

OptionButton

+

OptionButton

+

VB Equivalent: OptionButton -- DVX Widget: radio (radio group + radio button) | Name Prefix: Option

+

A radio button for mutually exclusive choices. DVX uses a radio group container; individual OptionButtons are children of the group. The Value property returns the button's index within its group.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Caption    String    The text displayed next to the radio button.
+  Value      Integer   The index of this radio button within its group (read-only).
+

Type-Specific Methods

+
  Method        Parameters          Description
+  -----------   -----------------   -------------------------------------------
+  SetSelected   Index As Integer    Select the radio button at the given index within the group.
+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

ScrollPane

+

ScrollPane

+

DVX Extension -- DVX Widget: scrollpane | Name Prefix: Scroll

+

A scrollable container. Place child controls inside and the ScrollPane automatically provides scrollbars when the content exceeds the visible area.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  NoBorder   Boolean   When True, suppresses the border around the scroll pane.
+

Container: Yes

+

No default event.

+

Common Properties, Events, and Methods

+
+
+

Line

+

Line

+

VB Equivalent: Line -- DVX Widget: separator

+

A visual separator line. The underlying widget supports both horizontal and vertical orientations. The default (via BASIC) is horizontal.

+

No type-specific properties, events, or methods.

+

Common Properties, Events, and Methods

+
+
+

HScrollBar

+

HScrollBar

+

VB Equivalent: HScrollBar -- DVX Widget: slider | Name Prefix: HScroll

+

A horizontal slider/scrollbar control. The value ranges between a minimum and maximum set at creation time (default 0 to 100).

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Value      Integer   The current slider position (clamped to min/max range).
+

Default Event: Change

+

Example

+
Begin HScrollBar HScroll1
+    MinWidth = 200
+End
+
+Sub HScroll1_Change ()
+    Label1.Caption = "Value: " & Str$(HScroll1.Value)
+End Sub
+

Common Properties, Events, and Methods

+
+
+

Spacer

+

Spacer

+

DVX Extension -- DVX Widget: spacer

+

An invisible layout spacer. Takes up space in the layout without rendering anything. Useful for pushing controls apart. Give it a Weight to absorb extra space.

+

No type-specific properties, events, or methods.

+

Common Properties, Events, and Methods

+
+
+

SpinButton

+

SpinButton

+

DVX Extension -- DVX Widget: spinner | Name Prefix: Spin

+

A numeric input with up/down buttons. Supports integer mode (default) and real-number mode with configurable decimal places.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Value      Integer   Current integer value (in integer mode).
+  RealMode   Boolean   True to use floating-point mode; False for integer mode.
+  Decimals   Integer   Number of decimal places shown in real mode.
+

Type-Specific Methods

+
  Method     Parameters                       Description
+  --------   ------------------------------   -------------------------------------------
+  SetRange   Min As Integer, Max As Integer   Set the allowed value range.
+  SetStep    Step As Integer                  Set the increment per button click.
+

Default Event: Change

+

Common Properties, Events, and Methods

+
+
+

Splitter

+

Splitter

+

DVX Extension -- DVX Widget: splitter

+

A resizable split pane. Holds exactly two child widgets separated by a draggable divider. Default orientation is vertical (top/bottom split).

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Position   Integer   Position of the divider in pixels from the top (or left).
+

Container: Yes

+

No default event.

+

Common Properties, Events, and Methods

+
+
+

StatusBar

+

StatusBar

+

VB Equivalent: StatusBar -- DVX Widget: statusbar

+

A horizontal container styled as a status bar, typically placed at the bottom of a form. At the C API level it accepts child widgets, but it is not registered as a container in the form runtime, so child controls cannot be nested inside it in .frm files. Set its Caption property to display status text.

+

No type-specific properties, events, or methods.

+

Common Properties, Events, and Methods

+
+
+

TabStrip

+

TabStrip

+

VB Equivalent: TabStrip -- DVX Widget: tabcontrol

+

A tabbed container. Each tab page is a separate container that holds child controls. Switching tabs shows one page and hides others.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  TabIndex   Integer   Index of the active tab (0-based). Note: this property name collides with the common VB-compatibility TabIndex property, which shadows it at runtime. Use the SetActive method instead to switch tabs.
+

Type-Specific Methods

+
  Method      Parameters          Description
+  ---------   -----------------   -------------------------------------------
+  SetActive   Index As Integer    Switch to the tab at the given index. This is the recommended way to change tabs at runtime (the TabIndex property is shadowed by the common property handler).
+

Container: Yes

+

Default Event: Click

+
Warning: The TabIndex property is shadowed by the common property handler at runtime. Use the SetActive method to change tabs programmatically.
+

Common Properties, Events, and Methods

+
+
+

TextBox

+

TextBox

+

VB Equivalent: TextBox -- DVX Widget: textbox (single-line text input, max 256 chars)

+

A single-line text input field. Supports data binding via DataSource and DataField properties.

+

Type-Specific Properties

+
  Property     Type     Description
+  ----------   ------   -------------------------------------------
+  Text         String   The text content of the input field.
+  DataSource   String   Name of a Data control for data binding.
+  DataField    String   Column name for data binding.
+

Default Event: Change

+

Example

+
Begin TextBox Text1
+    Text = "Enter text here"
+End
+
+Sub Text1_Change ()
+    Label1.Caption = "You typed: " & Text1.Text
+End Sub
+

Common Properties, Events, and Methods

+

Data Binding

+
+
+

TextArea

+

TextArea

+

VB Equivalent: TextArea (DVX extension) -- DVX Widget: textarea (multi-line text input, max 4096 chars)

+

A multi-line text editing area. This is a DVX extension with no direct VB3 equivalent (VB uses a TextBox with MultiLine=True). Supports syntax colorization, line numbers, auto-indent, and find/replace via the C API.

+

Type-Specific Properties

+
  Property   Type     Description
+  --------   ------   -------------------------------------------
+  Text       String   The full text content.
+

Default Event: Change

+

Common Properties, Events, and Methods

+
+
+

Timer

+

Timer

+

VB Equivalent: Timer -- DVX Widget: timer (non-visual)

+

A non-visual control that fires its event at a regular interval. The Timer widget is invisible at runtime -- it has no on-screen representation.

+

Type-Specific Properties

+
  Property   Type      Description
+  --------   -------   -------------------------------------------
+  Enabled    Boolean   True to start the timer, False to stop it.
+  Interval   Integer   Timer interval in milliseconds (write-only from BASIC).
+

Type-Specific Methods

+
  Method   Parameters   Description
+  ------   ----------   -------------------------------------------
+  Start    (none)       Start the timer.
+  Stop     (none)       Stop the timer.
+

Type-Specific Events

+
  Event   Parameters   Description
+  -----   ----------   -------------------------------------------
+  Timer   (none)       Fires each time the interval elapses. This is the default event.
+
Note: The Timer control fires the Timer event instead of Change. The onChange callback on the underlying widget is remapped automatically.
+

Example

+
Begin Timer Timer1
+    Interval = 1000
+    Enabled  = True
+End
+
+Dim counter As Integer
+
+Sub Timer1_Timer ()
+    counter = counter + 1
+    Label1.Caption = "Ticks: " & Str$(counter)
+End Sub
+

Common Properties, Events, and Methods

+
+
+

Toolbar

+

Toolbar

+

VB Equivalent: Toolbar -- DVX Widget: toolbar

+

A horizontal container styled as a toolbar, with compact padding and spacing. Place buttons, labels, or other controls inside.

+

Container: Yes

+

No type-specific properties, events, or methods.

+

Common Properties, Events, and Methods

+
+
+

TreeView

+

TreeView

+

VB Equivalent: TreeView -- DVX Widget: treeview

+

A hierarchical tree of expandable/collapsible nodes. Nodes are created via the C API (wgtTreeItem). Supports multi-select and drag-to-reorder.

+

Type-Specific Methods

+
  Method           Parameters               Description
+  --------------   ----------------------   -------------------------------------------
+  SetMultiSelect   Multi As Boolean         Enable or disable multi-select mode.
+  SetReorderable   Reorderable As Boolean   Enable or disable node reordering.
+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+

WrapBox

+

WrapBox

+

DVX Extension -- DVX Widget: wrapbox

+

A container that arranges children in a flowing layout, wrapping to the next row when the available width is exceeded. Similar to CSS flexbox with flex-wrap: wrap.

+

Type-Specific Properties

+
  Property    Type   Description
+  ---------   ----   -------------------------------------------
+  Alignment   Enum   Horizontal alignment of items: Left, Center, or Right.
+

Container: Yes

+

Default Event: Click

+

Common Properties, Events, and Methods

+
+
+ + diff --git a/docs/dvx_help_viewer.html b/docs/dvx_help_viewer.html new file mode 100644 index 0000000..01e71c6 --- /dev/null +++ b/docs/dvx_help_viewer.html @@ -0,0 +1,175 @@ + + + + +DVX Help Viewer + + + + +
+
+

DVX Help Viewer

+

DVX Help Viewer

+

The DVX Help Viewer displays .hlp help files compiled from .dhs source documents. It provides a tree-based table of contents, scrollable content with word-wrapped text, clickable hyperlinks, full-text search, and a keyword index.

+

Opening Help

+

Press F1 from any DVX application to open context-sensitive help. Applications can register their own help file and topic so F1 opens the relevant page.

+

You can also launch the help viewer from an application's Help menu, or by clicking the DVX Help icon in the Program Manager.

+

Navigation

+
    +
  • Click a topic in the tree on the left to display it
  • +
  • Click underlined links in the content to jump to other topics
  • +
  • Use the Back and Forward buttons (or Navigate menu) to retrace your steps
  • +
  • Use Navigate > Index to browse an alphabetical keyword list
  • +
+

Use Navigate > Search to find topics by keyword

+

Keyboard Shortcuts

+
  Alt+Left     Back
+  Alt+Right    Forward
+  Ctrl+F       Search
+  Escape       Close viewer
+
+
+

Help Source Format (.dhs)

+

Help Source Format (.dhs)

+

Help files are authored as plain text .dhs source files using a simple line-oriented directive format. Lines beginning with a period at column 0 are directives. All other lines are body text, which is automatically word-wrapped by the viewer at display time.

+

Topic Directives

+
  .topic <id>          Start a new topic with a unique string ID
+  .title <text>        Set the topic's display title
+  .toc <depth> <text>  Add a table of contents entry (0=root, 1=child, etc.)
+  .default             Mark this topic as the one shown when the file opens
+

Content Directives

+
  .h1 <text>           Level 1 heading (colored bar)
+  .h2 <text>           Level 2 heading (underlined)
+  .h3 <text>           Level 3 heading (plain)
+  .hr                  Horizontal rule
+  .link <id> <text>    Hyperlink to another topic
+  .image <file.bmp>    Inline image (BMP format)
+

Block Directives

+
  .list                Start a bulleted list
+  .item <text>         List item (must be inside .list)
+  .endlist             End the bulleted list
+  .table               Start a preformatted table block
+  .endtable            End table block
+  .code                Start a preformatted code block
+  .endcode             End code block
+  .note [info|tip|warning]   Start a callout box
+  .endnote             End callout box
+

Index Directives

+
  .index <keyword>     Add a keyword to the index pointing to this topic
+

Example

+
.topic intro
+.title Welcome
+.toc 0 Welcome
+.default
+.index Welcome
+
+.h1 Welcome
+
+This is a paragraph of body text. It will be
+automatically word-wrapped by the viewer.
+
+.list
+.item First item
+.item Second item
+.endlist
+
+.link other.topic See also: Other Topic
+
+.note info
+This is an informational note.
+.endnote
+
+.note tip
+This is a helpful tip.
+.endnote
+
+.note warning
+This is a warning message.
+.endnote
+

Callout Boxes

+

Three types of callout boxes are available, each with a distinct colored accent bar:

+
Note: Use info notes for general supplementary information.
+
Tip: Use tip notes for helpful suggestions and best practices.
+
Warning: Use warning notes for important cautions the reader should be aware of.
+
+
+

Help Compiler (dvxhlpc)

+

Help Compiler (dvxhlpc)

+

The dvxhlpc tool runs on the host (Linux) and compiles .dhs source files into binary .hlp files for the viewer, and optionally into self-contained HTML.

+

Usage

+
dvxhlpc -o output.hlp [-i imagedir] [--html out.html] input.dhs [...]
+

Options

+
  -o output.hlp       Output binary help file (required)
+  -i imagedir         Directory to find .image files (default: current dir)
+  --html out.html     Also emit a self-contained HTML file
+

Multiple input files are merged into a single help file. This allows per-widget or per-feature documentation fragments to be combined automatically.

+

Build Integration

+

The standard build pattern globs all fragments:

+
dvxhlpc -o dvxhelp.hlp docs/src/overview.dhs widgets/*/*.dhs
+

New widgets or features just drop a .dhs file in their source directory and it appears in the help on the next build.

+

HTML Output

+

The --html flag produces a single self-contained HTML file with a sidebar table of contents, styled headings, lists, code blocks, notes, and embedded images (base64 data URIs). This is useful for viewing documentation on the host machine without running the DOS help viewer.

+
+
+

Application Integration

+

Application Integration

+

Any DVX application can provide context-sensitive help via the F1 key.

+

Setting Up Help

+

In your appMain, set the help file path on the app context:

+
snprintf(ctx->helpFile, sizeof(ctx->helpFile),
+         "%s%cMYAPP.HLP", ctx->appDir, DVX_PATH_SEP);
+

Context-Sensitive Topics

+

Update helpTopic as the user navigates your application:

+
snprintf(ctx->helpTopic, sizeof(ctx->helpTopic), "settings.video");
+

When the user presses F1, the shell launches the help viewer with your help file opened to the specified topic.

+

Launching Help from Menus

+

To add a Help menu item that opens your help file:

+
shellLoadAppWithArgs(ctx, viewerPath, helpFilePath);
+
+
+ + diff --git a/docs/dvx_system_reference.html b/docs/dvx_system_reference.html new file mode 100644 index 0000000..d8eae4d --- /dev/null +++ b/docs/dvx_system_reference.html @@ -0,0 +1,5348 @@ + + + + +DVX Architecture Overview + + + + +
+
+

DVX Architecture Overview

+

DVX Architecture Overview

+

DOS Visual eXecutive -- A Windowing GUI for DJGPP/DPMI

+

DVX (DOS Visual eXecutive) is a complete windowing GUI compositor targeting DJGPP/DPMI on DOS. It provides overlapping windows with Motif-style chrome, a retained-mode widget toolkit, cooperative multitasking of DXE-loaded applications, and a dirty-rectangle compositor optimized for 486/Pentium hardware.

+

Key Design Constraints

+
    +
  • VESA VBE 2.0+ LFB only -- no bank switching. If the hardware cannot provide a linear framebuffer, initialization fails.
  • +
  • 486 baseline -- all hot paths are written to be fast on a 486, with Pentium-specific paths where the gain is significant.
  • +
  • Single-tasking cooperative model -- applications yield the CPU via tsYield(); there is no preemptive scheduler.
  • +
  • 86Box is the trusted reference platform for testing. DOSBox-X is not used; any bugs observed are treated as DVX bugs.
  • +
+

No external font or cursor files -- all bitmaps are compiled in as static const data.

+

The runtime environment consists of a bootstrap loader (dvx.exe) that loads core DXE libraries, widget plugins, and the shell, which in turn loads and manages DXE application modules.

+

Contents

+

Five-Layer Architecture

+

Display Pipeline

+

Window System

+

Widget System

+

DXE Module System

+

Event Model

+

Font System

+

Color System

+

Platform Layer

+

Build System

+
+
+

Five-Layer Architecture

+

Five-Layer Architecture

+

DVX is organized into five layers, each implemented as a single .h/.c pair. Every header includes dvxTypes.h (the shared type definitions) to avoid circular dependencies. The layers are strictly stacked: each layer depends only on the layers below it.

+
 Applications (DXE .app modules)
+ ==================================================
+ |                                                |
+ |  +------------------------------------------+  |
+ |  |  Layer 5: dvxApp  (Application API)      |  |  dvxApp.h / dvxApp.c
+ |  |  Event loop, window creation, public API  |  |
+ |  +------------------------------------------+  |
+ |  |  Layer 4: dvxWm   (Window Manager)       |  |  dvxWm.h / dvxWm.c
+ |  |  Window stack, chrome, drag, resize      |  |
+ |  +------------------------------------------+  |
+ |  |  Layer 3: dvxComp  (Compositor)          |  |  dvxComp.h / dvxComp.c
+ |  |  Dirty rect tracking, merge, LFB flush   |  |
+ |  +------------------------------------------+  |
+ |  |  Layer 2: dvxDraw  (Drawing Primitives)  |  |  dvxDraw.h / dvxDraw.c
+ |  |  Rects, bevels, text, blits, cursors     |  |
+ |  +------------------------------------------+  |
+ |  |  Layer 1: dvxVideo (Video Backend)       |  |  dvxVideo.h / dvxVideo.c
+ |  |  VESA VBE, LFB mapping, pixel format     |  |
+ |  +------------------------------------------+  |
+ |                                                |
+ |  +------------------------------------------+  |
+ |  |  Platform Layer (dvxPlatform.h)          |  |  dvxPlatformDos.c
+ |  |  OS-specific: video, input, asm spans    |  |
+ |  +------------------------------------------+  |
+ |                                                |
+ |  +------------------------------------------+  |
+ |  |  Shared Types (dvxTypes.h)               |  |
+ |  |  DisplayT, WindowT, RectT, ColorSchemeT  |  |
+ |  +------------------------------------------+  |
+ ==================================================
+

Layer Summary

+
  Layer               Header         Responsibility
+  -----               ------         --------------
+  1 - Video           dvxVideo.h     VESA VBE mode negotiation, LFB mapping via DPMI, backbuffer allocation, packColor() (RGB to native pixel format), display-wide clip rectangle.
+  2 - Draw            dvxDraw.h      All 2D drawing: rectFill, rectCopy, drawBevel, drawText/drawTextN, drawMaskedBitmap (cursor), drawTermRow (batch terminal row). Stateless beyond clip rect. Dispatches hot inner loops through BlitOpsT function pointers.
+  3 - Compositor      dvxComp.h      Dirty rectangle tracking (dirtyListAdd), pairwise merge of overlapping rects (dirtyListMerge), and flushRect to copy dirty regions from backBuf to LFB.
+  4 - Window Manager  dvxWm.h        Window lifecycle, Z-order stack, chrome drawing (title bars, bevels, close/minimize/maximize gadgets), hit testing, drag/resize, menu bars, scrollbars, system menu, keyboard move/resize, minimized icon bar.
+  5 - Application     dvxApp.h       Public API aggregating all layers into AppContextT. Provides dvxInit/dvxShutdown, dvxRun/dvxUpdate, window creation helpers, image loading, clipboard, accelerator tables, theme management, wallpaper, video mode switching, screenshot capture.
+
+
+

Display Pipeline

+

Display Pipeline

+

The double-buffer strategy is the single most important performance decision in DVX. All drawing goes to a system RAM backbuffer (DisplayT.backBuf); only dirty rectangles are flushed to the linear framebuffer (DisplayT.lfb) in video memory.

+

This matters because writes to video memory over the PCI bus are 10-50x slower than writes to main RAM on 486/Pentium hardware for random-access patterns.

+

Per-Frame Compositing Pipeline

+
  1. Input poll (mouse, keyboard)
+         |
+  2. Event dispatch (focus window callbacks)
+         |
+  3. Layers call dirtyListAdd() for changed regions
+         |
+  4. dirtyListMerge() consolidates overlapping rects
+         |
+  5. For each merged dirty rect:
+     a. Clip and redraw desktop background (or wallpaper)
+     b. For each window (back-to-front, painter's algorithm):
+        - wmDrawChrome()   -- frame, title bar, gadgets, menu bar
+        - wmDrawContent()  -- blit per-window content buffer
+        - wmDrawScrollbars()
+     c. Draw minimized window icons
+     d. Draw popup menus / tooltips (overlay pass)
+     e. Draw software mouse cursor
+         |
+  6. flushRect() -- copy each dirty rect from backBuf to LFB
+         |
+  7. Yield (platformYield)
+

Key Data Structures

+

DisplayT -- Central display context: width, height, pitch, pixel format, LFB pointer, backbuffer pointer, palette, clip rectangle. Passed by pointer through every layer -- no globals.

+

BlitOpsT -- Vtable of span fill/copy function pointers resolved at init time for the active pixel depth. On DOS these dispatch to hand-written rep stosl / rep movsd asm inner loops.

+

DirtyListT -- Fixed-capacity dynamic array of RectT. Linear scanning for merge candidates is cache-friendly at typical sizes (under 128 rects). If the list fills up, the compositor merges aggressively or falls back to full-screen repaint.

+

Why This Works on a 486

+
    +
  • A full 640x480x32bpp frame is 1.2 MB -- far too much to flush every frame over a slow PCI bus.
  • +
  • A typical dirty region during normal interaction (typing, menu open) is a few KB.
  • +
  • Merging overlapping dirty rects into larger rects reduces per-rect overhead and improves bus utilization.
  • +
+

Per-window content buffers persist across frames, so windows don't repaint on expose -- only when their own content changes.

+
+
+

Window System

+

Window System

+

WindowT Structure

+

Each WindowT is the central object of the window manager. Key fields:

+
  Field Group                              Purpose
+  -----------                              -------
+  Geometry (x, y, w, h)                   Outer frame rectangle (including chrome).
+  Content area (contentX/Y/W/H)           Computed from frame minus chrome. Where application content lives.
+  Content buffer (contentBuf, contentPitch) Per-window backbuffer in native pixel format. Persists across frames.
+  Chrome state (menuBar, vScroll, hScroll) Optional menu bar and scrollbars. Affect content area computation.
+  Widget tree (widgetRoot)                 Root of the retained-mode widget tree (NULL if using raw callbacks).
+  Callbacks                                onPaint, onKey, onKeyUp, onMouse, onResize, onClose, onMenu, onScroll, onFocus, onBlur, onCursorQuery.
+

Window Stack (Z-Order)

+

WindowStackT is an array of WindowT* ordered front-to-back: index count-1 is the topmost window. This allows:

+
    +
  • Back-to-front iteration for painting (painter's algorithm).
  • +
  • Front-to-back iteration for hit testing (first hit wins).
  • +
+

Reordering by pointer swap (no copying of large WindowT structs).

+

Only one drag/resize/scroll operation can be active system-wide at a time (single mouse), so that state lives on the stack, not on individual windows.

+

Chrome Layout

+
  +-------------------------------------------+
+  |  4px outer border (raised bevel)          |
+  |  +-------------------------------------+  |
+  |  | [X] Title Bar Text     [_] [^] [X]  |  |  20px title height
+  |  +-------------------------------------+  |
+  |  | 2px inner border                    |  |
+  |  +-------------------------------------+  |
+  |  | Menu Bar (optional, 20px)           |  |
+  |  +-------------------------------------+  |
+  |  |                                     |  |
+  |  |          Content Area               |  |
+  |  |                                     |  |
+  |  |                               |  S  |  |  S = vertical scrollbar
+  |  |                               |  B  |  |      (16px wide)
+  |  +-------------------------------------+  |
+  |  |  Horizontal Scrollbar (optional)    |  |  16px tall
+  |  +-------------------------------------+  |
+  |  4px outer border                         |
+  +-------------------------------------------+
+

Chrome constants are compile-time defines:

+
  CHROME_BORDER_WIDTH   = 4px
+  CHROME_TITLE_HEIGHT   = 20px
+  CHROME_INNER_BORDER   = 2px
+  CHROME_MENU_HEIGHT    = 20px
+  SCROLLBAR_WIDTH       = 16px
+  CHROME_CLOSE_BTN_SIZE = 16px
+

Hit Test Regions

+

wmHitTest() iterates the stack front-to-back and returns a hit-part identifier: HIT_CONTENT, HIT_TITLE, HIT_CLOSE, HIT_RESIZE, HIT_MENU, HIT_VSCROLL, HIT_HSCROLL, HIT_MINIMIZE, HIT_MAXIMIZE. Resize edge detection returns a bitmask of RESIZE_LEFT, RESIZE_RIGHT, RESIZE_TOP, RESIZE_BOTTOM (corners combine two edges).

+

Menu System

+

Menus use fixed-size arrays with inline char buffers (no heap strings). Up to 8 menus per bar, items dynamically allocated. Supports cascading submenus via MenuItemT.subMenu pointer. Item types: normal, checkbox, radio. Separators are non-interactive items. The popup state (PopupStateT) tracks a stack of parent frames for cascading submenu nesting.

+

Minimized Windows

+

Minimized windows display as 64x64 icons at the bottom of the screen with beveled borders, similar to a classic desktop icon bar. Icons show a scaled-down preview of the window's content buffer, refreshed one per frame in a round-robin fashion to amortize the scaling cost.

+
+
+

Widget System

+

Widget System

+

The widget system (dvxWidget.h) is a retained-mode toolkit layered on top of the window manager. Widgets form a tree rooted at a per-window VBox container.

+

WidgetT Base Structure

+

Every widget shares the same WidgetT struct. The type field is a runtime-assigned integer ID. The wclass pointer references the widget's WidgetClassT vtable. Widget-specific private data is stored in w->data (opaque void*).

+

Tree linkage: parent, firstChild, lastChild, nextSibling. No prevSibling -- this halves pointer overhead and removal is still O(n) for typical tree depths of 5-10.

+

Layout Engine

+

Two-pass flexbox-like algorithm:

+
    +
  • Bottom-up (calcMinSize) -- compute minimum sizes for every widget, starting from leaves.
  • +
+

Top-down (layout) -- allocate space within available bounds, distributing extra space according to weight values (0 = fixed, 100 = normal stretch).

+

Size hints use a tagged encoding: the top 2 bits of an int32_t select the unit (pixels, character widths, or percentage of parent), the low 30 bits hold the value. Macros: wgtPixels(v), wgtChars(v), wgtPercent(v).

+

Widget Class Dispatch (WidgetClassT)

+

Each widget type provides a WidgetClassT with a handlers[] array indexed by stable method IDs. Method IDs are never reordered or reused -- new methods append at the end. This provides ABI-stable dispatch so that widget DXEs compiled against an older DVX version continue to work.

+

Methods include: PAINT, PAINT_OVERLAY, CALC_MIN_SIZE, LAYOUT, ON_MOUSE, ON_KEY, ON_ACCEL_ACTIVATE, DESTROY, GET_TEXT, SET_TEXT, POLL, and more (21 defined, room for 32).

+

Class Flags

+
  Flag                    Meaning
+  ----                    -------
+  WCLASS_FOCUSABLE        Can receive keyboard focus (Tab navigation)
+  WCLASS_HORIZ_CONTAINER  Lays out children horizontally (HBox)
+  WCLASS_PAINTS_CHILDREN  Widget handles child rendering itself
+  WCLASS_SCROLLABLE       Accepts mouse wheel events
+  WCLASS_SCROLL_CONTAINER ScrollPane -- scrolling viewport
+  WCLASS_NEEDS_POLL       Needs periodic polling (e.g. AnsiTerm comms)
+  WCLASS_SWALLOWS_TAB     Tab key goes to widget, not focus navigation
+  WCLASS_PRESS_RELEASE    Click = press + release (buttons)
+

Available Widget Types

+

Each widget is a separate .wgt DXE module. 29 widget types are included:

+
  Widget                  Description
+  ------                  -----------
+  Box (VBox/HBox)         Vertical and horizontal layout containers
+  Button                  Clickable push button with label
+  Canvas                  Raw drawing surface for custom painting
+  Checkbox                Boolean toggle with checkmark
+  ComboBox                Text input with dropdown list
+  DataCtrl                Data-bound control for database operations
+  DbGrid                  Database grid (tabular data display)
+  Dropdown                Dropdown selection list
+  Image                   Static image display
+  ImageButton             Button with bitmap icon
+  Label                   Static text label
+  ListBox                 Scrollable selection list
+  ListView                Multi-column list with headers and sorting
+  ProgressBar             Determinate progress indicator
+  Radio                   Radio button (mutual exclusion group)
+  ScrollPane              Scrollable viewport container
+  Separator               Visual divider line
+  Slider                  Value selection via draggable thumb
+  Spacer                  Empty space for layout
+  Spinner                 Numeric input with up/down arrows
+  Splitter                Resizable split pane
+  StatusBar               Window status bar with sections
+  TabControl              Tabbed page container
+  Terminal (AnsiTerm)     ANSI terminal emulator widget
+  TextInput               Single-line text entry field
+  Timer                   Periodic timer events
+  Toolbar                 Toolbar with icon buttons
+  TreeView                Hierarchical tree display
+  WrapBox                 Flow layout (wrapping horizontal container)
+

Widget API Registry

+

Each widget DXE registers a small API struct under a name during wgtRegister(). Callers retrieve it via wgtGetApi("button") and cast to the widget-specific API type. Per-widget headers provide typed accessors so callers avoid manual casts. Adding a new widget requires zero changes to the core.

+

Widget Interface Descriptors (WgtIfaceT)

+

Each widget can register an interface descriptor that describes its BASIC-facing properties, methods, and events. These descriptors are used by the form runtime and IDE for generic dispatch and property panel enumeration. Properties have typed getters/setters (WGT_IFACE_STRING, WGT_IFACE_INT, WGT_IFACE_BOOL, WGT_IFACE_ENUM).

+
+
+

DXE Module System

+

DXE Module System

+

DVX uses DJGPP's DXE3 (Dynamic eXtension) format for all loadable modules. DXE3 supports RTLD_GLOBAL symbol sharing -- symbols exported by one module are visible to all subsequently loaded modules. This is critical: widget DXEs call core API functions (e.g. rectFill, wgtInvalidate) that are exported by the core library DXE.

+

Module Types

+
  Extension  Directory   Purpose                                             Examples
+  ---------  ---------   -------                                             --------
+  .lib       LIBS/       Core libraries loaded first. Provide infrastructure APIs.  libtasks.lib, libdvx.lib, dvxshell.lib
+  .wgt       WIDGETS/    Widget type plugins. Each exports wgtRegister().    button.wgt, listview.wgt, terminal.wgt
+  .app       APPS/*/     Application modules. Each exports appDescriptor and appMain(). Loaded on demand by the shell.  progman.app, notepad.app, cpanel.app
+

Boot Sequence

+
  dvx.exe (loader)
+     |
+     +-- Enter VGA mode 13h, display splash screen with progress bar
+     |
+     +-- Scan LIBS/ for *.lib, WIDGETS/ for *.wgt
+     |
+     +-- Read .dep files for each module (dependency base names)
+     |
+     +-- Topological sort: load modules in dependency order
+     |     - dlopen() with RTLD_GLOBAL
+     |     - Each .wgt that exports wgtRegister() has it called
+     |
+     +-- Find and call shellMain() (exported by dvxshell.lib)
+           |
+           +-- dvxInit() -- video mode, input, font, colors, cursors
+           |
+           +-- Load desktop app (progman.app)
+           |
+           +-- Main loop:
+                 dvxUpdate() -> tsYield() -> shellReapApps()
+

Application Lifecycle

+

Two kinds of DXE apps:

+

Callback-only (hasMainLoop = false)

+

appMain() creates windows, registers callbacks, and returns. The app lives through GUI callbacks driven by the shell's main loop. Lifecycle ends when the last window is closed. No extra task stack needed -- simpler and cheaper.

+

Main-loop (hasMainLoop = true)

+

A dedicated cooperative task is created. appMain() runs in that task with its own loop, calling tsYield() to share CPU. Needed for apps with continuous work (terminal emulators, games). Lifecycle ends when appMain() returns.

+

Crash Recovery

+

The platform layer installs signal handlers for SIGSEGV, SIGFPE, SIGILL. On crash, the handler logs platform-specific diagnostics (register dump on DJGPP), then longjmps back to the shell's main loop. The crashed app is killed; other apps and the shell survive. This provides Windows 3.1-style fault tolerance.

+

Per-App Memory Tracking

+

All allocations route through dvxMalloc/dvxFree wrappers that prepend a 16-byte header recording the owning app ID and allocation size. The Task Manager displays per-app memory usage, and leaks are detected at app termination.

+
+
+

Event Model

+

Event Model

+

DVX uses a cooperative polling model. The main loop (dvxRun / dvxUpdate) runs this cycle each frame:

+
    +
  • Poll mouse -- platformMousePoll() returns position and button bitmask. Compare with previous frame for press/release edge detection.
  • +
  • Poll keyboard -- platformKeyboardRead() returns ASCII + scancode. Non-blocking; returns false if buffer is empty.
  • +
  • Dispatch to focused window -- the event loop fires window callbacks (onKey, onMouse, etc.) on the focused window. If the window has a widget tree, the widget system's installed handlers dispatch to individual widgets.
  • +
  • Compositor pass -- merge dirty rects, composite, flush to LFB.
  • +
+

Yield -- platformYield() or idle callback.

+

Event Dispatch Chain

+
  Mouse/Keyboard Input
+       |
+  Global handlers (Ctrl+Esc, modal filter)
+       |
+  Accelerator table check (focused window)
+       |
+  Window callback (onMouse / onKey)
+       |
+  [If widget tree installed:]
+       |
+  widgetOnMouse / widgetOnKey
+       |
+  Widget hit test (widgetHitTest)
+       |
+  wclsOnMouse / wclsOnKey (vtable dispatch)
+       |
+  Universal callbacks (onClick, onChange, etc.)
+

Accelerator Tables

+

Per-window accelerator tables map key + modifier combinations to command IDs. The runtime normalizes key/modifier at registration time (uppercase key, strip shift from modifiers) so matching at dispatch time is two integer comparisons per entry. Matched accelerators fire the window's onMenu callback with the command ID, unifying the menu and hotkey code paths.

+

Mouse Cursor

+

Software-rendered cursor using the classic AND/XOR mask approach. Seven cursor shapes are compiled in: arrow, horizontal resize, vertical resize, NW-SE diagonal resize, NE-SW diagonal resize, busy (hourglass), and crosshair. The cursor is painted into the backbuffer on top of the composited frame and the affected region is flushed to the LFB each frame.

+

Double-Click Detection

+

Timestamp-based: two clicks on the same target (title bar, minimized icon, close gadget) within the configurable double-click interval trigger the double-click action. Separate tracking for each target type.

+
+
+

Font System

+

Font System

+

DVX uses fixed-width 8-pixel-wide bitmap fonts only. One size is provided: 8x16, matching the standard VGA ROM font and CP437 encoding (256 glyphs).

+

BitmapFontT

+
  typedef struct {
+      int32_t        charWidth;    // fixed width per glyph (always 8)
+      int32_t        charHeight;   // 16
+      int32_t        firstChar;    // typically 0
+      int32_t        numChars;     // typically 256
+      const uint8_t *glyphData;    // packed 1bpp, charHeight bytes per glyph
+  } BitmapFontT;
+

Design rationale:

+
    +
  • Character positions are pure multiplication (x = col * 8).
  • +
  • Glyph lookup is a single array index.
  • +
  • Each scanline of a glyph is exactly one byte (1bpp at 8 pixels wide).
  • +
  • No glyph-width tables, kerning, or per-character positioning needed.
  • +
+

8-pixel width aligns with byte boundaries -- no bit shifting in per-scanline rendering.

+

Text Rendering Functions

+

drawChar() -- Renders a single character. Supports opaque (background fill) and transparent modes.

+

drawTextN() -- Optimized batch rendering for a known character count. Clips once for the entire run, fills background in a single rectFill, then overlays glyph foreground pixels. Significantly faster than per-character rendering for long runs.

+

drawTermRow() -- Renders an 80-column terminal row in a single pass, with per-cell foreground/background from a 16-color palette, blink attribute support, and cursor rendering. Exists because per-character terminal rendering is unacceptably slow on target hardware.

+

drawTextAccel() -- Renders text with & accelerator markers. The character after & is underlined to indicate the keyboard shortcut.

+

Performance Optimization

+

AppContextT stores a fixed-point 16.16 reciprocal of font.charHeight (charHeightRecip) so that dividing by charHeight (for pixel-to-row conversion in terminal/text widgets) becomes a multiply+shift instead of an integer divide, which costs 40+ cycles on a 486.

+
+
+

Color System

+

Color System

+

Pixel Format

+

PixelFormatT describes the active VESA mode's pixel encoding. Populated once from the VBE mode info block. Stores shift, mask, and bit count for each channel so packColor() can convert RGB to native format with shift-and-mask arithmetic -- no per-pixel computation.

+

Supported depths:

+
  Depth    Bytes/Pixel  Notes
+  -----    -----------  -----
+  8 bpp    1            Palette mode. Nearest-index via 6x6x6 color cube + grey ramp.
+  15 bpp   2            5-5-5 RGB (1 bit unused).
+  16 bpp   2            5-6-5 RGB.
+  32 bpp   4            8-8-8 RGB (8 bits unused).
+

ColorSchemeT -- Theming

+

All 20 UI colors are pre-packed into display pixel format at init time. Every color is a uint32_t that can be written directly to the framebuffer with zero per-pixel conversion. The scheme must be regenerated on video mode change, but mode changes require re-init anyway.

+

Color roles mirror classic Motif/Windows 3.x conventions:

+
    +
  • desktop -- desktop background
  • +
  • windowFace, windowHighlight, windowShadow -- window chrome bevel triplet
  • +
  • activeTitleBg/Fg, inactiveTitleBg/Fg -- focused vs. unfocused title bar
  • +
  • contentBg/Fg -- window content area
  • +
  • menuBg/Fg, menuHighlightBg/Fg -- menus
  • +
  • buttonFace -- button background
  • +
  • scrollbarBg/Fg/Trough -- scrollbar components
  • +
+

cursorFg/Bg -- mouse cursor colors

+

Source RGB values are kept in AppContextT.colorRgb[] for theme save/load. Themes are stored as INI files with a [colors] section. The API provides dvxLoadTheme(), dvxSaveTheme(), dvxSetColor(), and dvxResetColorScheme().

+

Bevel Styles

+

Bevels are the defining visual element of the Motif aesthetic. Convenience macros create bevel style descriptors by swapping highlight and shadow colors:

+
  BEVEL_RAISED(colorScheme, borderWidth)       -- raised 3D look
+  BEVEL_SUNKEN(colorScheme, face, borderWidth) -- sunken/inset look
+  BEVEL_TROUGH(colorScheme)                    -- 1px scrollbar trough
+  BEVEL_SB_BUTTON(colorScheme)                 -- scrollbar button
+
+
+

Platform Layer

+

Platform Layer

+

All OS-specific and CPU-specific code is isolated behind dvxPlatform.h. To port DVX, implement a new dvxPlatformXxx.c against this header.

+

Implementations

+
  File                Target        Details
+  ----                ------        -------
+  dvxPlatformDos.c    DJGPP/DPMI    Real VESA VBE, INT 33h mouse, INT 16h keyboard, rep movsd/rep stosl asm spans, DPMI physical memory mapping for LFB, INT 9 hook for key-up, CuteMouse Wheel API.
+

Abstraction Areas

+

Video

+

platformVideoInit() -- mode probe and framebuffer setup. platformVideoShutdown() -- restore previous mode. platformVideoEnumModes() -- enumerate available modes.

+

Framebuffer Flush

+

platformFlushRect() -- copy dirty rect from backBuf to LFB. On DOS, each scanline uses rep movsd for near-optimal aligned 32-bit writes over the PCI bus.

+

Optimized Memory Spans

+

Six functions: platformSpanFill8/16/32() and platformSpanCopy8/16/32(). Called once per scanline of every rectangle fill, blit, and text draw. On DOS these use inline assembly for critical inner loops.

+

Mouse Input

+

Polling model. platformMousePoll() returns position and button bitmask. Wheel support via CuteMouse API.

+

Keyboard Input

+

platformKeyboardRead() -- non-blocking key read. platformKeyUpRead() -- key release detection (requires INT 9 hook on DOS). platformAltScanToChar() -- scancode-to-ASCII lookup for Alt+key combinations.

+

Crash Recovery

+

platformInstallCrashHandler() -- signal handlers + longjmp for fault tolerance.

+

DXE Support

+

platformRegisterDxeExports() -- register C runtime and platform symbols for DXE resolution. platformRegisterSymOverrides() -- register function pointer overrides for module loader.

+
+
+

Build System

+

Build System

+

Cross-Compilation

+

DVX is cross-compiled from Linux using a DJGPP cross-compiler (i586-pc-msdosdjgpp-gcc). The top-level Makefile orchestrates building all subsystems in dependency order.

+
  make               -- build everything
+  ./mkcd.sh          -- build + create ISO for 86Box
+

Build Targets

+
  all: core tasks loader texthelp listhelp tools widgets shell taskmgr serial sql apps
+
  Target     Output                    Description
+  ------     ------                    -----------
+  core       bin/libs/libdvx.lib       GUI core library (draw, comp, wm, app, widget infrastructure)
+  tasks      bin/libs/libtasks.lib     Cooperative task switcher
+  loader     bin/dvx.exe               Bootstrap loader (the DOS executable)
+  widgets    bin/widgets/*.wgt         29 widget type plugins
+  shell      bin/libs/dvxshell.lib     DVX Shell (app management, desktop)
+  taskmgr    bin/libs/taskmgr.lib      Task Manager (loaded as a separate DXE)
+  texthelp   shared library            Shared text editing helpers (clipboard, word boundaries)
+  listhelp   shared library            Shared dropdown/list helpers
+  apps       bin/apps/*/*.app          Application modules (progman, notepad, clock, etc.)
+  tools      bin/dvxres                Resource compiler (runs on Linux, builds resource sections into DXEs)
+  serial     serial DXE libs           UART driver, HDLC packets, security, seclink
+  sql        SQL DXE lib               SQLite integration
+

DXE3 Build Process

+

Each DXE module is compiled to an object file with GCC, then linked with dxe3gen:

+
  # Compile
+  i586-pc-msdosdjgpp-gcc -O2 -march=i486 -mtune=i586 -c -o widget.o widget.c
+
+  # Link as DXE with exported symbols
+  dxe3gen -o widget.wgt -E _wgtRegister -U widget.o
+
+  # Optionally append resources
+  dvxres build widget.wgt widget.res
+

The -E flag specifies exported symbols (prefixed with underscore per DJGPP convention). -U marks unresolved symbols as OK (they'll be resolved at load time from previously loaded DXEs).

+

Deployment (mkcd.sh)

+
    +
  • Runs make all.
  • +
  • Verifies critical outputs exist (dvx.exe, libtasks.lib, libdvx.lib, dvxshell.lib).
  • +
  • Counts widget modules.
  • +
  • Creates an ISO 9660 image from bin/ using mkisofs: -iso-level 1 (strict 8.3 filenames for DOS), -J (Joliet extensions for long names), -V DVX (volume label).
  • +
+

Places the ISO at ~/.var/app/net._86box._86Box/data/86Box/dvx.iso for 86Box to mount as CD-ROM.

+

Compiler Flags

+
  -O2                  Optimization level 2
+  -march=i486          486 instruction set baseline
+  -mtune=i586          Optimize scheduling for Pentium
+  -Wall -Wextra        Full warnings
+

Directory Layout

+
  dvxgui/
+  +-- core/              Core library sources (dvxVideo, dvxDraw, dvxComp, dvxWm, dvxApp, widget infra)
+  |   +-- platform/      Platform abstraction (dvxPlatform.h, dvxPlatformDos.c)
+  |   +-- thirdparty/    stb_image, stb_ds, stb_image_write
+  +-- loader/            Bootstrap loader (dvx.exe)
+  +-- tasks/             Cooperative task switcher (libtasks.lib)
+  +-- shell/             DVX Shell (dvxshell.lib)
+  +-- widgets/           Widget DXE modules (*.wgt), each in its own subdirectory
+  |   +-- box/           VBox/HBox layout containers
+  |   +-- button/        Push button
+  |   +-- textInput/     Text entry field
+  |   +-- listView/      Multi-column list
+  |   +-- ...            (29 widget types total)
+  +-- texthelp/          Shared text editing helpers
+  +-- listhelp/          Shared dropdown/list helpers
+  +-- apps/              Application DXE modules (*.app)
+  |   +-- progman/       Program Manager (desktop)
+  |   +-- notepad/       Text editor
+  |   +-- cpanel/        Control Panel
+  |   +-- imgview/       Image viewer
+  |   +-- clock/         Clock
+  |   +-- dvxdemo/       Demo / showcase app
+  |   +-- dvxbasic/      DVX BASIC compiler and VM
+  +-- tools/             Build tools (dvxres resource compiler)
+  +-- rs232/             ISR-driven UART driver
+  +-- packet/            HDLC framing, CRC-16, sliding window
+  +-- security/          DH key exchange, XTEA cipher, DRBG RNG
+  +-- seclink/           Encrypted channel wrapper
+  +-- serial/            Combined serial stack DXE
+  +-- proxy/             Linux proxy (86Box <-> secLink <-> telnet)
+  +-- sql/               SQLite integration
+  +-- bin/               Build output (dvx.exe, libs/, widgets/, apps/, config/)
+  +-- obj/               Intermediate object files
+  +-- docs/              Documentation
+
+
+

DVX GUI API Reference

+

DVX GUI API Reference

+

DOS Visual eXecutive -- Complete public API documentation generated from source headers.

+

The DVX GUI is built as a five-layer architecture. Each layer is defined in its own header file. This reference covers every public function, type, and constant.

+

Layers

+
    +
  • dvxTypes.h -- Shared type definitions
  • +
  • dvxCursor.h -- Cursor definitions
  • +
  • dvxVideo.h -- Layer 1: VESA VBE Video Backend
  • +
  • dvxDraw.h -- Layer 2: Drawing Primitives
  • +
  • dvxComp.h -- Layer 3: Dirty Rectangle Compositor
  • +
  • dvxWm.h -- Layer 4: Window Manager
  • +
  • dvxApp.h -- Layer 5: Application API
  • +
+

dvxWidget.h -- Widget System

+

dvxTypes.h -- Shared Type Definitions

+

dvxCursor.h -- Cursor Definitions

+

dvxVideo.h -- Layer 1: VESA VBE Video Backend

+

dvxDraw.h -- Layer 2: Drawing Primitives

+

dvxComp.h -- Layer 3: Dirty Rectangle Compositor

+

dvxWm.h -- Layer 4: Window Manager

+

dvxApp.h -- Layer 5: Application API

+

dvxWidget.h -- Widget System

+
+
+

dvxTypes.h -- Shared Type Definitions

+

dvxTypes.h -- Shared Type Definitions

+

Central type definitions shared across all five layers of the DVX GUI stack. Every header includes this file. Contains no function definitions -- only structs, enums, typedefs, and compile-time constants.

+

Core Structures

+

PixelFormatT

+

Describes the pixel encoding for the active VESA video mode. Populated once at startup from the VBE mode info block, then treated as read-only.

+
  Field                                        Description
+  -----                                        -----------
+  int32_t bitsPerPixel                         8, 15, 16, or 32
+  int32_t bytesPerPixel                        1, 2, 2, or 4
+  uint32_t redMask, greenMask, blueMask        Bitmasks for each color channel
+  int32_t redShift, greenShift, blueShift      Bit position of each color field
+  int32_t redBits, greenBits, blueBits         Number of bits per channel
+

DisplayT

+

Single display context passed by pointer through every layer. All drawing targets the backBuf; only dirty rects are flushed to lfb.

+
  Field                                  Description
+  -----                                  -----------
+  int32_t width, height                  Screen dimensions in pixels
+  int32_t pitch                          Bytes per scanline
+  PixelFormatT format                    Active pixel format
+  uint8_t *lfb                           Mapped linear framebuffer (VESA LFB)
+  uint8_t *backBuf                       System RAM backbuffer
+  uint8_t *palette                       768 bytes for 8-bit mode, NULL otherwise
+  int32_t clipX, clipY, clipW, clipH     Current clip rectangle
+

RectT

+

Rectangle in origin + extent form. Used throughout the compositor, window manager, and widget layout engine.

+
  Field              Description
+  -----              -----------
+  int32_t x, y       Top-left corner
+  int32_t w, h       Width and height
+

BlitOpsT

+

Vtable for hot-path span operations. Resolved at init time based on pixel depth. On DOS, these dispatch to hand-written asm (rep stosl / rep movsd).

+
  Field                    Description
+  -----                    -----------
+  SpanFillFnT spanFill     Fill a horizontal span with a solid color
+  SpanCopyFnT spanCopy     Copy a horizontal span between buffers
+  int32_t bytesPerPixel    Bytes per pixel for the active mode
+  int32_t pitch            Bytes per scanline
+

BevelStyleT

+

Bevel drawing parameters. Swapping highlight/shadow flips raised vs. sunken appearance.

+
  Field                  Description
+  -----                  -----------
+  uint32_t highlight     Lighter color (top/left edges)
+  uint32_t shadow        Darker color (bottom/right edges)
+  uint32_t face          Interior fill color (0 = no fill)
+  int32_t width          Border thickness in pixels (typically 2)
+

BitmapFontT

+

Fixed-width 8-pixel-wide bitmap font descriptor. One size provided: 8x16 (standard VGA ROM font, CP437 encoding).

+
  Field                          Description
+  -----                          -----------
+  int32_t charWidth              Fixed width per glyph (always 8)
+  int32_t charHeight             Glyph height (14 or 16)
+  int32_t firstChar              ASCII code of first glyph (typically 0)
+  int32_t numChars               Number of glyphs (typically 256)
+  const uint8_t *glyphData       Packed 1bpp data, charHeight bytes per glyph
+

ColorSchemeT

+

All UI colors pre-packed into display pixel format at init time. Theme support is achieved by swapping this struct.

+
  Field                                              Description
+  -----                                              -----------
+  uint32_t desktop                                   Desktop background color
+  uint32_t windowFace                                Window body / chrome face
+  uint32_t windowHighlight                           Bevel highlight (top/left edge)
+  uint32_t windowShadow                              Bevel shadow (bottom/right edge)
+  uint32_t activeTitleBg, activeTitleFg              Focused window title bar
+  uint32_t inactiveTitleBg, inactiveTitleFg          Unfocused window title bar
+  uint32_t contentBg, contentFg                      Window content area default colors
+  uint32_t menuBg, menuFg                            Menu bar and popup background/text
+  uint32_t menuHighlightBg, menuHighlightFg          Menu item highlight
+  uint32_t buttonFace                                Button face color
+  uint32_t scrollbarBg, scrollbarFg, scrollbarTrough Scrollbar element colors
+  uint32_t cursorFg, cursorBg                        Mouse cursor colors
+

ColorIdE

+

Enum for addressing individual colors in ColorSchemeT. Order matches struct field order.

+

Values: ColorDesktopE, ColorWindowFaceE, ColorWindowHighlightE, ColorWindowShadowE, ColorActiveTitleBgE, ColorActiveTitleFgE, ColorInactiveTitleBgE, ColorInactiveTitleFgE, ColorContentBgE, ColorContentFgE, ColorMenuBgE, ColorMenuFgE, ColorMenuHighlightBgE, ColorMenuHighlightFgE, ColorButtonFaceE, ColorScrollbarBgE, ColorScrollbarFgE, ColorScrollbarTroughE, ColorCursorFgE, ColorCursorBgE, ColorCountE.

+

DirtyListT

+

Fixed-capacity list of dirty rectangles. Dynamic array, grows on demand.

+
  Field              Description
+  -----              -----------
+  RectT *rects       Dynamic array of dirty rectangles
+  int32_t count      Current number of dirty rects
+  int32_t cap        Allocated capacity
+

WindowT

+

Central window object. Each window owns a persistent content backbuffer and receives events through callback function pointers.

+
  Field                                                          Description
+  -----                                                          -----------
+  int32_t id                                                     Unique window identifier
+  int32_t appId                                                  Shell app ID (0 = shell itself)
+  int32_t x, y, w, h                                            Outer frame position and dimensions
+  int32_t contentX, contentY, contentW, contentH                 Content area inset from frame
+  char title[MAX_TITLE_LEN]                                      Window title text (max 128 chars)
+  bool visible, focused, minimized, maximized, resizable, modal  Window state flags
+  bool contentDirty                                              true when contentBuf has changed
+  bool needsPaint                                                true until first onPaint call
+  int32_t maxW, maxH                                             Maximum dimensions
+  int32_t preMaxX, preMaxY, preMaxW, preMaxH                    Saved geometry before maximize
+  uint8_t *contentBuf                                            Per-window content backbuffer
+  int32_t contentPitch                                           Content buffer bytes per row
+  uint8_t *iconData                                              Icon pixel data, NULL if none
+  int32_t iconW, iconH, iconPitch                                Icon image dimensions and pitch
+  MenuBarT *menuBar                                              Menu bar (NULL if no menus)
+  ScrollbarT *vScroll, *hScroll                                  Scrollbars (NULL if not present)
+  struct WidgetT *widgetRoot                                     Widget tree root (NULL if none)
+  MenuT *contextMenu                                             Right-click context menu
+  AccelTableT *accelTable                                        Keyboard accelerator table
+  void *userData                                                 Application-defined data pointer
+

Callbacks:

+
  Callback                                                     Description
+  --------                                                     -----------
+  onPaint(WindowT *win, RectT *dirtyArea)                      Content repaint requested
+  onKey(WindowT *win, int32_t key, int32_t mod)                Key press
+  onKeyUp(WindowT *win, int32_t scancode, int32_t mod)         Key release
+  onMouse(WindowT *win, int32_t x, int32_t y, int32_t btn)    Mouse event (content-relative)
+  onResize(WindowT *win, int32_t newW, int32_t newH)           Window resized
+  onClose(WindowT *win)                                        Close requested
+  onMenu(WindowT *win, int32_t menuId)                         Menu item or accelerator activated
+  onScroll(WindowT *win, ScrollbarOrientE orient, int32_t val) Scrollbar value changed
+  onCursorQuery(WindowT *win, int32_t x, int32_t y)            Return CURSOR_* for hit position
+  onFocus(WindowT *win)                                        Window gained focus
+  onBlur(WindowT *win)                                         Window lost focus
+

WindowStackT

+

Z-ordered window stack (front-to-back: index count-1 is topmost). Owns system-wide drag/resize/scroll interaction state.

+
  Field                                        Description
+  -----                                        -----------
+  WindowT **windows                            Dynamic array of window pointers
+  int32_t count, cap                           Current count and allocated capacity
+  int32_t focusedIdx                           Stack index of focused window
+  int32_t dragWindow, dragOffX, dragOffY       Active drag state
+  int32_t resizeWindow, resizeEdge             Active resize state
+  int32_t scrollWindow, scrollOrient, scrollDragOff  Active scroll drag state
+

MenuT / MenuItemT / MenuBarT

+

Menu system types. Fixed-size label buffers (MAX_MENU_LABEL = 32). Cascading submenus supported via MenuItemT.subMenu pointer.

+
  Field                        Description
+  -----                        -----------
+  MenuItemT.label              Item text (supports & accelerator markers)
+  MenuItemT.id                 Application-defined command ID
+  MenuItemT.type               MenuItemNormalE, MenuItemCheckE, or MenuItemRadioE
+  MenuItemT.separator          true = horizontal divider line
+  MenuItemT.enabled, checked   Item state
+  MenuItemT.subMenu            Child menu for cascading (NULL if leaf)
+  MenuBarT.activeIdx           Open popup index (-1 = none)
+

ScrollbarT

+

Window-level scrollbar state. Managed by the WM layer, drawn after content.

+
  Field                        Description
+  -----                        -----------
+  ScrollbarOrientE orient      ScrollbarVerticalE or ScrollbarHorizontalE
+  int32_t min, max             Scroll range
+  int32_t value                Current position
+  int32_t pageSize             Visible portion (for proportional thumb sizing)
+  int32_t x, y, length         Computed screen position and track length
+

AccelTableT / AccelEntryT

+

Per-window keyboard accelerator table. Entries are matched against keystrokes in the event loop and fire onMenu(cmdId) on match.

+
  Field                      Description
+  -----                      -----------
+  AccelEntryT.key            ASCII character or KEY_Fxx constant
+  AccelEntryT.modifiers      Bitmask of ACCEL_CTRL, ACCEL_SHIFT, ACCEL_ALT
+  AccelEntryT.cmdId          Command ID passed to onMenu
+

VideoModeInfoT

+

Describes an available video mode (enumerated at init).

+
  Field            Description
+  -----            -----------
+  int32_t w, h     Resolution
+  int32_t bpp      Bits per pixel
+

CursorT

+

Software-rendered 16x16 cursor using AND/XOR mask encoding.

+
  Field                          Description
+  -----                          -----------
+  int32_t width, height          Cursor dimensions (always 16x16)
+  int32_t hotX, hotY             Hot spot coordinates
+  const uint16_t *andMask        AND mask (0 = draw pixel, 1 = transparent)
+  const uint16_t *xorData        XOR data (0 = black, 1 = white where AND = 0)
+

Bevel Convenience Macros

+
  Macro                      Description
+  -----                      -----------
+  BEVEL_RAISED(cs, bw)       Raised bevel style from ColorSchemeT ptr and border width
+  BEVEL_SUNKEN(cs, face, bw) Sunken bevel style with explicit face color
+  BEVEL_TROUGH(cs)           1px sunken trough (for scrollbar tracks)
+  BEVEL_SB_BUTTON(cs)        1px raised scrollbar button
+

Chrome Constants

+
  Define                  Value   Description
+  ------                  -----   -----------
+  CHROME_BORDER_WIDTH     4       Outer frame border width
+  CHROME_TITLE_HEIGHT     20      Title bar height
+  CHROME_TITLE_PAD        4       Title text padding
+  CHROME_INNER_BORDER     2       Inner chrome border
+  CHROME_MENU_HEIGHT      20      Menu bar height
+  CHROME_TOTAL_TOP        26      Total inset from top of frame to content
+  CHROME_TOTAL_SIDE       6       Total inset from side of frame to content
+  CHROME_TOTAL_BOTTOM     6       Total inset from bottom of frame to content
+  CHROME_CLOSE_BTN_SIZE   16      Close button gadget size
+

Hit Test Constants

+
  Define          Value   Description
+  ------          -----   -----------
+  HIT_CONTENT     0       Content area
+  HIT_TITLE       1       Title bar
+  HIT_CLOSE       2       Close gadget
+  HIT_RESIZE      3       Resize border
+  HIT_MENU        4       Menu bar
+  HIT_VSCROLL     5       Vertical scrollbar
+  HIT_HSCROLL     6       Horizontal scrollbar
+  HIT_MINIMIZE    7       Minimize gadget
+  HIT_MAXIMIZE    8       Maximize gadget
+  HIT_NONE        -1      No window hit (desktop)
+

Mouse Button Flags

+
  Define          Value   Description
+  ------          -----   -----------
+  MOUSE_LEFT      1       Left mouse button
+  MOUSE_RIGHT     2       Right mouse button
+  MOUSE_MIDDLE    4       Middle mouse button
+

Accelerator Modifier Flags

+
  Define          Value   Description
+  ------          -----   -----------
+  ACCEL_SHIFT     0x03    Shift key (matches BIOS shift state bits)
+  ACCEL_CTRL      0x04    Ctrl key
+  ACCEL_ALT       0x08    Alt key
+

Extended Key Codes

+
  Define                  Description
+  ------                  -----------
+  KEY_F1 .. KEY_F12       Function keys (scancode | 0x100)
+  KEY_INSERT              Insert key
+  KEY_DELETE              Delete key
+  KEY_HOME                Home key
+  KEY_END                 End key
+  KEY_PGUP                Page Up key
+  KEY_PGDN                Page Down key
+

Resize Edge Flags

+
  Define          Value   Description
+  ------          -----   -----------
+  RESIZE_NONE     0       No resize edge
+  RESIZE_LEFT     1       Left edge
+  RESIZE_RIGHT    2       Right edge
+  RESIZE_TOP      4       Top edge
+  RESIZE_BOTTOM   8       Bottom edge (combinable via OR for corners)
+

Utility Macros

+
  Macro           Description
+  -----           -----------
+  DVX_MIN(a, b)   Return the smaller of two values
+  DVX_MAX(a, b)   Return the larger of two values
+
+
+

dvxCursor.h -- Cursor Definitions

+

dvxCursor.h -- Cursor Definitions

+

Embedded 16x16 mouse cursor bitmaps compiled as static const data. No external cursor files. Uses the standard AND/XOR mask encoding from the IBM VGA hardware cursor spec.

+

Cursor Shape IDs

+
  Define                      Value   Description
+  ------                      -----   -----------
+  CURSOR_ARROW                0       Standard arrow (hot spot at tip)
+  CURSOR_RESIZE_H             1       Horizontal resize (left/right arrows)
+  CURSOR_RESIZE_V             2       Vertical resize (up/down arrows)
+  CURSOR_RESIZE_DIAG_NWSE     3       NW-SE diagonal resize
+  CURSOR_RESIZE_DIAG_NESW     4       NE-SW diagonal resize
+  CURSOR_BUSY                 5       Hourglass (wait)
+  CURSOR_CROSSHAIR            6       Crosshair for placement
+  CURSOR_COUNT                7       Total number of cursor shapes
+

Data

+

dvxCursors[CURSOR_COUNT]

+

Static const array of CursorT structs, indexed by CURSOR_xxx constants. Each entry includes the AND mask, XOR data, dimensions, and hot spot coordinates.

+
+
+

dvxVideo.h -- Layer 1: VESA VBE Video Backend

+

dvxVideo.h -- Layer 1: VESA VBE Video Backend

+

The lowest layer. Responsible for VESA VBE mode negotiation, LFB mapping via DPMI, system RAM backbuffer allocation, pixel format discovery, and color packing. LFB-only design: bank switching is deliberately unsupported.

+

videoInit

+
int32_t videoInit(DisplayT *d, int32_t requestedW, int32_t requestedH, int32_t preferredBpp);
+

Probe VBE for a mode matching the requested resolution and depth, enable it, map the LFB into DPMI linear address space, and allocate a system RAM backbuffer. preferredBpp is a hint; the closest available depth is used if an exact match is not found.

+
  Parameter        Description
+  ---------        -----------
+  d                Display context to initialize
+  requestedW/H     Desired screen resolution
+  preferredBpp     Preferred bits per pixel (8, 15, 16, or 32)
+

Returns: 0 on success, negative on failure.

+

videoShutdown

+
void videoShutdown(DisplayT *d);
+

Restore VGA text mode (mode 3), unmap the LFB, and free the backbuffer. Safe to call even if videoInit() failed.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context to shut down
+

packColor

+
uint32_t packColor(const DisplayT *d, uint8_t r, uint8_t g, uint8_t b);
+

Pack an RGB triplet into the display's native pixel format. For direct-color modes (15/16/32 bpp), returns a packed pixel value using shift/mask fields. For 8-bit mode, returns the nearest palette index via Euclidean distance in RGB space.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context (provides pixel format)
+  r, g, b     Color components (0-255)
+

Returns: Native pixel value suitable for direct framebuffer write.

+

setClipRect

+
void setClipRect(DisplayT *d, int32_t x, int32_t y, int32_t w, int32_t h);
+

Set the clip rectangle on the display. All subsequent draw operations clip to this rectangle. The caller must save and restore the clip rect around scoped operations.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  x, y, w, h Clip rectangle in screen coordinates
+

resetClipRect

+
void resetClipRect(DisplayT *d);
+

Reset the clip rectangle to the full display dimensions.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+
+
+

dvxDraw.h -- Layer 2: Drawing Primitives

+

dvxDraw.h -- Layer 2: Drawing Primitives

+

All 2D drawing operations: rectangle fills, bitmap blits, text rendering, bevels, lines, and cursor rendering. Every function draws into the display's backbuffer and clips to the current clip rectangle. This layer is stateless beyond the clip rect on DisplayT.

+

drawInit

+
void drawInit(BlitOpsT *ops, const DisplayT *d);
+

Populate a BlitOpsT with the correct span functions for the display's pixel depth. Must be called once after videoInit().

+
  Parameter   Description
+  ---------   -----------
+  ops         BlitOpsT to populate
+  d           Initialized display context
+

rectFill

+
void rectFill(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color);
+

Fill a rectangle with a solid color. Clips to the display clip rect. Workhorse for backgrounds, window fills, and clear operations.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  x, y, w, h Rectangle to fill
+  color       Packed pixel color
+

rectCopy

+
void rectCopy(DisplayT *d, const BlitOpsT *ops, int32_t dstX, int32_t dstY, const uint8_t *srcBuf, int32_t srcPitch, int32_t srcX, int32_t srcY, int32_t w, int32_t h);
+

Copy a rectangle from an arbitrary source buffer into the backbuffer. Used to blit per-window content buffers during compositing.

+
  Parameter     Description
+  ---------     -----------
+  d             Display context
+  ops           Blit operations vtable
+  dstX, dstY    Destination position in backbuffer
+  srcBuf        Source pixel buffer
+  srcPitch      Source buffer bytes per row
+  srcX, srcY    Origin within source buffer
+  w, h          Rectangle dimensions to copy
+

rectCopyGrayscale

+
void rectCopyGrayscale(DisplayT *d, const BlitOpsT *ops, int32_t dstX, int32_t dstY, const uint8_t *srcBuf, int32_t srcPitch, int32_t srcX, int32_t srcY, int32_t w, int32_t h);
+

Copy a rectangle with grayscale conversion. Each pixel's RGB is converted to luminance (0.299R + 0.587G + 0.114B) for a disabled/grayed appearance.

+
  Parameter       Description
+  ---------       -----------
+  d               Display context
+  ops             Blit operations vtable
+  dstX, dstY      Destination position
+  srcBuf, srcPitch Source buffer and pitch
+  srcX, srcY      Source origin
+  w, h            Rectangle dimensions
+

drawBevel

+
void drawBevel(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, const BevelStyleT *style);
+

Draw a beveled frame. Top/left edges in highlight color, bottom/right in shadow. Interior filled with face color if non-zero.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  x, y, w, h Outer bevel rectangle
+  style       Bevel colors and width
+

drawChar

+
int32_t drawChar(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, char ch, uint32_t fg, uint32_t bg, bool opaque);
+

Draw a single character glyph. When opaque is true, the background fills the entire cell; when false, only foreground pixels are drawn (transparent background).

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  font        Bitmap font
+  x, y        Character position
+  ch          Character to draw
+  fg, bg      Foreground and background packed colors
+  opaque      true = fill background, false = transparent
+

Returns: Advance width (always charWidth).

+

drawText

+
void drawText(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, const char *text, uint32_t fg, uint32_t bg, bool opaque);
+

Draw a null-terminated string. Calls drawChar per character.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  font        Bitmap font
+  x, y        Start position
+  text        Null-terminated string
+  fg, bg      Foreground and background packed colors
+  opaque      true = fill background, false = transparent
+

drawTextN

+
void drawTextN(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, const char *text, int32_t count, uint32_t fg, uint32_t bg, bool opaque);
+

Optimized batch text rendering for a known character count. Computes clip bounds once, fills background in a single rectFill, then overlays glyph foreground pixels. Significantly faster than per-character drawChar for long runs (terminal rows, list items).

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  font        Bitmap font
+  x, y        Start position
+  text        Character buffer (not required to be null-terminated)
+  count       Number of characters to render
+  fg, bg      Foreground and background packed colors
+  opaque      true = fill background, false = transparent
+

textWidth

+
int32_t textWidth(const BitmapFontT *font, const char *text);
+

Return the pixel width of a null-terminated string (strlen(text) * charWidth).

+
  Parameter   Description
+  ---------   -----------
+  font        Bitmap font
+  text        Null-terminated string
+

Returns: Width in pixels.

+

accelParse

+
char accelParse(const char *text);
+

Scan text for an & prefix and return the following character as a lowercase accelerator key. "&File" returns 'f', "E&xit" returns 'x'.

+
  Parameter   Description
+  ---------   -----------
+  text        Text with optional & accelerator marker
+

Returns: Lowercase accelerator character, or 0 if none.

+

drawTextAccel

+
void drawTextAccel(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, const char *text, uint32_t fg, uint32_t bg, bool opaque);
+

Draw text with & accelerator markers. The character after & is drawn underlined to indicate the keyboard shortcut. && produces a literal &. Used for menu items and button labels.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  font        Bitmap font
+  x, y        Start position
+  text        Text with & markers
+  fg, bg      Foreground and background packed colors
+  opaque      true = fill background, false = transparent
+

textWidthAccel

+
int32_t textWidthAccel(const BitmapFontT *font, const char *text);
+

Measure text width excluding & markers (so "&File" measures as 4 chars).

+
  Parameter   Description
+  ---------   -----------
+  font        Bitmap font
+  text        Text with optional & markers
+

Returns: Width in pixels.

+

drawMaskedBitmap

+
void drawMaskedBitmap(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *andMask, const uint16_t *xorData, uint32_t fgColor, uint32_t bgColor);
+

Draw a 1-bit AND/XOR masked bitmap. Used for software-rendered mouse cursors.

+
  Parameter       Description
+  ---------       -----------
+  d               Display context
+  ops             Blit operations vtable
+  x, y            Screen position
+  w, h            Bitmap dimensions
+  andMask         AND transparency mask (one uint16_t per row)
+  xorData         XOR color data
+  fgColor, bgColor Cursor foreground and background packed colors
+

drawTermRow

+
void drawTermRow(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, int32_t cols, const uint8_t *lineData, const uint32_t *palette, bool blinkVisible, int32_t cursorCol);
+

Render an entire row of terminal character cells (ch/attr byte pairs) in a single pass. Colors looked up from a 16-color palette. Attribute bit 7 controls blink.

+
  Parameter       Description
+  ---------       -----------
+  d               Display context
+  ops             Blit operations vtable
+  font            Bitmap font
+  x, y            Row start position
+  cols            Number of columns
+  lineData        Packed ch/attr byte pairs (2 bytes per cell)
+  palette         16-entry packed color palette
+  blinkVisible    false = hide blinking characters
+  cursorCol       Column for inverted text cursor (-1 = none)
+

drawFocusRect

+
void drawFocusRect(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color);
+

Draw a 1px dotted rectangle (alternating pixels). Used for keyboard focus indicators, matching the Windows 3.x focus rectangle convention.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  x, y, w, h Focus rectangle bounds
+  color       Dot color (packed)
+

drawHLine

+
void drawHLine(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, uint32_t color);
+

Draw a horizontal line (1px tall).

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  x, y        Start position
+  w           Width in pixels
+  color       Packed pixel color
+

drawVLine

+
void drawVLine(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t h, uint32_t color);
+

Draw a vertical line (1px wide).

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  x, y        Start position
+  h           Height in pixels
+  color       Packed pixel color
+
+
+

dvxComp.h -- Layer 3: Dirty Rectangle Compositor

+

dvxComp.h -- Layer 3: Dirty Rectangle Compositor

+

Tracks changed screen regions and ensures only dirty regions are redrawn and flushed to video memory. The compositing pipeline: mark dirty, merge overlapping rects, redraw desktop + windows (back-to-front, painter's algorithm), flush to LFB.

+

dirtyListInit

+
void dirtyListInit(DirtyListT *dl);
+

Zero the dirty rect count. Called at the start of each frame.

+
  Parameter   Description
+  ---------   -----------
+  dl          Dirty list to initialize
+

dirtyListAdd

+
void dirtyListAdd(DirtyListT *dl, int32_t x, int32_t y, int32_t w, int32_t h);
+

Enqueue a dirty rectangle. Grows dynamically; triggers merge at a soft capacity limit.

+
  Parameter   Description
+  ---------   -----------
+  dl          Dirty list
+  x, y, w, h Dirty rectangle in screen coordinates
+

dirtyListMerge

+
void dirtyListMerge(DirtyListT *dl);
+

Consolidate the dirty list by merging overlapping and adjacent rects. Uses iterative pairwise merge: if combining two rects does not increase total area beyond a threshold, they are merged. Reduces compositor passes and LFB flush operations.

+
  Parameter   Description
+  ---------   -----------
+  dl          Dirty list to merge
+

dirtyListClear

+
void dirtyListClear(DirtyListT *dl);
+

Reset the dirty list to empty (sets count to 0).

+
  Parameter   Description
+  ---------   -----------
+  dl          Dirty list to clear
+

flushRect

+
void flushRect(DisplayT *d, const RectT *r);
+

Copy a rectangle from the system RAM backbuffer to the LFB (video memory). This is the only place the real framebuffer is written. Uses platform-specific fast copy (rep movsd on DOS) for each scanline.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  r           Rectangle to flush
+

rectIntersect

+
bool rectIntersect(const RectT *a, const RectT *b, RectT *result);
+

Compute the intersection of two rectangles.

+
  Parameter   Description
+  ---------   -----------
+  a, b        Input rectangles
+  result      Output: intersection rectangle (valid only when return is true)
+

Returns: true if the rectangles overlap, false if disjoint.

+

rectIsEmpty

+
bool rectIsEmpty(const RectT *r);
+

Test whether a rectangle has zero or negative area.

+
  Parameter   Description
+  ---------   -----------
+  r           Rectangle to test
+

Returns: true if w <= 0 or h <= 0.

+
+
+

dvxWm.h -- Layer 4: Window Manager

+

dvxWm.h -- Layer 4: Window Manager

+

Manages the window lifecycle, Z-order stack, chrome drawing, hit testing, and interactive operations (drag, resize, scroll). The WM owns window geometry and chrome; content is owned by the application via callbacks or the widget system.

+

Initialization

+

wmInit

+
void wmInit(WindowStackT *stack);
+

Zero the window stack. Must be called before any other WM function.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack to initialize
+

Window Lifecycle

+

wmCreateWindow

+
WindowT *wmCreateWindow(WindowStackT *stack, DisplayT *d, const char *title, int32_t x, int32_t y, int32_t w, int32_t h, bool resizable);
+

Allocate a new window, initialize its geometry and content buffer, and push it to the top of the Z-order stack. Returns with all callbacks NULL; the caller should set onPaint/onKey/etc. before the next event loop iteration.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  d           Display context
+  title       Window title text
+  x, y        Initial position
+  w, h        Initial outer frame dimensions
+  resizable   true = allow user resize
+

Returns: Pointer to new WindowT, or NULL on failure.

+

wmDestroyWindow

+
void wmDestroyWindow(WindowStackT *stack, WindowT *win);
+

Free the window's content buffer and all attached resources (menu bar, scrollbars, widget tree), remove it from the stack, and dirty the vacated region.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  win         Window to destroy
+

Z-Order and Focus

+

wmRaiseWindow

+
void wmRaiseWindow(WindowStackT *stack, DirtyListT *dl, int32_t idx);
+

Move window at stack index idx to the top of the Z-order. Dirties both old and new top positions so overlapping windows get repainted.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list for repaint marking
+  idx         Stack index of window to raise
+

wmSetFocus

+
void wmSetFocus(WindowStackT *stack, DirtyListT *dl, int32_t idx);
+

Transfer keyboard focus to the window at stack index idx. Unfocuses the previously focused window and dirties both title bars.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  idx         Stack index of window to focus
+

Geometry

+

wmUpdateContentRect

+
void wmUpdateContentRect(WindowT *win);
+

Recompute contentX/Y/W/H from the window's outer frame dimensions, accounting for chrome borders, title bar, menu bar, and scrollbars. Must be called after any change to frame size or chrome configuration.

+
  Parameter   Description
+  ---------   -----------
+  win         Window to update
+

wmReallocContentBuf

+
int32_t wmReallocContentBuf(WindowT *win, const DisplayT *d);
+

Reallocate the per-window content backbuffer to match current contentW/H. Old buffer contents are lost; caller should trigger a full repaint via onPaint afterward.

+
  Parameter   Description
+  ---------   -----------
+  win         Window to reallocate
+  d           Display context (for bytes-per-pixel)
+

Returns: 0 on success, -1 on allocation failure.

+

wmMinWindowSize

+
void wmMinWindowSize(const WindowT *win, int32_t *minW, int32_t *minH);
+

Get the minimum window size. Accounts for chrome, gadgets, and menu bar.

+
  Parameter    Description
+  ---------    -----------
+  win          Window
+  minW, minH   Output: minimum width and height
+

Menu Bar

+

wmAddMenuBar

+
MenuBarT *wmAddMenuBar(WindowT *win);
+

Allocate and attach a menu bar to a window. Adjusts content area to make room (CHROME_MENU_HEIGHT pixels). One menu bar per window.

+
  Parameter   Description
+  ---------   -----------
+  win         Window to add menu bar to
+

Returns: Pointer to the new MenuBarT.

+

wmDestroyMenuBar

+
void wmDestroyMenuBar(WindowT *win);
+

Free the menu bar and reclaim the content area.

+
  Parameter   Description
+  ---------   -----------
+  win         Window to remove menu bar from
+

wmAddMenu

+
MenuT *wmAddMenu(MenuBarT *bar, const char *label);
+

Append a dropdown menu to the menu bar. The label supports & accelerator markers (e.g. "&File").

+
  Parameter   Description
+  ---------   -----------
+  bar         Menu bar
+  label       Menu label text
+

Returns: Pointer to the new MenuT to populate with items.

+

wmAddMenuItem

+
void wmAddMenuItem(MenuT *menu, const char *label, int32_t id);
+

Append a clickable item to a menu. The id is passed to the window's onMenu callback when selected.

+
  Parameter   Description
+  ---------   -----------
+  menu        Menu to append to
+  label       Item label (supports & markers)
+  id          Application-defined command ID
+

wmAddMenuCheckItem

+
void wmAddMenuCheckItem(MenuT *menu, const char *label, int32_t id, bool checked);
+

Add a checkbox-style menu item. Check state toggles on click; rendered with a checkmark glyph.

+
  Parameter   Description
+  ---------   -----------
+  menu        Menu to append to
+  label       Item label
+  id          Command ID
+  checked     Initial checked state
+

wmAddMenuRadioItem

+
void wmAddMenuRadioItem(MenuT *menu, const char *label, int32_t id, bool checked);
+

Add a radio-style menu item. Radio groups are defined implicitly by consecutive radio items; selecting one unchecks the others in the group.

+
  Parameter   Description
+  ---------   -----------
+  menu        Menu to append to
+  label       Item label
+  id          Command ID
+  checked     Initial checked state
+

wmAddMenuSeparator

+
void wmAddMenuSeparator(MenuT *menu);
+

Insert a horizontal separator line. Separators are not interactive.

+
  Parameter   Description
+  ---------   -----------
+  menu        Menu to append separator to
+

wmMenuItemIsChecked

+
bool wmMenuItemIsChecked(MenuBarT *bar, int32_t id);
+

Query the checked state of a menu item by command ID. Searches all menus in the bar.

+
  Parameter   Description
+  ---------   -----------
+  bar         Menu bar
+  id          Command ID to query
+

Returns: true if checked.

+

wmMenuItemSetChecked

+
void wmMenuItemSetChecked(MenuBarT *bar, int32_t id, bool checked);
+

Set the checked state of a menu item by command ID. For radio items, setting checked=true also unchecks other radio items in the same group.

+
  Parameter   Description
+  ---------   -----------
+  bar         Menu bar
+  id          Command ID
+  checked     New checked state
+

wmMenuItemSetEnabled

+
void wmMenuItemSetEnabled(MenuBarT *bar, int32_t id, bool enabled);
+

Enable or disable a menu item by command ID.

+
  Parameter   Description
+  ---------   -----------
+  bar         Menu bar
+  id          Command ID
+  enabled     true = enabled, false = grayed out
+

wmAddSubMenu

+
MenuT *wmAddSubMenu(MenuT *parentMenu, const char *label);
+

Create a cascading submenu attached to a parent menu. The child MenuT is heap-allocated and freed when the parent window is destroyed.

+
  Parameter    Description
+  ---------    -----------
+  parentMenu   Parent menu to attach submenu to
+  label        Submenu label text
+

Returns: Pointer to the child MenuT, or NULL on allocation failure.

+

wmCreateMenu

+
MenuT *wmCreateMenu(void);
+

Allocate a heap-resident MenuT for use as a context menu (right-click). Unlike menu bar menus, context menus are standalone allocations. Free with wmFreeMenu().

+

Returns: Pointer to the new MenuT.

+

wmFreeMenu

+
void wmFreeMenu(MenuT *menu);
+

Free a standalone menu allocated with wmCreateMenu(). Also frees any heap-allocated submenu children recursively.

+
  Parameter   Description
+  ---------   -----------
+  menu        Menu to free
+

Scrollbars

+

wmAddVScrollbar

+
ScrollbarT *wmAddVScrollbar(WindowT *win, int32_t min, int32_t max, int32_t pageSize);
+

Attach a vertical scrollbar to the right edge of the window's content area. Shrinks contentW by SCROLLBAR_WIDTH pixels.

+
  Parameter   Description
+  ---------   -----------
+  win         Window
+  min, max    Scroll value range
+  pageSize    Visible portion (controls thumb size)
+

Returns: Pointer to the new ScrollbarT.

+

wmAddHScrollbar

+
ScrollbarT *wmAddHScrollbar(WindowT *win, int32_t min, int32_t max, int32_t pageSize);
+

Attach a horizontal scrollbar to the bottom edge. Shrinks contentH by SCROLLBAR_WIDTH pixels.

+
  Parameter   Description
+  ---------   -----------
+  win         Window
+  min, max    Scroll value range
+  pageSize    Visible portion
+

Returns: Pointer to the new ScrollbarT.

+

Drawing

+

wmDrawChrome

+
void wmDrawChrome(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors, WindowT *win, const RectT *clipTo);
+

Draw the window frame: outer bevel, title bar with text, close/minimize/maximize gadgets, and menu bar if present. Drawing is clipped to the intersection with clipTo.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  font        Bitmap font for title text
+  colors      Color scheme
+  win         Window to draw chrome for
+  clipTo      Dirty rectangle to clip drawing to
+

wmDrawContent

+
void wmDrawContent(DisplayT *d, const BlitOpsT *ops, WindowT *win, const RectT *clipTo);
+

Blit the window's content backbuffer into the display backbuffer, clipped to the dirty rect. Pure copy operation (no drawing).

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  win         Window
+  clipTo      Dirty rectangle
+

wmDrawScrollbars

+
void wmDrawScrollbars(DisplayT *d, const BlitOpsT *ops, const ColorSchemeT *colors, WindowT *win, const RectT *clipTo);
+

Draw scrollbars (track, arrows, proportional thumb) for a window. Drawn after content so scrollbars overlay the content area edge.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  colors      Color scheme
+  win         Window
+  clipTo      Dirty rectangle
+

wmDrawMinimizedIcons

+
void wmDrawMinimizedIcons(DisplayT *d, const BlitOpsT *ops, const ColorSchemeT *colors, const WindowStackT *stack, const RectT *clipTo);
+

Draw icons for all minimized windows along the bottom of the screen. Each icon shows a scaled preview of the window's content with a beveled border.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  ops         Blit operations vtable
+  colors      Color scheme
+  stack       Window stack
+  clipTo      Dirty rectangle
+

Hit Testing

+

wmHitTest

+
int32_t wmHitTest(const WindowStackT *stack, int32_t mx, int32_t my, int32_t *hitPart);
+

Determine which window and chrome region is under the given screen coordinates. Iterates front-to-back (highest Z first) so the topmost window wins.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  mx, my      Screen coordinates
+  hitPart     Output: HIT_CONTENT, HIT_TITLE, HIT_CLOSE, etc.
+

Returns: Stack index of hit window, or -1 for desktop.

+

wmResizeEdgeHit

+
int32_t wmResizeEdgeHit(const WindowT *win, int32_t mx, int32_t my);
+

Determine which edge(s) of a window's border zone are targeted for resize.

+
  Parameter   Description
+  ---------   -----------
+  win         Window
+  mx, my      Screen coordinates
+

Returns: Bitmask of RESIZE_LEFT / RESIZE_RIGHT / RESIZE_TOP / RESIZE_BOTTOM.

+

wmMinimizedIconHit

+
int32_t wmMinimizedIconHit(const WindowStackT *stack, const DisplayT *d, int32_t mx, int32_t my);
+

Hit-test minimized icons at the bottom of the screen.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  d           Display context
+  mx, my      Screen coordinates
+

Returns: Stack index of the minimized window, or -1.

+

Drag and Resize

+

wmDragBegin

+
void wmDragBegin(WindowStackT *stack, int32_t idx, int32_t mouseX, int32_t mouseY);
+

Begin a window drag operation. Records the mouse offset from the window origin.

+
  Parameter     Description
+  ---------     -----------
+  stack         Window stack
+  idx           Stack index of window to drag
+  mouseX/Y      Current mouse position
+

wmDragMove

+
void wmDragMove(WindowStackT *stack, DirtyListT *dl, int32_t mouseX, int32_t mouseY, int32_t screenW, int32_t screenH);
+

Update window position during an active drag. Dirties both old and new positions.

+
  Parameter      Description
+  ---------      -----------
+  stack          Window stack
+  dl             Dirty list
+  mouseX/Y       Current mouse position
+  screenW/H      Screen dimensions (for clamping)
+

wmDragEnd

+
void wmDragEnd(WindowStackT *stack);
+

End the current drag operation. Clears dragWindow state.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+

wmResizeBegin

+
void wmResizeBegin(WindowStackT *stack, int32_t idx, int32_t edge, int32_t mouseX, int32_t mouseY);
+

Begin a window resize operation. Records which edge(s) are being dragged.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  idx         Stack index
+  edge        Bitmask of RESIZE_xxx flags
+  mouseX/Y    Current mouse position
+

wmResizeMove

+
void wmResizeMove(WindowStackT *stack, DirtyListT *dl, const DisplayT *d, int32_t *mouseX, int32_t *mouseY);
+

Update window dimensions during an active resize. Enforces MIN_WINDOW_W/H and maxW/maxH constraints. Reallocates content buffer and calls onResize if size changed. mouseX/mouseY are in/out: clamped on return for cursor warping.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  d           Display context
+  mouseX/Y    In/out: mouse position (clamped on return)
+

wmResizeEnd

+
void wmResizeEnd(WindowStackT *stack);
+

End the current resize operation. Clears resizeWindow state.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+

Scrollbar Interaction

+

wmScrollbarClick

+
void wmScrollbarClick(WindowStackT *stack, DirtyListT *dl, int32_t idx, int32_t orient, int32_t mx, int32_t my);
+

Handle an initial click on a scrollbar. Determines what was hit (arrows, trough, or thumb) and either adjusts the value immediately or begins a thumb drag.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  idx         Stack index of window
+  orient      SCROLL_VERTICAL or SCROLL_HORIZONTAL
+  mx, my      Click screen coordinates
+

wmScrollbarDrag

+
void wmScrollbarDrag(WindowStackT *stack, DirtyListT *dl, int32_t mx, int32_t my);
+

Update the scroll value during an active thumb drag. Maps mouse position along the track to a proportional scroll value.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  mx, my      Current mouse position
+

wmScrollbarEnd

+
void wmScrollbarEnd(WindowStackT *stack);
+

End an active scrollbar thumb drag.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+

Minimize / Maximize / Restore

+

wmMaximize

+
void wmMaximize(WindowStackT *stack, DirtyListT *dl, const DisplayT *d, WindowT *win);
+

Maximize a window. Saves current geometry, then expands to screen or maxW/maxH bounds.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  d           Display context
+  win         Window to maximize
+

wmMinimize

+
void wmMinimize(WindowStackT *stack, DirtyListT *dl, WindowT *win);
+

Minimize a window. Hides the window and shows an icon at the bottom of the screen.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  win         Window to minimize
+

wmRestore

+
void wmRestore(WindowStackT *stack, DirtyListT *dl, const DisplayT *d, WindowT *win);
+

Restore a maximized window to its pre-maximize geometry.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  d           Display context
+  win         Maximized window to restore
+

wmRestoreMinimized

+
void wmRestoreMinimized(WindowStackT *stack, DirtyListT *dl, const DisplayT *d, WindowT *win);
+

Restore a minimized window (show it again and remove the icon).

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  dl          Dirty list
+  d           Display context
+  win         Minimized window to restore
+

Minimized Icon Layout

+

wmMinimizedIconPos

+
void wmMinimizedIconPos(const DisplayT *d, int32_t index, int32_t *x, int32_t *y);
+

Compute the screen position of a minimized icon by ordinal index. Icons wrap into rows from bottom to top when the screen fills up.

+
  Parameter   Description
+  ---------   -----------
+  d           Display context
+  index       Ordinal index of the minimized icon
+  x, y        Output: screen position
+

wmMinimizedIconRect

+
void wmMinimizedIconRect(const WindowStackT *stack, const DisplayT *d, int32_t *y, int32_t *h);
+

Compute the screen rect covering all minimized icon rows. Used to dirty the icon area when windows are minimized or restored.

+
  Parameter   Description
+  ---------   -----------
+  stack       Window stack
+  d           Display context
+  y, h        Output: vertical extent of icon area
+

Miscellaneous

+

wmSetTitle

+
void wmSetTitle(WindowT *win, DirtyListT *dl, const char *title);
+

Set the window title and dirty the title bar for repaint.

+
  Parameter   Description
+  ---------   -----------
+  win         Window
+  dl          Dirty list
+  title       New title text
+

wmSetIcon

+
int32_t wmSetIcon(WindowT *win, const char *path, const DisplayT *d);
+

Load an icon image for a window from a file. Converts to display pixel format.

+
  Parameter   Description
+  ---------   -----------
+  win         Window
+  path        Image file path
+  d           Display context
+

Returns: 0 on success, -1 on failure.

+
+
+

dvxApp.h -- Layer 5: Application API

+

dvxApp.h -- Layer 5: Application API

+

The topmost layer and the public-facing API. Aggregates all lower layers into a single AppContextT. Applications interact exclusively through dvx*() functions and window callbacks. The event loop follows a cooperative model: poll, dispatch, composite, yield.

+

AppContextT

+

Single monolithic context that owns all GUI state. Contains the display, window stack, dirty list, blit ops, font, color scheme, popup state, cursor state, mouse/keyboard state, tooltip state, wallpaper buffer, video mode list, and various configuration fields. Allocated on the caller's stack or statically.

+

Initialization and Shutdown

+

dvxInit

+
int32_t dvxInit(AppContextT *ctx, int32_t requestedW, int32_t requestedH, int32_t preferredBpp);
+

Initialize the entire GUI stack: video mode, input devices, font, color scheme, cursor shapes, and internal state. Single entry point for starting a DVX application.

+
  Parameter        Description
+  ---------        -----------
+  ctx              Application context to initialize
+  requestedW/H     Desired screen resolution
+  preferredBpp     Preferred bits per pixel
+

Returns: 0 on success, negative on failure.

+

dvxShutdown

+
void dvxShutdown(AppContextT *ctx);
+

Tear down the GUI stack in reverse order: destroy all windows, restore text mode, release input devices. Safe to call after a failed dvxInit().

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxChangeVideoMode

+
int32_t dvxChangeVideoMode(AppContextT *ctx, int32_t requestedW, int32_t requestedH, int32_t preferredBpp);
+

Switch to a new video mode live. Reallocates the backbuffer, all window content buffers, repacks colors, rescales wallpaper, and repositions off-screen windows.

+
  Parameter        Description
+  ---------        -----------
+  ctx              Application context
+  requestedW/H     New resolution
+  preferredBpp     New bits per pixel
+

Returns: 0 on success, -1 on failure (old mode restored).

+

Event Loop

+

dvxRun

+
void dvxRun(AppContextT *ctx);
+

Enter the main event loop. Polls input, dispatches events, composites dirty regions, and yields on each iteration. Returns when ctx->running becomes false.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxUpdate

+
bool dvxUpdate(AppContextT *ctx);
+

Process exactly one frame of the event loop. For applications that integrate the GUI into their own main loop (e.g. polling serial ports between frames).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Returns: false when the GUI wants to exit.

+

dvxQuit

+
void dvxQuit(AppContextT *ctx);
+

Request exit from the main event loop (sets ctx->running = false).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Window Management

+

dvxCreateWindow

+
WindowT *dvxCreateWindow(AppContextT *ctx, const char *title, int32_t x, int32_t y, int32_t w, int32_t h, bool resizable);
+

Create a window at an explicit screen position. The window is raised to the top, focused, and its entire region is dirtied.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  title       Window title
+  x, y        Screen position
+  w, h        Outer frame dimensions
+  resizable   true = allow user resize
+

Returns: Pointer to new WindowT.

+

dvxCreateWindowCentered

+
WindowT *dvxCreateWindowCentered(AppContextT *ctx, const char *title, int32_t w, int32_t h, bool resizable);
+

Convenience wrapper that centers the window on screen.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  title       Window title
+  w, h        Outer frame dimensions
+  resizable   true = allow user resize
+

Returns: Pointer to new WindowT.

+

dvxDestroyWindow

+
void dvxDestroyWindow(AppContextT *ctx, WindowT *win);
+

Destroy a window, free all its resources, and dirty its former region.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to destroy
+

dvxRaiseWindow

+
void dvxRaiseWindow(AppContextT *ctx, WindowT *win);
+

Raise a window to the top of the Z-order and give it focus.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to raise
+

dvxFitWindow

+
void dvxFitWindow(AppContextT *ctx, WindowT *win);
+

Resize a window to exactly fit its widget tree's computed minimum size (plus chrome). Used for dialog boxes and fixed-layout windows.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to fit
+

dvxFitWindowW

+
void dvxFitWindowW(AppContextT *ctx, WindowT *win);
+

Resize window width only to fit widget tree's minimum width (plus chrome).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to fit
+

dvxFitWindowH

+
void dvxFitWindowH(AppContextT *ctx, WindowT *win);
+

Resize window height only to fit widget tree's minimum height (plus chrome).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to fit
+

dvxResizeWindow

+
void dvxResizeWindow(AppContextT *ctx, WindowT *win, int32_t newW, int32_t newH);
+

Programmatically resize a window to the specified outer dimensions.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to resize
+  newW, newH  New outer frame dimensions
+

dvxMinimizeWindow

+
void dvxMinimizeWindow(AppContextT *ctx, WindowT *win);
+

Minimize a window (show as icon at bottom of screen).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to minimize
+

dvxMaximizeWindow

+
void dvxMaximizeWindow(AppContextT *ctx, WindowT *win);
+

Maximize a window (expand to fill screen or maxW/maxH).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to maximize
+

dvxHideWindow

+
void dvxHideWindow(AppContextT *ctx, WindowT *win);
+

Hide a window without destroying it. Marks the exposed region dirty.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to hide
+

dvxShowWindow

+
void dvxShowWindow(AppContextT *ctx, WindowT *win);
+

Show a previously hidden window. Marks its region dirty for repaint.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to show
+

Invalidation

+

dvxInvalidateRect

+
void dvxInvalidateRect(AppContextT *ctx, WindowT *win, int32_t x, int32_t y, int32_t w, int32_t h);
+

Mark a sub-region of a window's content area as needing repaint. Coordinates are relative to the content area, not the screen. Triggers onPaint during the next composite pass.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window
+  x, y, w, h Dirty rectangle in content-relative coordinates
+

dvxInvalidateWindow

+
void dvxInvalidateWindow(AppContextT *ctx, WindowT *win);
+

Mark the entire window content area as dirty.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to invalidate
+

Window Properties

+

dvxSetTitle

+
void dvxSetTitle(AppContextT *ctx, WindowT *win, const char *title);
+

Set a window's title text and dirty the title bar.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window
+  title       New title text
+

dvxSetWindowIcon

+
int32_t dvxSetWindowIcon(AppContextT *ctx, WindowT *win, const char *path);
+

Load an icon for a window from an image file.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window
+  path        Image file path
+

Returns: 0 on success, -1 on failure.

+

dvxSetBusy

+
void dvxSetBusy(AppContextT *ctx, bool busy);
+

Set or clear busy state. While busy, the hourglass cursor is shown and input is blocked.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  busy        true = show hourglass, false = normal
+

Accessors

+

dvxGetFont

+
const BitmapFontT *dvxGetFont(const AppContextT *ctx);
+

Get a pointer to the default font.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Returns: Pointer to the active BitmapFontT.

+

dvxGetColors

+
const ColorSchemeT *dvxGetColors(const AppContextT *ctx);
+

Get a pointer to the current color scheme.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Returns: Pointer to the active ColorSchemeT.

+

dvxGetDisplay

+
DisplayT *dvxGetDisplay(AppContextT *ctx);
+

Get a pointer to the display context.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Returns: Pointer to the DisplayT.

+

dvxGetBlitOps

+
const BlitOpsT *dvxGetBlitOps(const AppContextT *ctx);
+

Get a pointer to the blit operations vtable.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Returns: Pointer to the active BlitOpsT.

+

dvxGetVideoModes

+
const VideoModeInfoT *dvxGetVideoModes(const AppContextT *ctx, int32_t *count);
+

Return the list of available video modes enumerated at init time.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  count       Output: number of mode entries
+

Returns: Pointer to the VideoModeInfoT array.

+

Color Scheme

+

dvxSetColor

+
void dvxSetColor(AppContextT *ctx, ColorIdE id, uint8_t r, uint8_t g, uint8_t b);
+

Set a single color by ID. Repacks to native pixel format and invalidates the entire screen.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  id          Color ID (ColorIdE)
+  r, g, b     RGB values (0-255)
+

dvxGetColor

+
void dvxGetColor(const AppContextT *ctx, ColorIdE id, uint8_t *r, uint8_t *g, uint8_t *b);
+

Get a color's RGB values by ID.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  id          Color ID (ColorIdE)
+  r, g, b     Output: RGB values
+

dvxApplyColorScheme

+
void dvxApplyColorScheme(AppContextT *ctx);
+

Apply all colors from ctx->colorRgb[] at once (repack + full repaint).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxResetColorScheme

+
void dvxResetColorScheme(AppContextT *ctx);
+

Reset all colors to the built-in defaults and repaint.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxLoadTheme

+
bool dvxLoadTheme(AppContextT *ctx, const char *filename);
+

Load a theme file (INI format with [colors] section) and apply it.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  filename    Path to theme INI file
+

Returns: true on success.

+

dvxSaveTheme

+
bool dvxSaveTheme(const AppContextT *ctx, const char *filename);
+

Save the current color scheme to a theme file.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  filename    Output file path
+

Returns: true on success.

+

dvxColorName

+
const char *dvxColorName(ColorIdE id);
+

Return the INI key name for a color ID (e.g. "desktop", "windowFace").

+
  Parameter   Description
+  ---------   -----------
+  id          Color ID
+

Returns: Static string.

+

dvxColorLabel

+
const char *dvxColorLabel(ColorIdE id);
+

Return a human-readable display label (e.g. "Desktop", "Cursor Color").

+
  Parameter   Description
+  ---------   -----------
+  id          Color ID
+

Returns: Static string.

+

Wallpaper

+

dvxSetWallpaper

+
bool dvxSetWallpaper(AppContextT *ctx, const char *path);
+

Load and apply a wallpaper image using the current wallpaperMode (stretch/tile/center). Pass NULL to clear the wallpaper.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  path        Image file path, or NULL to clear
+

Returns: true on success.

+

dvxSetWallpaperMode

+
void dvxSetWallpaperMode(AppContextT *ctx, WallpaperModeE mode);
+

Change the wallpaper display mode and re-render. No effect if no wallpaper is loaded.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  mode        WallpaperStretchE, WallpaperTileE, or WallpaperCenterE
+

Mouse Configuration

+

dvxSetMouseConfig

+
void dvxSetMouseConfig(AppContextT *ctx, int32_t wheelDir, int32_t dblClickMs, int32_t accelThreshold);
+

Configure mouse behavior.

+
  Parameter        Description
+  ---------        -----------
+  ctx              Application context
+  wheelDir         1 = normal, -1 = reversed
+  dblClickMs       Double-click speed in milliseconds (e.g. 500)
+  accelThreshold   Double-speed threshold in mickeys/sec (0 = don't change)
+

Accelerators

+

dvxCreateAccelTable

+
AccelTableT *dvxCreateAccelTable(void);
+

Allocate a new accelerator table. Attach to a window via win->accelTable.

+

Returns: Pointer to new AccelTableT.

+

dvxFreeAccelTable

+
void dvxFreeAccelTable(AccelTableT *table);
+

Free an accelerator table and its entries.

+
  Parameter   Description
+  ---------   -----------
+  table       Table to free
+

dvxAddAccel

+
void dvxAddAccel(AccelTableT *table, int32_t key, int32_t modifiers, int32_t cmdId);
+

Register a keyboard shortcut. On match, fires the window's onMenu callback with cmdId.

+
  Parameter   Description
+  ---------   -----------
+  table       Accelerator table
+  key         ASCII character or KEY_Fxx constant
+  modifiers   Bitmask of ACCEL_CTRL / ACCEL_SHIFT / ACCEL_ALT
+  cmdId       Command ID passed to onMenu
+

Window Arrangement

+

dvxCascadeWindows

+
void dvxCascadeWindows(AppContextT *ctx);
+

Cascade all visible, non-minimized windows. Each is offset diagonally by the title bar height.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxTileWindows

+
void dvxTileWindows(AppContextT *ctx);
+

Arrange visible windows in an NxM grid filling the screen.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxTileWindowsH

+
void dvxTileWindowsH(AppContextT *ctx);
+

Tile windows horizontally (side by side, equal width, full height).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

dvxTileWindowsV

+
void dvxTileWindowsV(AppContextT *ctx);
+

Tile windows vertically (stacked, full width, equal height).

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+

Image I/O

+

dvxLoadImage

+
uint8_t *dvxLoadImage(const AppContextT *ctx, const char *path, int32_t *outW, int32_t *outH, int32_t *outPitch);
+

Load an image file (BMP, PNG, JPEG, GIF) and convert to the display's native pixel format. Caller must free with dvxFreeImage().

+
  Parameter     Description
+  ---------     -----------
+  ctx           Application context
+  path          Image file path
+  outW, outH    Output: image dimensions
+  outPitch      Output: row pitch in bytes
+

Returns: Pixel buffer, or NULL on failure.

+

dvxLoadImageFromMemory

+
uint8_t *dvxLoadImageFromMemory(const AppContextT *ctx, const uint8_t *data, int32_t dataLen, int32_t *outW, int32_t *outH, int32_t *outPitch);
+

Load an image from a memory buffer. Same output format as dvxLoadImage(). Caller must free with dvxFreeImage().

+
  Parameter     Description
+  ---------     -----------
+  ctx           Application context
+  data          Image data buffer
+  dataLen       Buffer size in bytes
+  outW, outH    Output: image dimensions
+  outPitch      Output: row pitch in bytes
+

Returns: Pixel buffer, or NULL on failure.

+

dvxFreeImage

+
void dvxFreeImage(uint8_t *data);
+

Free a pixel buffer returned by dvxLoadImage() or dvxLoadImageFromMemory().

+
  Parameter   Description
+  ---------   -----------
+  data        Buffer to free
+

dvxImageInfo

+
bool dvxImageInfo(const char *path, int32_t *outW, int32_t *outH);
+

Query image dimensions without decoding the full file.

+
  Parameter     Description
+  ---------     -----------
+  path          Image file path
+  outW, outH    Output: image dimensions
+

Returns: true on success.

+

dvxSaveImage

+
int32_t dvxSaveImage(const AppContextT *ctx, const uint8_t *data, int32_t w, int32_t h, int32_t pitch, const char *path);
+

Save native-format pixel data to a PNG file.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  data        Pixel data in display native format
+  w, h        Image dimensions
+  pitch       Row pitch in bytes
+  path        Output file path
+

Returns: 0 on success, -1 on failure.

+

Screenshots

+

dvxScreenshot

+
int32_t dvxScreenshot(AppContextT *ctx, const char *path);
+

Save the entire screen (backbuffer contents) to a PNG file. Converts from native pixel format to RGB.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  path        Output PNG file path
+

Returns: 0 on success, -1 on failure.

+

dvxWindowScreenshot

+
int32_t dvxWindowScreenshot(AppContextT *ctx, WindowT *win, const char *path);
+

Save a window's content to a PNG file.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window
+  path        Output PNG file path
+

Returns: 0 on success, -1 on failure.

+

Clipboard

+

dvxClipboardCopy

+
void dvxClipboardCopy(const char *text, int32_t len);
+

Copy text to the process-wide clipboard buffer. Simple static buffer (not inter-process).

+
  Parameter   Description
+  ---------   -----------
+  text        Text to copy
+  len         Length in bytes
+

dvxClipboardGet

+
const char *dvxClipboardGet(int32_t *outLen);
+

Retrieve the current clipboard contents. Returns a pointer to the internal buffer (valid until the next dvxClipboardCopy), or NULL if empty.

+
  Parameter   Description
+  ---------   -----------
+  outLen      Output: length of clipboard text
+

Returns: Clipboard text, or NULL.

+

Resource Loading

+

dvxResLoadIcon

+
uint8_t *dvxResLoadIcon(AppContextT *ctx, const char *dxePath, const char *resName, int32_t *outW, int32_t *outH, int32_t *outPitch);
+

Load an icon/image resource from a DXE file and decode to native pixel format. Caller must free with dvxFreeImage().

+
  Parameter     Description
+  ---------     -----------
+  ctx           Application context
+  dxePath       Path to DXE file
+  resName       Resource name within the DXE
+  outW, outH    Output: image dimensions
+  outPitch      Output: row pitch
+

Returns: Pixel buffer, or NULL if not found.

+

dvxResLoadText

+
bool dvxResLoadText(const char *dxePath, const char *resName, char *buf, int32_t bufSize);
+

Load a text resource from a DXE file into a caller-provided buffer. Null-terminated and truncated to fit bufSize.

+
  Parameter   Description
+  ---------   -----------
+  dxePath     Path to DXE file
+  resName     Resource name
+  buf         Output buffer
+  bufSize     Buffer capacity
+

Returns: true on success.

+

dvxResLoadData

+
void *dvxResLoadData(const char *dxePath, const char *resName, uint32_t *outSize);
+

Load a raw binary resource from a DXE file. Returns a malloc'd buffer that the caller must free.

+
  Parameter   Description
+  ---------   -----------
+  dxePath     Path to DXE file
+  resName     Resource name
+  outSize     Output: data size in bytes
+

Returns: Data buffer, or NULL if not found.

+

Utilities

+

dvxTextHash

+
uint32_t dvxTextHash(const char *text);
+

Compute a djb2-xor hash for cheap dirty detection. Compare at save time with the current hash to detect changes without a shadow copy. Not cryptographic.

+
  Parameter   Description
+  ---------   -----------
+  text        Null-terminated string to hash
+

Returns: 32-bit hash value.

+
+
+

dvxWidget.h -- Widget System

+

dvxWidget.h -- Widget System

+

Retained-mode widget toolkit layered on the DVX window manager. Widgets form a tree (parent-child) rooted at a per-window VBox container. Layout is automatic: measure minimum sizes bottom-up, then allocate space top-down with flexbox-like weighted distribution. Widget types are registered dynamically at runtime via DXE plugins.

+

WidgetT Structure

+

Core widget structure. Generic across all widget types; type-specific data lives in the void *data pointer managed by each widget's DXE.

+
  Field                                       Description
+  -----                                       -----------
+  int32_t type                                Widget type ID (assigned by wgtRegisterClass)
+  const WidgetClassT *wclass                  Vtable for this widget type
+  char name[MAX_WIDGET_NAME]                  Widget name for lookup via wgtFind
+  parent, firstChild, lastChild, nextSibling  Tree linkage pointers
+  WindowT *window                             Owning window
+  int32_t x, y, w, h                         Computed geometry (relative to content area)
+  int32_t calcMinW, calcMinH                  Computed minimum size (from layout pass)
+  int32_t minW, minH, maxW, maxH, prefW, prefH  Size hints (tagged sizes)
+  int32_t weight                              Extra-space distribution weight (0=fixed, 100=normal)
+  WidgetAlignE align                          Main-axis alignment for children
+  int32_t spacing, padding                    Tagged sizes for child spacing and padding
+  uint32_t fgColor, bgColor                   Custom colors (0 = use scheme defaults)
+  bool visible, enabled, readOnly             State flags
+  bool swallowTab                             Tab key goes to widget, not focus navigation
+  char accelKey                               Accelerator character (0 = none)
+  void *userData, *data                       Application data and widget-private data
+  const char *tooltip                         Tooltip text (NULL = none)
+  MenuT *contextMenu                          Right-click menu (NULL = none)
+

Universal Callbacks:

+
  Callback                                           Description
+  --------                                           -----------
+  onClick(WidgetT *w)                                Widget clicked
+  onDblClick(WidgetT *w)                             Widget double-clicked
+  onChange(WidgetT *w)                               Value changed
+  onFocus(WidgetT *w)                                Widget gained focus
+  onBlur(WidgetT *w)                                 Widget lost focus
+  onKeyPress(WidgetT *w, int32_t keyAscii)           ASCII key press
+  onKeyDown(WidgetT *w, int32_t keyCode, int32_t shift)  Key down
+  onKeyUp(WidgetT *w, int32_t keyCode, int32_t shift)    Key up
+  onMouseDown(WidgetT *w, int32_t btn, int32_t x, int32_t y)  Mouse button pressed
+  onMouseUp(WidgetT *w, int32_t btn, int32_t x, int32_t y)    Mouse button released
+  onMouseMove(WidgetT *w, int32_t btn, int32_t x, int32_t y)  Mouse moved
+  onScroll(WidgetT *w, int32_t delta)                Mouse wheel
+  onValidate(WidgetT *w)                             Return false to cancel a write
+

Size Specification Macros

+
  Macro            Description
+  -----            -----------
+  wgtPixels(v)     Size in pixels
+  wgtChars(v)      Size in character widths (multiplied by charWidth at layout)
+  wgtPercent(v)    Size as percentage of parent dimension
+

Widget Class Flags

+
  Flag                        Description
+  ----                        -----------
+  WCLASS_FOCUSABLE            Can receive keyboard focus (Tab navigation)
+  WCLASS_HORIZ_CONTAINER      Lays out children horizontally (vs. vertical)
+  WCLASS_PAINTS_CHILDREN      Widget handles child rendering itself
+  WCLASS_NO_HIT_RECURSE       Hit testing stops here, no child recursion
+  WCLASS_FOCUS_FORWARD        Accel hit forwards focus to next focusable sibling
+  WCLASS_HAS_POPUP            Has dropdown popup overlay
+  WCLASS_SCROLLABLE           Accepts mouse wheel events
+  WCLASS_SCROLL_CONTAINER     Scroll container (ScrollPane)
+  WCLASS_NEEDS_POLL           Needs periodic polling
+  WCLASS_SWALLOWS_TAB         Tab key goes to widget, not focus navigation
+  WCLASS_RELAYOUT_ON_SCROLL   Full relayout on scrollbar drag
+  WCLASS_PRESS_RELEASE        Click = press + release (Button, ImageButton)
+  WCLASS_ACCEL_WHEN_HIDDEN    Accelerator matching works even when invisible
+

Window Integration

+

wgtInitWindow

+
WidgetT *wgtInitWindow(AppContextT *ctx, WindowT *win);
+

Initialize the widget system for a window. Creates a root VBox container that fills the content area, and installs callback handlers (onPaint, onMouse, onKey, onResize) for widget-based event dispatch. The window's userData is set to the AppContextT pointer.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  win         Window to initialize
+

Returns: Root VBox widget (add children to this).

+

Widget Operations

+

wgtGetContext

+
AppContextT *wgtGetContext(const WidgetT *w);
+

Walk from any widget up the tree to the root, then retrieve the AppContextT stored in the window's userData. Lets any widget access the full application context.

+
  Parameter   Description
+  ---------   -----------
+  w           Any widget in the tree
+

Returns: Pointer to the AppContextT.

+

wgtInvalidate

+
void wgtInvalidate(WidgetT *w);
+

Mark a widget as needing both re-layout (measure + position) and repaint. Propagates upward to ancestors. Use after structural changes (adding/removing children, text changes that affect size).

+
  Parameter   Description
+  ---------   -----------
+  w           Widget to invalidate
+

wgtInvalidatePaint

+
void wgtInvalidatePaint(WidgetT *w);
+

Mark a widget as needing repaint only, without re-layout. Use for visual-only changes (checkbox toggle, selection highlight, cursor blink).

+
  Parameter   Description
+  ---------   -----------
+  w           Widget to repaint
+

wgtSetText

+
void wgtSetText(WidgetT *w, const char *text);
+

Set widget text content (dispatches to the widget class's SET_TEXT handler).

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+  text        New text
+

wgtGetText

+
const char *wgtGetText(const WidgetT *w);
+

Get the widget's current text content.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+

Returns: Text string (empty string if no handler).

+

wgtSetEnabled

+
void wgtSetEnabled(WidgetT *w, bool enabled);
+

Enable or disable a widget. Disabled widgets are grayed out and do not receive input.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+  enabled     true = enabled, false = disabled
+

wgtSetReadOnly

+
void wgtSetReadOnly(WidgetT *w, bool readOnly);
+

Set read-only mode. Allows scrolling and selection but blocks editing.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+  readOnly    true = read-only
+

wgtSetFocused

+
void wgtSetFocused(WidgetT *w);
+

Set keyboard focus to a widget.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget to focus
+

wgtGetFocused

+
WidgetT *wgtGetFocused(void);
+

Get the currently focused widget.

+

Returns: Focused widget, or NULL.

+

wgtSetVisible

+
void wgtSetVisible(WidgetT *w, bool visible);
+

Show or hide a widget.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+  visible     true = visible, false = hidden
+

wgtSetName

+
void wgtSetName(WidgetT *w, const char *name);
+

Set a widget's name for lookup via wgtFind().

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+  name        Name string (max MAX_WIDGET_NAME chars)
+

wgtFind

+
WidgetT *wgtFind(WidgetT *root, const char *name);
+

Find a widget by name. Searches the subtree rooted at root.

+
  Parameter   Description
+  ---------   -----------
+  root        Root of subtree to search
+  name        Widget name to find
+

Returns: Matching widget, or NULL.

+

wgtDestroy

+
void wgtDestroy(WidgetT *w);
+

Destroy a widget and all its children. Removes from parent's child list.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget to destroy
+

wgtSetTooltip

+
void wgtSetTooltip(WidgetT *w, const char *text);
+

Set tooltip text for a widget. Pass NULL to remove. Caller owns the string and it must outlive the widget.

+
  Parameter   Description
+  ---------   -----------
+  w           Widget
+  text        Tooltip text, or NULL
+

widgetOnResize

+
void widgetOnResize(WindowT *win, int32_t newW, int32_t newH);
+

Default window resize handler installed by wgtInitWindow(). Re-evaluates scrollbars and relayouts the widget tree. Call from custom onResize handlers to chain to the widget system.

+
  Parameter    Description
+  ---------    -----------
+  win          Window being resized
+  newW, newH   New content dimensions
+

Layout

+

wgtResolveSize

+
int32_t wgtResolveSize(int32_t taggedSize, int32_t parentSize, int32_t charWidth);
+

Decode a tagged size value (WGT_SIZE_PIXELS/CHARS/PERCENT) into a concrete pixel count. Returns 0 for a raw 0 input (meaning "auto").

+
  Parameter     Description
+  ---------     -----------
+  taggedSize    Tagged size value
+  parentSize    Parent dimension (for PERCENT mode)
+  charWidth     Font character width (for CHARS mode)
+

Returns: Size in pixels.

+

wgtLayout

+
void wgtLayout(WidgetT *root, int32_t availW, int32_t availH, const BitmapFontT *font);
+

Execute the full two-pass layout algorithm. Pass 1 (bottom-up): compute minimum sizes. Pass 2 (top-down): allocate space with weighted distribution. Normally called automatically; exposed for cases where layout must be forced before the next paint.

+
  Parameter     Description
+  ---------     -----------
+  root          Root widget
+  availW/H      Available space
+  font          Bitmap font (for character-based sizing)
+

wgtPaint

+
void wgtPaint(WidgetT *root, DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors);
+

Paint the entire widget tree by depth-first traversal. Each widget's clip rect is set to its bounds. Overlays (popups, tooltips) are painted in a second pass on top.

+
  Parameter   Description
+  ---------   -----------
+  root        Root widget
+  d           Display context
+  ops         Blit operations vtable
+  font        Bitmap font
+  colors      Color scheme
+

Debug

+

wgtSetDebugLayout

+
void wgtSetDebugLayout(AppContextT *ctx, bool enabled);
+

Draw colored borders around layout containers for debugging.

+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context
+  enabled     true = draw debug borders
+

Dynamic Widget Registration

+

wgtRegisterClass

+
int32_t wgtRegisterClass(const WidgetClassT *wclass);
+

Register a new widget class at runtime. Appends to widgetClassTable. The WidgetClassT must remain valid for the lifetime of the process (typically static const in a DXE).

+
  Parameter   Description
+  ---------   -----------
+  wclass      Widget class vtable to register
+

Returns: Assigned type ID.

+

wgtRegisterApi

+
void wgtRegisterApi(const char *name, const void *api);
+

Register a widget API struct under a name. Each widget DXE registers its API during initialization. Callers retrieve it via wgtGetApi() and cast to the widget-specific type.

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name (e.g. "button", "listbox")
+  api         Pointer to the widget's API struct
+

wgtGetApi

+
const void *wgtGetApi(const char *name);
+

Retrieve a registered widget API struct by name.

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name
+

Returns: Pointer to the API struct, or NULL if not found.

+

Widget Interface Descriptors

+

wgtRegisterIface

+
void wgtRegisterIface(const char *name, const WgtIfaceT *iface);
+

Register an interface descriptor for a widget type. Used by the BASIC form runtime and IDE for generic property/method dispatch.

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name
+  iface       Interface descriptor
+

wgtGetIface

+
const WgtIfaceT *wgtGetIface(const char *name);
+

Retrieve an interface descriptor by widget type name.

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name
+

Returns: Interface descriptor, or NULL.

+

wgtFindByBasName

+
const char *wgtFindByBasName(const char *basName);
+

Find a widget type name by its VB-style name (e.g. "CommandButton" -> "button"). Case-insensitive search.

+
  Parameter   Description
+  ---------   -----------
+  basName     VB-style widget name
+

Returns: Internal type name, or NULL.

+

wgtIfaceCount

+
int32_t wgtIfaceCount(void);
+

Return the number of registered widget interfaces.

+

Returns: Count of registered interfaces.

+

wgtIfaceAt

+
const WgtIfaceT *wgtIfaceAt(int32_t idx, const char **outName);
+

Get a registered widget interface by index.

+
  Parameter   Description
+  ---------   -----------
+  idx         Index (0-based)
+  outName     Output: type name
+

Returns: Interface descriptor.

+

wgtIfaceGetPath

+
const char *wgtIfaceGetPath(const char *name);
+

Get the .wgt DXE file path for a registered widget.

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name
+

Returns: File path string.

+

wgtIfaceSetPath

+
void wgtIfaceSetPath(const char *name, const char *path);
+

Set the .wgt DXE file path for a registered widget (called by the loader).

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name
+  path        DXE file path
+

wgtIfaceGetPathIndex

+
int32_t wgtIfaceGetPathIndex(const char *name);
+

Get the 1-based index of this widget within its .wgt file. Used to construct suffixed resource names (e.g. "name-2", "icon16-2").

+
  Parameter   Description
+  ---------   -----------
+  name        Widget type name
+

Returns: 1-based index within the DXE file.

+

Typed Dispatch Helpers

+

The following inline functions provide type-safe dispatch through the WidgetClassT handler table. Each checks for a non-NULL handler before calling.

+
  Function                                Method ID                          Description
+  --------                                ---------                          -----------
+  wclsHas(w, methodId)                    --                                 Check if handler exists
+  wclsPaint(w, d, ops, font, colors)      WGT_METHOD_PAINT                   Paint the widget
+  wclsPaintOverlay(w, d, ops, font, colors) WGT_METHOD_PAINT_OVERLAY         Paint overlay (popups)
+  wclsCalcMinSize(w, font)                WGT_METHOD_CALC_MIN_SIZE           Compute minimum size
+  wclsLayout(w, font)                     WGT_METHOD_LAYOUT                  Layout children
+  wclsGetLayoutMetrics(w, font, ...)      WGT_METHOD_GET_LAYOUT_METRICS      Get pad, gap, extraTop, borderW
+  wclsOnMouse(w, root, vx, vy)           WGT_METHOD_ON_MOUSE                Handle mouse event
+  wclsOnKey(w, key, mod)                  WGT_METHOD_ON_KEY                  Handle key event
+  wclsOnAccelActivate(w, root)            WGT_METHOD_ON_ACCEL_ACTIVATE       Handle accelerator
+  wclsDestroy(w)                          WGT_METHOD_DESTROY                 Destroy widget data
+  wclsOnChildChanged(parent, child)       WGT_METHOD_ON_CHILD_CHANGED        Notify parent of change
+  wclsGetText(w)                          WGT_METHOD_GET_TEXT                Get widget text
+  wclsSetText(w, text)                    WGT_METHOD_SET_TEXT                Set widget text
+  wclsClearSelection(w)                   WGT_METHOD_CLEAR_SELECTION         Clear text selection
+  wclsClosePopup(w)                       WGT_METHOD_CLOSE_POPUP             Close dropdown popup
+  wclsGetPopupRect(w, font, ...)          WGT_METHOD_GET_POPUP_RECT          Get popup screen rect
+  wclsOnDragUpdate(w, root, x, y)         WGT_METHOD_ON_DRAG_UPDATE          Update during drag
+  wclsOnDragEnd(w, root, x, y)            WGT_METHOD_ON_DRAG_END             End drag operation
+  wclsGetCursorShape(w, vx, vy)           WGT_METHOD_GET_CURSOR_SHAPE        Get cursor for position
+  wclsPoll(w, win)                        WGT_METHOD_POLL                    Periodic polling
+  wclsQuickRepaint(w, outY, outH)         WGT_METHOD_QUICK_REPAINT           Fast partial repaint
+  wclsScrollChildIntoView(parent, child)  WGT_METHOD_SCROLL_CHILD_INTO_VIEW  Scroll child visible
+
+
+

libtasks -- Cooperative Task Switching

+

libtasks -- Cooperative Task Switching

+

Credit-based cooperative (non-preemptive) multitasking library for DOS protected mode (DJGPP/DPMI). Each task receives (priority + 1) credits per scheduling round. Tasks run round-robin, consuming one credit per turn. When all credits are exhausted, every ready task is refilled. Higher-priority tasks run proportionally more often but never starve lower ones.

+

Header: tasks/taskswitch.h

+

Why Cooperative

+

DOS is single-threaded with no kernel scheduler. DPMI provides no preemption primitives. The DVX GUI event model is inherently single-threaded: one compositor, one input queue, one window stack. Cooperative switching lets each task yield at safe points, avoiding synchronization primitives entirely.

+

Error Codes

+
  Constant         Value   Description
+  --------         -----   -----------
+  TS_OK            0       Success
+  TS_ERR_INIT      -1      Task system not initialized
+  TS_ERR_PARAM     -2      Invalid parameter (bad task ID, etc.)
+  TS_ERR_FULL      -3      Task array full (should not occur; array grows)
+  TS_ERR_NOMEM     -4      Memory allocation failed
+  TS_ERR_STATE     -5      Invalid state transition
+

Constants

+
  Constant                  Value   Description
+  --------                  -----   -----------
+  TS_DEFAULT_STACK_SIZE     32768   Default stack size per task (32 KB)
+  TS_NAME_MAX               32      Maximum task name length including NUL
+  TS_PRIORITY_LOW           0       Low priority (1 credit per round)
+  TS_PRIORITY_NORMAL        5       Normal priority (6 credits per round)
+  TS_PRIORITY_HIGH          10      High priority (11 credits per round)
+

Types

+

TaskStateE

+

Task scheduling state. Only Ready tasks participate in scheduling.

+
  Value                  Description
+  -----                  -----------
+  TaskStateReady         Eligible for scheduling
+  TaskStateRunning       Currently executing (cosmetic; marks active task)
+  TaskStatePaused        Skipped by scheduler until explicitly resumed
+  TaskStateTerminated    Slot available for reuse
+

TaskEntryT

+
typedef void (*TaskEntryT)(void *arg);
+

Task entry point function signature. The void* argument lets the caller pass arbitrary context (e.g. a shell app descriptor).

+

tsInit

+
int32_t tsInit(void);
+

Initialize the task system. The calling context becomes task 0 (the main task). Task 0 is special: it cannot be killed or paused, and tsRecoverToMain() always returns control here. No separate stack is allocated for task 0; it uses the process stack directly.

+

Returns: TS_OK on success, TS_ERR_INIT if already initialized.

+

tsShutdown

+
void tsShutdown(void);
+

Shut down the task system and free all task stacks and internal storage. Safe to call even if tsInit() was never called.

+

tsCreate

+
int32_t tsCreate(const char *name, TaskEntryT entry, void *arg, uint32_t stackSize, int32_t priority);
+

Create a new task. Terminated task slots are recycled to avoid unbounded array growth.

+
  Parameter    Description
+  ---------    -----------
+  name         Task name (truncated to TS_NAME_MAX - 1 characters)
+  entry        Task entry point function
+  arg          Opaque argument passed to entry
+  stackSize    Stack size in bytes (pass 0 for TS_DEFAULT_STACK_SIZE)
+  priority     Scheduling priority (0..10; use TS_PRIORITY_* constants)
+

Returns: Task ID (>= 0) on success, or a negative error code (TS_ERR_INIT, TS_ERR_PARAM, TS_ERR_NOMEM).

+

tsYield

+
void tsYield(void);
+

Yield CPU to the next eligible ready task using credit-based round-robin. This is the sole mechanism for task switching. Every task must call this (or a GUI function that calls it) periodically, or it will monopolize the CPU.

+

tsPause

+
int32_t tsPause(uint32_t taskId);
+

Pause a task, removing it from scheduling. Cannot pause the main task (ID 0). If a task pauses itself, an implicit yield occurs.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to pause
+

Returns: TS_OK on success, TS_ERR_PARAM on invalid ID, TS_ERR_STATE if the task is not in a pausable state.

+

tsResume

+
int32_t tsResume(uint32_t taskId);
+

Resume a paused task. Credits are refilled so the task gets a fair share of CPU time immediately rather than waiting for the next scheduling round.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to resume
+

Returns: TS_OK on success, TS_ERR_PARAM on invalid ID, TS_ERR_STATE if the task is not paused.

+

tsSetPriority

+
int32_t tsSetPriority(uint32_t taskId, int32_t priority);
+

Set a task's scheduling priority. Also refills credits so the change takes effect immediately.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to modify
+  priority    New priority level (0..10)
+

Returns: TS_OK on success, TS_ERR_PARAM on invalid ID or out-of-range priority.

+

tsGetPriority

+
int32_t tsGetPriority(uint32_t taskId);
+

Get a task's current scheduling priority.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to query
+

Returns: Priority value (0..10) on success, TS_ERR_PARAM on invalid ID.

+

tsGetState

+
TaskStateE tsGetState(uint32_t taskId);
+

Get a task's current scheduling state.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to query
+

Returns: TaskStateE value. Returns TaskStateTerminated for invalid IDs.

+

tsCurrentId

+
uint32_t tsCurrentId(void);
+

Get the ID of the currently executing task. Always valid while the task system is initialized.

+

Returns: Current task ID.

+

tsGetName

+
const char *tsGetName(uint32_t taskId);
+

Get a task's name string.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to query
+

Returns: Pointer to the task's name, or NULL on invalid ID. The pointer remains valid until the task slot is reused.

+

tsExit

+
void tsExit(void);
+

Terminate the calling task. Must not be called from the main task (ID 0). The stack is freed immediately and the slot is marked for reuse. This function never returns; it performs an internal context switch to the next ready task.

+

tsKill

+
int32_t tsKill(uint32_t taskId);
+

Forcibly terminate another task. Cannot kill the main task (ID 0) or the currently running task (use tsExit() for self-termination). Safe because cooperative scheduling guarantees the target is suspended at a yield point.

+
  Parameter   Description
+  ---------   -----------
+  taskId      ID of the task to terminate
+

Returns: TS_OK on success, TS_ERR_PARAM on invalid ID or illegal target (main task, self).

+

tsRecoverToMain

+
void tsRecoverToMain(void);
+

Crash recovery: force the scheduler back to the main task (ID 0). Call after longjmp from a signal handler that fired in a non-main task. The crashed task is NOT cleaned up by this call; call tsKill() afterward to free its resources. This exists because longjmp unwinds the crashed task's stack but the scheduler state still points to it.

+

tsActiveCount

+
uint32_t tsActiveCount(void);
+

Get the number of non-terminated tasks currently in the system.

+

Returns: Count of tasks in Ready, Running, or Paused state.

+
+
+

DVX Shell Library

+

DVX Shell Library

+

The DVX shell library manages the lifecycle of DXE applications: loading, launching, tracking, and reaping. It provides the bridge between the DVX GUI compositor and dynamically loaded DXE3 application modules.

+

Header: shell/shellApp.h

+

App Model

+

The shell supports two kinds of DXE apps:

+
    +
  • Callback-only (hasMainLoop = false) -- appMain() runs in the shell's task 0, creates windows, registers event callbacks, and returns immediately. The app lives through GUI callbacks. Lifecycle ends when the last window is closed. Simpler and cheaper (no extra stack/task).
  • +
+

Main-loop (hasMainLoop = true) -- A dedicated cooperative task is created. appMain() runs in that task and can do its own polling loop, calling tsYield() to share CPU. Lifecycle ends when appMain() returns or the task is killed. Needed for terminal emulators, games, or long computations.

+

Both types use the same DXE interface: an exported appDescriptor and appMain function.

+

DXE Interface

+

Every .app DXE module must export these symbols (COFF convention uses leading underscore):

+
  Symbol                Type                            Required
+  ------                ----                            --------
+  _appDescriptor        AppDescriptorT                  Yes
+  _appMain              int32_t (*)(DxeAppContextT *)   Yes
+  _appShutdown          void (*)(void)                  No
+

State Machine

+

App slots progress through four states:

+
Free -> Loaded -> Running -> Terminating -> Free
+

LoadedE is transient (only during shellLoadApp before the entry point is called). TerminatingE means the app's task has exited but cleanup has not yet occurred. The shell's main loop reaps terminating apps each frame via shellReapApps().

+

Contents

+

Types and Constants

+

Lifecycle API

+

Query API

+

Configuration API

+

Desktop Callbacks

+

System Information

+
+
+

Shell Types and Constants

+

Types and Constants

+

Constants

+
  Constant              Value                           Description
+  --------              -----                           -----------
+  SHELL_APP_NAME_MAX    64                              Maximum length of an app name string.
+  SHELL_STACK_DEFAULT   0                               Use in AppDescriptorT.stackSize to get the default task stack size.
+  SHELL_DESKTOP_APP     "apps/kpunch/progman/progman.app"  Default desktop application path.
+

AppDescriptorT

+

Exported by every DXE app as a global named appDescriptor. The shell reads it at load time to determine how to launch the app.

+
  Field                          Type      Description
+  -----                          ----      -----------
+  name[SHELL_APP_NAME_MAX]       char[]    Display name of the application.
+  hasMainLoop                    bool      false = callback-only, true = dedicated task.
+  multiInstance                  bool      true = allow multiple simultaneous instances via temp copy.
+  stackSize                      int32_t   SHELL_STACK_DEFAULT or explicit byte count for the task stack.
+  priority                       int32_t   TS_PRIORITY_* value or custom priority for the task.
+

DxeAppContextT

+

Passed as the sole argument to appMain(). Gives the app access to the shell's GUI context and its own identity.

+
  Field                          Type           Description
+  -----                          ----           -----------
+  shellCtx                       AppContextT *  The shell's GUI context (for creating windows, drawing, etc.).
+  appId                          int32_t        This app's unique ID (slot index, 1-based).
+  appPath[DVX_MAX_PATH]          char[]         Full path to the .app DXE file.
+  appDir[DVX_MAX_PATH]           char[]         Directory containing the .app file (for loading resources).
+  configDir[DVX_MAX_PATH]        char[]         Writable config directory (e.g. CONFIG/APPS/KPUNCH/DVXBASIC/).
+  args[1024]                     char[]         Launch arguments (empty string if none).
+  helpFile[DVX_MAX_PATH]         char[]         Help file path (for F1 context help).
+  helpTopic[128]                 char[]         Current help topic ID (updated by the app at runtime).
+

The appDir field is derived from the .app file path at load time so apps can find their own resources via relative paths. This is necessary because the working directory is shared by all apps in DOS.

+

AppStateE

+
  Value                 Description
+  -----                 -----------
+  AppStateFreeE         Slot is available for reuse.
+  AppStateLoadedE       DXE loaded, entry point not yet called (transient).
+  AppStateRunningE      Entry point called, app is active.
+  AppStateTerminatingE  Shutdown in progress, awaiting reap.
+

ShellAppT

+

Per-app slot in the shell's app table. Slot 0 is reserved for the shell itself; apps use slots 1 and above.

+
  Field                          Type                            Description
+  -----                          ----                            -----------
+  appId                          int32_t                         Unique ID (slot index, 1-based; 0 = shell).
+  name[SHELL_APP_NAME_MAX]       char[]                          Display name from AppDescriptorT.
+  path[DVX_MAX_PATH]             char[]                          Original DXE file path.
+  tempPath[DVX_MAX_PATH]         char[]                          Temp copy path for multi-instance (empty if not a copy).
+  dxeHandle                      void *                          dlopen() handle for the DXE module.
+  state                          AppStateE                       Current lifecycle state.
+  hasMainLoop                    bool                            Whether this app has a dedicated task.
+  mainTaskId                     uint32_t                        Task ID if hasMainLoop, else 0.
+  entryFn                        int32_t (*)(DxeAppContextT *)   Pointer to appMain.
+  shutdownFn                     void (*)(void)                  Pointer to appShutdown (may be NULL).
+  dxeCtx                         DxeAppContextT *                Heap-allocated context (address stable across realloc).
+
+
+

App Lifecycle API

+

App Lifecycle API

+

shellAppInit

+
void shellAppInit(void);
+

Initialize the app slot table. Seeds slot 0 (reserved for the shell). Must be called once at startup before any other shell API function.

+

shellLoadApp

+
int32_t shellLoadApp(AppContextT *ctx, const char *path);
+

Load and start an app from a DXE file. Returns the app ID (>= 1) on success, or -1 on error.

+

For callback-only apps, appMain() runs synchronously and returns before shellLoadApp returns. For main-loop apps, a cooperative task is created and the app begins running on the next tsYield().

+

If multiInstance is false in the app's descriptor and the same DXE is already loaded, the call fails with an error dialog. If multiInstance is true, the DXE is copied to a temp file so dlopen gets an independent code and data image.

+

shellLoadAppWithArgs

+
int32_t shellLoadAppWithArgs(AppContextT *ctx, const char *path, const char *args);
+

Load and run an app with arguments. The args string is copied into DxeAppContextT.args before appMain() is called. Otherwise identical to shellLoadApp().

+

shellReapApps

+
bool shellReapApps(AppContextT *ctx);
+

Scan for and reap finished apps. Call once per frame from the main loop.

+

Returns true if any apps were reaped, so the caller can trigger a desktop refresh. For main-loop apps, termination is detected by the AppStateTerminatingE state (set when appMain returns). For callback-only apps, termination is detected when no windows remain for that app.

+

shellReapApp

+
void shellReapApp(AppContextT *ctx, ShellAppT *app);
+

Gracefully shut down a single app. Calls the app's shutdownFn (if present), destroys all windows belonging to the app, kills its task (if any), closes the DXE handle, and frees the context. The slot returns to AppStateFreeE.

+

shellForceKillApp

+
void shellForceKillApp(AppContextT *ctx, ShellAppT *app);
+

Forcibly kill an app without calling its shutdown hook. Used by the Task Manager "End Task" or when an app has crashed and cannot be trusted to run cleanup code.

+

Cleanup order: windows first (removes from compositor), then task (frees stack), then DXE handle (unmaps code). Closing the DXE before destroying windows would cause callbacks into unmapped code.

+

shellTerminateAllApps

+
void shellTerminateAllApps(AppContextT *ctx);
+

Force-kill all running apps. Called during shell shutdown. Iterates all slots and calls shellForceKillApp() on each active app.

+
+
+

Query API

+

Query API

+

shellGetApp

+
ShellAppT *shellGetApp(int32_t appId);
+

Look up an app slot by ID. Returns a pointer to the ShellAppT, or NULL if the ID is out of range or the slot is free. Valid app IDs are 1 through shellAppSlotCount() - 1.

+

shellAppSlotCount

+
int32_t shellAppSlotCount(void);
+

Return the total number of app slots (including slot 0). Use as the iteration bound when scanning all slots. Slot 0 is the shell itself; app slots start at 1.

+

shellRunningAppCount

+
int32_t shellRunningAppCount(void);
+

Count running apps, not counting the shell itself. Includes apps in both AppStateLoadedE and AppStateRunningE states.

+
+
+

Configuration API

+

Configuration API

+

Each app has a per-app configuration directory derived from its DXE path, mirrored under CONFIG/. For example, an app at APPS/KPUNCH/DVXBASIC/dvxbasic.app gets the config directory CONFIG/APPS/KPUNCH/DVXBASIC/.

+

shellEnsureConfigDir

+
int32_t shellEnsureConfigDir(const DxeAppContextT *ctx);
+

Ensure the app's config directory exists, creating all parent directories as needed. Returns 0 on success, -1 on failure.

+

Call this before writing any config files. The directory path comes from ctx->configDir.

+

shellConfigPath

+
void shellConfigPath(const DxeAppContextT *ctx, const char *filename, char *outPath, int32_t outSize);
+

Build a full path to a file in the app's config directory by joining ctx->configDir with the given filename.

+
// Example:
+char path[DVX_MAX_PATH];
+shellConfigPath(ctx, "settings.ini", path, sizeof(path));
+// -> "CONFIG/APPS/KPUNCH/PROGMAN/settings.ini"
+
+
+

Desktop Callbacks

+

Desktop Callbacks

+

The shell provides a notification mechanism for app state changes (load, reap, crash). Desktop managers register a callback to refresh their display when apps come and go.

+

shellRegisterDesktopUpdate

+
void shellRegisterDesktopUpdate(void (*updateFn)(void));
+

Register a callback for app state change notifications. Multiple callbacks are supported. Apps typically call this during appMain() to receive notifications.

+

shellUnregisterDesktopUpdate

+
void shellUnregisterDesktopUpdate(void (*updateFn)(void));
+

Remove a previously registered callback. Call this before app shutdown to avoid dangling function pointers.

+

shellDesktopUpdate

+
void shellDesktopUpdate(void);
+

Notify all registered desktop callbacks that app state has changed. Called internally by the shell after loading or reaping an app. Can also be called by apps that need to trigger a desktop refresh.

+

shellCtrlEscFn

+
extern void (*shellCtrlEscFn)(AppContextT *ctx);
+

Function pointer set by the taskmgr DXE's constructor. The shell calls this when Ctrl+Esc is pressed. NULL if the task manager is not loaded.

+
+
+

System Information

+

System Information

+

Header: shell/shellInfo.h

+

Thin wrapper around the platform layer's hardware detection. Gathers system information at startup, logs it, and caches the result for display in dialogs.

+

shellInfoInit

+
void shellInfoInit(AppContextT *ctx);
+

Gather all hardware information via the platform layer, log each line to DVX.LOG, and store the result for later retrieval. Call once after dvxInit().

+

shellGetSystemInfo

+
const char *shellGetSystemInfo(void);
+

Return the formatted system information text. The returned pointer is valid for the lifetime of the process (static buffer in the platform layer).

+
+
+

dvxSql -- SQL Database Interface

+

dvxSql -- SQL Database Interface

+

High-level wrapper around SQLite3 for DVX applications. Manages database connections and result set cursors via integer handles so BASIC code never touches raw pointers. All handles are 1-based; 0 indicates an error or invalid handle.

+

Header: sql/dvxSql.h

+

Limits

+
  Constant        Value    Description
+  --------        -----    -----------
+  MAX_DBS         16       Maximum number of simultaneously open databases.
+  MAX_CURSORS     64       Maximum number of simultaneously open result set cursors.
+

Handle Model

+

Database and cursor handles are int32_t values. A successful open or query returns a handle greater than zero. Handle 0 is reserved as the invalid/error sentinel. Closing a database automatically finalizes all cursors that belong to it.

+

Database Operations

+

Cursor Operations

+

Utility Functions

+

Example

+
+
+

Database Operations

+

Database Operations

+

dvxSqlOpen

+
int32_t dvxSqlOpen(const char *path);
+

Open a SQLite database file. Creates the file if it does not exist.

+
  Parameter    Description
+  ---------    -----------
+  path         Path to the database file.
+

Returns a database handle greater than 0 on success, or 0 on error (null path, open failure, or no free slots).

+

dvxSqlClose

+
void dvxSqlClose(int32_t db);
+

Close a database and free all associated resources. Any open cursors belonging to this database are automatically finalized.

+
  Parameter    Description
+  ---------    -----------
+  db           Database handle returned by dvxSqlOpen.
+

Safe to call with an invalid handle (no-op).

+

dvxSqlExec

+
bool dvxSqlExec(int32_t db, const char *sql);
+

Execute one or more SQL statements that return no result rows. Suitable for DDL (CREATE TABLE, DROP TABLE, etc.) and DML (INSERT, UPDATE, DELETE).

+
  Parameter    Description
+  ---------    -----------
+  db           Database handle.
+  sql          SQL statement(s) to execute.
+

Returns true on success, false on error. On failure, the error message is available via dvxSqlError. On success, the affected row count is available via dvxSqlAffectedRows.

+

dvxSqlError

+
const char *dvxSqlError(int32_t db);
+

Return the last error message for a database handle. The returned string is stored internally and valid until the next operation on the same handle.

+
  Parameter    Description
+  ---------    -----------
+  db           Database handle.
+

Returns the error string, or "Invalid database handle" if the handle is invalid.

+

dvxSqlAffectedRows

+
int32_t dvxSqlAffectedRows(int32_t db);
+

Return the number of rows inserted, updated, or deleted by the last dvxSqlExec call on this handle.

+
  Parameter    Description
+  ---------    -----------
+  db           Database handle.
+

Returns the row count, or 0 if the handle is invalid.

+
+
+

Cursor Operations

+

Cursor Operations

+

Result set cursors are created by dvxSqlQuery and must be freed with dvxSqlFreeResult when no longer needed. A new cursor is positioned before the first row; call dvxSqlNext to advance to the first row before reading field values.

+

dvxSqlQuery

+
int32_t dvxSqlQuery(int32_t db, const char *sql);
+

Execute a SELECT query and return a cursor handle for iterating the results. The cursor is positioned before the first row.

+
  Parameter    Description
+  ---------    -----------
+  db           Database handle.
+  sql          SQL SELECT statement.
+

Returns a cursor handle greater than 0 on success, or 0 on error (invalid handle, null SQL, SQL syntax error, or no free cursor slots). On failure, the error message is available via dvxSqlError on the database handle.

+

dvxSqlNext

+
bool dvxSqlNext(int32_t rs);
+

Advance the cursor to the next row.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle returned by dvxSqlQuery.
+

Returns true if a row is now available for reading, false if the cursor has reached the end or the handle is invalid.

+

dvxSqlEof

+
bool dvxSqlEof(int32_t rs);
+

Test whether the cursor is past the last row.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+

Returns true if the cursor is exhausted or the handle is invalid, false otherwise.

+

dvxSqlFieldCount

+
int32_t dvxSqlFieldCount(int32_t rs);
+

Return the number of columns in the result set.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+

Returns the column count, or 0 if the handle is invalid.

+

dvxSqlFieldName

+
const char *dvxSqlFieldName(int32_t rs, int32_t col);
+

Return the name of a column by index.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+  col          Column index (0-based).
+

Returns the column name, or "" if the handle or index is invalid.

+

dvxSqlFieldText

+
const char *dvxSqlFieldText(int32_t rs, int32_t col);
+

Return the value of a column as a string.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+  col          Column index (0-based).
+

Returns the text value, or "" if the handle or index is invalid or the value is NULL.

+

dvxSqlFieldByName

+
const char *dvxSqlFieldByName(int32_t rs, const char *name);
+

Return the value of a column identified by name as a string. The name match is case-insensitive.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+  name         Column name (case-insensitive).
+

Returns the text value, or "" if the handle is invalid, the name is NULL, or no column with that name exists.

+

dvxSqlFieldInt

+
int32_t dvxSqlFieldInt(int32_t rs, int32_t col);
+

Return the value of a column as a 32-bit integer.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+  col          Column index (0-based).
+

Returns the integer value, or 0 if the handle or index is invalid.

+

dvxSqlFieldDbl

+
double dvxSqlFieldDbl(int32_t rs, int32_t col);
+

Return the value of a column as a double-precision floating point number.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+  col          Column index (0-based).
+

Returns the double value, or 0.0 if the handle or index is invalid.

+

dvxSqlFreeResult

+
void dvxSqlFreeResult(int32_t rs);
+

Close a result set cursor and free its resources. Must be called for every cursor returned by dvxSqlQuery.

+
  Parameter    Description
+  ---------    -----------
+  rs           Cursor handle.
+

Safe to call with an invalid handle (no-op).

+
+
+

Utility Functions

+

Utility Functions

+

dvxSqlEscape

+
int32_t dvxSqlEscape(const char *src, char *dst, int32_t dstSize);
+

Escape a string for safe inclusion in SQL string literals. Doubles single quotes so that O'Brien becomes O''Brien.

+
  Parameter    Description
+  ---------    -----------
+  src          Source string to escape.
+  dst          Destination buffer for the escaped string.
+  dstSize      Size of the destination buffer in bytes.
+

Returns the length of the escaped string (not including the null terminator), or -1 if the buffer was too small or any parameter is NULL/invalid.

+
+
+

Example Usage

+

Example Usage

+

Creating a Table and Inserting Data

+
int32_t db = dvxSqlOpen("mydata.db");
+if (!db) {
+    // handle error
+}
+
+dvxSqlExec(db, "CREATE TABLE IF NOT EXISTS contacts ("
+               "id INTEGER PRIMARY KEY, "
+               "name TEXT, "
+               "phone TEXT)");
+
+dvxSqlExec(db, "INSERT INTO contacts (name, phone) "
+               "VALUES ('Alice', '555-0100')");
+

Querying and Iterating Results

+
int32_t rs = dvxSqlQuery(db, "SELECT id, name, phone FROM contacts");
+if (!rs) {
+    printf("Error: %s\n", dvxSqlError(db));
+}
+
+while (dvxSqlNext(rs)) {
+    int32_t     id    = dvxSqlFieldInt(rs, 0);
+    const char *name  = dvxSqlFieldText(rs, 1);
+    const char *phone = dvxSqlFieldText(rs, 2);
+    printf("%d: %s -- %s\n", id, name, phone);
+}
+
+dvxSqlFreeResult(rs);
+dvxSqlClose(db);
+

Escaping User Input

+
char escaped[512];
+dvxSqlEscape(userInput, escaped, sizeof(escaped));
+
+char sql[1024];
+snprintf(sql, sizeof(sql),
+         "INSERT INTO notes (text) VALUES ('%s')", escaped);
+dvxSqlExec(db, sql);
+
+
+

Text Help Library

+

Text Help Library

+

Shared text editing infrastructure library for DVX widget DXEs. Provides cursor blink management, cross-widget selection clearing, word boundary logic, and a complete single-line text editing engine. Used by TextInput, Spinner, ComboBox, AnsiTerm, and other widgets that need text editing behavior.

+

Header: texthelp/textHelp.h

+

Constants

+
  Constant             Value    Description
+  --------             -----    -----------
+  TEXT_INPUT_PAD        3       Pixel padding inside text editing fields.
+
+ +
+

clearOtherSelections

+

clearOtherSelections

+

Clears the text selection on whichever widget previously had one, unless that widget is the one passed as the argument. Tracks the last selected widget in a static pointer for O(1) lookup instead of walking the widget tree. Validates that the previous widget's window is still in the window stack before touching it, so stale pointers from closed windows are handled safely. If the previous selection was in a different window, that window gets a full repaint to clear the stale highlight.

+
void clearOtherSelections(WidgetT *except);
+
  Parameter    Type         Description
+  ---------    ----         -----------
+  except       WidgetT *    The widget that now owns the selection. Its selection is preserved.
+
+
+

isWordChar

+

isWordChar

+

Returns true if the character is alphanumeric or underscore. Used by word boundary functions to define what constitutes a "word" for double-click selection and Ctrl+arrow navigation.

+
bool isWordChar(char c);
+
  Parameter    Type    Description
+  ---------    ----    -----------
+  c            char    The character to test.
+

Returns true if c is alphanumeric (a-z, A-Z, 0-9) or underscore.

+
+
+

wordEnd

+

wordEnd

+

Scans forward from the given position, returning the index of the first non-word character. Used to find the right boundary of a word for double-click word selection.

+
int32_t wordEnd(const char *buf, int32_t len, int32_t pos);
+
  Parameter    Type           Description
+  ---------    ----           -----------
+  buf          const char *   The text buffer to scan.
+  len          int32_t        Length of the text in the buffer.
+  pos          int32_t        Starting position (character index).
+

Returns the index one past the last word character.

+
+
+

wordStart

+

wordStart

+

Scans backward from the given position, returning the index of the first character of the current word. Used to find the left boundary of a word for double-click word selection.

+
int32_t wordStart(const char *buf, int32_t pos);
+
  Parameter    Type           Description
+  ---------    ----           -----------
+  buf          const char *   The text buffer to scan.
+  pos          int32_t        Starting position (character index).
+

Returns the index of the first character of the word containing pos.

+
+
+

widgetTextEditDragUpdateLine

+

widgetTextEditDragUpdateLine

+

Called during mouse drag to extend the selection in a single-line text field. Converts a viewport-relative pixel x coordinate to a character position and updates the cursor and selection end accordingly. Auto-scrolls the text when the mouse moves past the left or right visible edge.

+
void widgetTextEditDragUpdateLine(
+    int32_t vx, int32_t leftEdge, int32_t maxChars,
+    const BitmapFontT *font, int32_t len,
+    int32_t *pCursorPos, int32_t *pScrollOff,
+    int32_t *pSelEnd);
+
  Parameter     Type                Description
+  ---------     ----                -----------
+  vx            int32_t             Mouse x position in viewport coordinates.
+  leftEdge      int32_t             Pixel x of the left edge of the text area.
+  maxChars      int32_t             Maximum visible characters in the field.
+  font          const BitmapFontT * Bitmap font used for character width.
+  len           int32_t             Total length of the text buffer.
+  pCursorPos    int32_t *           [in/out] Current cursor position.
+  pScrollOff    int32_t *           [in/out] Horizontal scroll offset in characters.
+  pSelEnd       int32_t *           [out] Updated selection end position.
+
+
+

widgetTextEditMouseClick

+

widgetTextEditMouseClick

+

Handles mouse click events for single-line text widgets. Converts pixel coordinates to a character position using the font's character width. Detects multi-click sequences via the core multiClickDetect() function:

+
    +
  • Single click -- places the cursor and begins a potential drag selection.
  • +
  • Double click -- selects the word under the cursor (if wordSelect is true), or selects all text.
  • +
+

Triple click -- selects all text in the field.

+
void widgetTextEditMouseClick(
+    WidgetT *w, int32_t vx, int32_t vy,
+    int32_t textLeftX, const BitmapFontT *font,
+    const char *buf, int32_t len, int32_t scrollOff,
+    int32_t *pCursorPos, int32_t *pSelStart,
+    int32_t *pSelEnd, bool wordSelect,
+    bool dragSelect);
+
  Parameter     Type                Description
+  ---------     ----                -----------
+  w             WidgetT *           The widget receiving the click.
+  vx            int32_t             Mouse x in viewport coordinates.
+  vy            int32_t             Mouse y in viewport coordinates.
+  textLeftX     int32_t             Pixel x of the left edge of the text area.
+  font          const BitmapFontT * Bitmap font for character width calculation.
+  buf           const char *        Text buffer contents.
+  len           int32_t             Length of text in the buffer.
+  scrollOff     int32_t             Current horizontal scroll offset.
+  pCursorPos    int32_t *           [out] Computed cursor position.
+  pSelStart     int32_t *           [out] Selection start.
+  pSelEnd       int32_t *           [out] Selection end.
+  wordSelect    bool                If true, double-click selects word; if false, selects all.
+  dragSelect    bool                If true, single-click begins drag selection.
+
+
+

widgetTextEditOnKey

+

widgetTextEditOnKey

+

The core single-line text editing engine. Processes a single keystroke and updates the buffer, cursor, scroll offset, selection, and undo state. All state is passed by pointer so the function is reusable across TextInput, Spinner, ComboBox, and any other single-line widget.

+
void widgetTextEditOnKey(
+    WidgetT *w, int32_t key, int32_t mod,
+    char *buf, int32_t bufSize,
+    int32_t *pLen, int32_t *pCursor,
+    int32_t *pScrollOff,
+    int32_t *pSelStart, int32_t *pSelEnd,
+    char *undoBuf, int32_t *pUndoLen,
+    int32_t *pUndoCursor, int32_t fieldWidth);
+
  Parameter     Type         Description
+  ---------     ----         -----------
+  w             WidgetT *    The widget receiving the key event.
+  key           int32_t      Key code (ASCII for printable, control code or scan|0x100 for extended).
+  mod           int32_t      Modifier flags (KEY_MOD_SHIFT, etc.).
+  buf           char *       [in/out] The text buffer.
+  bufSize       int32_t      Total size of the buffer including null terminator.
+  pLen          int32_t *    [in/out] Current text length.
+  pCursor       int32_t *    [in/out] Cursor position (character index).
+  pScrollOff    int32_t *    [in/out] Horizontal scroll offset.
+  pSelStart     int32_t *    [in/out] Selection start (-1 if no selection).
+  pSelEnd       int32_t *    [in/out] Selection end (-1 if no selection).
+  undoBuf       char *       Undo buffer (same size as buf). NULL to disable undo.
+  pUndoLen      int32_t *    [in/out] Length of undo buffer contents.
+  pUndoCursor   int32_t *    [in/out] Cursor position saved in undo state.
+  fieldWidth    int32_t      Visible field width in pixels. 0 = use widget width.
+

Supported Keys

+
  Key              Action
+  ---              ------
+  Printable        Insert character at cursor (replaces selection if active).
+  Backspace        Delete character before cursor or delete selection.
+  Delete           Delete character after cursor or delete selection.
+  Left             Move cursor left. With Shift, extend selection.
+  Right            Move cursor right. With Shift, extend selection.
+  Ctrl+Left        Move cursor to previous word boundary. With Shift, extend selection.
+  Ctrl+Right       Move cursor to next word boundary. With Shift, extend selection.
+  Home             Move cursor to start. With Shift, extend selection.
+  End              Move cursor to end. With Shift, extend selection.
+  Ctrl+A           Select all text.
+  Ctrl+C           Copy selection to clipboard.
+  Ctrl+V           Paste from clipboard (newlines stripped).
+  Ctrl+X           Cut selection to clipboard.
+  Ctrl+Z           Undo (swaps current and undo buffers).
+

Fires w->onChange after any mutation (insert, delete, paste, cut, undo). Automatically adjusts scroll offset to keep cursor visible after every operation.

+
+
+

widgetTextEditPaintLine

+

widgetTextEditPaintLine

+

Renders a single line of text with optional selection highlighting and a blinking cursor. Splits the visible text into up to three segments (pre-selection, selection, post-selection) and draws each with appropriate colors. The selection highlight uses the menu highlight colors from the color scheme. The cursor is drawn as a one-pixel vertical line when sCursorBlinkOn is true.

+
void widgetTextEditPaintLine(
+    DisplayT *d, const BlitOpsT *ops,
+    const BitmapFontT *font,
+    const ColorSchemeT *colors,
+    int32_t textX, int32_t textY,
+    const char *buf, int32_t visLen,
+    int32_t scrollOff, int32_t cursorPos,
+    int32_t selStart, int32_t selEnd,
+    uint32_t fg, uint32_t bg,
+    bool showCursor,
+    int32_t cursorMinX, int32_t cursorMaxX);
+
  Parameter     Type                  Description
+  ---------     ----                  -----------
+  d             DisplayT *            Display context for drawing.
+  ops           const BlitOpsT *      Blit operations table for the current pixel format.
+  font          const BitmapFontT *   Bitmap font for text rendering.
+  colors        const ColorSchemeT *  Color scheme (used for selection highlight colors).
+  textX         int32_t               Pixel x of the start of visible text.
+  textY         int32_t               Pixel y of the text baseline.
+  buf           const char *          Visible portion of the text buffer (buf + scrollOff).
+  visLen        int32_t               Number of visible characters to draw.
+  scrollOff     int32_t               Scroll offset (used to map selection to visible range).
+  cursorPos     int32_t               Absolute cursor position in the full buffer.
+  selStart      int32_t               Selection start (-1 if no selection).
+  selEnd        int32_t               Selection end (-1 if no selection).
+  fg            uint32_t              Foreground (text) color.
+  bg            uint32_t              Background color.
+  showCursor    bool                  Whether to draw the cursor (false when widget lacks focus).
+  cursorMinX    int32_t               Left clipping bound for cursor drawing.
+  cursorMaxX    int32_t               Right clipping bound for cursor drawing.
+
+
+

List Helper Library

+

List Helper Library

+

Shared helper routines for dropdown and list-based widget DXEs (ListBox, Dropdown, ComboBox, ListView, TreeView). Provides dropdown arrow rendering, item measurement, keyboard navigation, popup geometry calculation, and popup list painting.

+

Header: listhelp/listHelp.h

+

Constants

+
  Constant               Value   Description
+  --------               -----   -----------
+  DROPDOWN_BTN_WIDTH     16      Width of the dropdown arrow button in pixels.
+  DROPDOWN_MAX_VISIBLE   8       Maximum number of items visible in a popup list.
+

widgetDrawDropdownArrow

+

Draw the triangular dropdown arrow glyph centered at a given position.

+
void widgetDrawDropdownArrow(DisplayT *d, const BlitOpsT *ops,
+    int32_t centerX, int32_t centerY, uint32_t color);
+
  Parameter   Description
+  ---------   -----------
+  d           Display context.
+  ops         Blit operations vtable for the active pixel depth.
+  centerX     Horizontal center of the arrow in backbuffer coordinates.
+  centerY     Vertical center of the arrow in backbuffer coordinates.
+  color       Pre-packed pixel color for the arrow.
+

widgetMaxItemLen

+

Scan an array of strings and return the length (in characters) of the longest item.

+
int32_t widgetMaxItemLen(const char **items, int32_t count);
+
  Parameter   Description
+  ---------   -----------
+  items       Array of null-terminated string pointers.
+  count       Number of items in the array.
+

Returns the character length of the longest item, or 0 if count is zero.

+

widgetNavigateIndex

+

Compute a new selected index from a navigation key press. Handles Up, Down, Home, End, Page Up, and Page Down.

+
int32_t widgetNavigateIndex(int32_t key, int32_t current,
+    int32_t count, int32_t pageSize);
+
  Parameter   Description
+  ---------   -----------
+  key         Keyboard scancode (Up, Down, Home, End, PgUp, PgDn).
+  current     Currently selected index.
+  count       Total number of items in the list.
+  pageSize    Number of visible items (used for PgUp/PgDn step size).
+

Returns the new index, clamped to [0, count-1].

+

widgetDropdownPopupRect

+

Calculate the screen rectangle for a dropdown popup list, positioning it below the owning widget and clamping to screen bounds.

+
void widgetDropdownPopupRect(WidgetT *w, const BitmapFontT *font,
+    int32_t contentH, int32_t itemCount,
+    int32_t *popX, int32_t *popY, int32_t *popW, int32_t *popH);
+
  Parameter   Description
+  ---------   -----------
+  w           The widget that owns the popup (Dropdown, ComboBox, etc.).
+  font        Bitmap font used for item text (determines row height).
+  contentH    Height of the widget's content area in pixels.
+  itemCount   Total number of items in the list.
+  popX        Output: popup X position (screen coordinates).
+  popY        Output: popup Y position (screen coordinates).
+  popW        Output: popup width in pixels.
+  popH        Output: popup height in pixels.
+

The popup is sized to show up to DROPDOWN_MAX_VISIBLE items.

+

widgetPaintPopupList

+

Render a popup item list with highlight, scrolling, and beveled border.

+
void widgetPaintPopupList(DisplayT *d, const BlitOpsT *ops,
+    const BitmapFontT *font, const ColorSchemeT *colors,
+    int32_t popX, int32_t popY, int32_t popW, int32_t popH,
+    const char **items, int32_t itemCount,
+    int32_t hoverIdx, int32_t scrollPos);
+
  Parameter   Description
+  ---------   -----------
+  d           Display context.
+  ops         Blit operations vtable.
+  font        Bitmap font for rendering item text.
+  colors      Color scheme for background, text, and highlight colors.
+  popX        Popup X position (from widgetDropdownPopupRect).
+  popY        Popup Y position.
+  popW        Popup width.
+  popH        Popup height.
+  items       Array of null-terminated item strings.
+  itemCount   Total number of items.
+  hoverIdx    Index of the highlighted (hovered/selected) item, or -1 for none.
+  scrollPos   Index of the first visible item (scroll offset).
+
+
+

Task Manager

+

Task Manager

+

System-level task manager for DVX. Displays running applications and per-app memory usage. Always accessible via Ctrl+Esc regardless of which application is focused. Persists independently of the desktop app (Program Manager).

+

Header: taskmgr/shellTaskMgr.h

+

Loaded as: bin/libs/taskmgr.lib

+

shellTaskMgrOpen

+

Open the Task Manager window, or raise it to the front if already open.

+
void shellTaskMgrOpen(AppContextT *ctx);
+
  Parameter   Description
+  ---------   -----------
+  ctx         Application context (from dvxInit). Required for window creation and event registration.
+

Called by the shell's global Ctrl+Esc handler.

+

shellTaskMgrRefresh

+

Refresh the task list display. Call this when applications are launched or terminated so the Task Manager reflects the current state.

+
void shellTaskMgrRefresh(void);
+

Takes no parameters. Safe to call even if the Task Manager window is not currently open (the call is a no-op in that case).

+
+
+

Serial Stack

+

Serial Stack

+

The DVX serial/networking stack provides reliable, optionally encrypted communication over RS-232 serial ports. It is composed of four layers, each building on the one below:

+
    +
  • rs232 -- ISR-driven UART driver with ring buffers and flow control
  • +
  • packet -- HDLC framing, CRC-16, Go-Back-N ARQ (reliable delivery)
  • +
  • security -- 1024-bit Diffie-Hellman key exchange, XTEA-CTR cipher, DRBG RNG
  • +
+

secLink -- Convenience wrapper: channel multiplexing, per-packet encryption

+

Loaded as: bin/libs/kpunch/serial/serial.lib

+

Layer 1: RS-232 UART Driver

+

Layer 2: Packet Transport

+

Layer 3: Security (DH + XTEA)

+

Layer 4: Secure Link

+
+
+

RS-232 UART Driver

+

RS-232 UART Driver

+

ISR-driven serial port driver supporting up to 4 simultaneous COM ports. A shared ISR drains UART FIFOs into per-port ring buffers (2048 bytes, power-of-2 for fast index wrapping). Flow control (XON/XOFF, RTS/CTS, DTR/DSR) operates within the ISR using watermark thresholds. All ISR data structures are DPMI-locked to prevent page faults.

+

Header: rs232/rs232.h

+

Port Constants

+
  Constant      Value   Description
+  --------      -----   -----------
+  RS232_COM1    0       First serial port.
+  RS232_COM2    1       Second serial port.
+  RS232_COM3    2       Third serial port.
+  RS232_COM4    3       Fourth serial port.
+

Handshake Modes

+
  Constant                  Value   Description
+  --------                  -----   -----------
+  RS232_HANDSHAKE_NONE      0       No flow control.
+  RS232_HANDSHAKE_XONXOFF   1       Software flow control (XON/XOFF characters).
+  RS232_HANDSHAKE_RTSCTS    2       Hardware flow control via RTS/CTS lines.
+  RS232_HANDSHAKE_DTRDSR    3       Hardware flow control via DTR/DSR lines.
+

UART Types

+

Detected automatically by probing the scratch register and FIFO capability.

+
  Constant            Value   Description
+  --------            -----   -----------
+  RS232_UART_UNKNOWN  0       Detection failed.
+  RS232_UART_8250     1       Original IBM PC UART. No FIFO.
+  RS232_UART_16450    2       Has scratch register, no FIFO.
+  RS232_UART_16550    3       Has FIFO but buggy (rare).
+  RS232_UART_16550A   4       Working 16-byte FIFO. Most common in 486+ hardware.
+

Error Codes

+
  Constant                     Value   Description
+  --------                     -----   -----------
+  RS232_SUCCESS                0       Operation succeeded.
+  RS232_ERR_UNKNOWN            -1      Unknown error.
+  RS232_ERR_NOT_OPEN           -2      Port is not open.
+  RS232_ERR_ALREADY_OPEN       -3      Port is already open.
+  RS232_ERR_NO_UART            -4      No UART detected at port address.
+  RS232_ERR_INVALID_PORT       -5      Invalid port number.
+  RS232_ERR_INVALID_BASE       -6      Invalid base I/O address.
+  RS232_ERR_INVALID_IRQ        -7      Invalid IRQ number.
+  RS232_ERR_INVALID_BPS        -8      Invalid baud rate.
+  RS232_ERR_INVALID_DATA       -9      Invalid data bits value.
+  RS232_ERR_INVALID_PARITY     -10     Invalid parity character.
+  RS232_ERR_INVALID_STOP       -11     Invalid stop bits value.
+  RS232_ERR_INVALID_HANDSHAKE  -12     Invalid handshake mode.
+  RS232_ERR_INVALID_FIFO       -13     Invalid FIFO threshold.
+  RS232_ERR_NULL_PTR           -14     NULL pointer argument.
+  RS232_ERR_IRQ_NOT_FOUND      -15     Could not detect IRQ for port.
+  RS232_ERR_LOCK_MEM           -16     DPMI memory lock failed.
+

rs232Open

+

Open a COM port with the specified line parameters.

+
int rs232Open(int com, int32_t bps, int dataBits,
+    char parity, int stopBits, int handshake);
+
  Parameter   Description
+  ---------   -----------
+  com         Port index (RS232_COM1..RS232_COM4).
+  bps         Baud rate (e.g. 9600, 19200, 38400, 57600, 115200).
+  dataBits    Data bits per character (5, 6, 7, or 8).
+  parity      Parity mode: 'N' (none), 'O' (odd), 'E' (even), 'M' (mark), 'S' (space).
+  stopBits    Stop bits (1 or 2).
+  handshake   Flow control mode (RS232_HANDSHAKE_*).
+

Returns RS232_SUCCESS or a negative error code.

+

rs232Close

+

Close a COM port and release its ISR resources.

+
int rs232Close(int com);
+

rs232Read

+

Non-blocking read from the receive ring buffer.

+
int rs232Read(int com, char *data, int len);
+
  Parameter   Description
+  ---------   -----------
+  com         Port index.
+  data        Buffer to receive data.
+  len         Maximum bytes to read.
+

Returns the number of bytes actually read (may be less than len).

+

rs232Write

+

Blocking polled write directly to UART transmit holding register. Bypasses the TX ring buffer. Use for small, immediate writes.

+
int rs232Write(int com, const char *data, int len);
+

Returns RS232_SUCCESS or a negative error code.

+

rs232WriteBuf

+

Non-blocking write to the transmit ring buffer. The ISR drains buffered data to the UART asynchronously.

+
int rs232WriteBuf(int com, const char *data, int len);
+

Returns the number of bytes actually queued (may be less than len if the buffer is full).

+

rs232Set

+

Change all line parameters on an open port.

+
int rs232Set(int com, int32_t bps, int dataBits,
+    char parity, int stopBits, int handshake);
+

Configuration Getters

+
  Function                   Returns
+  --------                   -------
+  rs232GetBase(com)          I/O base address.
+  rs232GetBps(com)           Current baud rate.
+  rs232GetData(com)          Data bits setting.
+  rs232GetParity(com)        Parity character ('N', 'O', 'E', 'M', 'S').
+  rs232GetStop(com)          Stop bits setting.
+  rs232GetHandshake(com)     Handshake mode.
+  rs232GetIrq(com)           IRQ number.
+  rs232GetUartType(com)      Detected UART type (RS232_UART_*).
+

Status Getters

+
  Function                   Returns
+  --------                   -------
+  rs232GetRxBuffered(com)    Bytes waiting in the receive ring buffer.
+  rs232GetTxBuffered(com)    Bytes waiting in the transmit ring buffer.
+  rs232GetCts(com)           CTS line state (0 or 1).
+  rs232GetDsr(com)           DSR line state (0 or 1).
+  rs232GetDtr(com)           DTR line state (0 or 1).
+  rs232GetRts(com)           RTS line state (0 or 1).
+  rs232GetLsr(com)           Line status register value.
+  rs232GetMcr(com)           Modem control register value.
+  rs232GetMsr(com)           Modem status register value.
+

Configuration Setters

+
  Function                          Description
+  --------                          -----------
+  rs232SetBase(com, base)           Set I/O base address (before open).
+  rs232SetBps(com, bps)             Change baud rate.
+  rs232SetData(com, dataBits)       Change data bits.
+  rs232SetParity(com, parity)       Change parity mode.
+  rs232SetStop(com, stopBits)       Change stop bits.
+  rs232SetHandshake(com, handshake) Change flow control mode.
+  rs232SetIrq(com, irq)             Set IRQ number (before open).
+  rs232SetMcr(com, mcr)             Set modem control register directly.
+  rs232SetDtr(com, dtr)             Set DTR line state.
+  rs232SetRts(com, rts)             Set RTS line state.
+  rs232SetFifoThreshold(com, thr)   Set FIFO trigger level (1, 4, 8, or 14 bytes).
+

Buffer Management

+
  Function                   Description
+  --------                   -----------
+  rs232ClearRxBuffer(com)    Discard all data in the receive ring buffer.
+  rs232ClearTxBuffer(com)    Discard all data in the transmit ring buffer.
+
+
+

Packet Transport

+

Packet Transport

+

Reliable, ordered packet delivery over an RS-232 serial link. Uses HDLC-style byte-stuffed framing for frame delimiting, CRC-16-CCITT for error detection, and Go-Back-N ARQ with a configurable sliding window for retransmission.

+

Header: packet/packet.h

+

Constants

+
  Constant            Value   Description
+  --------            -----   -----------
+  PKT_MAX_PAYLOAD     255     Maximum bytes per packet payload.
+  PKT_DEFAULT_WINDOW  4       Default sliding window size (unacknowledged frames in flight).
+  PKT_MAX_WINDOW      8       Maximum sliding window size.
+

Error Codes

+
  Constant                Value   Description
+  --------                -----   -----------
+  PKT_SUCCESS             0       Operation succeeded.
+  PKT_ERR_INVALID_PORT    -1      Invalid COM port index.
+  PKT_ERR_NOT_OPEN        -2      Connection is not open.
+  PKT_ERR_ALREADY_OPEN    -3      Connection is already open.
+  PKT_ERR_WOULD_BLOCK     -4      Operation would block.
+  PKT_ERR_OVERFLOW        -5      Buffer overflow.
+  PKT_ERR_INVALID_PARAM   -6      Invalid parameter.
+  PKT_ERR_TX_FULL         -7      Transmit window is full.
+  PKT_ERR_NO_DATA         -8      No data available.
+  PKT_ERR_DISCONNECTED    -9      Remote side disconnected.
+

PktRecvCallbackT

+

Callback type for received packets.

+
typedef void (*PktRecvCallbackT)(void *ctx,
+    const uint8_t *data, int len);
+
  Parameter   Description
+  ---------   -----------
+  ctx         User context pointer (passed to pktOpen).
+  data        Payload bytes (valid only during the callback).
+  len         Payload length.
+

pktOpen

+

Open a packetized connection over an already-open COM port.

+
PktConnT *pktOpen(int com, int windowSize,
+    PktRecvCallbackT callback, void *callbackCtx);
+
  Parameter     Description
+  ---------     -----------
+  com           COM port index (RS232_COM1..RS232_COM4). Must already be open via rs232Open.
+  windowSize    Sliding window size (1..PKT_MAX_WINDOW). Pass 0 for PKT_DEFAULT_WINDOW.
+  callback      Called when a complete, CRC-verified packet is received.
+  callbackCtx   User pointer passed to the callback.
+

Returns an opaque PktConnT handle, or NULL on failure.

+

pktClose

+

Close a packetized connection. Does not close the underlying COM port.

+
void pktClose(PktConnT *conn);
+

pktSend

+

Send a data packet.

+
int pktSend(PktConnT *conn, const uint8_t *data,
+    int len, bool block);
+
  Parameter   Description
+  ---------   -----------
+  conn        Connection handle from pktOpen.
+  data        Payload bytes (up to PKT_MAX_PAYLOAD).
+  len         Payload length.
+  block       If true, block until transmit window has space. If false, return PKT_ERR_TX_FULL when the window is full.
+

Returns PKT_SUCCESS or a negative error code.

+

pktPoll

+

Poll for incoming data, process received frames, and handle retransmits. Must be called frequently in the main loop.

+
int pktPoll(PktConnT *conn);
+

Returns the number of valid data packets delivered to the callback.

+

pktReset

+

Reset the connection state (sequence numbers, buffers) and send a RST frame to the remote side.

+
int pktReset(PktConnT *conn);
+

pktCanSend

+

Check whether there is room in the transmit window for another packet.

+
bool pktCanSend(PktConnT *conn);
+

pktGetPending

+

Get the number of unacknowledged packets currently in the transmit window.

+
int pktGetPending(PktConnT *conn);
+
+
+

Security (DH + XTEA)

+

Security (DH + XTEA)

+

Cryptographic primitives for the serial stack: 1024-bit Diffie-Hellman key exchange (RFC 2409 Group 2), XTEA block cipher in CTR mode, and an XTEA-CTR DRBG random number generator.

+

XTEA requires no lookup tables and compiles to approximately 20 instructions per round, making it suitable for 486-class hardware where AES S-box tables would thrash the 8KB cache.

+

Header: security/security.h

+

Constants

+
  Constant           Value   Description
+  --------           -----   -----------
+  SEC_DH_KEY_SIZE    128     Size of a DH public key in bytes (1024 bits).
+  SEC_XTEA_KEY_SIZE  16      Size of an XTEA key in bytes (128 bits).
+

Error Codes

+
  Constant           Value   Description
+  --------           -----   -----------
+  SEC_SUCCESS        0       Operation succeeded.
+  SEC_ERR_PARAM      -1      Invalid parameter.
+  SEC_ERR_NOT_READY  -2      DH context not ready (keys not generated or secret not computed).
+  SEC_ERR_ALLOC      -3      Memory allocation failed.
+

RNG Functions

+

The RNG uses XTEA-CTR as a DRBG. Hardware entropy from PIT timer jitter is weak (~20 bits); supplement with keyboard timing or mouse jitter before generating DH keys.

+
void secRngSeed(const uint8_t *entropy, int len);
+int  secRngGatherEntropy(uint8_t *buf, int len);
+void secRngAddEntropy(const uint8_t *data, int len);
+void secRngBytes(uint8_t *buf, int len);
+
  Function              Description
+  --------              -----------
+  secRngSeed            Seed the DRBG from an entropy buffer.
+  secRngGatherEntropy   Gather hardware entropy (PIT jitter, BIOS tick count) into a buffer.
+  secRngAddEntropy      Mix additional entropy into the DRBG state.
+  secRngBytes           Generate pseudorandom bytes.
+

Diffie-Hellman Key Exchange

+

1024-bit DH with 256-bit private exponents using the RFC 2409 Group 2 safe prime.

+
SecDhT *secDhCreate(void);
+int     secDhGenerateKeys(SecDhT *dh);
+int     secDhGetPublicKey(SecDhT *dh, uint8_t *buf, int *len);
+int     secDhComputeSecret(SecDhT *dh,
+            const uint8_t *remotePub, int len);
+int     secDhDeriveKey(SecDhT *dh, uint8_t *key, int keyLen);
+void    secDhDestroy(SecDhT *dh);
+
  Function            Description
+  --------            -----------
+  secDhCreate         Allocate a new DH context.
+  secDhGenerateKeys   Generate a private exponent and public key. RNG must be seeded first.
+  secDhGetPublicKey   Copy the local public key into buf. *len receives the key size.
+  secDhComputeSecret  Compute the shared secret from the remote public key.
+  secDhDeriveKey      Derive a symmetric key (XTEA key) from the shared secret via hashing.
+  secDhDestroy        Free the DH context and all associated memory.
+

Typical usage order: secDhCreate, secDhGenerateKeys, exchange public keys, secDhComputeSecret, secDhDeriveKey, secDhDestroy.

+

XTEA-CTR Cipher

+

XTEA in counter mode. Encrypt and decrypt are the same operation (XOR with keystream). The counter must never repeat with the same key.

+
SecCipherT *secCipherCreate(const uint8_t *key);
+void        secCipherSetNonce(SecCipherT *c,
+                uint32_t nonceLo, uint32_t nonceHi);
+void        secCipherCrypt(SecCipherT *c,
+                uint8_t *data, int len);
+void        secCipherDestroy(SecCipherT *c);
+
  Function             Description
+  --------             -----------
+  secCipherCreate      Allocate a cipher context with a 128-bit key.
+  secCipherSetNonce    Set the initial counter value (nonce). Must be unique per session.
+  secCipherCrypt       Encrypt or decrypt data in place. The counter increments automatically.
+  secCipherDestroy     Free the cipher context.
+
+ +
+

BASIC Runtime Library

+

BASIC Runtime Library

+

Stack-based p-code virtual machine and value system for DVX BASIC. Embeddable: the host provides I/O and UI callbacks. No DVX GUI dependencies in the core runtime.

+

Headers: apps/dvxbasic/runtime/vm.h, apps/dvxbasic/runtime/values.h

+

Value System (values.h)

+

Virtual Machine (vm.h)

+
+
+

Value System

+

Value System

+

Tagged union value type for the VM evaluation stack, variables, and array elements. Strings, arrays, and UDT instances are reference-counted for automatic memory management without a garbage collector.

+

Header: apps/dvxbasic/runtime/values.h

+

Type Tags

+
  Constant         Value   C Union Field   Description
+  --------         -----   -------------   -----------
+  BAS_TYPE_INTEGER 0       intVal          16-bit signed integer.
+  BAS_TYPE_LONG    1       longVal         32-bit signed integer.
+  BAS_TYPE_SINGLE  2       sngVal          32-bit float.
+  BAS_TYPE_DOUBLE  3       dblVal          64-bit float.
+  BAS_TYPE_STRING  4       strVal          Reference-counted dynamic string.
+  BAS_TYPE_BOOLEAN 5       boolVal         True (-1) or False (0).
+  BAS_TYPE_ARRAY   6       arrVal          Reference-counted array.
+  BAS_TYPE_UDT     7       udtVal          Reference-counted user-defined type.
+  BAS_TYPE_OBJECT  8       objVal          Opaque host pointer (form, control).
+  BAS_TYPE_REF     9       refVal          ByRef pointer to a BasValueT slot.
+

BasValueT

+

Tagged union holding any BASIC value.

+
struct BasValueTag {
+    uint8_t type;   // BAS_TYPE_*
+    union {
+        int16_t     intVal;
+        int32_t     longVal;
+        float       sngVal;
+        double      dblVal;
+        BasStringT *strVal;
+        int16_t     boolVal;
+        BasArrayT  *arrVal;
+        BasUdtT    *udtVal;
+        void       *objVal;
+        BasValueT  *refVal;
+    };
+};
+

Value Constructors

+
BasValueT basValInteger(int16_t v);
+BasValueT basValLong(int32_t v);
+BasValueT basValSingle(float v);
+BasValueT basValDouble(double v);
+BasValueT basValString(BasStringT *s);
+BasValueT basValStringFromC(const char *text);
+BasValueT basValBool(bool v);
+BasValueT basValObject(void *obj);
+

Each returns a BasValueT with the appropriate type tag set. basValString increments the string's reference count.

+

Value Lifetime

+
BasValueT basValCopy(BasValueT v);
+void      basValRelease(BasValueT *v);
+
  Function       Description
+  --------       -----------
+  basValCopy     Copy a value. Increments reference count for strings, arrays, and UDTs.
+  basValRelease  Release a value. Decrements reference count and frees if it reaches zero.
+

Type Conversion

+
BasValueT basValToInteger(BasValueT v);
+BasValueT basValToLong(BasValueT v);
+BasValueT basValToSingle(BasValueT v);
+BasValueT basValToDouble(BasValueT v);
+BasValueT basValToString(BasValueT v);
+BasValueT basValToBool(BasValueT v);
+

Each returns a new value of the target type. The original is not released; the caller manages both lifetimes.

+

Value Utilities

+
  Function                          Description
+  --------                          -----------
+  basValToNumber(v)                 Convert any numeric value to double.
+  basValFormatString(v)             Return a new ref-counted string representation of v.
+  basValIsTruthy(v)                 True if non-zero number or non-empty string.
+  basValCompare(a, b)               Compare two values. Returns -1, 0, or 1.
+  basValCompareCI(a, b)             Case-insensitive comparison (OPTION COMPARE TEXT).
+  basValPromoteType(a, b)           Determine common type for binary ops (e.g. Integer + Single -> Single).
+

BasStringT

+

Reference-counted string with flexible array member for inline storage.

+
typedef struct {
+    int32_t refCount;
+    int32_t len;
+    int32_t cap;
+    char    data[];
+} BasStringT;
+

String Functions

+
  Function                            Description
+  --------                            -----------
+  basStringNew(text, len)             Allocate from a C string. refCount starts at 1.
+  basStringAlloc(cap)                 Allocate an empty string with given capacity.
+  basStringRef(s)                     Increment reference count. Returns s.
+  basStringUnref(s)                   Decrement reference count. Frees when it reaches zero.
+  basStringConcat(a, b)               Concatenate two strings. Returns a new string (refCount 1).
+  basStringSub(s, start, len)         Extract a substring. Returns a new string (refCount 1).
+  basStringCompare(a, b)              Compare. Returns <0, 0, >0 (like strcmp).
+  basStringCompareCI(a, b)            Case-insensitive compare.
+  basStringSystemInit()               Initialize the string system and empty string singleton.
+  basStringSystemShutdown()           Shut down the string system.
+

The global basEmptyString is a singleton that is never freed.

+

BasArrayT

+

Reference-counted multi-dimensional array (up to BAS_ARRAY_MAX_DIMS = 8 dimensions).

+
typedef struct {
+    int32_t    refCount;
+    uint8_t    elementType;
+    int32_t    dims;
+    int32_t    lbound[BAS_ARRAY_MAX_DIMS];
+    int32_t    ubound[BAS_ARRAY_MAX_DIMS];
+    int32_t    totalElements;
+    BasValueT *elements;
+} BasArrayT;
+

Array Functions

+
  Function                                  Description
+  --------                                  -----------
+  basArrayNew(dims, lbounds, ubounds, type) Allocate an array. refCount starts at 1.
+  basArrayFree(arr)                         Free all elements and release the array.
+  basArrayRef(arr)                          Increment reference count.
+  basArrayUnref(arr)                        Decrement reference count. Frees at zero.
+  basArrayIndex(arr, indices, ndims)        Compute flat index from multi-dimensional indices. Returns -1 if out of bounds.
+

BasUdtT

+

Reference-counted user-defined type instance.

+
typedef struct {
+    int32_t    refCount;
+    int32_t    typeId;
+    int32_t    fieldCount;
+    BasValueT *fields;
+} BasUdtT;
+

UDT Functions

+
  Function                          Description
+  --------                          -----------
+  basUdtNew(typeId, fieldCount)     Allocate a UDT instance. refCount starts at 1.
+  basUdtFree(udt)                   Free all fields and release.
+  basUdtRef(udt)                    Increment reference count.
+  basUdtUnref(udt)                  Decrement reference count. Frees at zero.
+
+
+

Virtual Machine

+

Virtual Machine

+

Stack-based p-code interpreter. Executes compiled BASIC bytecode modules. The host provides I/O, UI, SQL, and external library callbacks. The VM has no DVX dependencies; it can be embedded in any C program.

+

Header: apps/dvxbasic/runtime/vm.h

+

VM Limits

+
  Constant                Value   Description
+  --------                -----   -----------
+  BAS_VM_STACK_SIZE       256     Evaluation stack depth.
+  BAS_VM_CALL_STACK_SIZE  64      Maximum call nesting depth.
+  BAS_VM_MAX_GLOBALS      512     Global variable slots.
+  BAS_VM_MAX_LOCALS       64      Local variables per stack frame.
+  BAS_VM_MAX_FOR_DEPTH    32      Maximum nested FOR loop depth.
+  BAS_VM_MAX_FILES        16      Open file channels (1-based).
+

BasVmResultE

+

Result codes returned by basVmRun and basVmStep.

+
  Code                    Value   Description
+  ----                    -----   -----------
+  BAS_VM_OK               0       Program completed normally.
+  BAS_VM_HALTED           1       HALT instruction reached.
+  BAS_VM_YIELDED          2       DoEvents yielded control.
+  BAS_VM_ERROR            3       Runtime error.
+  BAS_VM_STACK_OVERFLOW   4       Evaluation stack overflow.
+  BAS_VM_STACK_UNDERFLOW  5       Evaluation stack underflow.
+  BAS_VM_CALL_OVERFLOW    6       Call stack overflow.
+  BAS_VM_DIV_BY_ZERO      7       Division by zero.
+  BAS_VM_TYPE_MISMATCH    8       Type mismatch in operation.
+  BAS_VM_OUT_OF_MEMORY    9       Memory allocation failed.
+  BAS_VM_BAD_OPCODE       10      Unknown opcode encountered.
+  BAS_VM_FILE_ERROR       11      File I/O error.
+  BAS_VM_SUBSCRIPT_RANGE  12      Array subscript out of range.
+  BAS_VM_USER_ERROR       13      ON ERROR raised by program.
+  BAS_VM_STEP_LIMIT       14      Step limit reached (not an error).
+  BAS_VM_BREAKPOINT       15      Breakpoint or step completed (not an error).
+

Lifecycle

+
BasVmT *basVmCreate(void);
+void    basVmDestroy(BasVmT *vm);
+void    basVmLoadModule(BasVmT *vm, BasModuleT *module);
+void    basVmReset(BasVmT *vm);
+
  Function         Description
+  --------         -----------
+  basVmCreate      Allocate and initialize a new VM instance.
+  basVmDestroy     Destroy the VM and free all resources.
+  basVmLoadModule  Load a compiled module (BasModuleT) into the VM.
+  basVmReset       Reset to initial state (clear stack, globals, PC).
+

Execution

+
BasVmResultE basVmRun(BasVmT *vm);
+BasVmResultE basVmStep(BasVmT *vm);
+void         basVmSetStepLimit(BasVmT *vm, int32_t limit);
+
  Function           Description
+  --------           -----------
+  basVmRun           Execute the loaded module until it ends, halts, yields, errors, or hits a breakpoint/step limit.
+  basVmStep          Execute a single instruction and return. Useful for debugger stepping.
+  basVmSetStepLimit  Set maximum instructions per basVmRun call. 0 = unlimited (default). Returns BAS_VM_STEP_LIMIT when reached.
+

I/O Callbacks

+

The host provides these callbacks for PRINT, INPUT, and DoEvents statements.

+
void basVmSetPrintCallback(BasVmT *vm, BasPrintFnT fn, void *ctx);
+void basVmSetInputCallback(BasVmT *vm, BasInputFnT fn, void *ctx);
+void basVmSetDoEventsCallback(BasVmT *vm, BasDoEventsFnT fn, void *ctx);
+

Callback Types

+
typedef void (*BasPrintFnT)(void *ctx, const char *text, bool newline);
+typedef bool (*BasInputFnT)(void *ctx, const char *prompt,
+    char *buf, int32_t bufSize);
+typedef bool (*BasDoEventsFnT)(void *ctx);
+
  Type             Description
+  ----             -----------
+  BasPrintFnT      Called for PRINT output. text is null-terminated. newline indicates line advance.
+  BasInputFnT      Called for INPUT. Fill buf (up to bufSize-1 chars). Return true on success, false on cancel.
+  BasDoEventsFnT   Called for DoEvents. Process pending events and return. Return false to stop the program.
+

UI Callbacks

+

For form and control integration. The VM resolves all UI operations through these callbacks, keeping it independent of any specific GUI toolkit.

+
void basVmSetUiCallbacks(BasVmT *vm, const BasUiCallbacksT *ui);
+

BasUiCallbacksT

+
  Field         Signature                                            Description
+  -----         ---------                                            -----------
+  getProp       BasValueT (*)(ctx, ctrlRef, propName)                Get a control property value.
+  setProp       void (*)(ctx, ctrlRef, propName, value)              Set a control property.
+  callMethod    BasValueT (*)(ctx, ctrlRef, methodName, args, argc)  Call a method on a control.
+  createCtrl    void *(*)(ctx, formRef, typeName, ctrlName)          Create a control on a form.
+  findCtrl      void *(*)(ctx, formRef, ctrlName)                    Find a control by name.
+  findCtrlIdx   void *(*)(ctx, formRef, ctrlName, index)             Find a control array element.
+  loadForm      void *(*)(ctx, formName)                             Load a form by name.
+  unloadForm    void (*)(ctx, formRef)                               Unload a form.
+  showForm      void (*)(ctx, formRef, modal)                        Show a form (modal or modeless).
+  hideForm      void (*)(ctx, formRef)                               Hide a form (keep in memory).
+  msgBox        int32_t (*)(ctx, message, flags)                     Display a message box.
+  inputBox      BasStringT *(*)(ctx, prompt, title, defaultText)     Display an input box.
+  ctx           void *                                               User pointer passed to all callbacks.
+

SQL Callbacks

+

For database integration.

+
void basVmSetSqlCallbacks(BasVmT *vm, const BasSqlCallbacksT *sql);
+

BasSqlCallbacksT

+
  Field           Signature                                  Description
+  -----           ---------                                  -----------
+  sqlOpen          int32_t (*)(path)                          Open a database. Returns handle.
+  sqlClose         void (*)(db)                               Close a database.
+  sqlExec          bool (*)(db, sql)                          Execute a non-query SQL statement.
+  sqlError         const char *(*)(db)                        Get last error message.
+  sqlQuery         int32_t (*)(db, sql)                       Execute a query. Returns result set handle.
+  sqlNext          bool (*)(rs)                               Advance to next row.
+  sqlEof           bool (*)(rs)                               Check if at end of result set.
+  sqlFieldCount    int32_t (*)(rs)                            Get number of columns.
+  sqlFieldName     const char *(*)(rs, col)                   Get column name by index.
+  sqlFieldText     const char *(*)(rs, col)                   Get column value as text by index.
+  sqlFieldByName   const char *(*)(rs, name)                  Get column value as text by name.
+  sqlFieldInt      int32_t (*)(rs, col)                       Get column value as integer.
+  sqlFieldDbl      double (*)(rs, col)                        Get column value as double.
+  sqlFreeResult    void (*)(rs)                               Free a result set.
+  sqlAffectedRows  int32_t (*)(db)                            Get number of rows affected by last statement.
+

External Library Callbacks

+

For DECLARE LIBRARY support. The VM resolves external functions at runtime via the host.

+
void basVmSetExternCallbacks(BasVmT *vm,
+    const BasExternCallbacksT *ext);
+

BasExternCallbacksT

+
  Field           Signature                                                Description
+  -----           ---------                                                -----------
+  resolveExtern   void *(*)(ctx, libName, funcName)                        Resolve a native function by library and symbol name. Cached after first call.
+  callExtern      BasValueT (*)(ctx, funcPtr, funcName, args, argc, retType) Call a resolved native function, marshalling arguments and return value.
+  ctx             void *                                                   User pointer passed to both callbacks.
+

Form Context

+

Set the active form context during event dispatch.

+
void basVmSetCurrentForm(BasVmT *vm, void *formRef);
+void basVmSetCurrentFormVars(BasVmT *vm,
+    BasValueT *vars, int32_t count);
+

Stack Access

+

Push and pop values on the evaluation stack for host integration.

+
bool basVmPush(BasVmT *vm, BasValueT val);
+bool basVmPop(BasVmT *vm, BasValueT *val);
+

Both return true on success, false on stack overflow/underflow.

+

Error Reporting

+
const char *basVmGetError(const BasVmT *vm);
+

Returns the current error message string. Valid after basVmRun returns BAS_VM_ERROR.

+

Sub/Function Calls from Host

+

Call a SUB or FUNCTION by its code address from host code.

+
bool basVmCallSub(BasVmT *vm, int32_t codeAddr);
+bool basVmCallSubWithArgs(BasVmT *vm, int32_t codeAddr,
+    const BasValueT *args, int32_t argCount);
+bool basVmCallSubWithArgsOut(BasVmT *vm, int32_t codeAddr,
+    const BasValueT *args, int32_t argCount,
+    BasValueT *outArgs, int32_t outCount);
+
  Function                Description
+  --------                -----------
+  basVmCallSub            Call a SUB with no arguments.
+  basVmCallSubWithArgs    Call a SUB with arguments pushed onto the stack frame.
+  basVmCallSubWithArgsOut Call a SUB and read back modified argument values after it returns.
+

All three push a call frame, execute until the SUB returns, then restore the previous execution state. Return true on normal completion, false on error or if the VM is not idle.

+

Debugger API

+
void    basVmSetBreakpoints(BasVmT *vm,
+            int32_t *lines, int32_t count);
+void    basVmStepInto(BasVmT *vm);
+void    basVmStepOver(BasVmT *vm);
+void    basVmStepOut(BasVmT *vm);
+void    basVmRunToCursor(BasVmT *vm, int32_t line);
+int32_t basVmGetCurrentLine(const BasVmT *vm);
+
  Function              Description
+  --------              -----------
+  basVmSetBreakpoints   Set the breakpoint list (sorted array of source line numbers, host-owned memory).
+  basVmStepInto         Break at the next OP_LINE instruction.
+  basVmStepOver         Break when call depth returns to the current level.
+  basVmStepOut          Break when call depth drops below the current level.
+  basVmRunToCursor      Break when execution reaches the specified source line.
+  basVmGetCurrentLine   Get the current source line number (from the last OP_LINE instruction).
+

The breakpoint callback notifies the host when a breakpoint fires during nested sub calls:

+
typedef void (*BasBreakpointFnT)(void *ctx, int32_t line);
+

BasModuleT

+

Compiled module produced by the BASIC compiler and loaded into the VM.

+
typedef struct {
+    uint8_t          *code;
+    int32_t           codeLen;
+    BasStringT      **constants;
+    int32_t           constCount;
+    int32_t           globalCount;
+    int32_t           entryPoint;
+    BasValueT        *dataPool;
+    int32_t           dataCount;
+    BasProcEntryT    *procs;
+    int32_t           procCount;
+    BasFormVarInfoT  *formVarInfo;
+    int32_t           formVarInfoCount;
+    BasDebugVarT     *debugVars;
+    int32_t           debugVarCount;
+    BasDebugUdtDefT  *debugUdtDefs;
+    int32_t           debugUdtDefCount;
+} BasModuleT;
+
  Field              Description
+  -----              -----------
+  code               P-code bytecode array.
+  codeLen            Length of bytecode in bytes.
+  constants          String constant pool.
+  constCount         Number of string constants.
+  globalCount        Number of global variable slots needed.
+  entryPoint         PC of the first instruction (module-level code).
+  dataPool           DATA statement value pool (for READ).
+  dataCount          Number of values in the data pool.
+  procs              Procedure table (SUBs and FUNCTIONs).
+  procCount          Number of procedures.
+  formVarInfo        Per-form variable counts and init code addresses.
+  formVarInfoCount   Number of forms with form-scoped variables.
+  debugVars          Variable names and metadata for the debugger.
+  debugVarCount      Number of debug variable entries.
+  debugUdtDefs       UDT type definitions for the debugger.
+  debugUdtDefCount   Number of debug UDT definitions.
+
+
+

Base WidgetT (Common Properties, Events, and Operations)

+

DVX Widget System

+

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

+

Individual widgets are documented in their own sections. See the table of contents for the full list.

+

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

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

Size Specification Macros

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

Common Events (Callbacks)

+

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

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

Common Operations

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

AnsiTerm

+

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

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

Properties (BASIC Interface)

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

Methods (BASIC Interface)

+
  Method       Description
+  ------       -----------
+  Clear        Clear the terminal screen.
+  Write        Write a string into the terminal.
+

Events

+

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

+
+
+

Box (VBox / HBox / Frame)

+

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

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

Properties

+

Box containers use the common WidgetT fields for layout control:

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

Events

+

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

+
+
+

Button

+

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

+
  Macro                        Description
+  -----                        -----------
+  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

+
  Callback     Description
+  --------     -----------
+  onClick      Fires when the button is clicked (press + release).
+
+
+

Canvas

+

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

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

Events

+
  Callback                                     Description
+  --------                                     -----------
+  onClick                                      Fires when the canvas is clicked.
+  Mouse callback (via wgtCanvasSetMouseCallback)   Fires on mouse down and drag with canvas-local coordinates.
+

Methods (BASIC Interface)

+
  Method       Description
+  ------       -----------
+  Clear        Clear the canvas to a given color.
+
+
+

Checkbox

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires when clicked (after toggle).
+  onChange     Fires when the checked state changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  Value        Boolean    Read/Write   Whether the checkbox is checked.
+
+
+

ComboBox

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onChange     Fires when the text or selection changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  ListIndex    Integer    Read/Write   Index of the currently selected item.
+
+
+

DataCtrl

+

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

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

Properties (BASIC Interface)

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

Methods (BASIC Interface)

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

Events

+
  Event          Description
+  -----          -----------
+  Reposition     Fires when the current row changes (navigation, refresh, etc.). Default event.
+  Validate       Fires before writing changes. Return false to cancel.
+
+
+

DbGrid

+

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

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

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  GridLines    Boolean    Read/Write   Whether to draw grid lines between cells.
+

Methods (BASIC Interface)

+
  Method       Description
+  ------       -----------
+  Refresh      Re-read the Data control and repaint.
+

Events

+
  Event        Description
+  -----        -----------
+  Click        Fires when a row is clicked.
+  DblClick     Fires when a row is double-clicked. Default event.
+
+
+

Dropdown

+

Dropdown

+

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

+

Header: widgets/widgetDropdown.h

+

Creation

+
WidgetT *dd = wgtDropdown(parent);
+const char *items[] = { "Red", "Green", "Blue" };
+wgtDropdownSetItems(dd, items, 3);
+

Macros

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

Events

+
  Callback     Description
+  --------     -----------
+  onChange     Fires when the selected item changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  ListIndex    Integer    Read/Write   Index of the currently selected item.
+
+
+

ImageButton

+

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

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

Methods

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires when the image button is clicked (press + release).
+

Properties (BASIC Interface)

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

Image

+

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

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

Methods

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires when the image is clicked.
+

Properties (BASIC Interface)

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

Label

+

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

+
  Macro                        Description
+  -----                        -----------
+  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)

+
  Property     Type                         Access       Description
+  --------     ----                         ------       -----------
+  Alignment    Enum (Left, Center, Right)   Read/Write   Text alignment within the label.
+
+
+
+

ListBox

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires when an item is clicked.
+  onDblClick   Fires when an item is double-clicked.
+  onChange     Fires when the selection changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  ListIndex    Integer    Read/Write   Index of the currently selected item.
+

Methods (BASIC Interface)

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

ListView

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires when a row is clicked.
+  onDblClick   Fires when a row is double-clicked.
+  onChange     Fires when the selection changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  ListIndex    Integer    Read/Write   Index of the currently selected row.
+

Methods (BASIC Interface)

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

ProgressBar

+

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

+
  Macro                    Description
+  -----                    -----------
+  wgtProgressBar(parent)   Create a horizontal progress bar.
+  wgtProgressBarV(parent)  Create a vertical progress bar.
+

Methods

+
  Macro                            Description
+  -----                            -----------
+  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)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  Value        Integer    Read/Write   Current progress value (0-100).
+
+
+
+

Radio Button

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires on the radio button when clicked.
+  onChange     Fires when the selection changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  Value        Integer    Read-only    Index of the currently selected radio button in the group.
+

Methods (BASIC Interface)

+
  Method          Description
+  ------          -----------
+  SetSelected     Set the selected radio button by index.
+
+
+
+

ScrollPane

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onScroll     Fires when the scroll position changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  NoBorder     Boolean    Read/Write   Whether the border around the scroll pane is hidden.
+
+
+
+

Separator

+

Separator

+

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

+

Header: widgets/widgetSeparator.h

+

Creation

+
  Macro                    Description
+  -----                    -----------
+  wgtHSeparator(parent)    Create a horizontal separator line.
+  wgtVSeparator(parent)    Create a vertical separator line.
+

Events

+

Separator is a visual-only widget. No events.

+
+
+
+

Slider

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onChange     Fires when the slider value changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  Value        Integer    Read/Write   Current slider value.
+
+
+
+

Spacer

+

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

+
  Macro                Description
+  -----                -----------
+  wgtSpacer(parent)    Create an invisible spacer widget.
+

Events

+

Spacer is an invisible layout widget. No events.

+
+
+
+

Spinner

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onChange     Fires when the value changes.
+

Properties (BASIC Interface)

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

Methods (BASIC Interface)

+
  Method       Description
+  ------       -----------
+  SetRange     Set the integer range (min, max).
+  SetStep      Set the integer step size.
+
+
+
+

Splitter

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onChange     Fires when the divider position changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  Position     Integer    Read/Write   Divider position in pixels.
+
+
+
+

StatusBar

+

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

+
  Macro                  Description
+  -----                  -----------
+  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.

+
+
+
+

TabControl

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onChange     Fires when the active tab changes.
+

Properties (BASIC Interface)

+
  Property     Type       Access       Description
+  --------     ----       ------       -----------
+  TabIndex     Integer    Read/Write   Index of the currently active tab (0-based).
+

Methods (BASIC Interface)

+
  Method       Description
+  ------       -----------
+  SetActive    Set the active tab by index.
+
+
+
+

TextInput / TextArea

+

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

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

Methods (TextArea-specific)

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

Events

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

Timer

+

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

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

Events

+
  Callback     Description
+  --------     -----------
+  onClick      Fires each time the timer elapses.
+

Properties (BASIC Interface)

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

Methods (BASIC Interface)

+
  Method       Description
+  ------       -----------
+  Start        Start the timer.
+  Stop         Stop the timer.
+

Extra Events (BASIC Interface)

+
  Event        Description
+  -----        -----------
+  Timer        Fires each time the timer elapses. Default event.
+
+
+
+

Toolbar

+

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

+
  Macro                Description
+  -----                -----------
+  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.

+
+
+
+

TreeView

+

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

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

Events

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

Methods (BASIC Interface)

+
  Method           Description
+  ------           -----------
+  SetMultiSelect   Enable or disable multi-selection.
+  SetReorderable   Enable or disable drag-to-reorder.
+
+
+
+

WrapBox

+

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

+
  Macro                  Description
+  -----                  -----------
+  wgtWrapBox(parent)     Create a wrap box container.
+

Properties

+

WrapBox uses the common WidgetT container fields for layout control:

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

Properties (BASIC Interface)

+
  Property     Type                         Access       Description
+  --------     ----                         ------       -----------
+  Alignment    Enum (Left, Center, Right)   Read/Write   Row 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.

+
+
+ + diff --git a/listhelp/Makefile b/listhelp/Makefile index 1399ee2..65d8792 100644 --- a/listhelp/Makefile +++ b/listhelp/Makefile @@ -40,7 +40,7 @@ $(TARGETDIR): mkdir -p $(TARGETDIR) # Dependencies -$(OBJDIR)/listHelp.o: listHelp.c listHelp.h ../core/dvxWidgetPlugin.h ../core/dvxWidget.h ../core/dvxTypes.h ../core/dvxApp.h ../core/dvxDraw.h ../core/dvxWm.h ../core/dvxVideo.h +$(OBJDIR)/listHelp.o: listHelp.c listHelp.h ../core/dvxWgtP.h ../core/dvxWgt.h ../core/dvxTypes.h ../core/dvxApp.h ../core/dvxDraw.h ../core/dvxWm.h ../core/dvxVideo.h clean: rm -rf $(OBJS) $(TARGET) $(TARGETDIR)/listhelp.dep $(TARGETDIR) diff --git a/listhelp/listHelp.h b/listhelp/listHelp.h index df3a3f5..c19b941 100644 --- a/listhelp/listHelp.h +++ b/listhelp/listHelp.h @@ -7,7 +7,7 @@ #ifndef LIST_HELP_H #define LIST_HELP_H -#include "../core/dvxWidgetPlugin.h" +#include "../core/dvxWgtP.h" #define DROPDOWN_BTN_WIDTH 16 #define DROPDOWN_MAX_VISIBLE 8 diff --git a/loader/Makefile b/loader/Makefile index f22e176..d6e5e43 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -50,8 +50,8 @@ $(BINDIR): mkdir -p $(BINDIR) # Dependencies -$(OBJDIR)/loaderMain.o: loaderMain.c ../core/platform/dvxPlatform.h ../core/dvxTypes.h -$(POBJDIR)/dvxPlatformDos.o: ../core/platform/dvxPlatformDos.c ../core/platform/dvxPlatform.h ../core/dvxTypes.h ../core/dvxPalette.h +$(OBJDIR)/loaderMain.o: loaderMain.c ../core/platform/dvxPlat.h ../core/dvxTypes.h +$(POBJDIR)/dvxPlatformDos.o: ../core/platform/dvxPlatformDos.c ../core/platform/dvxPlat.h ../core/dvxTypes.h ../core/dvxPal.h $(POBJDIR)/dvxPrefs.o: ../core/dvxPrefs.c ../core/dvxPrefs.h clean: diff --git a/loader/loaderMain.c b/loader/loaderMain.c index 3f688ca..e9b7c03 100644 --- a/loader/loaderMain.c +++ b/loader/loaderMain.c @@ -10,7 +10,7 @@ // order. After loading, any module that exports wgtRegister() has // it called. Finally, the loader finds and calls shellMain(). -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "dvxPrefs.h" #include diff --git a/sdk/readme.txt b/sdk/readme.txt new file mode 100644 index 0000000..5adfc80 --- /dev/null +++ b/sdk/readme.txt @@ -0,0 +1,75 @@ +DVX SDK +======= + +This SDK contains everything needed to develop applications and +widgets for the DVX GUI system. + +Directory Structure +------------------- + + include/ + core/ DVX core headers (types, drawing, windows, widgets) + shell/ Shell/app loading API + tasks/ Cooperative task switching API + sql/ SQLite database wrapper API + widget/ Per-widget public API headers + + samples/ + hello/ Minimal "Hello World" application + widget/ Minimal custom widget + +Requirements +------------ + + - DJGPP cross-compiler (i586-pc-msdosdjgpp-gcc) + - dxe3gen (included with DJGPP) + - DVX resource compiler (SYSTEM/DVXRES.EXE on the target, + or bin/dvxres on the host) + - DVX help compiler (SYSTEM/DVXHLPC.EXE on the target, + or bin/dvxhlpc on the host) + +Building an Application +----------------------- + + 1. Write your app with appDescriptor and appMain exports + 2. Compile: gcc -c -o myapp.o myapp.c -Isdk/include/core ... + 3. Link: dxe3gen -o myapp.app -E _appDescriptor -E _appMain -U myapp.o + 4. Optionally create a .res file and build resources with dvxres + +See samples/hello/ for a complete example. + +Building a Widget +----------------- + + 1. Write your widget with wgtRegister export + 2. Compile: gcc -c -o mywgt.o mywgt.c -Isdk/include/core + 3. Link: dxe3gen -o mywgt.wgt -E _wgtRegister -U mywgt.o + +See samples/widget/ for a complete example. + +Deployment +---------- + +Applications: APPS///.APP +Widgets: WIDGETS///.WGT +Libraries: LIBS///.LIB + +Each component can include: + - .DHS file for C API documentation (compiled into system help) + - .BHS file for BASIC documentation (compiled into BASIC help) + - .DEP file listing load-before dependencies + - .HCF file defining help compilation rules + - .RES file for embedded resources (icons, text, binary data) + +Help is recompiled automatically at startup when module counts +change. + +DXE3 Symbol Resolution +---------------------- + +DXE modules resolve symbols at load time via dlopen/dlsym. +All DVX core functions, widget APIs, and C runtime functions +are available automatically. You do not need import libraries. + +The loader ensures libraries are loaded before widgets, and +widgets before applications, respecting .dep dependencies. diff --git a/sdk/samples/hello/hello.c b/sdk/samples/hello/hello.c new file mode 100644 index 0000000..f19db81 --- /dev/null +++ b/sdk/samples/hello/hello.c @@ -0,0 +1,83 @@ +// hello.c -- Minimal DVX application +// +// Demonstrates: +// - App descriptor and entry point +// - Window creation with widgets +// - Resource loading (reading embedded strings from .res) +// - Message box display +// +// Build: see makefile +// Deploy: copy hello.app to APPS//HELLO/ on the target. + +#include "dvxApp.h" +#include "dvxWgt.h" +#include "dvxWm.h" +#include "dvxRes.h" +#include "shellApp.h" +#include "button/button.h" +#include "label/label.h" +#include "box/box.h" + +#include + +// App descriptor — exported to the shell +AppDescriptorT appDescriptor = { + .name = "Hello", + .hasMainLoop = false, + .multiInstance = false, + .stackSize = 0, + .priority = 0 +}; + +static AppContextT *sAc = NULL; +static DxeAppContextT *sCtx = NULL; +static WindowT *sWin = NULL; + +static void onClose(WindowT *win) { + dvxDestroyWindow(sAc, win); + sWin = NULL; +} + + +static void onButtonClick(WidgetT *w) { + (void)w; + + // Read the custom "greeting" resource from our .app file + uint32_t size = 0; + void *data = dvxResRead(dvxResOpen(sCtx->appPath), "greeting", &size); + + if (data) { + dvxMessageBox(sAc, "Hello", (const char *)data, MB_OK | MB_ICONINFO); + free(data); + } else { + dvxMessageBox(sAc, "Hello", "Hello from DVX!", MB_OK | MB_ICONINFO); + } +} + + +int32_t appMain(DxeAppContextT *ctx) { + sCtx = ctx; + sAc = ctx->shellCtx; + + sWin = dvxCreateWindow(sAc, "Hello World", 100, 80, 240, 120, true); + + if (!sWin) { + return -1; + } + + sWin->onClose = onClose; + + WidgetT *root = wgtInitWindow(sAc, sWin); + + if (root) { + wgtLabel(root, "Welcome to DVX!"); + + WidgetT *btn = wgtButton(root, "Click Me"); + + if (btn) { + btn->onClick = onButtonClick; + } + } + + return 0; +} diff --git a/sdk/samples/hello/hello.res b/sdk/samples/hello/hello.res new file mode 100644 index 0000000..114af35 --- /dev/null +++ b/sdk/samples/hello/hello.res @@ -0,0 +1,22 @@ +# hello.res -- Resource manifest for Hello World app +# +# Resource types: +# icon BMP image (32x32 app icon, toolbar buttons, etc.) +# text Null-terminated string (metadata, labels, etc.) +# binary Raw binary data (app-specific data files) +# +# Format: name type data +# - icon: name icon path/to/file.bmp +# - text: name text "string value" +# - binary: name binary path/to/file.dat + +# App icon (32x32 BMP displayed in Program Manager) +icon32 icon icon32.bmp + +# App metadata (displayed in Program Manager and About dialogs) +name text "Hello World" +author text "Sample Developer" +description text "DVX SDK sample application" + +# Custom text resource (accessible via dvxResRead at runtime) +greeting text "Welcome to DVX development!" diff --git a/sdk/samples/hello/icon32.bmp b/sdk/samples/hello/icon32.bmp new file mode 100644 index 0000000..2ff3d44 --- /dev/null +++ b/sdk/samples/hello/icon32.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e80c12d82bec065b279d219f657e0475ebbcf55dce2bb3b916aa202671b37032 +size 3126 diff --git a/sdk/samples/hello/makefile b/sdk/samples/hello/makefile new file mode 100644 index 0000000..1312b12 --- /dev/null +++ b/sdk/samples/hello/makefile @@ -0,0 +1,28 @@ +# Hello World app — sample DVX application Makefile +# +# Adjust DJGPP_PREFIX, SDK_DIR, and DVXRES for your environment. + +DJGPP_PREFIX = $(HOME)/djgpp/djgpp +CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc +DXE3GEN = PATH=$(DJGPP_PREFIX)/bin:$(PATH) DJDIR=$(DJGPP_PREFIX)/i586-pc-msdosdjgpp $(DJGPP_PREFIX)/i586-pc-msdosdjgpp/bin/dxe3gen + +SDK_DIR = ../.. +DVXRES = dvxres +CFLAGS = -O2 -Wall -Wextra -Werror -march=i486 -mtune=i586 \ + -I$(SDK_DIR)/include/core \ + -I$(SDK_DIR)/include/shell \ + -I$(SDK_DIR)/include/widget + +.PHONY: all clean + +all: hello.app + +hello.app: hello.o hello.res icon32.bmp + $(DXE3GEN) -o $@ -E _appDescriptor -E _appMain -U hello.o + $(DVXRES) build $@ hello.res + +hello.o: hello.c + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + rm -f hello.o hello.app diff --git a/sdk/samples/library/makefile b/sdk/samples/library/makefile new file mode 100644 index 0000000..cdc6d3b --- /dev/null +++ b/sdk/samples/library/makefile @@ -0,0 +1,23 @@ +# Sample library — DVX library Makefile +# +# Adjust DJGPP_PREFIX for your environment. + +DJGPP_PREFIX = $(HOME)/djgpp/djgpp +CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc +DXE3GEN = PATH=$(DJGPP_PREFIX)/bin:$(PATH) DJDIR=$(DJGPP_PREFIX)/i586-pc-msdosdjgpp $(DJGPP_PREFIX)/i586-pc-msdosdjgpp/bin/dxe3gen + +CFLAGS = -O2 -Wall -Wextra -Werror -march=i486 -mtune=i586 + +.PHONY: all clean + +all: mylib.lib + +mylib.lib: mylib.o + $(DXE3GEN) -o mylib.dxe -E _myLibAdd -E _myLibMul -E _myLibVersion -U $< + mv mylib.dxe $@ + +mylib.o: mylib.c mylib.h + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + rm -f mylib.o mylib.lib diff --git a/sdk/samples/library/mylib.c b/sdk/samples/library/mylib.c new file mode 100644 index 0000000..714a7f4 --- /dev/null +++ b/sdk/samples/library/mylib.c @@ -0,0 +1,27 @@ +// mylib.c -- Sample DVX library implementation +// +// Build: +// i586-pc-msdosdjgpp-gcc -O2 -Wall -c -o mylib.o mylib.c +// dxe3gen -o mylib.lib -E _myLibAdd -E _myLibMul -E _myLibVersion -U mylib.o +// +// Deploy: copy mylib.lib to LIBS//MYLIB/ on the target. +// Add a mylib.dep file if this library depends on others. +// +// Any DXE loaded after this one can call myLibAdd(), myLibMul(), +// and myLibVersion() directly — DXE3 resolves symbols at load time. + +#include "mylib.h" + +int32_t myLibAdd(int32_t a, int32_t b) { + return a + b; +} + + +int32_t myLibMul(int32_t a, int32_t b) { + return a * b; +} + + +const char *myLibVersion(void) { + return "MyLib 1.0"; +} diff --git a/sdk/samples/library/mylib.h b/sdk/samples/library/mylib.h new file mode 100644 index 0000000..7583747 --- /dev/null +++ b/sdk/samples/library/mylib.h @@ -0,0 +1,21 @@ +// mylib.h -- Sample DVX library public header +// +// A library exports functions via DXE3 symbol sharing. +// Any module loaded after this library can call its functions +// directly — no import library or dlsym needed. + +#ifndef MYLIB_H +#define MYLIB_H + +#include + +// Add two integers +int32_t myLibAdd(int32_t a, int32_t b); + +// Multiply two integers +int32_t myLibMul(int32_t a, int32_t b); + +// Return the library version string +const char *myLibVersion(void); + +#endif // MYLIB_H diff --git a/sdk/samples/widget/icon24.bmp b/sdk/samples/widget/icon24.bmp new file mode 100644 index 0000000..2ff3d44 --- /dev/null +++ b/sdk/samples/widget/icon24.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e80c12d82bec065b279d219f657e0475ebbcf55dce2bb3b916aa202671b37032 +size 3126 diff --git a/sdk/samples/widget/makefile b/sdk/samples/widget/makefile new file mode 100644 index 0000000..b92b75a --- /dev/null +++ b/sdk/samples/widget/makefile @@ -0,0 +1,27 @@ +# Sample widget — DVX widget Makefile +# +# Adjust DJGPP_PREFIX, SDK_DIR, and DVXRES for your environment. + +DJGPP_PREFIX = $(HOME)/djgpp/djgpp +CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc +DXE3GEN = PATH=$(DJGPP_PREFIX)/bin:$(PATH) DJDIR=$(DJGPP_PREFIX)/i586-pc-msdosdjgpp $(DJGPP_PREFIX)/i586-pc-msdosdjgpp/bin/dxe3gen + +SDK_DIR = ../.. +DVXRES = dvxres +CFLAGS = -O2 -Wall -Wextra -Werror -march=i486 -mtune=i586 \ + -I$(SDK_DIR)/include/core + +.PHONY: all clean + +all: mywgt.wgt + +mywgt.wgt: mywgt.o mywgt.res icon24.bmp + $(DXE3GEN) -o mywgt.dxe -E _wgtRegister -U mywgt.o + mv mywgt.dxe $@ + $(DVXRES) build $@ mywgt.res + +mywgt.o: mywgt.c + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + rm -f mywgt.o mywgt.wgt diff --git a/sdk/samples/widget/mywgt.c b/sdk/samples/widget/mywgt.c new file mode 100644 index 0000000..e32e4d8 --- /dev/null +++ b/sdk/samples/widget/mywgt.c @@ -0,0 +1,239 @@ +// mywgt.c -- Sample DVX widget with full BASIC interface +// +// A simple widget that draws a colored rectangle with centered text. +// Demonstrates: +// - Widget class registration (calcMinSize, paint, destroy) +// - Public C API (create function + API struct) +// - BASIC interface (properties, methods, events, WgtIfaceT) +// +// Build: +// i586-pc-msdosdjgpp-gcc -O2 -Wall -I../../include/core -c -o mywgt.o mywgt.c +// dxe3gen -o mywgt.wgt -E _wgtRegister -U mywgt.o +// +// Deploy: copy mywgt.wgt to WIDGETS//MYWGT/ on the target. +// Optionally include MYWGT.DHS (C API docs) and MYWGT.BHS (BASIC docs). + +#define DVX_WIDGET_IMPL +#include "dvxWgt.h" +#include "dvxWgtP.h" +#include "dvxDraw.h" +#include "dvxVideo.h" + +#include +#include + +// ============================================================ +// Widget data +// ============================================================ + +typedef struct { + char *text; + int32_t style; // 0=flat, 1=raised, 2=sunken + bool bold; +} MyWidgetDataT; + +static int32_t sTypeId = -1; + +// ============================================================ +// Style enum names (for BASIC property panel dropdown) +// ============================================================ + +static const char *sStyleNames[] = { "Flat", "Raised", "Sunken", NULL }; + +// ============================================================ +// Widget methods (vtable handlers) +// ============================================================ + +static void myCalcMinSize(WidgetT *w, const BitmapFontT *font) { + w->calcMinW = font->charWidth * 10; + w->calcMinH = font->charHeight + 8; +} + + +static void myPaint(WidgetT *w, DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + uint32_t bg = colors->buttonFace; + uint32_t fg = colors->contentFg; + + // Fill background + rectFill(d, ops, w->x, w->y, w->w, w->h, bg); + + // Draw border based on style + if (data && data->style == 1) { + BevelStyleT bevel = BEVEL_RAISED(colors, 2); + drawBevel(d, ops, w->x, w->y, w->w, w->h, &bevel); + } else if (data && data->style == 2) { + BevelStyleT bevel = BEVEL_SUNKEN(colors, bg, 2); + drawBevel(d, ops, w->x, w->y, w->w, w->h, &bevel); + } + + // Draw text centered + if (data && data->text) { + int32_t textW = textWidth(font, data->text); + int32_t tx = w->x + (w->w - textW) / 2; + int32_t ty = w->y + (w->h - font->charHeight) / 2; + drawText(d, ops, font, tx, ty, data->text, fg, bg, true); + } +} + + +static void myDestroy(WidgetT *w) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + + if (data) { + free(data->text); + free(data); + w->data = NULL; + } +} + +// ============================================================ +// Widget class definition +// ============================================================ + +static const WidgetClassT sClass = { + .version = WGT_CLASS_VERSION, + .flags = WCLASS_FOCUSABLE, + .handlers = { + [WGT_METHOD_PAINT] = (void *)myPaint, + [WGT_METHOD_CALC_MIN_SIZE] = (void *)myCalcMinSize, + [WGT_METHOD_DESTROY] = (void *)myDestroy, + } +}; + +// ============================================================ +// C API — called by apps via wgtGetApi("mywgt") +// ============================================================ + +static WidgetT *myWidgetCreate(WidgetT *parent, const char *text) { + WidgetT *w = widgetAlloc(parent, sTypeId); + + if (w) { + MyWidgetDataT *data = (MyWidgetDataT *)calloc(1, sizeof(MyWidgetDataT)); + + if (data) { + data->text = text ? strdup(text) : NULL; + data->style = 0; + data->bold = false; + } + + w->data = data; + } + + return w; +} + + +static void myWidgetSetStyle(WidgetT *w, int32_t style) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + + if (data) { + data->style = style; + wgtInvalidatePaint(w); + } +} + + +static int32_t myWidgetGetStyle(const WidgetT *w) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + return data ? data->style : 0; +} + + +static void myWidgetSetBold(WidgetT *w, bool bold) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + + if (data) { + data->bold = bold; + wgtInvalidatePaint(w); + } +} + + +static bool myWidgetGetBold(const WidgetT *w) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + return data ? data->bold : false; +} + + +static void myWidgetClear(WidgetT *w) { + MyWidgetDataT *data = (MyWidgetDataT *)w->data; + + if (data) { + free(data->text); + data->text = NULL; + wgtInvalidatePaint(w); + } +} + + +static const struct { + WidgetT *(*create)(WidgetT *parent, const char *text); + void (*setStyle)(WidgetT *w, int32_t style); + int32_t (*getStyle)(const WidgetT *w); + void (*setBold)(WidgetT *w, bool bold); + bool (*getBold)(const WidgetT *w); + void (*clear)(WidgetT *w); +} sApi = { + .create = myWidgetCreate, + .setStyle = myWidgetSetStyle, + .getStyle = myWidgetGetStyle, + .setBold = myWidgetSetBold, + .getBold = myWidgetGetBold, + .clear = myWidgetClear, +}; + +// ============================================================ +// BASIC interface — describes properties, methods, and events +// for the form runtime and IDE property panel +// ============================================================ + +// Properties accessible from BASIC (e.g., MyWidget1.Style = 2) +static const WgtPropDescT sProps[] = { + // String property: Caption (read/write via SET_TEXT/GET_TEXT) + // Common properties like Caption, Left, Top, Width, Height are + // handled automatically by the form runtime. Only list type-specific + // properties here. + + // Enum property: Style (Flat=0, Raised=1, Sunken=2) + { "Style", WGT_IFACE_ENUM, (void *)myWidgetGetStyle, (void *)myWidgetSetStyle, sStyleNames }, + + // Boolean property: Bold + { "Bold", WGT_IFACE_BOOL, (void *)myWidgetGetBold, (void *)myWidgetSetBold, NULL }, +}; + +// Methods callable from BASIC (e.g., MyWidget1.Clear) +static const WgtMethodDescT sMethods[] = { + { "Clear", WGT_SIG_VOID, (void *)myWidgetClear }, +}; + +// Events beyond the common set (Click, DblClick, Change, GotFocus, LostFocus). +// Only list EXTRA events here — common events are wired automatically. +static const WgtEventDescT sEvents[] = { + { "StyleChange" }, +}; + +static const WgtIfaceT sIface = { + .basName = "MyWidget", // VB-style control name (used in .frm files) + .props = sProps, + .propCount = sizeof(sProps) / sizeof(sProps[0]), + .methods = sMethods, + .methodCount = sizeof(sMethods) / sizeof(sMethods[0]), + .events = sEvents, + .eventCount = sizeof(sEvents) / sizeof(sEvents[0]), + .createSig = WGT_CREATE_PARENT_TEXT, // create(parent, text) + .createArgs = {0}, // no default numeric args + .isContainer = false, // cannot hold child widgets + .defaultEvent = "Click", // double-click in IDE opens this event + .namePrefix = "MyWidget", // auto-names: MyWidget1, MyWidget2, ... +}; + +// ============================================================ +// Registration — called by the loader at startup +// ============================================================ + +void wgtRegister(void) { + sTypeId = wgtRegisterClass(&sClass); + wgtRegisterApi("mywgt", &sApi); + wgtRegisterIface("mywgt", &sIface); +} diff --git a/sdk/samples/widget/mywgt.res b/sdk/samples/widget/mywgt.res new file mode 100644 index 0000000..c13e9b4 --- /dev/null +++ b/sdk/samples/widget/mywgt.res @@ -0,0 +1,15 @@ +# mywgt.res -- Resource manifest for sample widget +# +# Widgets can embed resources just like apps. +# The icon24 resource is used by the IDE toolbox to +# display the widget's icon when designing forms. + +# Widget toolbox icon (24x24 BMP for the form designer toolbox) +icon24 icon icon24.bmp + +# Widget display name (shown in the IDE toolbox and properties panel) +name text "My Widget" + +# Author and description (for documentation and about dialogs) +author text "Sample Developer" +description text "A sample custom widget for DVX" diff --git a/shell/Makefile b/shell/Makefile index c2cdcc5..f769c74 100644 --- a/shell/Makefile +++ b/shell/Makefile @@ -63,10 +63,10 @@ $(WPAPERDIR)/%.jpg: ../config/wpaper/%.jpg | $(WPAPERDIR) cp $< $@ # Dependencies -SHELL_DEPS = shellApp.h ../core/dvxWidget.h ../core/dvxApp.h ../core/dvxTypes.h ../core/platform/dvxPlatform.h +SHELL_DEPS = shellApp.h ../core/dvxWgt.h ../core/dvxApp.h ../core/dvxTypes.h ../core/platform/dvxPlat.h $(OBJDIR)/shellMain.o: shellMain.c $(SHELL_DEPS) $(OBJDIR)/shellApp.o: shellApp.c $(SHELL_DEPS) -$(OBJDIR)/shellInfo.o: shellInfo.c shellInfo.h $(SHELL_DEPS) +$(OBJDIR)/shellInfo.o: shellInfo.c shellInf.h $(SHELL_DEPS) clean: rm -rf $(OBJS) $(TARGET) $(TARGETDIR)/dvxshell.dep $(TARGETDIR) diff --git a/shell/shellApp.c b/shell/shellApp.c index f057c98..dcdfbc3 100644 --- a/shell/shellApp.c +++ b/shell/shellApp.c @@ -4,8 +4,8 @@ // ctx->currentAppId, and clean teardown of both callback-only and main-loop apps. #include "shellApp.h" -#include "dvxDialog.h" -#include "dvxPlatform.h" +#include "dvxDlg.h" +#include "dvxPlat.h" #include "stb_ds_wrap.h" #include diff --git a/shell/shellApp.h b/shell/shellApp.h index d236ec5..557abee 100644 --- a/shell/shellApp.h +++ b/shell/shellApp.h @@ -23,8 +23,8 @@ #define SHELL_APP_H #include "dvxApp.h" -#include "dvxWidget.h" -#include "taskswitch.h" +#include "dvxWgt.h" +#include "taskSwch.h" #include #include diff --git a/shell/shellInfo.h b/shell/shellInf.h similarity index 100% rename from shell/shellInfo.h rename to shell/shellInf.h diff --git a/shell/shellInfo.c b/shell/shellInfo.c index 74911e0..492afc5 100644 --- a/shell/shellInfo.c +++ b/shell/shellInfo.c @@ -5,9 +5,9 @@ // to DVX.LOG. The result pointer is cached so subsequent calls // to shellGetSystemInfo() return instantly without re-probing. -#include "shellInfo.h" +#include "shellInf.h" #include "shellApp.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include #include "dvxMem.h" diff --git a/shell/shellMain.c b/shell/shellMain.c index db24741..e45f406 100644 --- a/shell/shellMain.c +++ b/shell/shellMain.c @@ -27,13 +27,13 @@ // doesn't take down the whole system. #include "shellApp.h" -#include "shellInfo.h" -#include "dvxDialog.h" +#include "shellInf.h" +#include "dvxDlg.h" #include "dvxDraw.h" #include "dvxVideo.h" #include "dvxComp.h" #include "dvxPrefs.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "stb_ds_wrap.h" #include diff --git a/taskmgr/Makefile b/taskmgr/Makefile index dc89f52..a95ecf9 100644 --- a/taskmgr/Makefile +++ b/taskmgr/Makefile @@ -39,7 +39,7 @@ $(TARGETDIR): mkdir -p $(TARGETDIR) # Dependencies -$(OBJDIR)/shellTaskMgr.o: shellTaskMgr.c shellTaskMgr.h ../shell/shellApp.h ../core/dvxWidget.h ../core/dvxApp.h +$(OBJDIR)/shellTaskMgr.o: shellTaskMgr.c shellTaskMgr.h ../shell/shellApp.h ../core/dvxWgt.h ../core/dvxApp.h clean: rm -rf $(OBJS) $(TARGET) $(TARGETDIR)/taskmgr.dep $(TARGETDIR) diff --git a/taskmgr/shellTaskMgr.c b/taskmgr/shellTaskMgr.c index 16c91d1..82cede4 100644 --- a/taskmgr/shellTaskMgr.c +++ b/taskmgr/shellTaskMgr.c @@ -6,14 +6,14 @@ #include "shellTaskMgr.h" #include "../shell/shellApp.h" -#include "dvxDialog.h" -#include "dvxWidget.h" -#include "widgetBox.h" -#include "widgetButton.h" -#include "widgetLabel.h" -#include "widgetListView.h" +#include "dvxDlg.h" +#include "dvxWgt.h" +#include "box/box.h" +#include "button/button.h" +#include "label/label.h" +#include "listView/listView.h" #include "dvxWm.h" -#include "dvxPlatform.h" +#include "dvxPlat.h" #include "stb_ds_wrap.h" #include diff --git a/tasks/Makefile b/tasks/Makefile index f0cea78..991ba7f 100644 --- a/tasks/Makefile +++ b/tasks/Makefile @@ -36,7 +36,7 @@ $(TARGETDIR): mkdir -p $(TARGETDIR) # Dependencies -$(OBJDIR)/taskswitch.o: taskswitch.c taskswitch.h ../core/thirdparty/stb_ds.h +$(OBJDIR)/taskswitch.o: taskswitch.c taskSwch.h ../core/thirdparty/stb_ds.h clean: rm -rf $(OBJS) $(TARGET) $(TARGETDIR) diff --git a/tasks/taskswitch.h b/tasks/taskSwch.h similarity index 97% rename from tasks/taskswitch.h rename to tasks/taskSwch.h index 76867cd..fe906d6 100644 --- a/tasks/taskswitch.h +++ b/tasks/taskSwch.h @@ -1,4 +1,4 @@ -// taskswitch.h -- Cooperative task switching library for DJGPP +// taskSwch.h -- Cooperative task switching library for DJGPP // // Cooperative (non-preemptive) multitasking for DOS protected mode (DJGPP/DPMI). // @@ -21,8 +21,8 @@ // turns per round while a priority-0 task gets 1, but the low-priority // task is guaranteed to run eventually -- no starvation is possible. -#ifndef TASKSWITCH_H -#define TASKSWITCH_H +#ifndef TASKSWCH_H +#define TASKSWCH_H #include #include @@ -130,4 +130,4 @@ void tsRecoverToMain(void); // Get the number of non-terminated tasks. uint32_t tsActiveCount(void); -#endif // TASKSWITCH_H +#endif // TASKSWCH_H diff --git a/tasks/taskswitch.c b/tasks/taskswitch.c index 2f231db..5a6e5de 100644 --- a/tasks/taskswitch.c +++ b/tasks/taskswitch.c @@ -23,7 +23,7 @@ #include "../core/thirdparty/stb_ds_wrap.h" -#include "taskswitch.h" +#include "taskSwch.h" #include #include diff --git a/termdemo/Makefile b/termdemo/Makefile index 15ff7cd..4a71643 100644 --- a/termdemo/Makefile +++ b/termdemo/Makefile @@ -37,7 +37,7 @@ $(BINDIR): mkdir -p $(BINDIR) # Dependencies -$(OBJDIR)/termdemo.o: termdemo.c ../dvx/dvxApp.h ../dvx/dvxWidget.h ../seclink/secLink.h ../security/security.h +$(OBJDIR)/termdemo.o: termdemo.c ../dvx/dvxApp.h ../dvx/dvxWgt.h ../seclink/secLink.h ../security/security.h clean: rm -rf $(OBJDIR) $(TARGET) diff --git a/termdemo/termdemo.c b/termdemo/termdemo.c index 19ad6ed..9a1e39b 100644 --- a/termdemo/termdemo.c +++ b/termdemo/termdemo.c @@ -24,7 +24,7 @@ // baud_rate -- baud rate (default 115200) #include "dvxApp.h" -#include "dvxWidget.h" +#include "dvxWgt.h" #include "secLink.h" #include "security.h" #include diff --git a/texthelp/Makefile b/texthelp/Makefile index 612282a..fd2f7d1 100644 --- a/texthelp/Makefile +++ b/texthelp/Makefile @@ -40,7 +40,7 @@ $(TARGETDIR): mkdir -p $(TARGETDIR) # Dependencies -$(OBJDIR)/textHelp.o: textHelp.c textHelp.h ../core/dvxWidgetPlugin.h ../core/dvxWidget.h ../core/dvxTypes.h ../core/dvxApp.h ../core/dvxDraw.h ../core/dvxWm.h ../core/dvxVideo.h +$(OBJDIR)/textHelp.o: textHelp.c textHelp.h ../core/dvxWgtP.h ../core/dvxWgt.h ../core/dvxTypes.h ../core/dvxApp.h ../core/dvxDraw.h ../core/dvxWm.h ../core/dvxVideo.h clean: rm -rf $(OBJS) $(TARGET) $(TARGETDIR)/texthelp.dep $(TARGETDIR) diff --git a/texthelp/textHelp.h b/texthelp/textHelp.h index ebd38d7..cfd3f7f 100644 --- a/texthelp/textHelp.h +++ b/texthelp/textHelp.h @@ -8,7 +8,7 @@ #ifndef TEXT_HELP_H #define TEXT_HELP_H -#include "../core/dvxWidgetPlugin.h" +#include "../core/dvxWgtP.h" #define TEXT_INPUT_PAD 3 diff --git a/tools/Makefile b/tools/Makefile index fb46daa..d6d584e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -12,33 +12,37 @@ CWSDSTUB = $(DJGPP_PREFIX)/i586-pc-msdosdjgpp/bin/CWSDSTUB.EXE DOSCFLAGS = -O2 -Wall -Wextra -Werror -Wno-format-truncation -march=i486 -mtune=i586 -I../core -I../core/platform BINDIR = ../bin +HOSTDIR = ../bin/host CONFIGDIR = ../bin/config SYSTEMDIR = ../bin/system .PHONY: all clean deploy-helpsrc -all: $(BINDIR)/dvxres $(BINDIR)/mkicon $(BINDIR)/mktbicon $(BINDIR)/mkwgticon $(BINDIR)/bmp2raw $(BINDIR)/dvxhlpc $(SYSTEMDIR)/SPLASH.RAW $(SYSTEMDIR)/DVXHLPC.EXE $(SYSTEMDIR)/DVXRES.EXE +all: $(HOSTDIR)/dvxres $(HOSTDIR)/mkicon $(HOSTDIR)/mktbicon $(HOSTDIR)/mkwgticon $(HOSTDIR)/bmp2raw $(HOSTDIR)/dvxhlpc $(SYSTEMDIR)/SPLASH.RAW $(SYSTEMDIR)/DVXHLPC.EXE $(SYSTEMDIR)/DVXRES.EXE -$(BINDIR)/dvxres: dvxres.c ../core/dvxResource.c ../core/dvxResource.h | $(BINDIR) +$(HOSTDIR)/dvxres: dvxres.c ../core/dvxResource.c ../core/dvxRes.h | $(HOSTDIR) $(CC) $(CFLAGS) -o $@ dvxres.c ../core/dvxResource.c -$(BINDIR)/mkicon: mkicon.c | $(BINDIR) +$(HOSTDIR)/mkicon: mkicon.c | $(HOSTDIR) $(CC) $(CFLAGS) -o $@ mkicon.c -lm -$(BINDIR)/mktbicon: mktbicon.c | $(BINDIR) +$(HOSTDIR)/mktbicon: mktbicon.c | $(HOSTDIR) $(CC) $(CFLAGS) -o $@ mktbicon.c -$(BINDIR)/mkwgticon: mkwgticon.c | $(BINDIR) +$(HOSTDIR)/mkwgticon: mkwgticon.c | $(HOSTDIR) $(CC) $(CFLAGS) -o $@ mkwgticon.c -$(BINDIR)/bmp2raw: bmp2raw.c | $(BINDIR) +$(HOSTDIR)/bmp2raw: bmp2raw.c | $(HOSTDIR) $(CC) $(CFLAGS) -o $@ bmp2raw.c -$(BINDIR)/dvxhlpc: dvxhlpc.c ../apps/dvxhelp/hlpformat.h | $(BINDIR) +$(HOSTDIR)/dvxhlpc: dvxhlpc.c ../apps/dvxhelp/hlpformat.h | $(HOSTDIR) $(CC) $(CFLAGS) -o $@ dvxhlpc.c -$(SYSTEMDIR)/SPLASH.RAW: $(BINDIR)/bmp2raw ../assets/splash.bmp | $(SYSTEMDIR) - $(BINDIR)/bmp2raw ../assets/splash.bmp $@ +$(HOSTDIR): + mkdir -p $(HOSTDIR) + +$(SYSTEMDIR)/SPLASH.RAW: $(HOSTDIR)/bmp2raw ../assets/splash.bmp | $(SYSTEMDIR) + $(HOSTDIR)/bmp2raw ../assets/splash.bmp $@ $(BINDIR): mkdir -p $(BINDIR) @@ -52,7 +56,7 @@ $(SYSTEMDIR)/DVXHLPC.EXE: dvxhlpc.c ../apps/dvxhelp/hlpformat.h | $(SYSTEMDIR) cat $(CWSDSTUB) $(SYSTEMDIR)/dvxhlpc > $@ rm -f $(SYSTEMDIR)/dvxhlpc $(SYSTEMDIR)/dvxhlpc.exe -$(SYSTEMDIR)/DVXRES.EXE: dvxres.c ../core/dvxResource.c ../core/dvxResource.h | $(SYSTEMDIR) +$(SYSTEMDIR)/DVXRES.EXE: dvxres.c ../core/dvxResource.c ../core/dvxRes.h | $(SYSTEMDIR) $(DOSCC) $(DOSCFLAGS) -o $(SYSTEMDIR)/dvxres.exe dvxres.c ../core/dvxResource.c $(EXE2COFF) $(SYSTEMDIR)/dvxres.exe cat $(CWSDSTUB) $(SYSTEMDIR)/dvxres > $@ @@ -119,5 +123,5 @@ deploy-helpsrc: done clean: - rm -f $(BINDIR)/dvxres + rm -rf $(HOSTDIR) rm -rf $(SYSTEMDIR) diff --git a/tools/dvxres.c b/tools/dvxres.c index 129701f..86586b0 100644 --- a/tools/dvxres.c +++ b/tools/dvxres.c @@ -16,7 +16,7 @@ // [resource directory] // [footer with magic + directory offset + count] -#include "../core/dvxResource.h" +#include "../core/dvxRes.h" #include #include diff --git a/widgets/Makefile b/widgets/Makefile index ec8e8fe..c2bd949 100644 --- a/widgets/Makefile +++ b/widgets/Makefile @@ -7,7 +7,7 @@ DJGPP_PREFIX = $(HOME)/djgpp/djgpp CC = $(DJGPP_PREFIX)/bin/i586-pc-msdosdjgpp-gcc DXE3GEN = PATH=$(DJGPP_PREFIX)/bin:$(PATH) DJDIR=$(DJGPP_PREFIX)/i586-pc-msdosdjgpp $(DJGPP_PREFIX)/i586-pc-msdosdjgpp/bin/dxe3gen CFLAGS = -O2 -Wall -Wextra -Werror -Wno-type-limits -Wno-sign-compare -Wno-format-truncation -march=i486 -mtune=i586 -I../core -I../core/platform -I../tasks -I../core/thirdparty -DVXRES = ../bin/dvxres +DVXRES = ../bin/host/dvxres OBJDIR = ../obj/widgets WGTDIR = ../bin/widgets/kpunch @@ -68,7 +68,7 @@ endef $(foreach d,$(DEPFILES),$(eval $(call DEP_RULE,$(d)))) # Compile: source is in subdirectory -WIDGET_DEPS_H = ../core/dvxWidgetPlugin.h ../core/dvxWidget.h ../core/dvxTypes.h ../core/dvxApp.h ../core/dvxDraw.h ../core/dvxWm.h ../core/dvxVideo.h ../core/platform/dvxPlatform.h +WIDGET_DEPS_H = ../core/dvxWgtP.h ../core/dvxWgt.h ../core/dvxTypes.h ../core/dvxApp.h ../core/dvxDraw.h ../core/dvxWm.h ../core/dvxVideo.h ../core/platform/dvxPlat.h define WIDGET_RULES $(OBJDIR)/$(word 3,$(subst :, ,$1)).o: $(word 2,$(subst :, ,$1))/$(word 3,$(subst :, ,$1)).c $$(WIDGET_DEPS_H) | $(OBJDIR) diff --git a/widgets/widgetAnsiTerm.h b/widgets/ansiTerm/ansiTerm.h similarity index 89% rename from widgets/widgetAnsiTerm.h rename to widgets/ansiTerm/ansiTerm.h index 9643013..0278421 100644 --- a/widgets/widgetAnsiTerm.h +++ b/widgets/ansiTerm/ansiTerm.h @@ -1,8 +1,8 @@ -// widgetAnsiTerm.h -- ANSI terminal widget API -#ifndef WIDGET_ANSITERM_H -#define WIDGET_ANSITERM_H +// ansiTerm.h -- ANSI terminal widget API +#ifndef ANSITERM_H +#define ANSITERM_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, int32_t cols, int32_t rows); @@ -28,4 +28,4 @@ static inline const AnsiTermApiT *dvxAnsiTermApi(void) { #define wgtAnsiTermPoll(w) dvxAnsiTermApi()->poll(w) #define wgtAnsiTermRepaint(w, outY, outH) dvxAnsiTermApi()->repaint(w, outY, outH) -#endif // WIDGET_ANSITERM_H +#endif // ANSITERM_H diff --git a/widgets/ansiTerm/widgetAnsiTerm.c b/widgets/ansiTerm/widgetAnsiTerm.c index a3eba91..d3097a6 100644 --- a/widgets/ansiTerm/widgetAnsiTerm.c +++ b/widgets/ansiTerm/widgetAnsiTerm.c @@ -36,7 +36,7 @@ // the terminal to work with raw serial ports, the secLink encrypted channel, // or any other byte-oriented transport. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../texthelp/textHelp.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetBox.h b/widgets/box/box.h similarity index 76% rename from widgets/widgetBox.h rename to widgets/box/box.h index d8406ca..e4cbe67 100644 --- a/widgets/widgetBox.h +++ b/widgets/box/box.h @@ -1,8 +1,8 @@ -// widgetBox.h -- Box container widget API (VBox, HBox, Frame) -#ifndef WIDGET_BOX_H -#define WIDGET_BOX_H +// box.h -- Box container widget API (VBox, HBox, Frame) +#ifndef BOX_H +#define BOX_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*vBox)(WidgetT *parent); @@ -20,4 +20,4 @@ static inline const BoxApiT *dvxBoxApi(void) { #define wgtHBox(parent) dvxBoxApi()->hBox(parent) #define wgtFrame(parent, title) dvxBoxApi()->frame(parent, title) -#endif // WIDGET_BOX_H +#endif // BOX_H diff --git a/widgets/box/widgetBox.c b/widgets/box/widgetBox.c index a499dbc..e6468b4 100644 --- a/widgets/box/widgetBox.c +++ b/widgets/box/widgetBox.c @@ -19,7 +19,7 @@ // "break" the border behind the title -- this is the classic Win3.1/Motif // group box appearance. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sVBoxTypeId = -1; static int32_t sHBoxTypeId = -1; diff --git a/widgets/widgetButton.h b/widgets/button/button.h similarity index 69% rename from widgets/widgetButton.h rename to widgets/button/button.h index 92f6b5b..454e08c 100644 --- a/widgets/widgetButton.h +++ b/widgets/button/button.h @@ -1,8 +1,8 @@ -// widgetButton.h -- Button widget API -#ifndef WIDGET_BUTTON_H -#define WIDGET_BUTTON_H +// button.h -- Button widget API +#ifndef BUTTON_H +#define BUTTON_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, const char *text); @@ -16,4 +16,4 @@ static inline const ButtonApiT *dvxButtonApi(void) { #define wgtButton(parent, text) dvxButtonApi()->create(parent, text) -#endif // WIDGET_BUTTON_H +#endif // BUTTON_H diff --git a/widgets/button/widgetButton.c b/widgets/button/widgetButton.c index a9002be..0bb29e3 100644 --- a/widgets/button/widgetButton.c +++ b/widgets/button/widgetButton.c @@ -20,7 +20,7 @@ // Text supports accelerator keys via '&' prefix (e.g., "&OK" underlines 'O' // and Alt+O activates the button). -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define BUTTON_PAD_H 8 #define BUTTON_PAD_V 4 diff --git a/widgets/widgetCanvas.h b/widgets/canvas/canvas.h similarity index 94% rename from widgets/widgetCanvas.h rename to widgets/canvas/canvas.h index c4f0433..7dcd476 100644 --- a/widgets/widgetCanvas.h +++ b/widgets/canvas/canvas.h @@ -1,8 +1,8 @@ -// widgetCanvas.h -- Canvas widget API -#ifndef WIDGET_CANVAS_H -#define WIDGET_CANVAS_H +// canvas.h -- Canvas widget API +#ifndef CANVAS_H +#define CANVAS_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, int32_t w, int32_t h); @@ -42,4 +42,4 @@ static inline const CanvasApiT *dvxCanvasApi(void) { #define wgtCanvasGetPixel(w, x, y) dvxCanvasApi()->getPixel(w, x, y) #define wgtCanvasDrawText(w, x, y, text) dvxCanvasApi()->drawText(w, x, y, text) -#endif // WIDGET_CANVAS_H +#endif // CANVAS_H diff --git a/widgets/canvas/widgetCanvas.c b/widgets/canvas/widgetCanvas.c index ec31250..a30dbbc 100644 --- a/widgets/canvas/widgetCanvas.c +++ b/widgets/canvas/widgetCanvas.c @@ -22,7 +22,7 @@ // top-left of the canvas content, not the widget. Mouse events translate // widget-space coordinates to canvas-space by subtracting the border offset. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetCheckbox.h b/widgets/checkbox/checkbox.h similarity index 80% rename from widgets/widgetCheckbox.h rename to widgets/checkbox/checkbox.h index 82acd67..27c3a06 100644 --- a/widgets/widgetCheckbox.h +++ b/widgets/checkbox/checkbox.h @@ -1,8 +1,8 @@ -// widgetCheckbox.h -- Checkbox widget API -#ifndef WIDGET_CHECKBOX_H -#define WIDGET_CHECKBOX_H +// checkbox.h -- Checkbox widget API +#ifndef CHECKBOX_H +#define CHECKBOX_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, const char *text); @@ -20,4 +20,4 @@ static inline const CheckboxApiT *dvxCheckboxApi(void) { #define wgtCheckboxIsChecked(w) dvxCheckboxApi()->isChecked(w) #define wgtCheckboxSetChecked(w, checked) dvxCheckboxApi()->setChecked(w, checked) -#endif // WIDGET_CHECKBOX_H +#endif // CHECKBOX_H diff --git a/widgets/checkbox/widgetCheckbox.c b/widgets/checkbox/widgetCheckbox.c index 725ab5c..447caa7 100644 --- a/widgets/checkbox/widgetCheckbox.c +++ b/widgets/checkbox/widgetCheckbox.c @@ -13,7 +13,7 @@ // Focus is shown via a dotted rectangle around the label text (not the box), // matching the Win3.1 convention where the focus indicator wraps the label. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define CHECKBOX_BOX_SIZE 12 #define CHECKBOX_GAP 4 diff --git a/widgets/widgetComboBox.h b/widgets/comboBox/comboBox.h similarity index 83% rename from widgets/widgetComboBox.h rename to widgets/comboBox/comboBox.h index 92d1224..4a86d93 100644 --- a/widgets/widgetComboBox.h +++ b/widgets/comboBox/comboBox.h @@ -1,8 +1,8 @@ -// widgetComboBox.h -- ComboBox widget API -#ifndef WIDGET_COMBOBOX_H -#define WIDGET_COMBOBOX_H +// comboBox.h -- ComboBox widget API +#ifndef COMBOBOX_H +#define COMBOBOX_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, int32_t maxLen); @@ -22,4 +22,4 @@ static inline const ComboBoxApiT *dvxComboBoxApi(void) { #define wgtComboBoxGetSelected(w) dvxComboBoxApi()->getSelected(w) #define wgtComboBoxSetSelected(w, idx) dvxComboBoxApi()->setSelected(w, idx) -#endif // WIDGET_COMBOBOX_H +#endif // COMBOBOX_H diff --git a/widgets/comboBox/widgetComboBox.c b/widgets/comboBox/widgetComboBox.c index 3aec805..be3a1f3 100644 --- a/widgets/comboBox/widgetComboBox.c +++ b/widgets/comboBox/widgetComboBox.c @@ -21,7 +21,7 @@ // double-click (word select), and triple-click (select all). Drag-select // is tracked via the sDragWidget global. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../texthelp/textHelp.h" #include "../listhelp/listHelp.h" diff --git a/widgets/widgetDataCtrl.h b/widgets/dataCtrl/dataCtrl.h similarity index 93% rename from widgets/widgetDataCtrl.h rename to widgets/dataCtrl/dataCtrl.h index 156d242..500f840 100644 --- a/widgets/widgetDataCtrl.h +++ b/widgets/dataCtrl/dataCtrl.h @@ -1,9 +1,9 @@ -// widgetDataCtrl.h -- VB3-style Data control for database binding +// dataCtrl.h -- VB3-style Data control for database binding -#ifndef WIDGET_DATACTRL_H -#define WIDGET_DATACTRL_H +#ifndef DATACTRL_H +#define DATACTRL_H -#include "dvxWidget.h" +#include "dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -49,4 +49,4 @@ static inline const DataCtrlApiT *dvxDataCtrlApi(void) { #define wgtDataCtrlGetCellText(w, r, c) dvxDataCtrlApi()->getCellText(w, r, c) #define wgtDataCtrlSetCurrentRow(w, row) dvxDataCtrlApi()->setCurrentRow(w, row) -#endif // WIDGET_DATACTRL_H +#endif // DATACTRL_H diff --git a/widgets/dataCtrl/widgetDataCtrl.c b/widgets/dataCtrl/widgetDataCtrl.c index ebc051f..3e9bfdd 100644 --- a/widgets/dataCtrl/widgetDataCtrl.c +++ b/widgets/dataCtrl/widgetDataCtrl.c @@ -10,7 +10,7 @@ // Depends on the dvxsql library DXE (via datactrl.dep) so all // dvxSql* functions are resolved at load time. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../../sql/dvxSql.h" #include "thirdparty/stb_ds_wrap.h" diff --git a/widgets/widgetDbGrid.h b/widgets/dbGrid/dbGrid.h similarity index 89% rename from widgets/widgetDbGrid.h rename to widgets/dbGrid/dbGrid.h index 6680b33..5fffe57 100644 --- a/widgets/widgetDbGrid.h +++ b/widgets/dbGrid/dbGrid.h @@ -1,9 +1,9 @@ -// widgetDbGrid.h -- Database grid widget API +// dbGrid.h -- Database grid widget API -#ifndef WIDGET_DBGRID_H -#define WIDGET_DBGRID_H +#ifndef DBGRID_H +#define DBGRID_H -#include "dvxWidget.h" +#include "dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -27,4 +27,4 @@ static inline const DbGridApiT *dvxDbGridApi(void) { #define wgtDbGridSetColumnWidth(w, field, width) dvxDbGridApi()->setColumnWidth(w, field, width) #define wgtDbGridGetSelectedRow(w) dvxDbGridApi()->getSelectedRow(w) -#endif // WIDGET_DBGRID_H +#endif // DBGRID_H diff --git a/widgets/dbGrid/widgetDbGrid.c b/widgets/dbGrid/widgetDbGrid.c index 12b5c3b..9c03c28 100644 --- a/widgets/dbGrid/widgetDbGrid.c +++ b/widgets/dbGrid/widgetDbGrid.c @@ -14,8 +14,8 @@ // // Depends on the datactrl widget DXE for the DataCtrlApiT. -#include "dvxWidgetPlugin.h" -#include "../widgetDataCtrl.h" +#include "dvxWgtP.h" +#include "../dataCtrl/dataCtrl.h" #include #include diff --git a/widgets/widgetDropdown.h b/widgets/dropdown/dropdown.h similarity index 83% rename from widgets/widgetDropdown.h rename to widgets/dropdown/dropdown.h index e4d9c0b..656eca4 100644 --- a/widgets/widgetDropdown.h +++ b/widgets/dropdown/dropdown.h @@ -1,8 +1,8 @@ -// widgetDropdown.h -- Dropdown widget API -#ifndef WIDGET_DROPDOWN_H -#define WIDGET_DROPDOWN_H +// dropdown.h -- Dropdown widget API +#ifndef DROPDOWN_H +#define DROPDOWN_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -22,4 +22,4 @@ static inline const DropdownApiT *dvxDropdownApi(void) { #define wgtDropdownGetSelected(w) dvxDropdownApi()->getSelected(w) #define wgtDropdownSetSelected(w, idx) dvxDropdownApi()->setSelected(w, idx) -#endif // WIDGET_DROPDOWN_H +#endif // DROPDOWN_H diff --git a/widgets/dropdown/widgetDropdown.c b/widgets/dropdown/widgetDropdown.c index 94aaa52..91e1797 100644 --- a/widgets/dropdown/widgetDropdown.c +++ b/widgets/dropdown/widgetDropdown.c @@ -19,7 +19,7 @@ // Popup overlay painting and hit testing are shared with ComboBox via // widgetDropdownPopupRect and widgetPaintPopupList in widgetCore.c. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../texthelp/textHelp.h" #include "../listhelp/listHelp.h" diff --git a/widgets/widgetImage.h b/widgets/image/image.h similarity index 86% rename from widgets/widgetImage.h rename to widgets/image/image.h index f44501c..d695098 100644 --- a/widgets/widgetImage.h +++ b/widgets/image/image.h @@ -1,8 +1,8 @@ -// widgetImage.h -- Image widget API -#ifndef WIDGET_IMAGE_H -#define WIDGET_IMAGE_H +// image.h -- Image widget API +#ifndef IMAGE_H +#define IMAGE_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, uint8_t *data, int32_t w, int32_t h, int32_t pitch); @@ -22,4 +22,4 @@ static inline const ImageApiT *dvxImageApi(void) { #define wgtImageSetData(w, data, imgW, imgH, pitch) dvxImageApi()->setData(w, data, imgW, imgH, pitch) #define wgtImageLoadFile(w, path) dvxImageApi()->loadFile(w, path) -#endif // WIDGET_IMAGE_H +#endif // IMAGE_H diff --git a/widgets/image/widgetImage.c b/widgets/image/widgetImage.c index 57cdef4..2639a1c 100644 --- a/widgets/image/widgetImage.c +++ b/widgets/image/widgetImage.c @@ -17,7 +17,7 @@ // No border or bevel is drawn -- the image fills its widget bounds with // centering if the widget is larger than the image. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetImageButton.h b/widgets/imageButton/imgBtn.h similarity index 85% rename from widgets/widgetImageButton.h rename to widgets/imageButton/imgBtn.h index f3943ed..47aa5b5 100644 --- a/widgets/widgetImageButton.h +++ b/widgets/imageButton/imgBtn.h @@ -1,8 +1,8 @@ -// widgetImageButton.h -- ImageButton widget API -#ifndef WIDGET_IMAGEBUTTON_H -#define WIDGET_IMAGEBUTTON_H +// imgBtn.h -- ImageButton widget API +#ifndef IMGBTN_H +#define IMGBTN_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, uint8_t *data, int32_t w, int32_t h, int32_t pitch); @@ -22,4 +22,4 @@ static inline const ImageButtonApiT *dvxImageButtonApi(void) { #define wgtImageButtonSetData(w, data, imgW, imgH, pitch) dvxImageButtonApi()->setData(w, data, imgW, imgH, pitch) #define wgtImageButtonLoadFile(w, path) dvxImageButtonApi()->loadFile(w, path) -#endif // WIDGET_IMAGEBUTTON_H +#endif // IMGBTN_H diff --git a/widgets/imageButton/widgetImageButton.c b/widgets/imageButton/widgetImageButton.c index fc1dee9..cb828b7 100644 --- a/widgets/imageButton/widgetImageButton.c +++ b/widgets/imageButton/widgetImageButton.c @@ -17,7 +17,7 @@ // the 2px bevel on each side -- no extra padding is added beyond that, // keeping image buttons compact for toolbar use. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetLabel.h b/widgets/label/label.h similarity index 76% rename from widgets/widgetLabel.h rename to widgets/label/label.h index 028850e..dc74403 100644 --- a/widgets/widgetLabel.h +++ b/widgets/label/label.h @@ -1,8 +1,8 @@ -// widgetLabel.h -- Label widget API -#ifndef WIDGET_LABEL_H -#define WIDGET_LABEL_H +// label.h -- Label widget API +#ifndef LABEL_H +#define LABEL_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, const char *text); @@ -18,4 +18,4 @@ static inline const LabelApiT *dvxLabelApi(void) { #define wgtLabel(parent, text) dvxLabelApi()->create(parent, text) #define wgtLabelSetAlign(w, align) dvxLabelApi()->setAlign(w, align) -#endif // WIDGET_LABEL_H +#endif // LABEL_H diff --git a/widgets/label/widgetLabel.c b/widgets/label/widgetLabel.c index 329bbea..9f7d806 100644 --- a/widgets/label/widgetLabel.c +++ b/widgets/label/widgetLabel.c @@ -16,7 +16,7 @@ // content background color from the color scheme). The +1 in calcMinH adds a // pixel of breathing room below the text baseline. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetListBox.h b/widgets/listBox/listBox.h similarity index 91% rename from widgets/widgetListBox.h rename to widgets/listBox/listBox.h index 83a6aa9..3c02759 100644 --- a/widgets/widgetListBox.h +++ b/widgets/listBox/listBox.h @@ -1,8 +1,8 @@ -// widgetListBox.h -- ListBox widget API -#ifndef WIDGET_LISTBOX_H -#define WIDGET_LISTBOX_H +// listBox.h -- ListBox widget API +#ifndef LISTBOX_H +#define LISTBOX_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -34,4 +34,4 @@ static inline const ListBoxApiT *dvxListBoxApi(void) { #define wgtListBoxClearSelection(w) dvxListBoxApi()->clearSelection(w) #define wgtListBoxSetReorderable(w, reorderable) dvxListBoxApi()->setReorderable(w, reorderable) -#endif // WIDGET_LISTBOX_H +#endif // LISTBOX_H diff --git a/widgets/listBox/widgetListBox.c b/widgets/listBox/widgetListBox.c index 256f976..3987083 100644 --- a/widgets/listBox/widgetListBox.c +++ b/widgets/listBox/widgetListBox.c @@ -28,7 +28,7 @@ // and a 2px horizontal line indicator shows the insertion point. The actual // reordering is handled by the application's onReorder callback. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../listhelp/listHelp.h" #define LISTBOX_BORDER 2 diff --git a/widgets/widgetListView.h b/widgets/listView/listView.h similarity index 91% rename from widgets/widgetListView.h rename to widgets/listView/listView.h index a36abb3..3c2001b 100644 --- a/widgets/widgetListView.h +++ b/widgets/listView/listView.h @@ -1,12 +1,12 @@ -// widgetListView.h -- ListView widget API +// listView.h -- ListView widget API // // Include this header in app/shell code that uses the ListView widget. // Column types (ListViewColT, ListViewAlignE, ListViewSortE) are -// defined in dvxWidget.h so widget DXEs can reference them. -#ifndef WIDGET_LISTVIEW_H -#define WIDGET_LISTVIEW_H +// defined in dvxWgt.h so widget DXEs can reference them. +#ifndef LISTVIEW_H +#define LISTVIEW_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -44,4 +44,4 @@ static inline const ListViewApiT *dvxListViewApi(void) { #define wgtListViewClearSelection(w) dvxListViewApi()->clearSelection(w) #define wgtListViewSetReorderable(w, reorderable) dvxListViewApi()->setReorderable(w, reorderable) -#endif // WIDGET_LISTVIEW_H +#endif // LISTVIEW_H diff --git a/widgets/listView/widgetListView.c b/widgets/listView/widgetListView.c index 956137c..5c7dd6e 100644 --- a/widgets/listView/widgetListView.c +++ b/widgets/listView/widgetListView.c @@ -49,7 +49,7 @@ // may trigger the vertical scrollbar to appear (and vice versa) -- this // two-pass logic handles the interdependency correctly. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../listhelp/listHelp.h" #define LISTVIEW_BORDER 2 diff --git a/widgets/widgetProgressBar.h b/widgets/progressBar/progress.h similarity index 81% rename from widgets/widgetProgressBar.h rename to widgets/progressBar/progress.h index 653ef82..2cb481e 100644 --- a/widgets/widgetProgressBar.h +++ b/widgets/progressBar/progress.h @@ -1,8 +1,8 @@ -// widgetProgressBar.h -- ProgressBar widget API -#ifndef WIDGET_PROGRESSBAR_H -#define WIDGET_PROGRESSBAR_H +// progress.h -- ProgressBar widget API +#ifndef PROGRESS_H +#define PROGRESS_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -22,4 +22,4 @@ static inline const ProgressBarApiT *dvxProgressBarApi(void) { #define wgtProgressBarSetValue(w, value) dvxProgressBarApi()->setValue(w, value) #define wgtProgressBarGetValue(w) dvxProgressBarApi()->getValue(w) -#endif // WIDGET_PROGRESSBAR_H +#endif // PROGRESS_H diff --git a/widgets/progressBar/widgetProgressBar.c b/widgets/progressBar/widgetProgressBar.c index b0d3883..0f81cba 100644 --- a/widgets/progressBar/widgetProgressBar.c +++ b/widgets/progressBar/widgetProgressBar.c @@ -15,7 +15,7 @@ // The widget has no mouse or keyboard handlers -- it is purely display. // Value is controlled externally through the set/get API. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetRadio.h b/widgets/radio/radio.h similarity index 83% rename from widgets/widgetRadio.h rename to widgets/radio/radio.h index 7c71852..05714a1 100644 --- a/widgets/widgetRadio.h +++ b/widgets/radio/radio.h @@ -1,8 +1,8 @@ -// widgetRadio.h -- Radio button widget API -#ifndef WIDGET_RADIO_H -#define WIDGET_RADIO_H +// radio.h -- Radio button widget API +#ifndef RADIO_H +#define RADIO_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*group)(WidgetT *parent); @@ -22,4 +22,4 @@ static inline const RadioApiT *dvxRadioApi(void) { #define wgtRadioGroupSetSelected(w, idx) dvxRadioApi()->groupSetSelected(w, idx) #define wgtRadioGetIndex(w) dvxRadioApi()->getIndex(w) -#endif // WIDGET_RADIO_H +#endif // RADIO_H diff --git a/widgets/radio/widgetRadio.c b/widgets/radio/widgetRadio.c index aacb00c..728dbeb 100644 --- a/widgets/radio/widgetRadio.c +++ b/widgets/radio/widgetRadio.c @@ -22,7 +22,7 @@ // focus AND selection together (standard radio group behavior -- // focus and selection are coupled, unlike checkboxes). -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define CHECKBOX_BOX_SIZE 12 #define CHECKBOX_GAP 4 diff --git a/widgets/widgetScrollPane.h b/widgets/scrollPane/scrlPane.h similarity index 82% rename from widgets/widgetScrollPane.h rename to widgets/scrollPane/scrlPane.h index c383f94..3601e03 100644 --- a/widgets/widgetScrollPane.h +++ b/widgets/scrollPane/scrlPane.h @@ -1,8 +1,8 @@ -// widgetScrollPane.h -- ScrollPane widget API -#ifndef WIDGET_SCROLLPANE_H -#define WIDGET_SCROLLPANE_H +// scrlPane.h -- ScrollPane widget API +#ifndef SCRLPANE_H +#define SCRLPANE_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -22,4 +22,4 @@ static inline const ScrollPaneApiT *dvxScrollPaneApi(void) { #define wgtScrollPaneSetNoBorder(w, noBorder) dvxScrollPaneApi()->setNoBorder((w), (noBorder)) #define wgtScrollPaneScrollToTop(w) dvxScrollPaneApi()->scrollToTop(w) -#endif // WIDGET_SCROLLPANE_H +#endif // SCRLPANE_H diff --git a/widgets/scrollPane/widgetScrollPane.c b/widgets/scrollPane/widgetScrollPane.c index a095909..19d05d2 100644 --- a/widgets/scrollPane/widgetScrollPane.c +++ b/widgets/scrollPane/widgetScrollPane.c @@ -28,7 +28,7 @@ // This is a minor duplication tradeoff for allowing different scrollbar // widths in different contexts. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetSeparator.h b/widgets/separator/separatr.h similarity index 73% rename from widgets/widgetSeparator.h rename to widgets/separator/separatr.h index c70fc3e..1a874d6 100644 --- a/widgets/widgetSeparator.h +++ b/widgets/separator/separatr.h @@ -1,8 +1,8 @@ -// widgetSeparator.h -- Separator widget API -#ifndef WIDGET_SEPARATOR_H -#define WIDGET_SEPARATOR_H +// separatr.h -- Separator widget API +#ifndef SEPARATR_H +#define SEPARATR_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*hSeparator)(WidgetT *parent); @@ -18,4 +18,4 @@ static inline const SeparatorApiT *dvxSeparatorApi(void) { #define wgtHSeparator(parent) dvxSeparatorApi()->hSeparator(parent) #define wgtVSeparator(parent) dvxSeparatorApi()->vSeparator(parent) -#endif // WIDGET_SEPARATOR_H +#endif // SEPARATR_H diff --git a/widgets/separator/widgetSeparator.c b/widgets/separator/widgetSeparator.c index bbefcf4..959e436 100644 --- a/widgets/separator/widgetSeparator.c +++ b/widgets/separator/widgetSeparator.c @@ -18,7 +18,7 @@ // // No mouse/key handlers -- purely decorative, non-focusable. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define SEPARATOR_THICKNESS 2 diff --git a/widgets/widgetSlider.h b/widgets/slider/slider.h similarity index 80% rename from widgets/widgetSlider.h rename to widgets/slider/slider.h index 08f5b62..94dfd37 100644 --- a/widgets/widgetSlider.h +++ b/widgets/slider/slider.h @@ -1,8 +1,8 @@ -// widgetSlider.h -- Slider widget API -#ifndef WIDGET_SLIDER_H -#define WIDGET_SLIDER_H +// slider.h -- Slider widget API +#ifndef SLIDER_H +#define SLIDER_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, int32_t minVal, int32_t maxVal); @@ -20,4 +20,4 @@ static inline const SliderApiT *dvxSliderApi(void) { #define wgtSliderSetValue(w, value) dvxSliderApi()->setValue(w, value) #define wgtSliderGetValue(w) dvxSliderApi()->getValue(w) -#endif // WIDGET_SLIDER_H +#endif // SLIDER_H diff --git a/widgets/slider/widgetSlider.c b/widgets/slider/widgetSlider.c index 6732454..5eb4399 100644 --- a/widgets/slider/widgetSlider.c +++ b/widgets/slider/widgetSlider.c @@ -21,7 +21,7 @@ // Home/End jump to min/max. This gives ~100 keyboard steps regardless // of the actual value range. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define SLIDER_TRACK_H 4 #define SLIDER_THUMB_W 11 diff --git a/widgets/widgetSpacer.h b/widgets/spacer/spacer.h similarity index 67% rename from widgets/widgetSpacer.h rename to widgets/spacer/spacer.h index 5e792f1..ad3267a 100644 --- a/widgets/widgetSpacer.h +++ b/widgets/spacer/spacer.h @@ -1,8 +1,8 @@ -// widgetSpacer.h -- Spacer widget API -#ifndef WIDGET_SPACER_H -#define WIDGET_SPACER_H +// spacer.h -- Spacer widget API +#ifndef SPACER_H +#define SPACER_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -16,4 +16,4 @@ static inline const SpacerApiT *dvxSpacerApi(void) { #define wgtSpacer(parent) dvxSpacerApi()->create(parent) -#endif // WIDGET_SPACER_H +#endif // SPACER_H diff --git a/widgets/spacer/widgetSpacer.c b/widgets/spacer/widgetSpacer.c index f4e6c5c..4253cd4 100644 --- a/widgets/spacer/widgetSpacer.c +++ b/widgets/spacer/widgetSpacer.c @@ -13,7 +13,7 @@ // no mouse, no keyboard, no state. The entire widget is effectively // just a weight value attached to a position in the sibling list. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetSpinner.h b/widgets/spinner/spinner.h similarity index 92% rename from widgets/widgetSpinner.h rename to widgets/spinner/spinner.h index 1b85624..a85d362 100644 --- a/widgets/widgetSpinner.h +++ b/widgets/spinner/spinner.h @@ -1,8 +1,8 @@ -// widgetSpinner.h -- Spinner widget API -#ifndef WIDGET_SPINNER_H -#define WIDGET_SPINNER_H +// spinner.h -- Spinner widget API +#ifndef SPINNER_H +#define SPINNER_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, int32_t minVal, int32_t maxVal, int32_t step); @@ -36,4 +36,4 @@ static inline const SpinnerApiT *dvxSpinnerApi(void) { #define wgtSpinnerSetRealStep(w, step) dvxSpinnerApi()->setRealStep(w, step) #define wgtSpinnerSetDecimals(w, decimals) dvxSpinnerApi()->setDecimals(w, decimals) -#endif // WIDGET_SPINNER_H +#endif // SPINNER_H diff --git a/widgets/spinner/widgetSpinner.c b/widgets/spinner/widgetSpinner.c index e76675b..9128fe0 100644 --- a/widgets/spinner/widgetSpinner.c +++ b/widgets/spinner/widgetSpinner.c @@ -35,7 +35,7 @@ // look like they're part of the border chrome. The up/down buttons // split the widget height evenly. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../texthelp/textHelp.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetSplitter.h b/widgets/splitter/splitter.h similarity index 79% rename from widgets/widgetSplitter.h rename to widgets/splitter/splitter.h index db29d3b..e834931 100644 --- a/widgets/widgetSplitter.h +++ b/widgets/splitter/splitter.h @@ -1,8 +1,8 @@ -// widgetSplitter.h -- Splitter widget API -#ifndef WIDGET_SPLITTER_H -#define WIDGET_SPLITTER_H +// splitter.h -- Splitter widget API +#ifndef SPLITTER_H +#define SPLITTER_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, bool vertical); @@ -20,4 +20,4 @@ static inline const SplitterApiT *dvxSplitterApi(void) { #define wgtSplitterSetPos(w, pos) dvxSplitterApi()->setPos(w, pos) #define wgtSplitterGetPos(w) dvxSplitterApi()->getPos(w) -#endif // WIDGET_SPLITTER_H +#endif // SPLITTER_H diff --git a/widgets/splitter/widgetSplitter.c b/widgets/splitter/widgetSplitter.c index 0b6e007..5ffc9a8 100644 --- a/widgets/splitter/widgetSplitter.c +++ b/widgets/splitter/widgetSplitter.c @@ -28,7 +28,7 @@ // nothing. The clamp also ensures the divider can't be dragged past // where the second pane would violate its minimum. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define SPLITTER_BAR_W 5 #define SPLITTER_MIN_PANE 20 diff --git a/widgets/widgetStatusBar.h b/widgets/statusBar/statBar.h similarity index 67% rename from widgets/widgetStatusBar.h rename to widgets/statusBar/statBar.h index a0ade0e..040032c 100644 --- a/widgets/widgetStatusBar.h +++ b/widgets/statusBar/statBar.h @@ -1,8 +1,8 @@ -// widgetStatusBar.h -- StatusBar widget API -#ifndef WIDGET_STATUSBAR_H -#define WIDGET_STATUSBAR_H +// statBar.h -- StatusBar widget API +#ifndef STATBAR_H +#define STATBAR_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -16,4 +16,4 @@ static inline const StatusBarApiT *dvxStatusBarApi(void) { #define wgtStatusBar(parent) dvxStatusBarApi()->create(parent) -#endif // WIDGET_STATUSBAR_H +#endif // STATBAR_H diff --git a/widgets/statusBar/widgetStatusBar.c b/widgets/statusBar/widgetStatusBar.c index a15b5d2..e76ca02 100644 --- a/widgets/statusBar/widgetStatusBar.c +++ b/widgets/statusBar/widgetStatusBar.c @@ -17,7 +17,7 @@ // No mouse/key handlers -- the status bar is purely display. Children // that are interactive (e.g., a clickable label) handle their own events. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define TOOLBAR_PAD 2 #define TOOLBAR_GAP 2 diff --git a/widgets/widgetTabControl.h b/widgets/tabControl/tabCtrl.h similarity index 81% rename from widgets/widgetTabControl.h rename to widgets/tabControl/tabCtrl.h index 1170b8c..c2f86f3 100644 --- a/widgets/widgetTabControl.h +++ b/widgets/tabControl/tabCtrl.h @@ -1,8 +1,8 @@ -// widgetTabControl.h -- TabControl widget API -#ifndef WIDGET_TABCONTROL_H -#define WIDGET_TABCONTROL_H +// tabCtrl.h -- TabControl widget API +#ifndef TABCTRL_H +#define TABCTRL_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -22,4 +22,4 @@ static inline const TabControlApiT *dvxTabControlApi(void) { #define wgtTabControlSetActive(w, idx) dvxTabControlApi()->setActive(w, idx) #define wgtTabControlGetActive(w) dvxTabControlApi()->getActive(w) -#endif // WIDGET_TABCONTROL_H +#endif // TABCTRL_H diff --git a/widgets/tabControl/widgetTabControl.c b/widgets/tabControl/widgetTabControl.c index 095b4ec..0664a1c 100644 --- a/widgets/tabControl/widgetTabControl.c +++ b/widgets/tabControl/widgetTabControl.c @@ -31,7 +31,7 @@ // layout computation for hidden pages. When switching tabs, the old // page becomes invisible and the new page becomes visible + relaid out. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define TAB_PAD_H 8 #define TAB_PAD_V 4 diff --git a/widgets/widgetTextInput.h b/widgets/textInput/textInpt.h similarity index 95% rename from widgets/widgetTextInput.h rename to widgets/textInput/textInpt.h index 345c278..22837ab 100644 --- a/widgets/widgetTextInput.h +++ b/widgets/textInput/textInpt.h @@ -1,8 +1,8 @@ -// widgetTextInput.h -- Text input widget API -#ifndef WIDGET_TEXTINPUT_H -#define WIDGET_TEXTINPUT_H +// textInpt.h -- Text input widget API +#ifndef TEXTINPT_H +#define TEXTINPT_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" // Colorize callback: called for each visible line during paint. // line: pointer into the buffer (NOT null-terminated). @@ -55,4 +55,4 @@ static inline const TextInputApiT *dvxTextInputApi(void) { #define wgtTextAreaGetCursorLine(w) dvxTextInputApi()->getCursorLine(w) #define wgtTextAreaSetGutterClick(w, fn) dvxTextInputApi()->setGutterClick(w, fn) -#endif // WIDGET_TEXTINPUT_H +#endif // TEXTINPT_H diff --git a/widgets/textInput/widgetTextInput.c b/widgets/textInput/widgetTextInput.c index e2bbd3b..983b085 100644 --- a/widgets/textInput/widgetTextInput.c +++ b/widgets/textInput/widgetTextInput.c @@ -55,7 +55,7 @@ // Password mode: renders bullets instead of characters (CP437 0xF9) // and blocks copy/cut operations for security. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include "../texthelp/textHelp.h" static int32_t sTextInputTypeId = -1; diff --git a/widgets/widgetTimer.h b/widgets/timer/timer.h similarity index 87% rename from widgets/widgetTimer.h rename to widgets/timer/timer.h index cd76af8..25595fc 100644 --- a/widgets/widgetTimer.h +++ b/widgets/timer/timer.h @@ -1,8 +1,8 @@ -// widgetTimer.h -- Timer widget API -#ifndef WIDGET_TIMER_H -#define WIDGET_TIMER_H +// timer.h -- Timer widget API +#ifndef TIMER_H +#define TIMER_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent, int32_t intervalMs, bool repeat); @@ -26,4 +26,4 @@ static inline const TimerApiT *dvxTimerApi(void) { #define wgtTimerIsRunning(w) dvxTimerApi()->isRunning(w) #define wgtUpdateTimers() do { const TimerApiT *_ta = dvxTimerApi(); if (_ta) { _ta->updateTimers(); } } while(0) -#endif // WIDGET_TIMER_H +#endif // TIMER_H diff --git a/widgets/timer/widgetTimer.c b/widgets/timer/widgetTimer.c index 99904fa..2b5c54d 100644 --- a/widgets/timer/widgetTimer.c +++ b/widgets/timer/widgetTimer.c @@ -9,7 +9,7 @@ // stb_ds dynamic array) so wgtUpdateTimers can check only timers, not // walk the entire widget tree each frame. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" static int32_t sTypeId = -1; diff --git a/widgets/widgetToolbar.h b/widgets/toolbar/toolbar.h similarity index 67% rename from widgets/widgetToolbar.h rename to widgets/toolbar/toolbar.h index 06517cb..277169f 100644 --- a/widgets/widgetToolbar.h +++ b/widgets/toolbar/toolbar.h @@ -1,8 +1,8 @@ -// widgetToolbar.h -- Toolbar widget API -#ifndef WIDGET_TOOLBAR_H -#define WIDGET_TOOLBAR_H +// toolbar.h -- Toolbar widget API +#ifndef TOOLBAR_H +#define TOOLBAR_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -16,4 +16,4 @@ static inline const ToolbarApiT *dvxToolbarApi(void) { #define wgtToolbar(parent) dvxToolbarApi()->create(parent) -#endif // WIDGET_TOOLBAR_H +#endif // TOOLBAR_H diff --git a/widgets/toolbar/widgetToolbar.c b/widgets/toolbar/widgetToolbar.c index 9b82fab..ee9ea33 100644 --- a/widgets/toolbar/widgetToolbar.c +++ b/widgets/toolbar/widgetToolbar.c @@ -16,7 +16,7 @@ // consistency between top and bottom chrome bars. Children (typically // ImageButtons or small Buttons) handle their own mouse/key events. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define TOOLBAR_PAD 2 #define TOOLBAR_GAP 2 diff --git a/widgets/widgetTreeView.h b/widgets/treeView/treeView.h similarity index 91% rename from widgets/widgetTreeView.h rename to widgets/treeView/treeView.h index 4082555..99b8b27 100644 --- a/widgets/widgetTreeView.h +++ b/widgets/treeView/treeView.h @@ -1,8 +1,8 @@ -// widgetTreeView.h -- TreeView widget API -#ifndef WIDGET_TREEVIEW_H -#define WIDGET_TREEVIEW_H +// treeView.h -- TreeView widget API +#ifndef TREEVIEW_H +#define TREEVIEW_H -#include "../core/dvxWidget.h" +#include "../../core/dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -34,4 +34,4 @@ static inline const TreeViewApiT *dvxTreeViewApi(void) { #define wgtTreeItemIsSelected(w) dvxTreeViewApi()->itemIsSelected(w) #define wgtTreeItemSetSelected(w, selected) dvxTreeViewApi()->itemSetSelected(w, selected) -#endif // WIDGET_TREEVIEW_H +#endif // TREEVIEW_H diff --git a/widgets/treeView/widgetTreeView.c b/widgets/treeView/widgetTreeView.c index 8dd0398..8a93524 100644 --- a/widgets/treeView/widgetTreeView.c +++ b/widgets/treeView/widgetTreeView.c @@ -48,7 +48,7 @@ // (dimsValid = false) whenever the tree structure changes: item add/ // remove, expand/collapse, text change, or drag-reorder. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #define TREE_INDENT 16 #define TREE_EXPAND_SIZE 9 diff --git a/widgets/wrapBox/widgetWrapBox.c b/widgets/wrapBox/widgetWrapBox.c index 794834f..20ae3f8 100644 --- a/widgets/wrapBox/widgetWrapBox.c +++ b/widgets/wrapBox/widgetWrapBox.c @@ -6,7 +6,7 @@ // child height in that row. Supports spacing between items and // rows. Supports per-row alignment (center, right) for short rows. -#include "dvxWidgetPlugin.h" +#include "dvxWgtP.h" #include #include diff --git a/widgets/widgetWrapBox.h b/widgets/wrapBox/wrapBox.h similarity index 70% rename from widgets/widgetWrapBox.h rename to widgets/wrapBox/wrapBox.h index 79955d5..00ac121 100644 --- a/widgets/widgetWrapBox.h +++ b/widgets/wrapBox/wrapBox.h @@ -1,12 +1,12 @@ -// widgetWrapBox.h -- Flow/wrap layout container +// wrapBox.h -- Flow/wrap layout container // // Lays out children left-to-right, wrapping to the next row when // the available width is exceeded. -#ifndef WIDGET_WRAPBOX_H -#define WIDGET_WRAPBOX_H +#ifndef WRAPBOX_H +#define WRAPBOX_H -#include "dvxWidget.h" +#include "dvxWgt.h" typedef struct { WidgetT *(*create)(WidgetT *parent); @@ -18,4 +18,4 @@ static inline const WrapBoxApiT *dvxWrapBoxApi(void) { #define wgtWrapBox(parent) dvxWrapBoxApi()->create(parent) -#endif // WIDGET_WRAPBOX_H +#endif // WRAPBOX_H