diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-20 17:12:58 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-20 17:12:58 -0600 |
commit | 9f43e32022ac261c6475fc68832cbe9ba9645362 (patch) | |
tree | e7adfbfd17ade39fe03671e2be677934a7e894cd /src/gui/widgets | |
parent | 3a7224117dfb6709b059fc258876699e969ec119 (diff) | |
download | mana-9f43e32022ac261c6475fc68832cbe9ba9645362.tar.gz mana-9f43e32022ac261c6475fc68832cbe9ba9645362.tar.bz2 mana-9f43e32022ac261c6475fc68832cbe9ba9645362.tar.xz mana-9f43e32022ac261c6475fc68832cbe9ba9645362.zip |
Fix up window visibility saving/restoring
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/popup.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 22 |
3 files changed, 28 insertions, 3 deletions
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 1e7f103e..895484b0 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -25,6 +25,7 @@ #include "gui/widgets/container.h" +#include "configuration.h" #include "guichanfwd.h" class Skin; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index fbd328d0..7de09994 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -50,6 +50,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent, mShowTitle(true), mModal(modal), mCloseButton(false), + mDefaultVisible(false), + mSaveVisible(false), mStickyButton(false), mSticky(false), mMinWinWidth(100), @@ -492,8 +494,8 @@ void Window::loadWindowState() setPosition((int) config.getValue(name + "WinX", mDefaultX), (int) config.getValue(name + "WinY", mDefaultY)); - if (mCloseButton) - setVisible((bool) config.getValue(name + "Visible", false)); + if (mSaveVisible) + setVisible((bool) config.getValue(name + "Visible", mDefaultVisible)); if (mStickyButton) setSticky((bool) config.getValue(name + "Sticky", isSticky())); @@ -534,7 +536,7 @@ void Window::saveWindowState() config.setValue(mWindowName + "WinX", getX()); config.setValue(mWindowName + "WinY", getY()); - if (mCloseButton) + if (mSaveVisible) config.setValue(mWindowName + "Visible", isVisible()); if (mStickyButton) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 510b0f04..aa9872d3 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -173,6 +173,26 @@ class Window : public gcn::Window, gcn::WidgetListener void setVisible(bool visible, bool forceSticky); /** + * Returns whether the window will save it's visibility. + */ + bool isDefaultVisible() const { return mDefaultVisible; } + + /** + * Returns whether the window will save it's visibility. + */ + void setDefaultVisible(bool save) { mDefaultVisible = save; } + + /** + * Returns whether the window will save it's visibility. + */ + bool willSaveVisible() const { return mSaveVisible; } + + /** + * Returns whether the window will save it's visibility. + */ + void setSaveVisible(bool save) { mSaveVisible = save; } + + /** * Returns the parent window. * * @return The parent window or <code>NULL</code> if there is none. @@ -335,6 +355,8 @@ class Window : public gcn::Window, gcn::WidgetListener bool mShowTitle; /**< Window has a title bar */ bool mModal; /**< Window is modal */ bool mCloseButton; /**< Window has a close button */ + bool mDefaultVisible; /**< Window's default visibility */ + bool mSaveVisible; /**< Window will save visibility */ bool mStickyButton; /**< Window has a sticky button */ bool mSticky; /**< Window resists hiding*/ int mMinWinWidth; /**< Minimum window width */ |