summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go46
-rw-r--r--new-structs.go29
-rw-r--r--structs.go1
-rw-r--r--window-debug.go2
4 files changed, 77 insertions, 1 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..eb9bdb4
--- /dev/null
+++ b/main.go
@@ -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()
+}
diff --git a/new-structs.go b/new-structs.go
new file mode 100644
index 0000000..8d65147
--- /dev/null
+++ b/new-structs.go
@@ -0,0 +1,29 @@
+package gui
+
+import "log"
+
+import "github.com/andlabs/ui"
+import _ "github.com/andlabs/ui/winmanifest"
+
+type Node struct {
+ Name string
+ tag string
+ Width int
+ Height int
+
+ uiType *ui.Control
+ Children []*Node
+}
+
+func (n Node) SetName(name string) {
+ // n.uiType.SetName(name)
+ log.Println("n.uiType =", n.uiType)
+ return
+}
+
+func (n Node) Append(child Node) {
+// if (n.UiBox == nil) {
+// return
+// }
+ // n.uiType.Append(child, x)
+}
diff --git a/structs.go b/structs.go
index ac67588..6387b45 100644
--- a/structs.go
+++ b/structs.go
@@ -42,6 +42,7 @@ type GuiData struct {
// andlabs/ui & andlabs/libui work
AllButtons []*GuiButton
buttonMap map[*ui.Button]*GuiButton
+ Nodes *Node
}
type GuiTab struct {
diff --git a/window-debug.go b/window-debug.go
index 92ed9c6..6d757a2 100644
--- a/window-debug.go
+++ b/window-debug.go
@@ -18,7 +18,7 @@ func makeWindowDebug() ui.Control {
vbox.Append(pbar, false)
/////////////////////////////////////////////////////
- vbox = addGroup(hbox, "WindowMap")
+ vbox = addGroup(hbox, "WindowMap 2")
cbox := ui.NewCombobox()
for name, _ := range Data.WindowMap {