diff options
| author | Jeff Carr <[email protected]> | 2023-03-29 22:44:08 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-29 22:44:08 -0500 |
| commit | 947169df5a22c9f9b53f825764747f648c70ff1e (patch) | |
| tree | 3c84fffc14352329bc41e6b58910ff278c99f08c /toolkit/andlabs/action.go | |
| parent | 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 (diff) | |
ready for version v0.7.4
start deprecating toolkit.Widget
switch to variable name 'ParentId'
use 'ActionType' and 'WidgetType'
preliminary redraw()
final definition of variables 'Name' and 'Text'
more cleaning of the code
remove lots of dumb code
bind 'd' key press to dump out debugging info
early color handling in gocui!
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/action.go')
| -rw-r--r-- | toolkit/andlabs/action.go | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/toolkit/andlabs/action.go b/toolkit/andlabs/action.go index 68fc34a..9d098df 100644 --- a/toolkit/andlabs/action.go +++ b/toolkit/andlabs/action.go @@ -59,7 +59,7 @@ func pad(a *toolkit.Action) { switch t.Type { case toolkit.Group: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiGroup.SetMargined(true) case toolkit.Unmargin: @@ -70,7 +70,7 @@ func pad(a *toolkit.Action) { t.uiGroup.SetMargined(false) } case toolkit.Tab: - switch a.Type { + switch a.ActionType { case toolkit.Margin: tabSetMargined(t.uiTab, true) case toolkit.Unmargin: @@ -81,7 +81,7 @@ func pad(a *toolkit.Action) { tabSetMargined(t.uiTab, false) } case toolkit.Window: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiWindow.SetMargined(true) case toolkit.Unmargin: @@ -92,7 +92,7 @@ func pad(a *toolkit.Action) { t.uiWindow.SetBorderless(true) } case toolkit.Grid: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiGrid.SetPadded(true) case toolkit.Unmargin: @@ -103,7 +103,7 @@ func pad(a *toolkit.Action) { t.uiGrid.SetPadded(false) } case toolkit.Box: - switch a.Type { + switch a.ActionType { case toolkit.Margin: t.uiBox.SetPadded(true) case toolkit.Unmargin: @@ -114,17 +114,17 @@ func pad(a *toolkit.Action) { t.uiBox.SetPadded(false) } case toolkit.Textbox: - log(debugError, "TODO: implement expand for", a.Type) - log(debugError, "TODO: implement expand for", a.Type) - log(debugError, "TODO: implement expand for", a.Type) - log(debugError, "TODO: implement expand for", a.Type) + log(debugError, "TODO: implement expand for", a.ActionType) + log(debugError, "TODO: implement expand for", a.ActionType) + log(debugError, "TODO: implement expand for", a.ActionType) + log(debugError, "TODO: implement expand for", a.ActionType) default: - log(debugError, "TODO: implement pad() for", a.Type) + log(debugError, "TODO: implement pad() for", a.ActionType) } } func move(a *toolkit.Action) { - log(debugNow, "move()", a.WidgetId, "to", a.WhereId) + log(debugNow, "move()", a.WidgetId, "to", a.ParentId) tWidget := andlabs[a.WidgetId] if (tWidget == nil) { @@ -132,55 +132,55 @@ func move(a *toolkit.Action) { return } - tWhere := andlabs[a.WhereId] - if (tWhere == nil) { - log(debugError, "move() ERROR: toolkit struct == nil. for", a.WhereId) + tParent := andlabs[a.ParentId] + if (tParent == nil) { + log(debugError, "move() ERROR: toolkit struct == nil. for", a.ParentId) return } - switch tWhere.Type { + switch tParent.Type { case toolkit.Group: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - tWhere.uiGroup.SetMargined(true) + tParent.uiGroup.SetMargined(true) } case toolkit.Tab: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - // tabSetMargined(tWhere.uiTab, true) + // tabSetMargined(tParent.uiTab, true) } case toolkit.Window: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiWindow.SetBorderless(false) } case toolkit.Grid: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiGrid.SetPadded(true) } case toolkit.Box: - log(debugNow, "TODO: move() for a =", a.Type) - log(debugNow, "TODO: move() where =", a.WhereId) + log(debugNow, "TODO: move() for a =", a.ActionType) + log(debugNow, "TODO: move() where =", a.ParentId) log(debugNow, "TODO: move() for widget =", a.WidgetId) stretchy = true - tWhere.uiBox.Append(tWidget.uiControl, stretchy) - // log(debugNow, "is there a tWhere parent? =", tWhere.parent) - // tWhere.uiBox.Delete(0) + tParent.uiBox.Append(tWidget.uiControl, stretchy) + // log(debugNow, "is there a tParent parent? =", tParent.parent) + // tParent.uiBox.Delete(0) // this didn't work: // tWidget.uiControl.Disable() // sleep(.8) default: - log(debugError, "TODO: need to implement move() for a =", a.Type) - log(debugError, "TODO: need to implement move() for where =", a.WhereId) + log(debugError, "TODO: need to implement move() for a =", a.ActionType) + log(debugError, "TODO: need to implement move() for where =", a.ParentId) log(debugError, "TODO: need to implement move() for widget =", a.WidgetId) } } func uiDelete(a *toolkit.Action) { - if (andlabs[a.WhereId] == nil) { + if (andlabs[a.ParentId] == nil) { log(debugError, "uiDelete() ERROR: can not uiDelete to nil") return } @@ -188,7 +188,7 @@ func uiDelete(a *toolkit.Action) { log(debugError, "uiDelete() ERROR: can not uiDelete nil") return } - log(debugNow, "uiDelete()", a.WidgetId, "to", a.WhereId) + log(debugNow, "uiDelete()", a.WidgetId, "to", a.ParentId) tWidget := andlabs[a.WidgetId] if (tWidget == nil) { @@ -196,38 +196,38 @@ func uiDelete(a *toolkit.Action) { return } - tWhere := andlabs[a.WhereId] - if (tWhere == nil) { - log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.WhereId) + tParent := andlabs[a.ParentId] + if (tParent == nil) { + log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.ParentId) return } - switch tWhere.Type { + switch tParent.Type { case toolkit.Group: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - tWhere.uiGroup.SetMargined(true) + tParent.uiGroup.SetMargined(true) } case toolkit.Tab: - switch a.Type { + switch a.ActionType { case toolkit.Margin: - // tabSetMargined(tWhere.uiTab, true) + // tabSetMargined(tParent.uiTab, true) } case toolkit.Window: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiWindow.SetBorderless(false) } case toolkit.Grid: - switch a.Type { + switch a.ActionType { case toolkit.Pad: // t.uiGrid.SetPadded(true) } case toolkit.Box: - log(debugNow, "tWidget.boxC =", tWhere.Name) - log(debugNow, "is there a tWhere parent? =", tWhere.parent) + log(debugNow, "tWidget.boxC =", tParent.Name) + log(debugNow, "is there a tParent parent? =", tParent.parent) if (tWidget.boxC < 1) { - log(debugNow, "Can not delete from Box. already empty. tWidget.boxC =", tWhere.boxC) + log(debugNow, "Can not delete from Box. already empty. tWidget.boxC =", tParent.boxC) return } tWidget.uiBox.Delete(0) @@ -236,10 +236,10 @@ func uiDelete(a *toolkit.Action) { // this didn't work: // tWidget.uiControl.Disable() // sleep(.8) - // tWhere.uiBox.Append(tWidget.uiControl, stretchy) + // tParent.uiBox.Append(tWidget.uiControl, stretchy) default: - log(debugError, "TODO: need to implement uiDelete() for a =", a.Type) - log(debugError, "TODO: need to implement uiDelete() for where =", a.WhereId) + log(debugError, "TODO: need to implement uiDelete() for a =", a.ActionType) + log(debugError, "TODO: need to implement uiDelete() for where =", a.ParentId) log(debugError, "TODO: need to implement uiDelete() for widget =", a.WidgetId) } } |
