andlabs/window.go

46 lines
990 B
Go
Raw Permalink Normal View History

package main
import (
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
"go.wit.com/log"
"go.wit.com/widget"
"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)
// bool == false is if the OS defined border on the window should be used
win := ui.NewWindow(n.GetProgName(), 40, 40, n.State.Borderless)
win.SetBorderless(n.State.Borderless)
win.SetMargined(n.State.Pad)
win.OnClosing(func(*ui.Window) bool {
// show(n, false)
me.myTree.SendWindowCloseEvent(n)
n.DeleteNode()
return true
})
newt.uiWindow = win
newt.uiControl = win
n.TK = newt
if p.WidgetType == widget.Window {
log.Log(WARN, "newWindow() TODO: make this window a tab")
} else {
place(p, n)
}
win.Show()
return
}