diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-28 00:55:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-28 00:55:13 +0300 |
commit | 01a0e4b658241cc3dbd8a5d11d34a6de48dab159 (patch) | |
tree | 37294c079b9a05768b7380f7595784eb73485769 /src/gui/widgets/window.cpp | |
parent | 072b727ae4d072d6c84f3331d78ca5a2ac76d271 (diff) | |
download | manaplus-01a0e4b658241cc3dbd8a5d11d34a6de48dab159.tar.gz manaplus-01a0e4b658241cc3dbd8a5d11d34a6de48dab159.tar.bz2 manaplus-01a0e4b658241cc3dbd8a5d11d34a6de48dab159.tar.xz manaplus-01a0e4b658241cc3dbd8a5d11d34a6de48dab159.zip |
Add strong typed bool type Visible.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r-- | src/gui/widgets/window.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index f4921e7ca..a48b2c062 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -221,7 +221,7 @@ Window::Window(const std::string &caption, } // Windows are invisible by default - setVisible(false); + setVisible(Visible_false); addWidgetListener(this); mForegroundColor = getThemeColor(Theme::WINDOW); @@ -737,27 +737,32 @@ void Window::setStickyButtonLock(const bool lock) mStickyButton = lock; } -void Window::setVisible(bool visible) +void Window::setVisible(Visible visible) { setVisible(visible, false); } -void Window::setVisible(const bool visible, const bool forceSticky) +void Window::setVisible(const Visible visible, const bool forceSticky) { if (visible == mVisible) return; // Check if the window is off screen... - if (visible) + if (visible == Visible_true) ensureOnScreen(); else mResizeHandles = 0; if (mStickyButtonLock) + { BasicContainer2::setVisible(visible); + } else - BasicContainer2::setVisible((!forceSticky && mSticky) || visible); - if (visible) + { + BasicContainer2::setVisible(fromBool((!forceSticky && mSticky) || + visible == Visible_true, Visible)); + } + if (visible == Visible_true) { if (mPlayVisibleSound) soundManager.playGuiSound(SOUND_SHOW_WINDOW); @@ -852,7 +857,7 @@ void Window::mousePressed(MouseEvent &event) void Window::close() { - setVisible(false); + setVisible(Visible_false); } void Window::mouseReleased(MouseEvent &event A_UNUSED) @@ -1044,8 +1049,8 @@ void Window::loadWindowState() if (mSaveVisible) { - setVisible(config.getValueBool(name - + "Visible", mDefaultVisible)); + setVisible(fromBool(config.getValueBool(name + + "Visible", mDefaultVisible), Visible)); } if (mStickyButton) |