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
|
modalParent *window
|
||||||
hasModal bool
|
hasModal bool
|
||||||
shy bool
|
shy bool
|
||||||
|
visible bool
|
||||||
|
|
||||||
metrics struct {
|
metrics struct {
|
||||||
bounds image.Rectangle
|
bounds image.Rectangle
|
||||||
@ -265,14 +266,21 @@ func (window *window) Paste (callback func (data.Data, error), accept ...data.Mi
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
func (window *window) Show () {
|
func (window *window) SetVisible (visible bool) {
|
||||||
window.xWindow.Map()
|
if this.visible == visible { return }
|
||||||
if window.shy { window.grabInput() }
|
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 () {
|
func (window *window) Visible () bool {
|
||||||
window.xWindow.Unmap()
|
return this.visible
|
||||||
if window.shy { window.ungrabInput() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (window *window) Close () {
|
func (window *window) Close () {
|
||||||
|
Reference in New Issue
Block a user