diff options
| author | Jeff Carr <[email protected]> | 2021-10-06 08:36:28 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-06 08:36:28 -0500 |
| commit | 504a067503e9d0dc4ce473eb1890276f485504c7 (patch) | |
| tree | b02c32453d96c6d83b7ad7a495c8156c2d9bb689 /main.go | |
| parent | e93fe915a6747dce10d7314dc968ebb734265ed0 (diff) | |
CODE: start a general code refactor
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 46 |
1 files changed, 46 insertions, 0 deletions
@@ -0,0 +1,46 @@ +package gui + +import "log" + +import "github.com/andlabs/ui" +import _ "github.com/andlabs/ui/winmanifest" + +func Main(f func()) { + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + ui.Main(f) +} + +// Other goroutines must use this +// +// 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: gui.Queue(addNewTabForColorSelection()) +func Queue(f func()) { + log.Println("Sending function to gui.Main() (using gtk via andlabs/ui)") + ui.QueueMain(f) +} + +// gui.Main( +// gui.MainExample() +// ) +func MainExample() { + name := "jcarr" + log.Println("gui.initUI() inside ui.Main()") + + box := InitWindow(nil, "StartNewWindow" + name, 0) + window := box.Window + log.Println("StartNewWindow() box =", box) + + window.UiWindow.Show() +} + +func TestExample() { + log.Println("gui.initUI() inside ui.Main()") + + box := InitWindow(nil, "test", 0) + window := box.Window + log.Println("StartNewWindow() box =", box) + + window.UiWindow.Show() +} |
