GRAPHICS: MACGUI: Allow windows to be hidden

This commit is contained in:
djsrv 2020-07-08 17:10:55 -04:00
parent 6e727d58a1
commit 3aaeced035
3 changed files with 22 additions and 0 deletions

View file

@ -39,8 +39,14 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
_contentIsDirty = true; _contentIsDirty = true;
_type = kWindowUnknown; _type = kWindowUnknown;
_visible = true;
} }
void BaseMacWindow::setVisible(bool visible) { _visible = visible; }
bool BaseMacWindow::isVisible() { return _visible; }
MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) : MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) :
BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) { BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) {
_borderIsDirty = true; _borderIsDirty = true;

View file

@ -98,6 +98,17 @@ public:
*/ */
bool isEditable() { return _editable; } bool isEditable() { return _editable; }
/**
* Mutator to change the visible state of the window.
* @param visible Target state.
*/
void setVisible(bool visible);
/**
* Accessor to determine whether a window is active.
* @return True if the window is active.
*/
bool isVisible();
/** /**
* Method to access the entire surface of the window (e.g. to draw an image). * Method to access the entire surface of the window (e.g. to draw an image).
* @return A pointer to the entire surface of the window. * @return A pointer to the entire surface of the window.
@ -141,6 +152,8 @@ protected:
bool (*_callback)(WindowClick, Common::Event &, void *); bool (*_callback)(WindowClick, Common::Event &, void *);
void *_dataPtr; void *_dataPtr;
bool _visible;
}; };
/** /**

View file

@ -412,6 +412,9 @@ void MacWindowManager::draw() {
for (Common::List<BaseMacWindow *>::const_iterator it = _windowStack.begin(); it != _windowStack.end(); it++) { for (Common::List<BaseMacWindow *>::const_iterator it = _windowStack.begin(); it != _windowStack.end(); it++) {
BaseMacWindow *w = *it; BaseMacWindow *w = *it;
if (!w->isVisible())
continue;
if (w->draw(_screen, _fullRefresh)) { if (w->draw(_screen, _fullRefresh)) {
w->setDirty(false); w->setDirty(false);