void SeparatorListControl::notifyComboChangePosition(MyGUI::ComboBox* _sender, size_t _index) { if (getCurrentSkin() == nullptr) return; if (_index == MyGUI::ITEM_NONE) return; SeparatorPreset preset = *_sender->getItemDataAt<SeparatorPreset>(_index); size_t index = 0; ItemHolder<SeparatorItem>::EnumeratorItem separators = getCurrentSkin()->getSeparators().getChildsEnumerator(); while (separators.next()) { SeparatorItem* item = separators.current(); MyGUI::UString value = ((preset & (1 << index)) != 0) ? "True" : "False"; item->getPropertySet()->setPropertyValue("Visible", value, mTypeName); ++index; } // для обновления пропертей getCurrentSkin()->getSeparators().setItemSelected(nullptr); updateList(); }
void RegionTextureControl::updateUnselectedStates() { std::vector<MyGUI::IntCoord> coords; if (getCurrentSkin() != nullptr) { ItemHolder<RegionItem>::EnumeratorItem regions = getCurrentSkin()->getRegions().getChildsEnumerator(); while (regions.next()) { RegionItem* item = regions.current(); if (item != getCurrentSkin()->getRegions().getItemSelected()) { if (item->getPropertySet()->getPropertyValue("Visible") == "True") { if (item->getPropertySet()->getPropertyValue("Enabled") == "True") { addCoord(coords, item->getPropertySet()->getPropertyValue("Position")); } } } } } drawUnselectedStates(coords); }
void SkinTextureControl::notifyChangePosition() { mCoordValue = mAreaSelectorControl->getCoord(); if (getCurrentSkin() != nullptr) getCurrentSkin()->getPropertySet()->setPropertyValue("Coord", mCoordValue.print(), mTypeName); }
void SeparatorTextureControl::updateUnselectedStates() { std::vector<int> coordsHor; std::vector<int> coordsVert; if (getCurrentSkin() != nullptr) { ItemHolder<SeparatorItem>::EnumeratorItem separators = getCurrentSkin()->getSeparators().getChildsEnumerator(); while (separators.next()) { SeparatorItem* item = separators.current(); if (item != getCurrentSkin()->getSeparators().getItemSelected()) { if (item->getPropertySet()->getPropertyValue("Visible") == "True") { MyGUI::Align corner = item->getCorner(); addCoord(coordsHor, coordsVert, corner, item->getPropertySet()->getPropertyValue("Offset")); } } } } drawUnselectedStates(coordsHor, coordsVert); }
void RegionTextureControl::updateTextureName() { mTextureName = ""; if (getCurrentSkin() != nullptr) mTextureName = getCurrentSkin()->getPropertySet()->getPropertyValue("Texture"); updateTextureControl(); }
void StateTextureControl::updateTexture() { MyGUI::UString texture; if (getCurrentSkin() != nullptr) texture = getCurrentSkin()->getPropertySet()->getPropertyValue("Texture"); setTextureName(texture); }
void SeparatorListControl::notifyChangePosition(MyGUI::ListBox* _sender, size_t _index) { if (getCurrentSkin() != nullptr) { SeparatorItem* item = nullptr; if (_index != MyGUI::ITEM_NONE) item = *mList->getItemDataAt<SeparatorItem*>(_index); getCurrentSkin()->getSeparators().setItemSelected(item); } }
void RegionTextureControl::updateRegionSize() { mTextureRegion.width = 0; mTextureRegion.height = 0; if (getCurrentSkin() != nullptr) { MyGUI::IntCoord coord = MyGUI::IntCoord::parse(getCurrentSkin()->getPropertySet()->getPropertyValue("Coord")); mTextureRegion.width = coord.width; mTextureRegion.height = coord.height; } updateTextureControl(); updateUnselectedStates(); }
void StateTextureControl::updateCoord() { MyGUI::UString value; if (getCurrentSkin() != nullptr) value = getCurrentSkin()->getPropertySet()->getPropertyValue("Coord"); MyGUI::IntCoord coord; if (MyGUI::utility::parseComplex(value, coord.left, coord.top, coord.width, coord.height)) { if (mSizeValue != coord.size()) { mSizeValue = coord.size(); updateSelectorsSize(); } } }
void StatesListControl::updatePreset() { mPresets->setEnabled(getCurrentSkin() != nullptr); if (getCurrentSkin() != nullptr) { int currentPreset = 0; int bitIndex = 0; ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator(); while (states.next()) { StateItem* item = states.current(); bool visible = item->getPropertySet()->getPropertyValue("Visible") == "True"; if (visible) currentPreset |= (1 << bitIndex); ++ bitIndex; } size_t indexSelected = MyGUI::ITEM_NONE; size_t count = mPresets->getItemCount(); for (size_t index = 0; index < count; ++index) { PresetEnum preset = *mPresets->getItemDataAt<PresetEnum>(index); if (preset == currentPreset) { indexSelected = index; break; } } mPresets->setIndexSelected(indexSelected); mPresets->setEnabled(true); } else { mPresets->setEnabled(false); } }
void SkinTextureControl::updateCoord() { MyGUI::UString value; if (getCurrentSkin() != nullptr) value = getCurrentSkin()->getPropertySet()->getPropertyValue("Coord"); MyGUI::IntCoord coord; if (MyGUI::utility::parseComplex(value, coord.left, coord.top, coord.width, coord.height)) { mAreaSelectorControl->setVisible(true); mCoordValue = coord; updateRegionCoord(); } else { mAreaSelectorControl->setVisible(false); } }
void SeparatorListControl::updateList() { if (getCurrentSkin() != nullptr) { SeparatorItem* selectedItem = getCurrentSkin()->getSeparators().getItemSelected(); size_t selectedIndex = MyGUI::ITEM_NONE; size_t index = 0; ItemHolder<SeparatorItem>::EnumeratorItem separators = getCurrentSkin()->getSeparators().getChildsEnumerator(); while (separators.next()) { SeparatorItem* item = separators.current(); MyGUI::UString name; if (item->getPropertySet()->getPropertyValue("Visible") != "True") name = replaceTags("ColourDisabled") + item->getName(); else name = item->getName(); if (index < mList->getItemCount()) { mList->setItemNameAt(index, name); mList->setItemDataAt(index, item); } else { mList->addItem(name, item); } if (item == selectedItem) selectedIndex = index; index ++; } while (index < mList->getItemCount()) mList->removeItemAt(mList->getItemCount() - 1); mList->setIndexSelected(selectedIndex); } }
void RegionTextureControl::updateTextureControl() { if (mTextureVisible && !mTextureName.empty() && getCurrentSkin() != nullptr && getCurrentState() != nullptr) { setTextureName(mTextureName); setTextureRegion(mTextureRegion); } else { setTextureRegion(MyGUI::IntCoord()); } }
void StateTextureControl::updateUnselectedStates() { std::vector<MyGUI::IntCoord> coords; if (getCurrentSkin() != nullptr) { ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator(); while (states.next()) { StateItem* item = states.current(); if (item != getCurrentSkin()->getStates().getItemSelected()) { if (item->getPropertySet()->getPropertyValue("Visible") == "True") addCoord(coords, getCurrentSkin()->getPropertySet()->getPropertyValue("Coord"), item->getPropertySet()->getPropertyValue("Position")); } } } drawUnselectedStates(coords); }
void StatesListControl::notifyComboChangePosition(MyGUI::ComboBox* _sender, size_t _index) { if (getCurrentSkin() == nullptr) return; if (_index == MyGUI::ITEM_NONE) return; PresetEnum preset = *_sender->getItemDataAt<PresetEnum>(_index); size_t index = 0; ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator(); while (states.next()) { StateItem* item = states.current(); MyGUI::UString value = ((preset & (1 << index)) != 0) ? "True" : "False"; item->getPropertySet()->setPropertyValue("Visible", value, mTypeName); ++index; } updateList(); }