00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 }