Add Visible, SetVisible to Window
This commit is contained in:
parent
8b44526c94
commit
c92377f50b
20
window.go
20
window.go
@ -32,6 +32,7 @@ type window struct {
|
||||
modalParent *window
|
||||
hasModal bool
|
||||
shy bool
|
||||
visible bool
|
||||
|
||||
metrics struct {
|
||||
bounds image.Rectangle
|
||||
@ -265,14 +266,21 @@ func (window *window) Paste (callback func (data.Data, error), accept ...data.Mi
|
||||
// TODO
|
||||
}
|
||||
|
||||
func (window *window) Show () {
|
||||
window.xWindow.Map()
|
||||
if window.shy { window.grabInput() }
|
||||
func (window *window) SetVisible (visible bool) {
|
||||
if this.visible == visible { return }
|
||||
window.visible = visible
|
||||
|
||||
if this.visible {
|
||||
window.xWindow.Map()
|
||||
if window.shy { window.grabInput() }
|
||||
} else {
|
||||
window.xWindow.Unmap()
|
||||
if window.shy { window.ungrabInput() }
|
||||
}
|
||||
}
|
||||
|
||||
func (window *window) Hide () {
|
||||
window.xWindow.Unmap()
|
||||
if window.shy { window.ungrabInput() }
|
||||
func (window *window) Visible () bool {
|
||||
return this.visible
|
||||
}
|
||||
|
||||
func (window *window) Close () {
|
||||
|
Reference in New Issue
Block a user