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 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 SeparatorListControl::updatePreset() { mPresets->setEnabled(getCurrentSkin() != nullptr); if (getCurrentSkin() != nullptr) { int currentPreset = 0; int bitIndex = 0; ItemHolder<SeparatorItem>::EnumeratorItem separators = getCurrentSkin()->getSeparators().getChildsEnumerator(); while (separators.next()) { SeparatorItem* item = separators.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) { SeparatorPreset preset = *mPresets->getItemDataAt<SeparatorPreset>(index); if (preset == currentPreset) { indexSelected = index; break; } } mPresets->setIndexSelected(indexSelected); mPresets->setEnabled(true); } else { mPresets->setEnabled(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); } }
SkinItem::SkinItem() : mPropertySet(nullptr) { mPropertySet = new PropertySet(); mPropertySet->createChild("Texture", "Texture"); mPropertySet->createChild("Coord", "IntCoord", "0 0 32 32"); StateItem* skin = nullptr; skin = mStates.createChild(); skin->setName("Disabled"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); skin = mStates.createChild(); skin->setName("Normal"); skin->getPropertySet()->setPropertyValue("Visible", "True", ""); skin = mStates.createChild(); skin->setName("Over"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); skin = mStates.createChild(); skin->setName("Pressed"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); skin = mStates.createChild(); skin->setName("Selected Disabled"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); skin = mStates.createChild(); skin->setName("Selected Normal"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); skin = mStates.createChild(); skin->setName("Selected Over"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); skin = mStates.createChild(); skin->setName("Selected Pressed"); skin->getPropertySet()->setPropertyValue("Visible", "False", ""); SeparatorItem* separator = nullptr; separator = mSeparators.createChild(); separator->setName("Top"); separator->setCorner(MyGUI::Align::Top); separator->getPropertySet()->setPropertyValue("Offset", "1", ""); separator = mSeparators.createChild(); separator->setName("Bottom"); separator->setCorner(MyGUI::Align::Bottom); separator->getPropertySet()->setPropertyValue("Offset", "1", ""); separator = mSeparators.createChild(); separator->setName("Left"); separator->setCorner(MyGUI::Align::Left); separator->getPropertySet()->setPropertyValue("Offset", "1", ""); separator = mSeparators.createChild(); separator->setName("Right"); separator->setCorner(MyGUI::Align::Right); separator->getPropertySet()->setPropertyValue("Offset", "1", ""); RegionItem* region = nullptr; region = mRegions.createChild(); region->setName("Left Top"); region->setSeparator(MyGUI::Align::Left | MyGUI::Align::Top); region->getPropertySet()->setPropertyValue("Align", "Left Top", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Top"); region->setSeparator(MyGUI::Align::Top); region->getPropertySet()->setPropertyValue("Align", "HStretch Top", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Right Top"); region->setSeparator(MyGUI::Align::Right | MyGUI::Align::Top); region->getPropertySet()->setPropertyValue("Align", "Right Top", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Right"); region->setSeparator(MyGUI::Align::Right); region->getPropertySet()->setPropertyValue("Align", "Right VStretch", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Right Bottom"); region->setSeparator(MyGUI::Align::Right | MyGUI::Align::Bottom); region->getPropertySet()->setPropertyValue("Align", "Right Bottom", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Bottom"); region->setSeparator(MyGUI::Align::Bottom); region->getPropertySet()->setPropertyValue("Align", "HStretch Bottom", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Left Bottom"); region->setSeparator(MyGUI::Align::Left | MyGUI::Align::Bottom); region->getPropertySet()->setPropertyValue("Align", "Left Bottom", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Left"); region->setSeparator(MyGUI::Align::Left); region->getPropertySet()->setPropertyValue("Align", "Left VStretch", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Center"); region->setSeparator(MyGUI::Align::Center); region->getPropertySet()->setPropertyValue("Align", "Stretch", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); region->getPropertySet()->setPropertyReadOnly("Position", true); region->getPropertySet()->setPropertyReadOnly("Align", true); region = mRegions.createChild(); region->setName("Text"); region->setSeparator(MyGUI::Align::Center); region->getPropertySet()->setPropertyValue("Align", "Stretch", ""); region->getPropertySet()->setPropertyValue("RegionType", "SimpleText", ""); region->getPropertySet()->setPropertyValue("Visible", "False", ""); region->getPropertySet()->setPropertyReadOnly("Enabled", true); }
void SeparatorPropertyControl::updateSeparatorProperties() { SeparatorItem* separator = getCurrentSeparator(); mPropertyVisibleControl->setProperty(separator != nullptr ? separator->getPropertySet()->getChild("Visible") : nullptr); mPropertyPositionControl->setProperty(separator != nullptr ? separator->getPropertySet()->getChild("Offset") : nullptr); }