add StandardExit()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
01b512ddb3
commit
751b6059c0
|
@ -65,6 +65,20 @@ func (w *BasicWindow) Title(title string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sets this window to run os.Exit()
|
||||||
|
func (w *BasicWindow) StandardExit() {
|
||||||
|
if ! w.Ready() {return}
|
||||||
|
w.win.Custom = func() {
|
||||||
|
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
|
||||||
|
log.Warn("BasicWindow.Custom() closed. handled properly?", w.title)
|
||||||
|
if w.Custom != nil {
|
||||||
|
w.Custom()
|
||||||
|
}
|
||||||
|
w.win.StandardExit()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if initialized
|
// Returns true if initialized
|
||||||
func (w *BasicWindow) Initialized() bool {
|
func (w *BasicWindow) Initialized() bool {
|
||||||
if w == nil {return false}
|
if w == nil {return false}
|
||||||
|
@ -107,13 +121,19 @@ func (w *BasicWindow) Make() {
|
||||||
log.Warn("BasicWindow.Make() window was already created")
|
log.Warn("BasicWindow.Make() window was already created")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// various timeout settings
|
|
||||||
w.win = w.parent.RawWindow(w.title)
|
w.win = w.parent.RawWindow(w.title)
|
||||||
w.win.Custom = func() {
|
|
||||||
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
|
// if Custom isn't set, set it here. This prevents the application from
|
||||||
log.Warn("BasicWindow.Custom() closed. handled properly?", w.title)
|
// os.Exit() if the window is closed. It destroy's the widgets in the toolkit plugins
|
||||||
if w.Custom != nil {
|
// the the window still exists in the binary tree and functions normally
|
||||||
w.Custom()
|
// I like to call this Sierpinski mode
|
||||||
|
if w.win.Custom == nil {
|
||||||
|
w.win.Custom = func() {
|
||||||
|
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
|
||||||
|
log.Warn("BasicWindow.Custom() closed. handled properly?", w.title)
|
||||||
|
if w.Custom != nil {
|
||||||
|
w.Custom()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if w.vertical {
|
if w.vertical {
|
||||||
|
|
Loading…
Reference in New Issue