summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/dropdown.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-03 14:41:38 -0600
committerJeff Carr <[email protected]>2023-03-03 14:41:38 -0600
commit49202eeafdad8e5780fefdad3d2f87fd4354725e (patch)
tree5d749b5d4835c7a0395bd1f87b5d2d1d91b14a08 /toolkit/andlabs/dropdown.go
parent80317ec89c94beadcbf3775f84c6010b5ceef302 (diff)
release as v0.6.5v0.6.5
good standard release really clean interaction to plugin really clean debug flags implementation common doAppend() idea, but it probably won't work re-implement combobox. this code base almost doesn't suck slider & spinner set values now tab set margin works convert dropdown to Send() lots of other changes to try to implement single line Entry() I guess use golang file names even though internalally the go developers use underscore chars in the actual go sources. Maybe there is a reason for that? go channel debug window does something make a debug window for channels. add sample icons Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/dropdown.go')
-rw-r--r--toolkit/andlabs/dropdown.go73
1 files changed, 57 insertions, 16 deletions
diff --git a/toolkit/andlabs/dropdown.go b/toolkit/andlabs/dropdown.go
index 935741c..57642e0 100644
--- a/toolkit/andlabs/dropdown.go
+++ b/toolkit/andlabs/dropdown.go
@@ -6,9 +6,9 @@ import (
"git.wit.org/wit/gui/toolkit"
)
-func (t *andlabsT) NewDropdown(w *toolkit.Widget) *andlabsT {
+func (t *andlabsT) newDropdown(w *toolkit.Widget) *andlabsT {
var newt andlabsT
- log(debugToolkit, "gui.Toolbox.NewDropdown() START", w.Name)
+ log(debugToolkit, "gui.Toolbox.newDropdown() START", w.Name)
if t.broken() {
return nil
@@ -53,23 +53,10 @@ func (t *andlabsT) AddDropdownName(title string) {
t.c = t.c + 1
}
-func (t andlabsT) SetDropdown(i int) {
+func (t *andlabsT) SetDropdown(i int) {
t.uiCombobox.SetSelected(i)
}
-func NewDropdown(parentW *toolkit.Widget, w *toolkit.Widget) {
- log(debugToolkit, "gui.andlabs.NewDropdown()", w.Name)
-
- t := mapToolkits[parentW]
- if (t == nil) {
- log(debugToolkit, "go.andlabs.NewDropdown() toolkit struct == nil. name=", parentW.Name, w.Name)
- listMap(debugToolkit)
- return
- }
- newt := t.NewDropdown(w)
- mapWidgetsToolkits(w, newt)
-}
-
func AddDropdownName(w *toolkit.Widget, s string) {
log(debugToolkit, "gui.andlabs.AddDropdownName()", w.Name, "add:", s)
@@ -94,3 +81,57 @@ func SetDropdownName(w *toolkit.Widget, s string) {
t.SetDropdown(1)
t.tw.S = s
}
+
+func newDropdown(parentW *toolkit.Widget, w *toolkit.Widget) {
+ log(debugToolkit, "gui.andlabs.newDropdown()", w.Name)
+
+ t := mapToolkits[parentW]
+ if (t == nil) {
+ log(debugToolkit, "go.andlabs.newDropdown() toolkit struct == nil. name=", parentW.Name, w.Name)
+ listMap(debugToolkit)
+ return
+ }
+ newt := t.newDropdown(w)
+ mapWidgetsToolkits(w, newt)
+}
+
+func doDropdown(p *toolkit.Widget, c *toolkit.Widget) {
+ if broken(c) {
+ return
+ }
+ if (c.Action == "New") {
+ newDropdown(p, c)
+ return
+ }
+ ct := mapToolkits[c]
+ if (ct == nil) {
+ log(true, "Trying to do something on a widget that doesn't work or doesn't exist or something", c)
+ return
+ }
+ if ct.broken() {
+ log(true, "Dropdown() ct.broken", ct)
+ return
+ }
+ if (ct.uiCombobox == nil) {
+ log(true, "Dropdown() uiCombobox == nil", ct)
+ return
+ }
+ log(true, "Going to attempt:", c.Action)
+ switch c.Action {
+ case "Add":
+ ct.AddDropdownName(c.S)
+ // ct.uiCombobox.Enable()
+ case "Enable":
+ ct.uiCombobox.Enable()
+ case "Disable":
+ ct.uiCombobox.Disable()
+ case "Show":
+ ct.uiCombobox.Show()
+ case "Hide":
+ ct.uiCombobox.Hide()
+ case "Set":
+ ct.uiCombobox.SetSelected(1)
+ default:
+ log(true, "Can't do", c.Action, "to a Dropdown")
+ }
+}