diff options
Diffstat (limited to 'toolkit/andlabs/slider.go')
| -rw-r--r-- | toolkit/andlabs/slider.go | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/toolkit/andlabs/slider.go b/toolkit/andlabs/slider.go index f75947a..f31bc25 100644 --- a/toolkit/andlabs/slider.go +++ b/toolkit/andlabs/slider.go @@ -35,13 +35,60 @@ func (t *andlabsT) newSlider(w *toolkit.Widget) *andlabsT { func newSlider(parentW *toolkit.Widget, w *toolkit.Widget) { var newt *andlabsT - log(debugToolkit, "gui.andlabs.NewTab()", w.Name) + log(debugToolkit, "newSlider()", w.Name) t := mapToolkits[parentW] if (t == nil) { - log(debugToolkit, "go.andlabs.NewTab() toolkit struct == nil. name=", parentW.Name, w.Name) + log(debugError, "newSlider() ERROR toolkit struct == nil. name=", parentW.Name, w.Name) return } newt = t.newSlider(w) mapWidgetsToolkits(w, newt) } + +// This routine is very specific to this toolkit +// It's annoying and has to be copied to each widget when there are changes +// it could be 'simplfied' maybe or made to be more generic, but this is as far as I've gotten +// it's probably not worth working much more on this toolkit, the andlabs/ui has been great and got me here! +// but it's time to write direct GTK, QT, macos and windows toolkit plugins +// -- jcarr 2023/03/09 + +func doSlider(p *toolkit.Widget, c *toolkit.Widget) { + if broken(c) { + return + } + log(debugChange, "Going to attempt:", c.Action) + if (c.Action == "New") { + newSlider(p, c) + return + } + ct := mapToolkits[c] + if (ct == nil) { + log(debugError, "Trying to do something on a widget that doesn't work or doesn't exist or something", c) + return + } + if ct.broken() { + log(debugError, "Slider() ct.broken", ct) + return + } + if (ct.uiSlider == nil) { + log(debugError, "Label() uiSlider == nil", ct) + return + } + switch c.Action { + case "Enable": + ct.uiSlider.Enable() + case "Disable": + ct.uiSlider.Disable() + case "Show": + ct.uiSlider.Show() + case "Hide": + ct.uiSlider.Hide() + case "Set": + ct.uiSlider.SetValue(c.I) + case "Get": + c.I = ct.uiSlider.Value() + default: + log(debugError, "Can't do", c.Action, "to a Slider") + } +} |
