SkinInfo WidgetsWindow::getCellData(MyGUI::Widget* _widget) { MyGUI::Widget* container = _widget->getParent()->_getContainer(); MyGUI::ItemBox* box = container->castType<MyGUI::ItemBox>(); size_t index = box->getIndexByWidget(_widget->getParent()); return *box->getItemDataAt<SkinInfo>(index); }
ItemBoxMenu::~ItemBoxMenu() { MyGUI::ItemBox* box = getItemBox(); size_t count = box->getItemCount(); for (size_t pos=0; pos<count; ++pos) { delete *box->getItemDataAt<ItemMenu*>(pos); } }
DeployItemBox::~DeployItemBox() { MyGUI::ItemBox* box = getItemBox(); size_t count = box->getItemCount(); for (size_t pos = 0; pos < count; ++pos) { delete *box->getItemDataAt<DeployItemData*>(pos); } }
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); } }
void TextureBrowseControl::setTextureName(const std::string& _value) { mCurrentTextureName = _value; MyGUI::ItemBox* box = mTextures->getItemBox(); size_t indexSelected = MyGUI::ITEM_NONE; for (size_t index = 0; index < box->getItemCount(); ++index) { if (*box->getItemDataAt<std::string>(index) == mCurrentTextureName) { indexSelected = index; break; } } box->setIndexSelected(indexSelected); }
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); } } }
void WidgetsWindow::notifyChangeCreatorMode(bool _modeCreate) { const std::string& widgetType = WidgetCreatorManager::getInstance().getWidgetType(); const std::string& widgetSkin = WidgetCreatorManager::getInstance().getWidgetSkin(); for (VectorItemBox::iterator item = mItemBoxs.begin(); item != mItemBoxs.end(); ++item) { MyGUI::ItemBox* box = (*item); box->setIndexSelected(MyGUI::ITEM_NONE); for (size_t index = 0; index < box->getItemCount(); ++index) { SkinInfo* info = box->getItemDataAt<SkinInfo>(index); if (info->widget_skin == widgetSkin && info->widget_type == widgetType) { box->setIndexSelected(index); break; } } } mPopupMode->setStateSelected(WidgetCreatorManager::getInstance().getPopupMode()); }
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); } }
bool WidgetsWindow::getCellSelected(MyGUI::Widget* _widget) { MyGUI::Widget* container = _widget->getParent()->_getContainer(); MyGUI::ItemBox* box = container->castType<MyGUI::ItemBox>(); return box->getIndexSelected() == box->getIndexByWidget(_widget->getParent()); }