예제 #1
0
void GUIManager::setHandlers ()
{
  CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();

  CEGUI::FrameWindow *dsFrame = static_cast<CEGUI::FrameWindow *>(
      wm.getWindow("Sheet/DatasetFrame"));
  dsFrame->hide();
  // Handle behavior of options-button
  CEGUI::PushButton *button = static_cast<CEGUI::PushButton *>(
      wm.getWindow("Sheet/Options"));
  button->subscribeEvent(CEGUI::PushButton::EventClicked,
      CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
  button = dsFrame->getCloseButton();
  button->subscribeEvent(CEGUI::PushButton::EventClicked,
      CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
  // Connect activate buttons on tabs
  auto connectFrames = [=](CEGUI::Window *tab) {
    CEGUI::PushButton *button =
      static_cast<CEGUI::PushButton *>(tab->getChild(3));
    button->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIManager::handleDSActivation, this));
    button = static_cast<CEGUI::PushButton *>(tab->getChild(4));
    button->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIManager::handleDSDeactivation, this));
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
        CEGUI::Event::Subscriber(&GUIManager::handleScrollbarChanged, this));
    CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
    lb->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
        CEGUI::Event::Subscriber(&GUIManager::handleDSSelection, this));
  };
  CEGUI::Window *tab =  wm.getWindow("Sheet/DatasetFrame/TabControl/HTab");
  connectFrames(tab);
  tab = wm.getWindow("Sheet/DatasetFrame/TabControl/PTab");
  connectFrames(tab);
  tab = wm.getWindow("Sheet/DatasetFrame/TabControl/CTab");
  connectFrames(tab);
  CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(
      wm.getWindow("Sheet/DimensionSlider"));
  sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
      CEGUI::Event::Subscriber(&GUIManager::handleBigScrollbarChanged, this));
}
예제 #2
0
bool MainGameScreen::Init()
{
    RootWindow = CEGUI::WindowManager::getSingleton().loadWindowLayout("MainGameScreen.layout");

    try
    {
        CEGUI::Window* GameOptionsButton = GUI->getWindowManager()->getWindow("MainGameScreen/TopBar/GameOptionsButton");
        if (GameOptionsButton != NULL)
        {
            GameOptionsButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::GameOptionsOpen, this));
        }

        CEGUI::Window* GameOptionsWindow = GUI->getWindowManager()->getWindow("MainGameScreen/GameOptionsWindow");
        if (GameOptionsWindow != NULL)
        {
            GameOptionsWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&MainGameScreen::GameOptionsClose, this));
        }

        CEGUI::Window* PathTesterWindow = GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow");
        if (PathTesterWindow != NULL)
        {
            PathTesterWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&MainGameScreen::PathProfilerClose, this));
        }

        CEGUI::Window* ZoneButton = GUI->getWindowManager()->getWindow("MainGameScreen/TopBar/ZoneButton");
        if (ZoneButton != NULL)
        {
            ZoneButton->subscribeEvent(CEGUI::FrameWindow::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::ZoneButtonClick, this));
        }

        CEGUI::Window* SaveButton = GUI->getWindowManager()->getWindow("MainGameScreen/GameOptionsWindow/SaveGameButton");
        if (SaveButton != NULL)
        {
            SaveButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::SaveGame, this));
        }

        CEGUI::Window* PathProfileButton = GUI->getWindowManager()->getWindow("MainGameScreen/GameOptionsWindow/PathProfilerButton");
        if (PathProfileButton != NULL)
        {
            PathProfileButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::PathProfilerOpen, this));
        }

        CEGUI::Window* ExitButton = GUI->getWindowManager()->getWindow("MainGameScreen/GameOptionsWindow/ExitButton");
        if (ExitButton != NULL)
        {
            ExitButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::ExitGame, this));
        }

        CEGUI::Window* TestSuiteButton = GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/RunSuiteButton");
        if (TestSuiteButton != NULL)
        {
            TestSuiteButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::RunSuitePressed, this));
        }

        CEGUI::Scrollbar* DepthSliderTop = static_cast<CEGUI::Scrollbar*> (GUI->getWindowManager()->getWindow("MainGameScreen/DepthScrollerTop"));
        if (DepthSliderTop != NULL)
        {
            DepthSliderTop->setDocumentSize(1000);
            DepthSliderTop->setScrollPosition(0);
            DepthSliderTop->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged, CEGUI::Event::Subscriber(&MainGameScreen::DepthSliderMoved, this));
        }

        CEGUI::Scrollbar* DepthSliderBottom = static_cast<CEGUI::Scrollbar*> (GUI->getWindowManager()->getWindow("MainGameScreen/DepthScrollerBottom"));
        if (DepthSliderBottom != NULL)
        {
            DepthSliderBottom->setDocumentSize(1000);
            DepthSliderBottom->setScrollPosition(1000);
            DepthSliderBottom->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged, CEGUI::Event::Subscriber(&MainGameScreen::DepthSliderMoved, this));
        }

        CEGUI::Window* PauseButton = GUI->getWindowManager()->getWindow("MainGameScreen/TopBar/PauseButton");
        if (PauseButton != NULL)
        {
            PauseButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::MainGameScreen::PausePressed, this));
        }

        CEGUI::Window* PlayButton = GUI->getWindowManager()->getWindow("MainGameScreen/TopBar/PlayButton");
        if (PauseButton != NULL)
        {
            PlayButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::MainGameScreen::PlayPressed, this));
        }

        CEGUI::Window* DigButton = GUI->getWindowManager()->getWindow("MainGameScreen/BottomWindow/DigButton");
        if (DigButton != NULL)
        {
            DigButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::MainGameScreen::DigPressed, this));
        }

    }

    catch(CEGUI::Exception &e)
    {
    }
}