Skip to content

Commit

Permalink
Merge pull request #89 from nucleic/feature-win-query
Browse files Browse the repository at this point in the history
add ability to query window min/max state
  • Loading branch information
sccolbert committed Nov 21, 2013
2 parents 3ac3e69 + 9f45672 commit 713feb8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
12 changes: 12 additions & 0 deletions enaml/qt/qt_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,24 @@ def maximize(self):
"""
self.widget.showMaximized()

def is_maximized(self):
""" Get whether the window is maximized.
"""
return bool(self.widget.windowState() & Qt.WindowMaximized)

def minimize(self):
""" Minimize the window.
"""
self.widget.showMinimized()

def is_minimized(self):
""" Get whether the window is minimized.
"""
return bool(self.widget.windowState() & Qt.WindowMinimized)

def restore(self):
""" Restore the window after a minimize or maximize.
Expand Down
28 changes: 25 additions & 3 deletions enaml/widgets/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ def frame_geometry(self):
def minimize(self):
raise NotImplementedError

def is_minimized(self):
raise NotImplementedError

def maximize(self):
raise NotImplementedError

def is_maximized(self):
raise NotImplementedError

def restore(self):
raise NotImplementedError

Expand Down Expand Up @@ -258,21 +264,37 @@ def frame_geometry(self):
return Rect(-1, -1, -1, -1)

def maximize(self):
""" Send the 'maximize' action to the client widget.
""" Maximize the window.
"""
if self.proxy_is_active:
self.proxy.maximize()

def is_maximized(self):
""" Get whether the window is maximized.
"""
if self.proxy_is_active:
return self.proxy.is_maximized()
return False

def minimize(self):
""" Send the 'minimize' action to the client widget.
""" Minimize the window.
"""
if self.proxy_is_active:
self.proxy.minimize()

def is_minimized(self):
""" Get whether the window is minimized.
"""
if self.proxy_is_active:
return self.proxy.is_minimized()
return False

def restore(self):
""" Send the 'restore' action to the client widget.
""" Restore the window from a maximized or minimized state.
"""
if self.proxy_is_active:
Expand Down
14 changes: 13 additions & 1 deletion enaml/wx/wx_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,29 @@ def maximize(self):
"""
self.widget.Maximize(True)

def is_maximized(self):
""" Get whether the window is maximized.
"""
return self.widget.IsMaximized()

def minimize(self):
""" Minimize the window.
"""
self.widget.Iconize(True)

def is_minimized(self):
""" Get whether the window is minimized.
"""
return self.widget.IsIconized()

def restore(self):
""" Restore the window after a minimize or maximize.
"""
self.widget.maximize(False)
self.widget.Maximize(False)

def send_to_front(self):
""" Move the window to the top of the Z order.
Expand Down

0 comments on commit 713feb8

Please sign in to comment.