diff options
| author | Jeff Carr <[email protected]> | 2022-11-13 08:53:03 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-11-13 08:53:03 -0600 |
| commit | 207cf7ea16f1da8fa9f893504d77a2856298cc22 (patch) | |
| tree | 54d513b83ce797be75268f7d8867e0b01ab8f23e /toolkit/andlabs2/main.go | |
| parent | ed382bec55be25039e4dcf020d1512139855c9bb (diff) | |
Massive refactor to use go plugins. This is neat.
update README.md
set xterm title. make os.Exit() default on window close
add a toolkit.Widget to the node structure
remove 'Greeter' symbol mapping scheme
removed the testing greeter code
plugins:
attempt to load plugins in a sensible order
andlabs/ui:
working andlabs/ui plugin (andlabs2)
buttons work in andlabs plugin
TODO: re-implement non-plugin version for Windows
mswindows doesn't support go plugins yet
gocui:
put the gocui console so file in the binary
does a full init of gocui plugin
Button() and Group() working very well with gogui
cleanly exit gocui
technically you can load two toolkits at the same time
kinda both working at the same time. esoteric
two working plugins at the same time
give up working on two gui's at the same time
this is fun, but _not interesting
wow. this actually works. NewButton() from both toolkits
examples:
all the examples run again
remove early helloplugin example
buttonplugin example cmd code
buttonplugin runs and ldd is minimum
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs2/main.go')
| -rw-r--r-- | toolkit/andlabs2/main.go | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/toolkit/andlabs2/main.go b/toolkit/andlabs2/main.go new file mode 100644 index 0000000..8a28710 --- /dev/null +++ b/toolkit/andlabs2/main.go @@ -0,0 +1,56 @@ +package main + +import ( + "log" +// "time" + + "git.wit.org/wit/gui/toolkit" + + "github.com/andlabs/ui" + // the _ means we only need this for the init() + _ "github.com/andlabs/ui/winmanifest" +) + +func Main(f func()) { + if (DebugToolkit) { + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + } + ui.Main( func() { + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + // time.Sleep(1 * time.Second) + // NewWindow2("helloworld2", 200, 100) + f() + }) +} + +// 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.) +// +// For example: Queue(NewWindow()) +// +func Queue(f func()) { + if (DebugToolkit) { + log.Println("Sending function to ui.QueueMain() (using gtk via andlabs/ui)") + } + ui.QueueMain(f) +} + +func Init() { + log.Println("should Init() here") + + mapWidgets = make(map[*andlabsT]*toolkit.Widget) + mapToolkits = make(map[*toolkit.Widget]*andlabsT) +} + +func Quit() { + log.Println("should Quit() here") + // myExit(nil) +} |
