diff options
Diffstat (limited to 'src/gui/window.cpp')
-rw-r--r-- | src/gui/window.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 706780be..0446e6eb 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -131,6 +131,15 @@ Window::~Window() { logger->log("Window::~Window(\"%s\")", getCaption().c_str()); + // Saving X, Y and Width and Height for resizables in the config + config.setValue(std::string(getWindowName() + "WinX"), getX()); + config.setValue(std::string(getWindowName() + "WinY"), getY()); + if ( resizable ) + { + config.setValue(std::string(getWindowName() + "WinWidth"), getWidth()); + config.setValue(std::string(getWindowName() + "WinHeight"), getHeight()); + } + instances--; if (instances == 0) @@ -416,3 +425,19 @@ std::string Window::getWindowName() { return mWindowName; } + +void Window::loadWindowState() +{ + setPosition((int)config.getValue(std::string(getWindowName() + "WinX"), getX()), + (int)config.getValue(std::string(getWindowName() + "WinY"), getY()) ); + + if ( resizable ) + { + setWidth((int)config.getValue(std::string(getWindowName() + "WinWidth"), getWidth()) ); + setHeight((int)config.getValue(std::string(getWindowName() + "WinHeight"), getHeight()) ); + if (mContent != NULL) + { + mContent->setDimension(getContentDimension()); + } + } +} |