diff options
| author | Jeff Carr <[email protected]> | 2023-03-23 12:35:12 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-23 12:35:12 -0500 |
| commit | d4787a1ebdd08359746516dbb72f1feaf95be5b6 (patch) | |
| tree | cb81756d61096ccf74af7c8cc9a15e4e00fe1da7 /toolkit/andlabs/button.go | |
| parent | 6a848bf40474365cc1c0b4da9e2f7e3e10b4d627 (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/button.go')
| -rw-r--r-- | toolkit/andlabs/button.go | 75 |
1 files changed, 7 insertions, 68 deletions
diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go index 4ae791c..741ce3a 100644 --- a/toolkit/andlabs/button.go +++ b/toolkit/andlabs/button.go @@ -7,24 +7,23 @@ import ( "git.wit.org/wit/gui/toolkit" ) -func newButton(parentW *toolkit.Widget, w *toolkit.Widget) { +func newButton(a *toolkit.Action) { var t, newt *andlabsT var b *ui.Button + w := a.Widget log(debugToolkit, "newButton()", w.Name) - t = mapToolkits[parentW] + t = mapToolkits[a.Where] if (t == nil) { - log(debugToolkit, "newButton() toolkit struct == nil. name=", parentW.Name, w.Name) + log(debugToolkit, "newButton() toolkit struct == nil. name=", a.Where.Name, w.Name) return } - if t.broken() { - return - } newt = new(andlabsT) b = ui.NewButton(w.Name) newt.uiButton = b + newt.uiControl = b newt.tw = w newt.parent = t @@ -32,66 +31,6 @@ func newButton(parentW *toolkit.Widget, w *toolkit.Widget) { newt.commonChange(newt.tw) }) - log(debugToolkit, "newButton() about to append to Box parent t:", w.Name) - log(debugToolkit, "newButton() about to append to Box new t:", w.Name) - if (debugToolkit) { - ShowDebug () - } - - if (t.uiBox != nil) { - t.uiBox.Append(b, stretchy) - } else if (t.uiWindow != nil) { - t.uiWindow.SetChild(b) - } else { - log(debugError, "ERROR: wit/gui andlabs couldn't place this button in a box or a window") - log(debugError, "ERROR: wit/gui andlabs couldn't place this button in a box or a window") - return - } - - 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 doButton(p *toolkit.Widget, c *toolkit.Widget) { - if broken(c) { - return - } - if (c.Action == "New") { - newButton(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, "Button() ct.broken", ct) - return - } - if (ct.uiButton == nil) { - log(debugError, "Button() uiButton == nil", ct) - return - } - log(debugToolkit, "Going to attempt:", c.Action) - switch c.Action { - case "Enable": - ct.uiButton.Enable() - case "Disable": - ct.uiButton.Disable() - case "Show": - ct.uiButton.Show() - case "Hide": - ct.uiButton.Hide() - case "Set": - ct.uiButton.SetText(c.S) - default: - log(debugError, "Can't do", c.Action, "to a Button") - } + place(a, t, newt) + mapWidgetsToolkits(a, newt) } |
