2024-01-01 16:11:54 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-15 16:11:40 -06:00
|
|
|
"go.wit.com/dev/andlabs/ui"
|
|
|
|
_ "go.wit.com/dev/andlabs/ui/winmanifest"
|
2024-01-08 21:19:42 -06:00
|
|
|
|
|
|
|
"go.wit.com/log"
|
2024-01-16 12:55:20 -06:00
|
|
|
"go.wit.com/gui/widget"
|
2024-01-17 21:31:49 -06:00
|
|
|
"go.wit.com/gui/toolkits/tree"
|
2024-01-01 16:11:54 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func (t *guiWidget) MessageWindow(msg1 string, msg2 string) {
|
|
|
|
ui.MsgBox(t.uiWindow, msg1, msg2)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *guiWidget) ErrorWindow(msg1 string, msg2 string) {
|
|
|
|
ui.MsgBoxError(t.uiWindow, msg1, msg2)
|
|
|
|
}
|
|
|
|
|
2024-01-17 21:31:49 -06:00
|
|
|
func newWindow(p, n *tree.Node) {
|
2024-01-01 16:11:54 -06:00
|
|
|
var newt *guiWidget
|
|
|
|
newt = new(guiWidget)
|
|
|
|
|
|
|
|
// menubar bool is if the OS defined border on the window should be used
|
2024-01-17 21:31:49 -06:00
|
|
|
win := ui.NewWindow(n.GetProgName(), 640, 480, menubar)
|
2024-01-01 16:11:54 -06:00
|
|
|
win.SetBorderless(canvas)
|
|
|
|
win.SetMargined(margin)
|
|
|
|
win.OnClosing(func(*ui.Window) bool {
|
2024-01-17 21:31:49 -06:00
|
|
|
// show(n, false)
|
|
|
|
me.myTree.DoWindowCloseEvent(n)
|
2024-01-10 15:35:42 -06:00
|
|
|
return false
|
2024-01-01 16:11:54 -06:00
|
|
|
})
|
|
|
|
newt.uiWindow = win
|
|
|
|
newt.uiControl = win
|
|
|
|
|
2024-01-17 21:31:49 -06:00
|
|
|
n.TK = newt
|
|
|
|
place(p, n)
|
2024-01-01 16:11:54 -06:00
|
|
|
win.Show()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *node) SetWindowTitle(title string) {
|
2024-01-16 12:55:20 -06:00
|
|
|
log.Log(CHANGE, "toolkit NewWindow", widget.GetString(n.value), "title", title)
|
2024-01-01 16:11:54 -06:00
|
|
|
win := n.tk.uiWindow
|
|
|
|
if (win == nil) {
|
2024-01-08 21:19:42 -06:00
|
|
|
log.Log(ERROR, "Error: no window", n.WidgetId)
|
2024-01-01 16:11:54 -06:00
|
|
|
} else {
|
|
|
|
win.SetTitle(title)
|
2024-01-08 21:19:42 -06:00
|
|
|
log.Log(CHANGE, "Setting the window title", title)
|
2024-01-01 16:11:54 -06:00
|
|
|
}
|
|
|
|
}
|