summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-29 23:03:04 -0500
committerJeff Carr <[email protected]>2023-03-29 23:03:04 -0500
commit4e28cde838683188bfbd9222746409538828592d (patch)
tree3c84fffc14352329bc41e6b58910ff278c99f08c /main.go
parentd4787a1ebdd08359746516dbb72f1feaf95be5b6 (diff)
add semi-working gocuiv0.7.4
commit 947169df5a22c9f9b53f825764747f648c70ff1e Author: Jeff Carr <[email protected]> Date: Wed Mar 29 22:44:08 2023 -0500 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]> commit 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 Author: Jeff Carr <[email protected]> Date: Sun Mar 26 17:19:20 2023 -0500 improvements towards a working dns control panel democui has the help menu try to add mouse support to gocui make a direct access method Margin() and Pad() tests add SPEW also push devel branch to github Signed-off-by: Jeff Carr <[email protected]> commit 6f91f5e080e06cdc0f34b13d23e5fd16ea37259a Author: Jeff Carr <[email protected]> Date: Fri Mar 24 20:14:18 2023 -0500 starting to try safe chan and goroutines fix tab title's right before attempting to add chan goroutines removed "where" widget pointer box added to tab experiement with log as it's own repo Signed-off-by: Jeff Carr <[email protected]> Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go38
1 files changed, 32 insertions, 6 deletions
diff --git a/main.go b/main.go
index 9f4b93c..51a44c3 100644
--- a/main.go
+++ b/main.go
@@ -2,7 +2,7 @@ package gui
import (
// "embed"
- // "git.wit.org/wit/gui/toolkit"
+ "git.wit.org/wit/gui/toolkit"
)
// Windows doesn't support plugins. How can I keep andlabs and only compile it on windows?
@@ -31,10 +31,12 @@ func init() {
Config.Height = 480
// Populates the top of the binary tree
- Config.master = addNode("guiBinaryTree")
+ Config.rootNode = addNode("guiBinaryTree")
+ Config.rootNode.WidgetType = toolkit.Root
// used to pass debugging flags to the toolkit plugins
- Config.flag = Config.master.New("flag", 0, nil)
+ Config.flag = Config.rootNode.New("flag", 0, nil)
+ Config.flag.WidgetType = toolkit.Flag
}
func doGuiChan() {
@@ -57,7 +59,7 @@ func InitPlugins(names []string) {
log(debugGui, "Starting gui.Init()")
for _, aplug := range allPlugins {
- log(debugGui, "gui.LoadToolkit() already loaded toolkit plugin =", aplug.name)
+ log(debugGui, "LoadToolkit() already loaded toolkit plugin =", aplug.name)
for _, name := range names {
if (name == aplug.name) {
return
@@ -93,6 +95,28 @@ func InitPlugins(names []string) {
// StandardExit("golang wit/gui could not load a plugin TODO: do something to STDOUT (?)")
}
+func Start() *Node {
+ log(logInfo, "Start() Main(f)")
+ f := func() {
+ }
+ go Main(f)
+ sleep(1)
+ return Config.rootNode
+}
+
+func StartS(name string) *Node {
+ log(logInfo, "Start() Main(f) for name =", name)
+ if (LoadToolkit(name) == false) {
+ return Config.rootNode
+ }
+ // will this really work on mswindows & macos?
+ f := func() {
+ }
+ go Main(f)
+ sleep(1) // temp hack until chan communication is setup
+ return Config.rootNode
+}
+
// This should not pass a function
func Main(f func()) {
log(debugGui, "Starting gui.Main() (using gtk via andlabs/ui)")
@@ -111,11 +135,12 @@ func Main(f func()) {
}
aplug.MainOk = true
aplug.Main(f)
- // f()
}
- // toolkit.Main(f)
}
+/*
+This is deprecated and will be implemented more correctly with waitgroups
+
// This should never be exposed(?)
// Other goroutines must use this to access the GUI
@@ -135,6 +160,7 @@ func Queue(f func()) {
aplug.Queue(f)
}
}
+*/
// The window is destroyed but the application does not quit
func (n *Node) StandardClose() {