Exemple #1
0
	void step_create_widget()
	{
		MyGUI::Widget* widget = get_random(all_widgets);
		if (widget)
		{
			int select = random(3);
			if (select == 0)
			{
				MyGUI::Widget* child = widget->createWidget<MyGUI::Widget>(MyGUI::WidgetStyle::Child, get_skin(), get_coord(), MyGUI::Align::Default);
				MYGUI_ASSERT(child, "child nullptr");
				all_widgets.push_back(child);
			}
			else if (select == 1)
			{
				MyGUI::Widget* child = widget->createWidget<MyGUI::Widget>(MyGUI::WidgetStyle::Popup, get_skin(), get_coord(), MyGUI::Align::Default, get_layer());
				MYGUI_ASSERT(child, "child nullptr");
				all_widgets.push_back(child);
			}
			else if (select == 2)
			{
				MyGUI::Widget* child = widget->createWidget<MyGUI::Widget>(MyGUI::WidgetStyle::Overlapped, get_skin(), get_coord(), MyGUI::Align::Default);
				MYGUI_ASSERT(child, "child nullptr");
				all_widgets.push_back(child);
			}
		}
		else
		{
			MyGUI::Widget* child = MyGUI::Gui::getInstance().createWidget<MyGUI::Widget>(get_skin(), get_coord(), MyGUI::Align::Default, get_layer());
			MYGUI_ASSERT(child, "child nullptr");
			all_widgets.push_back(child);
		}
		test_widgets();
	}
Exemple #2
0
/*清除通过Add加入的界面物件
*/
void SimpleDataUI::clear(){
	assert( mParent );
	MyGUI::VectorWidgetPtr dv;
	for( size_t i = 0;i<mParent->getChildCount();++i ){
		MyGUI::Widget* pw = mParent->getChildAt(i); 
		SimpleData* psd = pw->getUserData<SimpleData>(false);
		if( psd )dv.push_back(pw);

		string* ps = pw->getUserData<string>(false);
		if( ps && *ps == "@" )dv.push_back(pw);
	}
	MyGUI::Gui::getInstancePtr()->destroyWidgets( dv );
}