CODE: start a general code refactor
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
cabdb12495
commit
b4a11c0aa1
|
@ -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()
|
||||
}
|
|
@ -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)
|
||||
}
|
|
@ -42,6 +42,7 @@ type GuiData struct {
|
|||
// andlabs/ui & andlabs/libui work
|
||||
AllButtons []*GuiButton
|
||||
buttonMap map[*ui.Button]*GuiButton
|
||||
Nodes *Node
|
||||
}
|
||||
|
||||
type GuiTab struct {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue