2024-01-17 23:54:19 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/dev/andlabs/ui"
|
|
|
|
_ "go.wit.com/dev/andlabs/ui/winmanifest"
|
2024-02-15 08:15:38 -06:00
|
|
|
"go.wit.com/log"
|
|
|
|
"go.wit.com/widget"
|
2024-01-17 23:54:19 -06:00
|
|
|
|
|
|
|
"go.wit.com/toolkits/tree"
|
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
|
|
|
func newWindow(p, n *tree.Node) {
|
|
|
|
var newt *guiWidget
|
|
|
|
newt = new(guiWidget)
|
|
|
|
|
2024-01-19 12:18:11 -06:00
|
|
|
// bool == false is if the OS defined border on the window should be used
|
2024-01-19 18:12:30 -06:00
|
|
|
win := ui.NewWindow(n.GetProgName(), 40, 40, n.State.Borderless)
|
2024-01-19 12:18:11 -06:00
|
|
|
win.SetBorderless(n.State.Borderless)
|
|
|
|
win.SetMargined(n.State.Pad)
|
2024-01-17 23:54:19 -06:00
|
|
|
win.OnClosing(func(*ui.Window) bool {
|
|
|
|
// show(n, false)
|
2024-01-19 02:52:57 -06:00
|
|
|
me.myTree.SendWindowCloseEvent(n)
|
2024-01-19 12:18:11 -06:00
|
|
|
n.DeleteNode()
|
2024-01-18 21:00:37 -06:00
|
|
|
return true
|
2024-01-17 23:54:19 -06:00
|
|
|
})
|
|
|
|
newt.uiWindow = win
|
|
|
|
newt.uiControl = win
|
|
|
|
|
|
|
|
n.TK = newt
|
2024-02-15 08:15:38 -06:00
|
|
|
if p.WidgetType == widget.Window {
|
|
|
|
log.Log(WARN, "newWindow() TODO: make this window a tab")
|
|
|
|
} else {
|
|
|
|
place(p, n)
|
|
|
|
}
|
2024-01-17 23:54:19 -06:00
|
|
|
win.Show()
|
|
|
|
return
|
|
|
|
}
|