From eb8dc37bfa07e1185308bc8d4748d92c69af1783 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Wed, 28 Sep 2005 21:26:23 +0000 Subject: Save and load X, Y, Height, and Width to useful wins. --- src/gui/window.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/gui/window.cpp') 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()); + } + } +} -- cgit v1.2.3-70-g09d2