void CFileSystemDialogImp::OnPostLayoutLoad( void ) {GUCE_TRACE; GUCEF::GUI::CFileSystemDialog::OnPostLayoutLoad(); // Try and link the icon imageset CEGUI::ImagesetManager* imgSetManager = CEGUI::ImagesetManager::getSingletonPtr(); if ( imgSetManager->isImagesetPresent( "Icons" ) ) { m_iconsImageSet = imgSetManager->getImageset( "Icons" ); } // Hook up the event handlers CEGUI::FrameWindow* window = static_cast< CEGUI::FrameWindow* >( GetWindow()->GetImplementationPtr() ); window->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked , CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick , this ) ); CEGUI::MultiColumnList* fsViewWidget = static_cast< CEGUI::MultiColumnList* >( GetFileSystemGridView()->GetImplementationPtr() ); fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventSelectionChanged , CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemSelected , this ) ); fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventMouseDoubleClick , CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemDblClicked , this ) ); CEGUI::PushButton* okButton = static_cast< CEGUI::PushButton* >( GetOkButton()->GetImplementationPtr() ); okButton->subscribeEvent( CEGUI::PushButton::EventClicked , CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnOkButtonClick , this ) ); CEGUI::PushButton* cancelButton = static_cast< CEGUI::PushButton* >( GetCancelButton()->GetImplementationPtr() ); cancelButton->subscribeEvent( CEGUI::PushButton::EventClicked , CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick , this ) ); }
/*********************************************************** initalize the box ***********************************************************/ void ChooseNumberBox::Initialize(CEGUI::Window* Root) { try { _myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "choosenumberbox.layout" ); Root->addChildWindow(_myBox); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("ChooseNumberBoxFrame")); frw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&ChooseNumberBox::HandleCancel, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("ChooseNumberBoxFrame/bOk"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChooseNumberBox::HandleOk, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("ChooseNumberBoxFrame/bCancel"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ChooseNumberBox::HandleCancel, this)); _myBox->hide(); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init ChooseNumberBox: ") + ex.getMessage().c_str()); } }
void t_chessGui::initConnect() { CEGUI::FrameWindow *connect = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("connect.layout")); myRoot->addChildWindow(connect); connect->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeConnect,connect,_1))); CEGUI::MenuItem *connectItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/Open")); connectItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openConnect,connect,_1))); CEGUI::PushButton *newConnectItem = static_cast<CEGUI::PushButton *>(wmgr->getWindow("Lols2")); newConnectItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openConnect,connect,_1))); CEGUI::PushButton *cancelConnect = static_cast<CEGUI::PushButton *>(wmgr->getWindow("1Lols6")); cancelConnect->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(boost::bind(closeConnect,connect,_1))); CEGUI::Editbox *name = static_cast<CEGUI::Editbox *>(wmgr->getWindow("1Lols2")); CEGUI::Editbox *ip = static_cast<CEGUI::Editbox *>(wmgr->getWindow("1Lols7")); CEGUI::PushButton *startConnection = static_cast<CEGUI::PushButton *>(wmgr->getWindow("1Lols4")); startConnection->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(boost::bind(connectToServer,name,ip,boost::ref(sharedData),_1))); connect->hide(); }
/*********************************************************** 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()); } }
void t_chessGui::initServer() { CEGUI::FrameWindow *server = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("server.layout")); myRoot->addChildWindow(server); server->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeServer,server,_1))); CEGUI::MenuItem *serverItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/New")); serverItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openServer,server,_1))); CEGUI::MultiColumnList *testing = static_cast<CEGUI::MultiColumnList *>(wmgr->getWindow("Lols3")); testing->addColumn("Names",0,CEGUI::UDim(.25,0)); testing->addColumn("Action",1,CEGUI::UDim(.25,0)); testing->addColumn("Wins",2,CEGUI::UDim(.25,0)); testing->addColumn("Losses",3,CEGUI::UDim(.25,0)); testing->addRow(); testing->addRow(); testing->setItem(new CEGUI::ListboxTextItem("What, wow,"),0u,0u); server->hide(); }
/*********************************************************** 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 ContainerBox::Initialize(CEGUI::Window* Root) { try { _myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "container.layout" ); Root->addChildWindow(_myBox); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame")); frw->subscribeEvent ( CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&ContainerBox::HandleCancel, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/OK"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ContainerBox::HandleOk, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/TakeAll"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ContainerBox::HandleTakeAll, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/Cancel"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&ContainerBox::HandleCancel, this)); CEGUI::Window* pane = CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/ConScrollable"); CEGUI::Window* tmpwindow; for(int i=0; i<_NB_BOX_CONTAINER_; ++i) { int x = i / 3; int y = i % 3; tmpwindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText"); tmpwindow->setArea(CEGUI::UDim(0,5+((float)_boxsize+2)*y), CEGUI::UDim(0,5+((float)_boxsize+2)*x), CEGUI::UDim(0, (float)_boxsize), CEGUI::UDim(0, (float)_boxsize)); pane->addChildWindow(tmpwindow); tmpwindow->subscribeEvent( CEGUI::Window::EventDragDropItemDropped, CEGUI::Event::Subscriber(&ContainerBox::handle_ItemDroppedInContainer, this)); tmpwindow->setID(i); _cont_boxes.push_back(tmpwindow); } frw->show(); _myBox->hide(); frw->subscribeEvent(CEGUI::Window::EventKeyDown, CEGUI::Event::Subscriber (&ContainerBox::HandleEnterKey, this)); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init ContainerBox: ") + ex.getMessage().c_str()); } }
/*********************************************************** init function ***********************************************************/ void LoginGUI::Initialize(const std::string &clientversion) { try { _root = CEGUI::WindowManager::getSingleton().loadWindowLayout( "LoginWindow.layout" ); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("ConnectB"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::HandleConnect, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("CancelB"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::HandleCancel, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/plus"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::Handlebplus, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/minus"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::Handlebminus, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/cplus"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::Handlecplus, this)); static_cast<CEGUI::PushButton *> ( CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/cminus"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::Handlecminus, this)); CEGUI::WindowManager::getSingleton().getWindow("LBaNetLogo")->disable(); CEGUI::WindowManager::getSingleton().getWindow("LBaNetLogoCenter")->disable(); CEGUI::Editbox * pt = static_cast<CEGUI::Editbox *> ( CEGUI::WindowManager::getSingleton().getWindow("PasswordText")); if(pt) pt->setTextMasked(true); std::string name; ConfigurationManager::GetInstance()->GetString("Player.Name", name); CEGUI::Editbox * lt = static_cast<CEGUI::Editbox *> ( CEGUI::WindowManager::getSingleton().getWindow("LoginText")); lt->setText(name); CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame")->hide(); static_cast<CEGUI::FrameWindow *>( CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame"))->setDragMovingEnabled(false); static_cast<CEGUI::FrameWindow *>( CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame"))->setRollupEnabled(false); static_cast<CEGUI::FrameWindow *>( CEGUI::WindowManager::getSingleton().getWindow("LoginWIndowFrame"))->setDragMovingEnabled(false); static_cast<CEGUI::FrameWindow *>( CEGUI::WindowManager::getSingleton().getWindow("LoginWIndowFrame"))->setRollupEnabled(false); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame/bok"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&LoginGUI::HandleCloseTextClicked, this)); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame")); frw->subscribeEvent (CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&LoginGUI::HandleCloseTextClicked, this)); CEGUI::WindowManager::getSingleton().getWindow("ClientVersionText")->setText(clientversion); CEGUI::WindowManager::getSingleton().getWindow("PasswordText")->subscribeEvent(CEGUI::Window::EventKeyDown, CEGUI::Event::Subscriber (&LoginGUI::HandleEnterKey, this)); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init login gui: ") + ex.getMessage().c_str()); _root = NULL; } }
/*********************************************************** 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()); } }
/*********************************************************** initialize the GUI ***********************************************************/ void GameGUI::Initialize() { try { _root = CEGUI::WindowManager::getSingleton().loadWindowLayout( "GameGuiRoot.layout" ); _cb.Initialize(_root); _comb.Initialize(_root); _telb.Initialize(_root); _invb.Initialize(_root); _shortb.Initialize(_root); _containerb.Initialize(_root); _lettereditb.Initialize(_root); _letterviewb.Initialize(_root); _dialogb.Initialize(_root); _journalb.Initialize(_root); CGMessageBox::getInstance()->Initialize(_root); ChooseNumberBox::getInstance()->Initialize(_root); #ifdef _LBANET_SET_EDITOR_ if(_editb) _editb->Initialize(_root); #endif CEGUI::WindowManager::getSingleton().getWindow("HeadInterfaceBG")->disable(); CEGUI::WindowManager::getSingleton().getWindow("MenuCharInterfaceBG")->disable(); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnchaticon"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleChatIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btncomicon"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleComIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnteleporticon"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleTeleIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnquit"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleQuitIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnsound"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleSoundIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnchangeworld"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleChangeWorldIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnoption"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleOptionIconClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("DisplayGameTextFrame/bok"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleCloseTextClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btntunic"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleInventoryClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnweapon"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleShortcutClicked, this)); static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnquest"))->subscribeEvent ( CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber (&GameGUI::HandleJournalClicked, this)); CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("DisplayGameTextFrame")); frw->subscribeEvent (CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber (&GameGUI::HandleCloseTextClicked, this)); CEGUI::WindowManager::getSingleton().getWindow("DisplayGameTextFrame")->hide(); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init login gui: ") + ex.getMessage().c_str()); _root = NULL; } RefreshSOundButton(); }
/*********************************************************** 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()); } }