Mercurial > godwindows
changeset 108:279735652a39
Add Feature test display to the two dw(oo)test programs.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Thu, 11 Nov 2021 15:35:31 -0600 |
parents | 14e1582e6297 |
children | d121081ebf09 |
files | dw/dw.go dwootest/dwootest.go dwtest/dwtest.go |
diffstat | 3 files changed, 87 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/dw/dw.go Tue Nov 09 09:12:23 2021 -0600 +++ b/dw/dw.go Thu Nov 11 15:35:31 2021 -0600 @@ -431,6 +431,12 @@ var VK_LCONTROL = int(C.VK_LCONTROL) var VK_RCONTROL = int(C.VK_RCONTROL) +/* Some dark mode constants for supported platforms */ +var DARK_MODE_DISABLED = int(C.DW_DARK_MODE_DISABLED) +var DARK_MODE_BASIC = int(C.DW_DARK_MODE_BASIC) +var DARK_MODE_FULL = int(C.DW_DARK_MODE_FULL) +var DARK_MODE_FORCED = int(C.DW_DARK_MODE_FORCED) + /* Feature constants */ var FEATURE_UNSUPPORTED = int(C.DW_FEATURE_UNSUPPORTED) var FEATURE_ENABLED = int(C.DW_FEATURE_ENABLED) @@ -452,6 +458,7 @@ var FEATURE_TASK_BAR = int(C.DW_FEATURE_TASK_BAR) var FEATURE_TREE = int(C.DW_FEATURE_TREE) var FEATURE_WINDOW_PLACEMENT = int(C.DW_FEATURE_WINDOW_PLACEMENT) +var FEATURE_MAX = int(C.DW_FEATURE_MAX) // Convert a resource ID into a pointer func RESOURCE(id uintptr) unsafe.Pointer {
--- a/dwootest/dwootest.go Tue Nov 09 09:12:23 2021 -0600 +++ b/dwootest/dwootest.go Thu Nov 11 15:35:31 2021 -0600 @@ -1399,6 +1399,24 @@ } func main() { + DWFeatureList := []string{ + "Supports the HTML Widget", + "Supports the DW_SIGNAL_HTML_RESULT callback", + "Supports custom window border sizes", + "Supports window frame transparency", + "Supports Dark Mode user interface", + "Supports auto completion in Multi-line Edit boxes", + "Supports word wrapping in Multi-line Edit boxes", + "Supports striped line display in container widgets", + "Supports Multiple Document Interface window frame", + "Supports status text area on notebook/tabbed controls", + "Supports sending system notifications", + "Supports UTF8 encoded Unicode text", + "Supports Rich Edit based MLE control (Windows)", + "Supports icons in the taskbar or similar system widget", + "Supports the Tree Widget", + "Supports arbitrary window placement"} + /* Pick an approriate font for our platform */ if runtime.GOOS == "windows" { FIXEDFONT = "10.Lucida Console" @@ -1412,9 +1430,31 @@ SRCROOT = fmt.Sprintf("%s/dwtest", pkg.SrcRoot) } + /* Setup the Application ID for sending notifications */ + dw.App_id_set("org.dbsoft.dwindows.dwtest", "Dynamic Windows Test") + + /* Enable full dark mode on platforms that support it */ + if os.Getenv("DW_DARK_MODE") != "" { + dw.Feature_set(dw.FEATURE_DARK_MODE, dw.DARK_MODE_FULL) + } + /* Initialize the Dynamic Windows engine */ dw.Init(dw.TRUE) + /* Test all the features and display the results */ + for feat := 0; feat < dw.FEATURE_MAX && feat < len(DWFeatureList); feat++ { + result := dw.Feature_get(feat) + status := "Unsupported" + + if result == 0 { + status = "Disabled" + } else if result > 0 { + status = "Enabled" + } + + fmt.Printf("%s: %s (%d)\n", DWFeatureList[feat], status, result) + } + /* Create our window */ mainwindow := dw.WindowNew(dw.DESKTOP, "dwindows test UTF8 中国語 (繁体) cañón", dw.FCF_SYSMENU|dw.FCF_TITLEBAR|dw.FCF_TASKLIST|dw.FCF_DLGBORDER|dw.FCF_SIZEBORDER|dw.FCF_MINMAX)
--- a/dwtest/dwtest.go Tue Nov 09 09:12:23 2021 -0600 +++ b/dwtest/dwtest.go Thu Nov 11 15:35:31 2021 -0600 @@ -1603,6 +1603,24 @@ } func main() { + DWFeatureList := []string{ + "Supports the HTML Widget", + "Supports the DW_SIGNAL_HTML_RESULT callback", + "Supports custom window border sizes", + "Supports window frame transparency", + "Supports Dark Mode user interface", + "Supports auto completion in Multi-line Edit boxes", + "Supports word wrapping in Multi-line Edit boxes", + "Supports striped line display in container widgets", + "Supports Multiple Document Interface window frame", + "Supports status text area on notebook/tabbed controls", + "Supports sending system notifications", + "Supports UTF8 encoded Unicode text", + "Supports Rich Edit based MLE control (Windows)", + "Supports icons in the taskbar or similar system widget", + "Supports the Tree Widget", + "Supports arbitrary window placement"} + /* Pick an approriate font for our platform */ if runtime.GOOS == "windows" { FIXEDFONT = "10.Lucida Console" @@ -1616,9 +1634,31 @@ SRCROOT = fmt.Sprintf("%s/dwtest", pkg.SrcRoot) } + /* Setup the Application ID for sending notifications */ + dw.App_id_set("org.dbsoft.dwindows.dwtest", "Dynamic Windows Test") + + /* Enable full dark mode on platforms that support it */ + if os.Getenv("DW_DARK_MODE") != "" { + dw.Feature_set(dw.FEATURE_DARK_MODE, dw.DARK_MODE_FULL) + } + /* Initialize the Dynamic Windows engine */ dw.Init(dw.TRUE) + /* Test all the features and display the results */ + for feat := 0; feat < dw.FEATURE_MAX && feat < len(DWFeatureList); feat++ { + result := dw.Feature_get(feat) + status := "Unsupported" + + if result == 0 { + status = "Disabled" + } else if result > 0 { + status = "Enabled" + } + + fmt.Printf("%s: %s (%d)\n", DWFeatureList[feat], status, result) + } + /* Create our window */ mainwindow = dw.Window_new(dw.DESKTOP, "dwindows test UTF8 中国語 (繁体) cañón", dw.FCF_SYSMENU|dw.FCF_TITLEBAR|dw.FCF_TASKLIST|dw.FCF_DLGBORDER|dw.FCF_SIZEBORDER|dw.FCF_MINMAX)