void ComboBox::setPropertyOverride(const std::string& _key, const std::string& _value) { /// @wproperty{ComboBox, ModeDrop, bool} Режим выпадающего списка, в этом режиме значение в поля поменять нельзя. if (_key == "ModeDrop") setComboModeDrop(utility::parseValue<bool>(_value)); /// @wproperty{ComboBox, FlowDirection, FlowDirection} Направление выпадения списка. else if (_key == "FlowDirection") setFlowDirection(utility::parseValue<FlowDirection>(_value)); /// @wproperty{ComboBox, MaxListLength, int} Максимальная высота или ширина (зависит от направления) списка в пикселях. else if (_key == "MaxListLength") setMaxListLength(utility::parseValue<int>(_value)); /// @wproperty{ComboBox, SmoothShow, bool} Плавное раскрытие списка. else if (_key == "SmoothShow") setSmoothShow(utility::parseValue<bool>(_value)); // не коментировать else if (_key == "AddItem") addItem(_value); else { Base::setPropertyOverride(_key, _value); return; } eventChangeProperty(this, _key, _value); }
void Message::setProperty(const std::string& _key, const std::string& _value) { if (_key == "Message_Caption") setCaption(_value); else if (_key == "Message_Message") setMessageText(_value); else if (_key == "Message_Modal") setMessageModal(utility::parseValue<bool>(_value)); else if (_key == "Message_Button") setMessageButton(utility::parseValue<MessageBoxStyle>(_value)); else if (_key == "Message_AddButton") addButtonName(_value); else if (_key == "Message_SmoothShow") setSmoothShow(utility::parseValue<bool>(_value)); else if (_key == "Message_Fade") setWindowFade(utility::parseValue<bool>(_value)); else { Base::setProperty(_key, _value); return; } eventChangeProperty(this, _key, _value); }
void TabControl::setPropertyOverride(const std::string& _key, const std::string& _value) { if (_key == "ButtonWidth") setButtonDefaultWidth(utility::parseValue<int>(_value)); else if (_key == "ButtonAutoWidth") setButtonAutoWidth(utility::parseValue<bool>(_value)); else if (_key == "SmoothShow") setSmoothShow(utility::parseValue<bool>(_value)); else if (_key == "SelectItem") setIndexSelected(utility::parseValue<size_t>(_value)); else { Base::setPropertyOverride(_key, _value); return; } eventChangeProperty(this, _key, _value); }
void ComboBox::setPropertyOverride(const std::string& _key, const std::string& _value) { if (_key == "ModeDrop") setComboModeDrop(utility::parseValue<bool>(_value)); else if (_key == "FlowDirection") setFlowDirection(utility::parseValue<FlowDirection>(_value)); else if (_key == "MaxListLength") setMaxListLength(utility::parseValue<int>(_value)); else if (_key == "SmoothShow") setSmoothShow(utility::parseValue<bool>(_value)); else if (_key == "AddItem") addItem(_value); else { Base::setPropertyOverride(_key, _value); return; } eventChangeProperty(this, _key, _value); }
void ComboBox::initialiseWidgetSkin(WidgetSkinInfoPtr _info) { // парсим свойства const MapString & properties = _info->getProperties(); MapString::const_iterator iter = properties.find("HeightList"); if (iter != properties.end()) mMaxHeight = utility::parseSizeT(iter->second); iter = properties.find("ListSmoothShow"); if (iter != properties.end()) setSmoothShow(utility::parseBool(iter->second)); // парсим кнопку for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter) { if (*(*iter)->_getInternalData<std::string>() == "Button") { MYGUI_DEBUG_ASSERT( ! mButton, "widget already assigned"); mButton = (*iter)->castType<Button>(); mButton->eventMouseButtonPressed = newDelegate(this, &ComboBox::notifyButtonPressed); } else if (*(*iter)->_getInternalData<std::string>() == "List") { MYGUI_DEBUG_ASSERT( ! mList, "widget already assigned"); mList = (*iter)->castType<List>(); mList->setVisible(false); mList->eventKeyLostFocus = newDelegate(this, &ComboBox::notifyListLostFocus); mList->eventListSelectAccept = newDelegate(this, &ComboBox::notifyListSelectAccept); mList->eventListMouseItemActivate = newDelegate(this, &ComboBox::notifyListMouseItemActivate); mList->eventListChangePosition = newDelegate(this, &ComboBox::notifyListChangePosition); } } //OBSOLETE MYGUI_ASSERT(nullptr != mButton, "Child Button not found in skin (combobox must have Button)"); //MYGUI_ASSERT(nullptr != mList, "Child List not found in skin (combobox must have List)"); mManualList = mList == nullptr; if (mList == nullptr) { std::string list_skin; iter = properties.find("ListSkin"); if (iter != properties.end()) list_skin = iter->second; std::string list_layer; iter = properties.find("ListLayer"); if (iter != properties.end()) list_layer = iter->second; mList = createWidget<MyGUI::List>(WidgetStyle::Popup, list_skin, IntCoord(), Align::Default, list_layer); mWidgetChild.pop_back(); mList->setVisible(false); mList->eventKeyLostFocus = newDelegate(this, &ComboBox::notifyListLostFocus); mList->eventListSelectAccept = newDelegate(this, &ComboBox::notifyListSelectAccept); mList->eventListMouseItemActivate = newDelegate(this, &ComboBox::notifyListMouseItemActivate); mList->eventListChangePosition = newDelegate(this, &ComboBox::notifyListChangePosition); } // корректируем высоту списка //if (mMaxHeight < mList->getFontHeight()) mMaxHeight = mList->getFontHeight(); // подписываем дочерние классы на скролл mWidgetClient->eventMouseWheel = newDelegate(this, &ComboBox::notifyMouseWheel); mWidgetClient->eventMouseButtonPressed = newDelegate(this, &ComboBox::notifyMousePressed); // подписываемся на изменения текста eventEditTextChange = newDelegate(this, &ComboBox::notifyEditTextChange); }