TipDialog.cpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #include <dialogs/TipDialog.h>
00022 #include <graph/OptionsDisplay.h>
00023 #include <GLW/GLWTextButton.h>
00024 #include <GLW/GLWWindowManager.h>
00025 
00026 TipDialog *TipDialog::instance_ = 0;
00027 
00028 TipDialog *TipDialog::instance()
00029 {
00030         if (!instance_)
00031         {
00032                 instance_ = new TipDialog;
00033         }
00034         return instance_;
00035 }
00036 
00037 TipDialog::TipDialog() :
00038         GLWWindow("Tooltip Settings", 10.0f, 10.0f, 300.0f, 70.0f, eSmallTitle,
00039                 "Allow the user to change Tooltip settings")
00040 {
00041         needCentered_ = true;
00042 
00043         helpBox_ = new GLWCheckBoxText(0.0f, 0.0f, LANG_RESOURCE("SHOW_HELP_TOOLTIPS", "Show Help Tooltips"));
00044         addWidget(helpBox_, 0, SpaceLeft | SpaceRight | SpaceTop, 10.0f);
00045         infoBox_ = new GLWCheckBoxText(0.0f, 0.0f, LANG_RESOURCE("SHOW_INFO_TOOLTIPS", "Show Info Tooltips"));
00046         addWidget(infoBox_, 0, SpaceLeft | SpaceRight | SpaceTop, 10.0f);
00047 
00048         GLWPanel *buttonPanel = new GLWPanel(0.0f, 0.0f, 0.0f, 0.0f, false, false);
00049         GLWButton *cancelButton = new GLWTextButton(LANG_RESOURCE("CANCEL", "Cancel"), 95, 10, 105, this, 
00050                 GLWButton::ButtonFlagCancel | GLWButton::ButtonFlagCenterX);
00051         cancelId_ = cancelButton->getId();
00052         buttonPanel->addWidget(cancelButton, 0, SpaceRight, 10.0f);
00053         GLWButton *okButton = new GLWTextButton(LANG_RESOURCE("OK", "Ok"), 235, 10, 55, this, 
00054                 GLWButton::ButtonFlagOk | GLWButton::ButtonFlagCenterX);
00055         okId_ = okButton->getId();
00056         buttonPanel->addWidget(okButton);
00057         buttonPanel->setLayout(GLWPanel::LayoutHorizontal);
00058         addWidget(buttonPanel, 0, SpaceAll, 10.0f);
00059 
00060         setLayout(GLWPanel::LayoutVerticle);
00061         layout();
00062 }
00063 
00064 TipDialog::~TipDialog()
00065 {
00066 }
00067 
00068 void TipDialog::display()
00069 {
00070         GLWWindow::display();
00071 
00072         helpBox_->getCheckBox().setState(
00073                 OptionsDisplay::instance()->getShowContextHelp());
00074         infoBox_->getCheckBox().setState(
00075                 OptionsDisplay::instance()->getShowContextInfo());
00076 }
00077 
00078 void TipDialog::buttonDown(unsigned int id)
00079 {
00080         if (id == okId_)
00081         {
00082                 OptionsDisplay::instance()->getShowContextHelpEntry().setValue(
00083                         helpBox_->getCheckBox().getState());
00084                 OptionsDisplay::instance()->getShowContextInfoEntry().setValue(
00085                         infoBox_->getCheckBox().getState());
00086         }
00087         GLWWindowManager::instance()->hideWindow(getId());
00088 }

Generated on Mon Feb 16 15:14:38 2009 for Scorched3D by  doxygen 1.5.3