From: <sv...@ww...> - 2006-11-14 22:51:01
|
Author: stormbringer Date: 2006-11-14 14:50:53 -0800 (Tue, 14 Nov 2006) New Revision: 2006 Modified: trunk/csp/cspsim/windows/QuitResume.cpp trunk/csp/cspsim/windows/QuitResume.h Log: Add "Options" to "quit" dialog Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2006 Modified: trunk/csp/cspsim/windows/QuitResume.cpp =================================================================== --- trunk/csp/cspsim/windows/QuitResume.cpp 2006-11-14 22:48:32 UTC (rev 2005) +++ trunk/csp/cspsim/windows/QuitResume.cpp 2006-11-14 22:50:53 UTC (rev 2006) @@ -24,6 +24,9 @@ #include <csp/cspsim/CSPSim.h> #include <csp/cspsim/wf/Button.h> +#include <csp/cspsim/wf/TableControlContainer.h> +#include <csp/cspsim/wf/WindowManager.h> +#include <csp/cspsim/windows/Options.h> #include <csp/cspsim/windows/QuitResume.h> #include <csp/csplib/data/ObjectInterface.h> @@ -33,29 +36,25 @@ namespace windows { -QuitResume::QuitResume() { - // Completely white and opaque background. - setBackgroundColor(osg::Vec4(0.1f, 0.3f, 0.15f, 0.75f)); - setSize(wf::Size(80.0, 30.0)); +QuitResume::QuitResume(wf::Theme* theme) : wf::Window(theme) { + setSize(wf::Size(100.0, 25.0)); setZPos(0.0); setCaption("Combat Simulator Project"); - Ref<wf::Button> quitButton = new wf::Button; - quitButton->setLocation(wf::Point(-17.5, -2.0f)); - quitButton->setSize(wf::Size(25, 10)); - quitButton->setZPos(getZPos() - 0.1f); - quitButton->setText("Quit"); - addControl(quitButton.get()); + Ref<wf::TableControlContainer> table = new wf::TableControlContainer(getTheme(), 3, 1); + setControl(table.get()); + + Ref<wf::Button> resumeButton = new wf::Button(getTheme(), "Resume"); + resumeButton->addButtonClickedHandler(sigc::mem_fun(*this, &QuitResume::onResume)); + table->setControl(0, 0, resumeButton.get()); - Ref<wf::Button> resumeButton = new wf::Button; - resumeButton->setLocation(wf::Point(17.5, -2.0f)); - resumeButton->setSize(wf::Size(25, 10)); - resumeButton->setZPos(getZPos() - 0.1f); - resumeButton->setText("Resume"); - addControl(resumeButton.get()); - + Ref<wf::Button> optionsButton = new wf::Button(getTheme(), "Options"); + optionsButton->addButtonClickedHandler(sigc::mem_fun(*this, &QuitResume::onOptions)); + table->setControl(1, 0, optionsButton.get()); + + Ref<wf::Button> quitButton = new wf::Button(getTheme(), "Quit"); quitButton->addButtonClickedHandler(sigc::mem_fun(*this, &QuitResume::onQuit)); - resumeButton->addButtonClickedHandler(sigc::mem_fun(*this, &QuitResume::onResume)); + table->setControl(2, 0, quitButton.get()); } void QuitResume::onResume() { @@ -66,6 +65,18 @@ CSPSim::theSim->quit(); } +void QuitResume::onOptions() { + wf::WindowManager* manager = getWindowManager(); + if(manager != NULL) { + if(!manager->windowIsOpen<Options>()) { + Ref<Window> options = new Options(getTheme()); + manager->show(options.get()); + } + } + + close(); +} + QuitResume::~QuitResume() { } Modified: trunk/csp/cspsim/windows/QuitResume.h =================================================================== --- trunk/csp/cspsim/windows/QuitResume.h 2006-11-14 22:48:32 UTC (rev 2005) +++ trunk/csp/cspsim/windows/QuitResume.h 2006-11-14 22:50:53 UTC (rev 2006) @@ -33,12 +33,13 @@ class QuitResume : public wf::Window { public: - QuitResume(); + QuitResume(wf::Theme* theme); virtual ~QuitResume(); private: void onResume(); void onQuit(); + void onOptions(); }; } // namespace windows |