summaryrefslogtreecommitdiff
path: root/toolkit/andlabs
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-12-16 06:57:39 -0600
committerJeff Carr <[email protected]>2023-12-16 06:57:39 -0600
commit87ab9a958d9eb9f4db35d5c9f9ce923df3132dad (patch)
treefd3ee29d828e9e69175a6ca04fec6ae0fe60fcc0 /toolkit/andlabs
parentdcce32583387be7fc4f6cd8c8dea62fd7dc42ecf (diff)
gocui: fixes to labels + line entriesv0.8.8.1v0.8.8
correct line hight dump non-working size rectangle code somehow works better better dropdown menu debugging minor fixes to common.go more common code Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs')
-rw-r--r--toolkit/andlabs/action.go12
-rw-r--r--toolkit/andlabs/add.go6
-rw-r--r--toolkit/andlabs/main.go23
-rw-r--r--toolkit/andlabs/structs.go35
4 files changed, 10 insertions, 66 deletions
diff --git a/toolkit/andlabs/action.go b/toolkit/andlabs/action.go
index 2088917..29b797a 100644
--- a/toolkit/andlabs/action.go
+++ b/toolkit/andlabs/action.go
@@ -174,7 +174,7 @@ func (n *node) Delete() {
}
}
-func rawAction(a toolkit.Action) {
+func rawAction(a *toolkit.Action) {
log(logInfo, "rawAction() START a.ActionType =", a.ActionType)
log(logInfo, "rawAction() START a.S =", a.S)
@@ -191,7 +191,7 @@ func rawAction(a toolkit.Action) {
log(logInfo, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId)
switch a.WidgetType {
case toolkit.Flag:
- flag(&a)
+ flag(a)
return
}
@@ -232,18 +232,18 @@ func rawAction(a toolkit.Action) {
case toolkit.Disable:
n.enable(false)
case toolkit.Get:
- n.setText(&a)
+ n.setText(a)
case toolkit.GetText:
switch a.WidgetType {
case toolkit.Textbox:
a.S = n.S
}
case toolkit.Set:
- n.setText(&a)
+ n.setText(a)
case toolkit.SetText:
- n.setText(&a)
+ n.setText(a)
case toolkit.AddText:
- n.setText(&a)
+ n.setText(a)
case toolkit.Margin:
n.pad(toolkit.Unmargin)
case toolkit.Unmargin:
diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go
index 0d1ac32..9963b79 100644
--- a/toolkit/andlabs/add.go
+++ b/toolkit/andlabs/add.go
@@ -15,12 +15,12 @@ func actionDump(b bool, a *toolkit.Action) {
log(b, "actionDump() ParentId =", a.ParentId)
}
-func add(a toolkit.Action) {
+func add(a *toolkit.Action) {
if (a.WidgetType == toolkit.Root) {
- me.rootNode = addWidget(&a)
+ me.rootNode = addNode(a)
return
}
- n := addWidget(&a)
+ n := addNode(a)
p := n.parent
switch n.WidgetType {
diff --git a/toolkit/andlabs/main.go b/toolkit/andlabs/main.go
index 4737337..e2d34a3 100644
--- a/toolkit/andlabs/main.go
+++ b/toolkit/andlabs/main.go
@@ -9,12 +9,6 @@ import (
_ "github.com/andlabs/ui/winmanifest"
)
-// this is the channel we get requests to make widgets
-var pluginChan chan toolkit.Action
-
-// the starting point of the binary tree
-// var rootNode *node
-
var uiMainUndef bool = true
var uiMain sync.Once
var muAction sync.Mutex
@@ -30,7 +24,7 @@ func catchActionChannel() {
muAction.Lock()
// TODO ui.QueueMain(f)
// TODO ui.QueueMain( func() {rawAction(a)} )
- ui.QueueMain( func() {rawAction(a)} )
+ ui.QueueMain( func() {rawAction(&a)} )
// rawAction(a)
muAction.Unlock()
log(logInfo, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
@@ -38,21 +32,6 @@ func catchActionChannel() {
}
}
-// Other goroutines must use this to access the GUI
-//
-// You can not acess / process the GUI thread directly from
-// other goroutines. This is due to the nature of how
-// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
-//
-// this sets the channel to send user events back from the plugin
-func Callback(guiCallback chan toolkit.Action) {
- callback = guiCallback
-}
-
-func PluginChannel() chan toolkit.Action {
- return pluginChan
-}
-
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
func init() {
log(logNow, "Init() START")
diff --git a/toolkit/andlabs/structs.go b/toolkit/andlabs/structs.go
index c5f94ee..02b9204 100644
--- a/toolkit/andlabs/structs.go
+++ b/toolkit/andlabs/structs.go
@@ -16,41 +16,6 @@ type config struct {
rootNode *node // the base of the binary tree. it should have id == 0
}
-/*
-type node struct {
- parent *node
- children []*node
-
- WidgetId int // widget ID
- WidgetType toolkit.WidgetType
- ParentId int // parent ID
-
- Name string
- Text string
-
- // This is how the values are passed back and forth
- // values from things like checkboxes & dropdown's
- B bool
- I int
- S string
-
- A any // switch to this or deprecate this? pros/cons?
-
- // This is used for things like a slider(0,100)
- X int
- Y int
-
- // This is for the grid size & widget position
- W int
- H int
- AtW int
- AtH int
-
- // the internal plugin toolkit structure
- tk *andlabsT
-}
-*/
-
// stores the raw toolkit internals
type guiWidget struct {
Width int