Esempio n. 1
0
	void ToolControl::_OnInit(Event * sender)
	{
		MyGUI::ItemBox* box = mObject->createWidget<MyGUI::ItemBox>("ItemBoxEmpty", MyGUI::IntCoord(0, 0, mObject->getSize().width, mObject->getSize().height), MyGUI::Align::Stretch);

		box->requestCreateWidgetItem = MyGUI::newDelegate(this, &ToolControl::requestCreateObjectItem);
		box->requestCoordItem = MyGUI::newDelegate(this, &ToolControl::requestCoordItem);
		box->requestDrawItem = MyGUI::newDelegate(this, &ToolControl::requestDrawItem);

		for (int i = 0; i < ShapeManager::Instance()->GetFactoryCount(); ++i)
		{
			ShapeFactory * sf = ShapeManager::Instance()->GetFactory(i);
			box->addItem(sf);
		}
	}
Esempio n. 2
0
	void WidgetsWindow::initialise()
	{
		const SkinGroups& groups = WidgetTypes::getInstance().getSkinGroups();
		for (SkinGroups::const_iterator iter = groups.begin(); iter != groups.end(); ++iter)
		{
			MyGUI::TabItem* page = mTabSkins->addItem(iter->first);
			MyGUI::ItemBox* box = page->createWidget<MyGUI::ItemBox>("ItemBoxEmpty", MyGUI::IntCoord(0, 0, page->getSize().width, page->getSize().height), MyGUI::Align::Stretch);
			mItemBoxs.push_back(box);

			box->requestCreateWidgetItem = MyGUI::newDelegate(this, &WidgetsWindow::requestCreateWidgetItem);
			box->requestCoordItem = MyGUI::newDelegate(this, &WidgetsWindow::requestCoordItem);
			box->requestDrawItem = MyGUI::newDelegate(this, &WidgetsWindow::requestDrawItem);

			for (VectorSkinInfo::const_iterator iterSkin = iter->second.begin(); iterSkin != iter->second.end(); ++iterSkin)
			{
				box->addItem(*iterSkin);
			}
		}
	}
Esempio n. 3
0
	void eventDropResult(MyGUI::DDContainer* _sender, const MyGUI::DDItemInfo& _info, bool _result)
	{
		if (!_result) return;

		if (_info.receiver_index == MyGUI::ITEM_NONE)
		{
			MyGUI::ItemBox* sender = _info.sender->castType<MyGUI::ItemBox>();
			MyGUI::ItemBox* receiver = _info.receiver->castType<MyGUI::ItemBox>();
			int data = *sender->getItemDataAt<int>(_info.sender_index);
			sender->removeItemAt(_info.sender_index);
			receiver->addItem((int)data);
		}
		else
		{
			MyGUI::ItemBox* sender = _info.sender->castType<MyGUI::ItemBox>();
			MyGUI::ItemBox* receiver = _info.receiver->castType<MyGUI::ItemBox>();
			int data = *sender->getItemDataAt<int>(_info.sender_index);
			int data2 = *receiver->getItemDataAt<int>(_info.receiver_index);
			sender->removeItemAt(_info.sender_index);
			receiver->setItemDataAt(_info.receiver_index, data + data2);
		}
	}