forked from tslocum/cview
Add visibility attributes
This commit is contained in:
parent
c326cc4c16
commit
bbe99c97ca
17
window.go
17
window.go
|
@ -16,6 +16,7 @@ type Window struct {
|
|||
x, y int
|
||||
width, height int
|
||||
fullscreen bool
|
||||
visible bool
|
||||
|
||||
dragX, dragY int
|
||||
dragWX, dragWY int
|
||||
|
@ -32,9 +33,25 @@ func NewWindow(primitive Primitive) *Window {
|
|||
dragWY: -1,
|
||||
}
|
||||
w.Box.focus = w
|
||||
w.visible = true
|
||||
return w
|
||||
}
|
||||
|
||||
// IsVisible returns true if the window is visible
|
||||
func (w *Window) IsVisible() bool {
|
||||
return w.visible
|
||||
}
|
||||
|
||||
// Show the window.
|
||||
func (w *Window) Show() {
|
||||
w.visible = true
|
||||
}
|
||||
|
||||
// Hide the window.
|
||||
func (w *Window) Hide() {
|
||||
w.visible = false
|
||||
}
|
||||
|
||||
// SetPosition sets the position of the window.
|
||||
func (w *Window) SetPosition(x, y int) {
|
||||
w.Lock()
|
||||
|
|
Loading…
Reference in New Issue