Add visibility attributes

This commit is contained in:
Bo Maryniuk 2020-10-19 18:33:47 +02:00
parent c326cc4c16
commit bbe99c97ca
1 changed files with 17 additions and 0 deletions

View File

@ -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()