From: <sv...@ww...> - 2006-11-14 22:54:53
|
Author: stormbringer Date: 2006-11-14 14:54:43 -0800 (Tue, 14 Nov 2006) New Revision: 2008 Added: trunk/csp/cspsim/windows/DisplayOptions.cpp trunk/csp/cspsim/windows/DisplayOptions.h trunk/csp/cspsim/windows/Options.cpp trunk/csp/cspsim/windows/Options.h trunk/csp/cspsim/windows/SoundOptions.h Log: Additional code for "options" dialog Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2008 Added: trunk/csp/cspsim/windows/DisplayOptions.cpp =================================================================== --- trunk/csp/cspsim/windows/DisplayOptions.cpp 2006-11-14 22:53:09 UTC (rev 2007) +++ trunk/csp/cspsim/windows/DisplayOptions.cpp 2006-11-14 22:54:43 UTC (rev 2008) @@ -0,0 +1,65 @@ +// Combat Simulator Project +// Copyright (C) 2002 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file DisplayOptions.cpp + * + **/ + +#include <csp/cspsim/wf/Label.h> +#include <csp/cspsim/wf/TableControlContainer.h> +#include <csp/cspsim/windows/DisplayOptions.h> + +#include <osg/Vec4> + +CSP_NAMESPACE + +namespace windows { + +DisplayOptions::DisplayOptions(wf::Theme* theme) : wf::TabPage(theme) { + setText("Display"); + + Ref<wf::TableControlContainer> table = new wf::TableControlContainer(theme, 2, 5); + table->getColumns()[0].setWidth(0.3f); + table->getColumns()[1].setWidth(0.7f); + + table->setControl(0, 0, new wf::Label(theme, "Resolution:")); + table->setControl(1, 0, new wf::Label(theme, "TODO: 1024x768")); + + table->setControl(0, 1, new wf::Label(theme, "Terrain:")); + table->setControl(1, 1, new wf::Label(theme, "TODO: Low")); + + table->setControl(0, 2, new wf::Label(theme, "Texture:")); + table->setControl(1, 2, new wf::Label(theme, "TODO: Very high")); + + table->setControl(0, 3, new wf::Label(theme, "Effects:")); + table->setControl(1, 3, new wf::Label(theme, "TODO: Ultra realistic")); + + table->setControl(0, 4, new wf::Label(theme, "Shadows:")); + table->setControl(1, 4, new wf::Label(theme, "TODO: Dark")); + + setControl(table.get()); +} + +DisplayOptions::~DisplayOptions() { +} + +} // namespace windows + +CSP_NAMESPACE_END Added: trunk/csp/cspsim/windows/DisplayOptions.h =================================================================== --- trunk/csp/cspsim/windows/DisplayOptions.h 2006-11-14 22:53:09 UTC (rev 2007) +++ trunk/csp/cspsim/windows/DisplayOptions.h 2006-11-14 22:54:43 UTC (rev 2008) @@ -0,0 +1,46 @@ +// Combat Simulator Project +// Copyright (C) 2002 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file DisplayOptions.h + * + **/ + +#ifndef __CSPSIM_WINDOWS_DISPLAYOPTIONS_H__ +#define __CSPSIM_WINDOWS_DISPLAYOPTIONS_H__ + +#include <csp/cspsim/wf/TabPage.h> + +CSP_NAMESPACE + +namespace windows { + +class DisplayOptions : public wf::TabPage { +public: + DisplayOptions(wf::Theme* theme); + virtual ~DisplayOptions(); + +private: +}; + +} // namespace windows + +CSP_NAMESPACE_END + +#endif // __CSPSIM_WINDOWS_DISPLAYOPTIONS_H__ Added: trunk/csp/cspsim/windows/Options.cpp =================================================================== --- trunk/csp/cspsim/windows/Options.cpp 2006-11-14 22:53:09 UTC (rev 2007) +++ trunk/csp/cspsim/windows/Options.cpp 2006-11-14 22:54:43 UTC (rev 2008) @@ -0,0 +1,84 @@ +// Combat Simulator Project +// Copyright (C) 2002 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file Options.cpp + * + **/ + +#include <csp/cspsim/wf/Button.h> +#include <csp/cspsim/wf/Tab.h> +#include <csp/cspsim/wf/TableControlContainer.h> +#include <csp/cspsim/windows/DisplayOptions.h> +#include <csp/cspsim/windows/Options.h> +#include <csp/cspsim/windows/SoundOptions.h> +#include <csp/csplib/data/ObjectInterface.h> + +#include <osg/Vec4> + +CSP_NAMESPACE + +namespace windows { + +Options::Options(wf::Theme* theme) : wf::Window(theme) { + setSize(wf::Size(140.0, 120.0)); + setCaption("Options"); + + Ref<wf::TableControlContainer> topTable = new wf::TableControlContainer(getTheme(), 1, 2); + topTable->getRows()[0].setHeight(0.85f); + topTable->getRows()[1].setHeight(0.15f); + setControl(topTable.get()); + + // Add the tab page. + Ref<wf::Tab> tab = new wf::Tab(getTheme()); + m_DisplayOptionsPage = new DisplayOptions(getTheme()); + tab->addPage(m_DisplayOptionsPage.get()); + m_SoundOptionsPage = new SoundOptions(getTheme()); + tab->addPage(m_SoundOptionsPage.get()); + + topTable->setControl(0,0, tab.get()); + + Ref<wf::TableControlContainer> okCancelTable = new wf::TableControlContainer(getTheme(), 3, 1); + topTable->setControl(0, 1, okCancelTable.get()); + okCancelTable->getColumns()[0].setWidth(0.6f); + okCancelTable->getColumns()[1].setWidth(0.2f); + okCancelTable->getColumns()[2].setWidth(0.2f); + Ref<wf::Button> cancelButton = new wf::Button(getTheme(), "Cancel"); + cancelButton->addButtonClickedHandler(sigc::mem_fun(*this, &Options::onCancel)); + okCancelTable->setControl(1, 0, cancelButton.get()); + + Ref<wf::Button> okButton = new wf::Button(getTheme(), "OK"); + okButton->addButtonClickedHandler(sigc::mem_fun(*this, &Options::onOK)); + okCancelTable->setControl(2, 0, okButton.get()); +} + +void Options::onOK() { + close(); +} + +void Options::onCancel() { + close(); +} + +Options::~Options() { +} + +} // namespace windows + +CSP_NAMESPACE_END Added: trunk/csp/cspsim/windows/Options.h =================================================================== --- trunk/csp/cspsim/windows/Options.h 2006-11-14 22:53:09 UTC (rev 2007) +++ trunk/csp/cspsim/windows/Options.h 2006-11-14 22:54:43 UTC (rev 2008) @@ -0,0 +1,54 @@ +// Combat Simulator Project +// Copyright (C) 2002 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file Options.h + * + **/ + +#ifndef __CSPSIM_WINDOWS_OPTIONS_H__ +#define __CSPSIM_WINDOWS_OPTIONS_H__ + +#include <csp/cspsim/wf/Window.h> + +CSP_NAMESPACE + +namespace windows { + +class DisplayOptions; +class SoundOptions; + +class Options : public wf::Window { +public: + Options(wf::Theme* theme); + virtual ~Options(); + +private: + void onOK(); + void onCancel(); + + Ref<DisplayOptions> m_DisplayOptionsPage; + Ref<SoundOptions> m_SoundOptionsPage; +}; + +} // namespace windows + +CSP_NAMESPACE_END + +#endif // __CSPSIM_WINDOWS_OPTIONS_H__ Added: trunk/csp/cspsim/windows/SoundOptions.h =================================================================== --- trunk/csp/cspsim/windows/SoundOptions.h 2006-11-14 22:53:09 UTC (rev 2007) +++ trunk/csp/cspsim/windows/SoundOptions.h 2006-11-14 22:54:43 UTC (rev 2008) @@ -0,0 +1,46 @@ +// Combat Simulator Project +// Copyright (C) 2002 The Combat Simulator Project +// http://csp.sourceforge.net +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +/** + * @file SoundOptions.h + * + **/ + +#ifndef __CSPSIM_WINDOWS_SOUNDOPTIONS_H__ +#define __CSPSIM_WINDOWS_SOUNDOPTIONS_H__ + +#include <csp/cspsim/wf/TabPage.h> + +CSP_NAMESPACE + +namespace windows { + +class SoundOptions : public wf::TabPage { +public: + SoundOptions(wf::Theme* theme); + virtual ~SoundOptions(); + +private: +}; + +} // namespace windows + +CSP_NAMESPACE_END + +#endif // __CSPSIM_WINDOWS_SOUNDOPTIONS_H__ |