/*! @file @author Albert Semenov @date 12/2007 @module */ /* This file is part of MyGUI. MyGUI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MyGUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with MyGUI. If not, see . */ #include "MyGUI_Precompiled.h" #include "MyGUI_ComboBox.h" #include "MyGUI_ControllerManager.h" #include "MyGUI_InputManager.h" #include "MyGUI_WidgetManager.h" #include "MyGUI_Gui.h" #include "MyGUI_List.h" #include "MyGUI_Button.h" #include "MyGUI_ResourceSkin.h" #include "MyGUI_LayerManager.h" namespace MyGUI { const float COMBO_ALPHA_MAX = ALPHA_MAX; const float COMBO_ALPHA_MIN = ALPHA_MIN; const float COMBO_ALPHA_COEF = 4.0f; ComboBox::ComboBox() : mButton(nullptr), mList(nullptr), mListShow(false), mMaxHeight(0), mItemIndex(ITEM_NONE), mModeDrop(false), mDropMouse(false), mShowSmooth(false), mManualList(true) { } void ComboBox::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name) { Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name); initialiseWidgetSkin(_info); } ComboBox::~ComboBox() { shutdownWidgetSkin(); } void ComboBox::baseChangeWidgetSkin(ResourceSkin* _info) { shutdownWidgetSkin(); Base::baseChangeWidgetSkin(_info); initialiseWidgetSkin(_info); } void ComboBox::initialiseWidgetSkin(ResourceSkin* _info) { // парсим свойства const MapString& properties = _info->getProperties(); if (!properties.empty()) { MapString::const_iterator iter = properties.find("HeightList"); if (iter != properties.end()) mMaxHeight = utility::parseValue(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() == "Button") { MYGUI_DEBUG_ASSERT( ! mButton, "widget already assigned"); mButton = (*iter)->castType