summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/spinner.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-23 12:35:12 -0500
committerJeff Carr <[email protected]>2023-03-23 12:35:12 -0500
commitd4787a1ebdd08359746516dbb72f1feaf95be5b6 (patch)
treecb81756d61096ccf74af7c8cc9a15e4e00fe1da7 /toolkit/andlabs/spinner.go
parent6a848bf40474365cc1c0b4da9e2f7e3e10b4d627 (diff)
Squashed commit of the following:v0.7.3
boxes now exist and are tracked in the binary tree create for group and grid works gocui plugin no longer works. TODO: fix in next release converted everything from plugin to Action() can remove send() tab and window are now action() flags moved to action() ready for new release pad() margion() border() all work move worked! go.wit.com attept 578th try adds an early grid widget. won't work until chan andlabs/ui grid (X,Y) works right actually can put things in places in a grid Queue() means shit doesn't look right on grids lots of fucking around. why am I wasting time on image? wow. the crazy doAppend() thing is gone implement Action Show() and Hide() Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/spinner.go')
-rw-r--r--toolkit/andlabs/spinner.go64
1 files changed, 8 insertions, 56 deletions
diff --git a/toolkit/andlabs/spinner.go b/toolkit/andlabs/spinner.go
index 2e87541..6a47472 100644
--- a/toolkit/andlabs/spinner.go
+++ b/toolkit/andlabs/spinner.go
@@ -12,16 +12,10 @@ func (t *andlabsT) newSpinner(w *toolkit.Widget) *andlabsT {
log(debugToolkit, "newSpinner()", w.X, w.Y)
var newt andlabsT
- if (t.uiBox == nil) {
- log(debugToolkit, "newSpinner() node.UiBox == nil. I can't add a range UI element without a place to put it")
- return nil
- }
-
s := ui.NewSpinbox(w.X, w.Y)
newt.uiSpinbox = s
- newt.uiBox = t.uiBox
+ newt.uiControl = s
newt.tw = w
- t.uiBox.Append(s, stretchy)
s.OnChanged(func(s *ui.Spinbox) {
newt.tw.I = newt.uiSpinbox.Value()
@@ -31,61 +25,19 @@ func (t *andlabsT) newSpinner(w *toolkit.Widget) *andlabsT {
return &newt
}
-func newSpinner(parentW *toolkit.Widget, w *toolkit.Widget) {
+func newSpinner(a *toolkit.Action) {
var newt *andlabsT
+ w := a.Widget
+ parentW := a.Where
t := mapToolkits[parentW]
if (t == nil) {
log(debugError, "NewSpinner() toolkit struct == nil. name=", parentW.Name, w.Name)
return
}
+ w.X = a.X
+ w.Y = a.Y
newt = t.newSpinner(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 doSpinner(p *toolkit.Widget, c *toolkit.Widget) {
- if broken(c) {
- return
- }
- log(debugChange, "Going to attempt:", c.Action)
- if (c.Action == "New") {
- newSpinner(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, "Spinner() ct.broken", ct)
- return
- }
- if (ct.uiSpinbox == nil) {
- log(debugError, "Label() uiSpinbox == nil", ct)
- return
- }
- switch c.Action {
- case "Enable":
- ct.uiSpinbox.Enable()
- case "Disable":
- ct.uiSpinbox.Disable()
- case "Show":
- ct.uiSpinbox.Show()
- case "Hide":
- ct.uiSpinbox.Hide()
- case "Set":
- ct.uiSpinbox.SetValue(c.I)
- case "Get":
- c.I = ct.uiSpinbox.Value()
- default:
- log(debugError, "Can't do", c.Action, "to a Spinbox")
- }
+ place(a, t, newt)
+ mapWidgetsToolkits(a, newt)
}