void GUIMissionWindow::changeMission( int index,MissionState state,std::string caption) { MyGUI::ImageBox* icon; MyGUI::TextBox* text; if(caption!="") { assignWidget(text,str(boost::format("Mission%1%Caption")%(index+1))); if(caption!="clear") { text->setCaption(caption); } else { text->setCaption(""); } } assignWidget(icon,str(boost::format("Mission%1%Icon")%(index+1))); switch (state) { case MS_New: { icon->setItemName("New"); break; } case MS_Complete: { icon->setItemName("Complete"); break; } case MS_Fail: { icon->setItemName("Fail"); break; } case MS_NULL: { icon->setItemName(""); break; } } }
void DemoKeeper::createScene() { MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout"); const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout"); root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("Sample of picking mask for widget."); MyGUI::ResourceManager::getInstance().load("Resources.xml"); const MyGUI::IntSize& view = MyGUI::RenderManager::getInstance().getViewSize(); const MyGUI::IntSize size(128, 128); MyGUI::ImageBox* image = MyGUI::Gui::getInstance().createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord((view.width - size.width) / 2, (view.height - size.height) / 2, size.width, size.height), MyGUI::Align::Default, "Main"); image->setItemResource("pic_Crystal_Clear_Butterfly"); image->setItemGroup("States"); image->setItemName("Normal"); image->eventMouseSetFocus += MyGUI::newDelegate(notifyMouseSetFocus); image->eventMouseLostFocus += MyGUI::newDelegate(notifyMouseLostFocus); image->setMaskPick("Crystal_Clear_Butterfly_Pick.png"); }
void notifyMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new) { MyGUI::ImageBox* image = _sender->castType<MyGUI::ImageBox>(); image->setItemName("Normal"); }
void notifyMouseSetFocus(MyGUI::Widget* _sender, MyGUI::Widget* _old) { MyGUI::ImageBox* image = _sender->castType<MyGUI::ImageBox>(); image->setItemName("Active"); }