debian/andlabs/window.go

50 lines
1.0 KiB
Go
Raw Normal View History

2024-01-01 16:11:54 -06:00
package main
import (
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
"go.wit.com/log"
"go.wit.com/gui/widget"
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)
}
func newWindow(n *node) {
var newt *guiWidget
newt = new(guiWidget)
// menubar bool is if the OS defined border on the window should be used
win := ui.NewWindow(n.progname, n.X, n.Y, menubar)
2024-01-01 16:11:54 -06:00
win.SetBorderless(canvas)
win.SetMargined(margin)
win.OnClosing(func(*ui.Window) bool {
n.show(false)
2024-01-01 16:11:54 -06:00
n.doUserEvent()
return false
2024-01-01 16:11:54 -06:00
})
newt.uiWindow = win
newt.uiControl = win
n.tk = newt
win.Show()
return
}
func (n *node) SetWindowTitle(title string) {
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) {
log.Log(ERROR, "Error: no window", n.WidgetId)
2024-01-01 16:11:54 -06:00
} else {
win.SetTitle(title)
log.Log(CHANGE, "Setting the window title", title)
2024-01-01 16:11:54 -06:00
}
}