Add Supervisor.CloseActiveWindow()

This commit is contained in:
Noah 2021-10-06 22:19:43 -07:00
parent 49992aad2a
commit 79210ae8c9

View File

@ -179,6 +179,17 @@ func (s *Supervisor) CloseAllWindows() int {
return i return i
} }
// CloseActiveWindow closes the topmost active window.
func (s *Supervisor) CloseActiveWindow() bool {
var node = s.winFocus
if node != nil {
node.window.Hide()
s.winFocus = node.next
return true
}
return false
}
// presentWindows draws the windows from bottom to top. // presentWindows draws the windows from bottom to top.
func (s *Supervisor) presentWindows(e render.Engine) { func (s *Supervisor) presentWindows(e render.Engine) {
item := s.winBottom item := s.winBottom