diff options
Diffstat (limited to 'toolkit/andlabs')
| -rw-r--r-- | toolkit/andlabs/action.go | 6 | ||||
| -rw-r--r-- | toolkit/andlabs/add.go | 4 | ||||
| -rw-r--r-- | toolkit/andlabs/button.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/checkbox.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/combobox.go | 4 | ||||
| -rw-r--r-- | toolkit/andlabs/common.go | 17 | ||||
| -rw-r--r-- | toolkit/andlabs/delete.go | 6 | ||||
| -rw-r--r-- | toolkit/andlabs/dropdown.go | 4 | ||||
| -rw-r--r-- | toolkit/andlabs/grid.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/group.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/image.go | 9 | ||||
| -rw-r--r-- | toolkit/andlabs/label.go | 7 | ||||
| -rw-r--r-- | toolkit/andlabs/plugin.go | 18 | ||||
| -rw-r--r-- | toolkit/andlabs/slider.go | 10 | ||||
| -rw-r--r-- | toolkit/andlabs/spinner.go | 5 | ||||
| -rw-r--r-- | toolkit/andlabs/structs.go | 5 | ||||
| -rw-r--r-- | toolkit/andlabs/tab.go | 2 | ||||
| -rw-r--r-- | toolkit/andlabs/textbox.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/window.go | 15 |
19 files changed, 65 insertions, 75 deletions
diff --git a/toolkit/andlabs/action.go b/toolkit/andlabs/action.go index 9d098df..10264aa 100644 --- a/toolkit/andlabs/action.go +++ b/toolkit/andlabs/action.go @@ -57,7 +57,7 @@ func pad(a *toolkit.Action) { return } - switch t.Type { + switch t.WidgetType { case toolkit.Group: switch a.ActionType { case toolkit.Margin: @@ -138,7 +138,7 @@ func move(a *toolkit.Action) { return } - switch tParent.Type { + switch tParent.WidgetType { case toolkit.Group: switch a.ActionType { case toolkit.Margin: @@ -202,7 +202,7 @@ func uiDelete(a *toolkit.Action) { return } - switch tParent.Type { + switch tParent.WidgetType { case toolkit.Group: switch a.ActionType { case toolkit.Margin: diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go index b03ee9c..2a1b677 100644 --- a/toolkit/andlabs/add.go +++ b/toolkit/andlabs/add.go @@ -121,7 +121,7 @@ func place(a *toolkit.Action, t *andlabsT, newt *andlabsT) bool { if (andlabs[a.WidgetId] == nil) { log(logInfo, "newTab() MAPPED", a.WidgetId, a.ParentId) andlabs[a.WidgetId] = newt - newt.Type = a.WidgetType + newt.WidgetType = a.WidgetType } else { log(debugError, "newTab() DO WHAT?", a.WidgetId, a.ParentId) log(debugError, "THIS IS BAD") @@ -138,7 +138,7 @@ func place(a *toolkit.Action, t *andlabsT, newt *andlabsT) bool { return false } - switch where.Type { + switch where.WidgetType { case toolkit.Grid: log(debugGrid, "add() Grid try at Parent X,Y =", a.X, a.Y) newt.gridX = a.X diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go index 1f9fdaf..94e2966 100644 --- a/toolkit/andlabs/button.go +++ b/toolkit/andlabs/button.go @@ -24,7 +24,7 @@ func newButton(a *toolkit.Action) { newt.uiButton = b newt.uiControl = b newt.tw = a.Widget - newt.Type = a.WidgetType + newt.WidgetType = a.WidgetType newt.parent = t b.OnClicked(func(*ui.Button) { diff --git a/toolkit/andlabs/checkbox.go b/toolkit/andlabs/checkbox.go index f73a284..69ba060 100644 --- a/toolkit/andlabs/checkbox.go +++ b/toolkit/andlabs/checkbox.go @@ -9,12 +9,14 @@ import ( func (t *andlabsT) newCheckbox(a *toolkit.Action) *andlabsT { var newt andlabsT w := a.Widget - log(debugToolkit, "newCheckbox()", w.Name, w.Type) + log(debugToolkit, "newCheckbox()", a.Name, a.WidgetType) newt.tw = w - newt.Type = w.Type + newt.WidgetType = a.WidgetType newt.wId = a.WidgetId + newt.Name = a.Name + newt.Text = a.Text - newt.uiCheckbox = ui.NewCheckbox(w.Name) + newt.uiCheckbox = ui.NewCheckbox(a.Text) newt.uiControl = newt.uiCheckbox newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) { diff --git a/toolkit/andlabs/combobox.go b/toolkit/andlabs/combobox.go index e7d51a7..100434e 100644 --- a/toolkit/andlabs/combobox.go +++ b/toolkit/andlabs/combobox.go @@ -9,11 +9,11 @@ import ( func (t *andlabsT) newCombobox(a *toolkit.Action) *andlabsT { var newt andlabsT w := a.Widget - log(debugToolkit, "newCombobox() START", w.Name) + log(debugToolkit, "newCombobox() START", a.Name) newt.tw = w newt.wId = a.WidgetId - newt.Type = w.Type + newt.WidgetType = a.WidgetType s := ui.NewEditableCombobox() newt.uiEditableCombobox = s newt.uiControl = s diff --git a/toolkit/andlabs/common.go b/toolkit/andlabs/common.go index 5e1b0fb..cddea3e 100644 --- a/toolkit/andlabs/common.go +++ b/toolkit/andlabs/common.go @@ -5,13 +5,17 @@ import ( ) func (t *andlabsT) commonChange(tw *toolkit.Widget, wId int) { - log(debugChange, "commonChange() START widget =", t.tw.Name, t.tw.Type) + log(debugChange, "commonChange() START widget =", t.Name, t.WidgetType) + if (sendToChan(wId)) { + log(debugChange, "commonChange() END attempted channel worked", t.Name, t.WidgetType) + return + } if (tw == nil) { log(true, "commonChange() What the fuck. there is no widget t.tw == nil") return } if (tw.Custom == nil) { - log(debugChange, "commonChange() END Widget.Custom() = nil", t.tw.Name, t.tw.Type) + log(debugChange, "commonChange() END Widget.Custom() = nil", t.Name, t.WidgetType) return } tw.Custom() @@ -20,16 +24,15 @@ func (t *andlabsT) commonChange(tw *toolkit.Widget, wId int) { log(debugError, "commonChange() ERROR: wId map == nil", wId) return } - sendToChan(wId) - log(debugChange, "commonChange() END Widget.Custom()", t.tw.Name, t.tw.Type) + log(debugChange, "commonChange() END Widget.Custom()", t.Name, t.WidgetType) } -func sendToChan(i int) { +func sendToChan(i int) bool { if (callback == nil) { log(debugError, "commonChange() SHOULD SEND int back here, but callback == nil", i) - return + return false } log(debugError, "commonChange() Running callback() i =", i) - callback(i) + return callback(i) } diff --git a/toolkit/andlabs/delete.go b/toolkit/andlabs/delete.go index 2d2e04a..dc28371 100644 --- a/toolkit/andlabs/delete.go +++ b/toolkit/andlabs/delete.go @@ -18,7 +18,7 @@ func destroy(pId int, cId int) { return } - switch ct.Type { + switch ct.WidgetType { case toolkit.Button: log(true, "Should delete Button here:", ct.Name) log(true, "Parent:") @@ -40,8 +40,8 @@ func destroy(pId int, cId int) { case toolkit.Window: log(true, "Should delete Window here:", ct.Name) default: - log(true, "Don't know how to delete pt =", pt.tw.Type, pt.tw.Name, pt.uiButton) - log(true, "Don't know how to delete ct =", ct.tw.Type, ct.tw.Name, ct.uiButton) + log(true, "Don't know how to delete pt =", pt.WidgetType, pt.Name, pt.uiButton) + log(true, "Don't know how to delete ct =", ct.WidgetType, ct.Name, ct.uiButton) log(true, "Parent:") pt.Dump(true) log(true, "Child:") diff --git a/toolkit/andlabs/dropdown.go b/toolkit/andlabs/dropdown.go index d020ed8..036ed3e 100644 --- a/toolkit/andlabs/dropdown.go +++ b/toolkit/andlabs/dropdown.go @@ -12,7 +12,7 @@ func (t *andlabsT) newDropdown(a *toolkit.Action) *andlabsT { log(debugToolkit, "gui.Toolbox.newDropdown() START", a.Name) newt.tw = w - newt.Type = w.Type + newt.WidgetType = a.WidgetType newt.wId = a.WidgetId s := ui.NewCombobox() newt.uiCombobox = s @@ -60,7 +60,7 @@ func AddDropdownName(a *toolkit.Action) { t := andlabs[a.WidgetId] if (t == nil) { - log(debugToolkit, "go.andlabs.AddDropdownName() toolkit struct == nil. name=", a.Widget.Name, a.S) + log(debugToolkit, "go.andlabs.AddDropdownName() toolkit struct == nil. name=", a.Name, a.S) listMap(debugToolkit) return } diff --git a/toolkit/andlabs/grid.go b/toolkit/andlabs/grid.go index be05b70..2f91c86 100644 --- a/toolkit/andlabs/grid.go +++ b/toolkit/andlabs/grid.go @@ -22,7 +22,7 @@ func newGrid(a *toolkit.Action) { newt.uiGrid = c newt.uiControl = c newt.tw = a.Widget - newt.Type = toolkit.Grid + newt.WidgetType = toolkit.Grid newt.gridX = 0 newt.gridY = 0 diff --git a/toolkit/andlabs/group.go b/toolkit/andlabs/group.go index 0769151..1551d66 100644 --- a/toolkit/andlabs/group.go +++ b/toolkit/andlabs/group.go @@ -8,15 +8,15 @@ import ( ) func newGroup(a *toolkit.Action) { - w := a.Widget - log(debugToolkit, "NewGroup()", w.Name) + // w := a.Widget + log(debugToolkit, "NewGroup()", a.Name) t := andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "NewGroup() toolkit struct == nil. name=", w.Name) + log(debugToolkit, "NewGroup() toolkit struct == nil. name=", a.Name) listMap(debugToolkit) } - newt := t.rawGroup(w.Name) + newt := t.rawGroup(a.Name) place(a, t, newt) } diff --git a/toolkit/andlabs/image.go b/toolkit/andlabs/image.go index a3d1cb6..cb1565c 100644 --- a/toolkit/andlabs/image.go +++ b/toolkit/andlabs/image.go @@ -9,15 +9,14 @@ import ( // make new Image here func newImage(a *toolkit.Action) { - w := a.Widget - log(debugToolkit, "newImage()", w.Name) + log(debugToolkit, "newImage()", a.Name) t := andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "newImage() toolkit struct == nil. name=", w.Name) + log(debugToolkit, "newImage() toolkit struct == nil. name=", a.Name) listMap(debugToolkit) } - newt := t.rawImage(w.Name) + newt := t.rawImage(a.Name) place(a, t, newt) } @@ -37,7 +36,7 @@ func (t *andlabsT) rawImage(title string) *andlabsT { return &newt } /* - if (w.Name == "image") { + if (a.Name == "image") { log(true, "NewTextbox() trying to add a new image") i := ui.NewImage(16, 16) img, _, err := image.Decode(bytes.NewReader(rawImage)) diff --git a/toolkit/andlabs/label.go b/toolkit/andlabs/label.go index c6bd670..7762827 100644 --- a/toolkit/andlabs/label.go +++ b/toolkit/andlabs/label.go @@ -9,8 +9,7 @@ import ( func newLabel(a *toolkit.Action) { var newt *andlabsT - w := a.Widget - log(debugToolkit, "NewLabel()", w.Name) + log(debugToolkit, "NewLabel()", a.Name) t := andlabs[a.ParentId] if (t == nil) { @@ -21,11 +20,11 @@ func newLabel(a *toolkit.Action) { return } - log(debugToolkit, "NewLabel()", w.Name) + log(debugToolkit, "NewLabel()", a.Name) newt = new(andlabsT) - c := ui.NewLabel(w.Name) + c := ui.NewLabel(a.Name) newt.uiLabel = c newt.uiControl = c diff --git a/toolkit/andlabs/plugin.go b/toolkit/andlabs/plugin.go index 6c2dd76..2cac13c 100644 --- a/toolkit/andlabs/plugin.go +++ b/toolkit/andlabs/plugin.go @@ -138,9 +138,9 @@ func setText(a *toolkit.Action) { actionDump(debugError, a) return } - log(debugChange, "setText() Attempt on", t.Type, "with", a.S) + log(debugChange, "setText() Attempt on", t.WidgetType, "with", a.S) - switch t.Type { + switch t.WidgetType { case toolkit.Window: t.uiWindow.SetTitle(a.S) case toolkit.Tab: @@ -157,7 +157,7 @@ func setText(a *toolkit.Action) { // t.uiCheckbox.SetChecked(a.B) t.tw.B = a.B default: - log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.Name) } case toolkit.Textbox: switch a.ActionType { @@ -170,7 +170,7 @@ func setText(a *toolkit.Action) { case toolkit.GetText: t.tw.S = t.s default: - log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.Name) } case toolkit.Label: t.uiLabel.SetText(a.S) @@ -183,7 +183,7 @@ func setText(a *toolkit.Action) { case toolkit.Set: t.uiSlider.SetValue(a.I) default: - log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.Name) } case toolkit.Spinner: switch a.ActionType { @@ -192,7 +192,7 @@ func setText(a *toolkit.Action) { case toolkit.Set: t.uiSpinbox.SetValue(a.I) default: - log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.Name) } case toolkit.Dropdown: switch a.ActionType { @@ -227,7 +227,7 @@ func setText(a *toolkit.Action) { case toolkit.GetText: t.tw.S = t.s default: - log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.Name) } case toolkit.Combobox: switch a.ActionType { @@ -244,9 +244,9 @@ func setText(a *toolkit.Action) { case toolkit.GetText: t.tw.S = t.s default: - log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.tw.Name) + log(debugError, "setText() unknown", a.ActionType, "on checkbox", t.Name) } default: - log(debugError, "plugin Send() Don't know how to setText on", t.tw.Type, "yet", a.ActionType) + log(debugError, "plugin Send() Don't know how to setText on", t.WidgetType, "yet", a.ActionType) } } diff --git a/toolkit/andlabs/slider.go b/toolkit/andlabs/slider.go index 5a16bff..ed96f98 100644 --- a/toolkit/andlabs/slider.go +++ b/toolkit/andlabs/slider.go @@ -10,13 +10,12 @@ import ( func (t *andlabsT) newSlider(a *toolkit.Action) *andlabsT { var newt andlabsT w := a.Widget - // log(debugToolkit, w.Name, w.Type, w.X, w.Y) s := ui.NewSlider(a.X, a.Y) newt.uiSlider = s newt.uiControl = s newt.tw = w - newt.Type = toolkit.Slider + newt.WidgetType = toolkit.Slider newt.wId = a.WidgetId s.OnChanged(func(spin *ui.Slider) { @@ -29,16 +28,13 @@ func (t *andlabsT) newSlider(a *toolkit.Action) *andlabsT { func newSlider(a *toolkit.Action) { var newt *andlabsT - w := a.Widget - log(debugToolkit, "newSlider()", w.Name) + log(debugToolkit, "newSlider()", a.Name) t := andlabs[a.ParentId] if (t == nil) { - log(debugError, "newSlider() ERROR toolkit struct == nil. name=", w.Name) + log(debugError, "newSlider() ERROR toolkit struct == nil. name=", a.Name) return } - // w.X = a.X - // w.Y = a.Y newt = t.newSlider(a) place(a, t, newt) } diff --git a/toolkit/andlabs/spinner.go b/toolkit/andlabs/spinner.go index 58e0934..46be999 100644 --- a/toolkit/andlabs/spinner.go +++ b/toolkit/andlabs/spinner.go @@ -17,7 +17,7 @@ func (t *andlabsT) newSpinner(a *toolkit.Action) *andlabsT { newt.uiControl = s newt.tw = w newt.wId = a.WidgetId - newt.Type = toolkit.Spinner + newt.WidgetType = toolkit.Spinner s.OnChanged(func(s *ui.Spinbox) { newt.tw.I = newt.uiSpinbox.Value() @@ -29,11 +29,10 @@ func (t *andlabsT) newSpinner(a *toolkit.Action) *andlabsT { func newSpinner(a *toolkit.Action) { var newt *andlabsT - w := a.Widget t := andlabs[a.ParentId] if (t == nil) { - log(debugError, "NewSpinner() toolkit struct == nil. name=", w.Name) + log(debugError, "NewSpinner() toolkit struct == nil. name=", a.Name) return } newt = t.newSpinner(a) diff --git a/toolkit/andlabs/structs.go b/toolkit/andlabs/structs.go index 1fb9a79..9cc1b9d 100644 --- a/toolkit/andlabs/structs.go +++ b/toolkit/andlabs/structs.go @@ -6,14 +6,15 @@ import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" var andlabs map[int]*andlabsT -var callback func(int) +var callback func(int) bool // stores the raw toolkit internals type andlabsT struct { wId int // widget ID - Type toolkit.WidgetType + WidgetType toolkit.WidgetType Name string + Text string // Type toolkit.WidgetType Width int Height int diff --git a/toolkit/andlabs/tab.go b/toolkit/andlabs/tab.go index 0753338..a9a3e38 100644 --- a/toolkit/andlabs/tab.go +++ b/toolkit/andlabs/tab.go @@ -44,7 +44,7 @@ func (t *andlabsT) newTab(a *toolkit.Action) { if (andlabs[a.WidgetId] == nil) { log(logInfo, "newTab() MAPPED", a.WidgetId, a.ParentId) andlabs[a.WidgetId] = newt - newt.Type = a.Widget.Type + newt.WidgetType = a.WidgetType } else { log(debugError, "newTab() DO WHAT?", a.WidgetId, a.ParentId) log(debugError, "THIS IS BAD") diff --git a/toolkit/andlabs/textbox.go b/toolkit/andlabs/textbox.go index ef39d33..6ea01e1 100644 --- a/toolkit/andlabs/textbox.go +++ b/toolkit/andlabs/textbox.go @@ -15,9 +15,8 @@ func (t *andlabsT) newTextbox(w *toolkit.Widget) *andlabsT { newt.uiMultilineEntry = c newt.uiControl = c - newt.Name = w.Name newt.tw = w - newt.Type = toolkit.Textbox + newt.WidgetType = toolkit.Textbox c.OnChanged(func(spin *ui.MultilineEntry) { t.s = spin.Text() @@ -30,14 +29,15 @@ func (t *andlabsT) newTextbox(w *toolkit.Widget) *andlabsT { func newTextbox(a *toolkit.Action) { w := a.Widget - log(debugToolkit, "newCombobox()", w.Name) + log(debugToolkit, "newCombobox()", a.Name) t := andlabs[a.ParentId] if (t == nil) { - log(debugToolkit, "newCombobox() toolkit struct == nil. name=", w.Name) + log(debugToolkit, "newCombobox() toolkit struct == nil. name=", a.Name) listMap(debugToolkit) return } newt := t.newTextbox(w) + newt.Name = a.Name place(a, t, newt) } diff --git a/toolkit/andlabs/window.go b/toolkit/andlabs/window.go index 2fee729..f00e1ee 100644 --- a/toolkit/andlabs/window.go +++ b/toolkit/andlabs/window.go @@ -16,22 +16,14 @@ func (t *andlabsT) ErrorWindow(msg1 string, msg2 string) { } func newWindow(a *toolkit.Action) { - w := a.Widget var newt *andlabsT - // log(debugToolkit, "toolkit NewWindow", w.Name, w.Width, w.Height) - - if (w == nil) { - log(debugToolkit, "wit/gui plugin error. widget == nil") - return - } newt = new(andlabsT) - newt.tw = w - newt.Type = toolkit.Window + newt.WidgetType = toolkit.Window newt.wId = a.WidgetId // menubar bool is if the OS defined border on the window should be used - win := ui.NewWindow(w.Name, a.Width, a.Height, menubar) + win := ui.NewWindow(a.Name, a.Width, a.Height, menubar) win.SetBorderless(canvas) win.SetMargined(margin) win.OnClosing(func(*ui.Window) bool { @@ -41,8 +33,7 @@ func newWindow(a *toolkit.Action) { win.Show() newt.uiWindow = win newt.uiControl = win - // newt.UiWindowBad = win // deprecate this as soon as possible - newt.Name = w.Name + newt.Name = a.Name andlabs[a.WidgetId] = newt return |
