/*********************************************************** restore the correct size of the windows ***********************************************************/ void JournalBox::RestoreGUISizes() { CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("JournalFrame")); frw->setPosition(CEGUI::UVector2(CEGUI::UDim(_savedPosX, 0), CEGUI::UDim(_savedPosY, 0))); frw->setWidth(CEGUI::UDim(_savedSizeX, 0)); frw->setHeight(CEGUI::UDim(_savedSizeY, 0)); }
/*********************************************************** initalize the box ***********************************************************/ void TeleportBox::Initialize(CEGUI::Window* Root) { try { _myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "TeleportBox.layout" ); Root->addChildWindow(_myBox); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("TeleportCancelButton"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&TeleportBox::HandleClose, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("TeleporGoButton"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&TeleportBox::HandleGoButton, this)); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("TeleportFrame")); frw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&TeleportBox::HandleClose, this)); float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY; bool Visible; ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.PosX", PosX); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.PosY", PosY); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.SizeX", SizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.SizeY", SizeY); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetPosX", OPosX); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetPosY", OPosY); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetSizeX", OSizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetSizeY", OSizeY); ConfigurationManager::GetInstance()->GetBool("Gui.Teleportbox.Visible", Visible); frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY))); frw->setWidth(CEGUI::UDim(SizeX, OSizeX)); frw->setHeight(CEGUI::UDim(SizeY, OSizeY)); if(Visible) frw->show(); else frw->hide(); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init teleport box: ") + ex.getMessage().c_str()); } }
/*********************************************************** initalize the box ***********************************************************/ void LetterViewerBox::Initialize(CEGUI::Window* Root) { try { _myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "letterviewer.layout" ); Root->addChildWindow(_myBox); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("LetterViewerGoB"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LetterViewerBox::HandleOK, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("LetterViewerDestroyB"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LetterViewerBox::HandleCancel, this)); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("LetterViewerWIndowFrame")); frw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&LetterViewerBox::HandleOK, this)); _myBox->hide(); InventoryHandler::getInstance()->SetLetterViewer(this); float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY; ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.PosX", PosX); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.PosY", PosY); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.SizeX", SizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.SizeY", SizeY); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetPosX", OPosX); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetPosY", OPosY); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetSizeX", OSizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetSizeY", OSizeY); frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY))); frw->setWidth(CEGUI::UDim(SizeX, OSizeX)); frw->setHeight(CEGUI::UDim(SizeY, OSizeY)); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init LetterEditorBox: ") + ex.getMessage().c_str()); } }
/*********************************************************** initalize the box ***********************************************************/ void CommunityBox::Initialize(CEGUI::Window* Root) { try { _myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "community.layout" ); Root->addChildWindow(_myBox); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame")); frw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleClose, this)); float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY; bool Visible; ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.PosX", PosX); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.PosY", PosY); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.SizeX", SizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.SizeY", SizeY); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetPosX", OPosX); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetPosY", OPosY); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetSizeX", OSizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetSizeY", OSizeY); ConfigurationManager::GetInstance()->GetBool("Gui.Communitybox.Visible", Visible); frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY))); frw->setWidth(CEGUI::UDim(SizeX, OSizeX)); frw->setHeight(CEGUI::UDim(SizeY, OSizeY)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame/friendAdd"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleAddFriend, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame/friendRemove"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleRemoveFriend, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame/friendRefresh"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleRefreshFriend, this)); _myChooseName = CEGUI::WindowManager::getSingleton().loadWindowLayout( "AddFriendName.layout" ); _myChooseName->setProperty("AlwaysOnTop", "True"); Root->addChildWindow(_myChooseName); _myChooseName->hide(); { CEGUI::FrameWindow * fw = static_cast<CEGUI::FrameWindow *>(_myChooseName); fw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleCPCancel, this) ); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/AddFriendName/bOk"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleCPOk, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/AddFriendName/bCancel"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&CommunityBox::HandleCPCancel, this)); } static_cast<CEGUI::Listbox *> ( CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"))->subscribeEvent ( CEGUI::Listbox::EventMouseDoubleClick, CEGUI::Event::Subscriber (&CommunityBox::HandleListdblClick, this)); static_cast<CEGUI::Listbox *> ( CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"))->subscribeEvent ( CEGUI::Listbox::EventMouseDoubleClick, CEGUI::Event::Subscriber (&CommunityBox::HandleConnecteddblClick, this)); if(Visible) frw->show(); else frw->hide(); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init community box: ") + ex.getMessage().c_str()); } }
/*********************************************************** initalize the box ***********************************************************/ void ChatBox::Initialize(CEGUI::Window* Root) { try { _myChat = CEGUI::WindowManager::getSingleton().loadWindowLayout( "chatbox.layout" ); Root->addChildWindow(_myChat); //tc->setProperty( "InheritsAlpha", "false" ); AddTab("All"); AddTab("World"); AddTab("Map"); AddTab("IRC"); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChatBox::HandleBChannel, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/bSend"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChatBox::HandleSend, this)); static_cast<CEGUI::Editbox *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"))->subscribeEvent ( CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber (&ChatBox::HandleEnterKey, this)); static_cast<CEGUI::Editbox *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"))->subscribeEvent ( CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber (&ChatBox::HandleReleaseKey, this)); _lb = static_cast<CEGUI::Listbox *> (CEGUI::WindowManager::getSingleton().createWindow( "TaharezLook/Listbox", "Chat/listchannel" )); _lb->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber (&ChatBox::HandleLbSelected, this)); _lb->setProperty("Text", "Channels"); _lb->setProperty("UnifiedMaxSize", "{{1,0},{1,0}}"); _lb->setProperty("UnifiedAreaRect", "{{0,10},{1,-160},{0,120},{1,-40}}"); _lb->setProperty("AlwaysOnTop", "True"); _myChat->addChildWindow(_lb); _lb->hide(); _myChannels = CEGUI::WindowManager::getSingleton().loadWindowLayout( "choosechannel.layout" ); _myChannels->setProperty("AlwaysOnTop", "True"); Root->addChildWindow(_myChannels); _myChannels->hide(); _myChooseName = CEGUI::WindowManager::getSingleton().loadWindowLayout( "choosePlayerName.layout" ); _myChooseName->setProperty("AlwaysOnTop", "True"); Root->addChildWindow(_myChooseName); _myChooseName->hide(); { CEGUI::FrameWindow * fw = static_cast<CEGUI::FrameWindow *>(_myChannels); fw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCCCancel, this) ); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/chooseChannel/bOk"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCCOk, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/chooseChannel/bCancel"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCCCancel, this)); } { CEGUI::FrameWindow * fw = static_cast<CEGUI::FrameWindow *>(_myChooseName); fw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCPCancel, this) ); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/bOk"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCPOk, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/bCancel"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCPCancel, this)); } CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("ChatFrame")); frw->subscribeEvent (CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&ChatBox::HandleCloseChatbox, this)); float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY; bool Visible; ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.PosX", PosX); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.PosY", PosY); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.SizeX", SizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.SizeY", SizeY); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetPosX", OPosX); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetPosY", OPosY); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetSizeX", OSizeX); ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetSizeY", OSizeY); ConfigurationManager::GetInstance()->GetBool("Gui.Chatbox.Visible", Visible); frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY))); frw->setWidth(CEGUI::UDim(SizeX, OSizeX)); frw->setHeight(CEGUI::UDim(SizeY, OSizeY)); if(Visible) frw->show(); else frw->hide(); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init chatbox: ") + ex.getMessage().c_str()); } }
/*********************************************************** initalize the box ***********************************************************/ void JournalBox::Initialize(CEGUI::Window* Root) { try { _myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "questbook.layout", "", "", &MyPropertyCallback); Root->addChildWindow(_myBox); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("JournalFrame")); frw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&JournalBox::HandleClose, this)); CEGUI::Tree * tree = static_cast<CEGUI::Tree *> ( CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questtab/Tree")); tree->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber (&JournalBox::HandleQuestTreeSelected, this)); CEGUI::Tree * tree2 = static_cast<CEGUI::Tree *> ( CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questdonetab/Tree")); tree2->subscribeEvent(CEGUI::Listbox::EventSelectionChanged, CEGUI::Event::Subscriber (&JournalBox::HandleQuestDoneTreeSelected, this)); float PosX = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.PosX", 0.65f); float PosY = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.PosY", 0.56f); float SizeX = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.SizeX", 0.35f); float SizeY = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.SizeY", 0.34f); bool Visible = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.Visible", false); frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, 0), CEGUI::UDim(PosY, 0))); frw->setWidth(CEGUI::UDim(SizeX, 0)); frw->setHeight(CEGUI::UDim(SizeY, 0)); if(Visible) frw->show(); else frw->hide(); // get quest topic tree which should be opened std::string treeqopen = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestTreeOpen", ""); std::string treedqopen = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestDoneTreeOpen", ""); _selected_tree_quests = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestTreeSelected", ""); _selected_tree_done_quests = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestDoneTreeSelected", ""); StringHelper::Tokenize(treeqopen, _open_tree_quests, "##"); StringHelper::Tokenize(treedqopen, _open_tree_done_quests, "##"); static_cast<CEGUI::TabControl *> ( CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab"))->setSelectedTab("Root/JournalWin/tab/questtab"); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init InventoryBox: ") + ex.getMessage().c_str()); } }