Browse Source

Add visibility attributes

tablepad
Bo Maryniuk 2 years ago
parent
commit
bbe99c97ca
  1. 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…
Cancel
Save