diff options
| author | Jeff Carr <[email protected]> | 2022-11-06 12:59:24 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-11-06 12:59:24 -0600 |
| commit | e55fb6675d692e3f44fa67b02b12661e476bd028 (patch) | |
| tree | c16084dea9779f5ef244adb3937d33adb17e7bad /structs.go | |
| parent | 099efb6b24caf9eaad50d7386636a7ac23552bde (diff) | |
start trying to make the tookits pluginsv0.4.3
totally minimize helloworld demo
try to make a button plugin example
debug changes
final changes before attempting to use a golang plugin
actually running gocui as a plugin
add gocli-as-plugin example
try to convert the go-cui toolkit into a plugin
doc updates
make a minimal console gui
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'structs.go')
| -rw-r--r-- | structs.go | 38 |
1 files changed, 27 insertions, 11 deletions
@@ -21,7 +21,15 @@ import toolkit "git.wit.org/wit/gui/toolkit/andlabs" var Config GuiConfig -func SetDebugToolkit (s bool) { +func GetDebug () bool { + return Config.Options.Debug +} + +func SetDebug (s bool) { + Config.Options.Debug = s + // also set these + Config.Options.DebugDump = s + Config.Options.DebugNode = s toolkit.DebugToolkit = s } @@ -29,6 +37,10 @@ func GetDebugToolkit () bool { return toolkit.DebugToolkit } +func SetDebugToolkit (s bool) { + toolkit.DebugToolkit = s +} + func ShowDebugValues() { log.Println("\t wit/gui Debug =", Config.Options.Debug) log.Println("\t wit/gui DebugDump =", Config.Options.DebugDump) @@ -102,23 +114,27 @@ func (s Widget) String() string { // The Node is simply the name and the size of whatever GUI element exists type Node struct { - id string + id int Name string Width int Height int + // this function is run when there are mouse or keyboard events + OnChanged func(*Node) + parent *Node - // TODO: make children a double linked list since some toolkits require order + // TODO: make children a double linked list since some toolkits require order (?) children []*Node + // hmm. how do you handle this when the toolkits are plugins? + toolkit *toolkit.Toolkit + // things that may not really be needed (?) custom func() - OnChanged func(*Node) checked bool text string - toolkit *toolkit.Toolkit } func (n *Node) Parent() *Node { @@ -159,12 +175,12 @@ func (n *Node) Dump() { IndentPrintln("toolkit = ", reflect.ValueOf(n.toolkit).Kind()) n.toolkit.Dump() } - if (n.id == "") { - // Node structs should never have a nil id. - // I probably shouldn't panic here, but this is just to check the sanity of - // the gui package to make sure it's not exiting - panic("gui.Node.Dump() id == nil TODO: make a unigue id here in the golang gui library") - } +// if (n.id == nil) { +// // Node structs should never have a nil id. +// // I probably shouldn't panic here, but this is just to check the sanity of +// // the gui package to make sure it's not exiting +// panic("gui.Node.Dump() id == nil TODO: make a unigue id here in the golang gui library") +// } IndentPrintln("NODE DUMP END") } |
