| 71 | } |
| 72 | |
| 73 | void SkinItem::_createSkinItem(ResourceSkin* _info) |
| 74 | { |
| 75 | mStateInfo = _info->getStateInfo(); |
| 76 | |
| 77 | // все что с текстурой можно тоже перенести в скин айтем и setRenderItemTexture |
| 78 | mTextureName = _info->getTextureName(); |
| 79 | mTexture = RenderManager::getInstance().getTexture(mTextureName); |
| 80 | |
| 81 | setRenderItemTexture(mTexture); |
| 82 | |
| 83 | const std::string& categoryName = SubWidgetManager::getInstance().getCategoryName(); |
| 84 | // загружаем кирпичики виджета |
| 85 | FactoryManager& factory = FactoryManager::getInstance(); |
| 86 | for (const auto& iter : _info->getBasisInfo()) |
| 87 | { |
| 88 | IObject* object = factory.createObject(categoryName, iter.type); |
| 89 | if (object == nullptr) |
| 90 | continue; |
| 91 | |
| 92 | ISubWidget* sub = object->castType<ISubWidget>(); |
| 93 | sub->_setCroppedParent(static_cast<Widget*>(this)); |
| 94 | sub->setCoord(iter.coord); |
| 95 | sub->setAlign(iter.align); |
| 96 | |
| 97 | mSubSkinChild.push_back(sub); |
| 98 | addRenderItem(sub); |
| 99 | |
| 100 | // ищем дефолтные сабвиджеты |
| 101 | if (mMainSkin == nullptr) |
| 102 | mMainSkin = sub->castType<ISubWidgetRect>(false); |
| 103 | if (mText == nullptr) |
| 104 | mText = sub->castType<ISubWidgetText>(false); |
| 105 | } |
| 106 | |
| 107 | _setSkinItemState("normal"); |
| 108 | } |
| 109 | |
| 110 | void SkinItem::_deleteSkinItem() |
| 111 | { |
nothing calls this directly
no test coverage detected