void DemoKeeper::notifyFrameStarted(float _time) { if (all_widgets.size() > 500) { step_destroy_widget(200); } else { int step = random(8); if (step == 0) { step_detach_layer(10); } else if (step == 1) { step_attach_layer(30); } else if (step == 2) { step_attach_widget(10); } else if (step == 3) { step_detach_widget(10); } else if (step == 4) { step_destroy_widget(2); } else if (step == 5) { step_create_widget(30); } else if (step == 6) { step_change_skin(30); } else if (step == 7) { step_change_type(30); } } getStatisticInfo()->change("COUNT", all_widgets.size()); #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 ::Sleep(10); #endif }
void DemoKeeper::createDemo(size_t _index) { destroyDemo(); if (_index == 0) { MyGUI::LanguageManager::getInstance().loadUserTags("core_theme_tag.xml"); getGUI()->load("core_skin.xml"); } else if (_index == 1) { MyGUI::LanguageManager::getInstance().loadUserTags("core_theme_black_blue_tag.xml"); getGUI()->load("core_skin.xml"); } else if (_index == 2) { MyGUI::LanguageManager::getInstance().loadUserTags("core_theme_black_orange_tag.xml"); getGUI()->load("core_skin.xml"); } MyGUI::VectorWidgetPtr windows = MyGUI::LayoutManager::getInstance().load("Themes.layout"); MYGUI_ASSERT(windows.size() == 1, "Error load layout"); mDemoView = windows[0]; mComboSkins = getGUI()->findWidget<MyGUI::ComboBox>("Combo"); mComboSkins->setComboModeDrop(true); mComboSkins->addItem("core"); mComboSkins->addItem("black & blue"); mComboSkins->addItem("black & orange"); mComboSkins->setIndexSelected(_index); mComboSkins->eventComboAccept = MyGUI::newDelegate(this, &DemoKeeper::notifyComboAccept); }
void toggleRadio(MyGUI::MenuItem* current) { MyGUI::VectorWidgetPtr widgets; _menuBar->findWidgets(current->getName(), widgets); for (size_t i = 0; i < widgets.size(); i++) { MyGUI::MenuItem *item = widgets[i]->castType<MyGUI::MenuItem>(); item->setItemChecked(item == current); } }
void createDemo( int index ) { destroyDemo(); switch ( index ) { case 0: MyGUI::ResourceManager::getInstance().load("MyGUI_BlueWhiteTheme.xml"); break; case 1: MyGUI::ResourceManager::getInstance().load("MyGUI_BlackBlueTheme.xml"); break; case 2: MyGUI::ResourceManager::getInstance().load("MyGUI_BlackOrangeTheme.xml"); break; default: break; } MyGUI::VectorWidgetPtr windows = MyGUI::LayoutManager::getInstance().loadLayout("Themes.layout"); if ( windows.size()<1 ) { OSG_WARN << "Error load layout" << std::endl; return; } _demoView = windows[0]; _comboSkins = MyGUI::Gui::getInstance().findWidget<MyGUI::ComboBox>("Combo"); if ( _comboSkins ) { _comboSkins->setComboModeDrop( true ); _comboSkins->addItem( "blue & white" ); _comboSkins->addItem( "black & blue" ); _comboSkins->addItem( "black & orange" ); _comboSkins->setIndexSelected( index ); _comboSkins->eventComboAccept += MyGUI::newDelegate(this, &CustomMYGUIManager::notifyComboAccept); } }