44 if (mButton !=
nullptr)
95 void ComboBox::notifyButtonPressed(
Widget* _sender,
int _left,
int _top,
MouseButton _id)
108 void ComboBox::notifyListLostFocus(Widget* _sender, Widget* _new)
116 if (focus == mButton)
120 if (mModeDrop && focus ==
mClient)
127 void ComboBox::notifyListSelectAccept(ListBox* _widget,
size_t _position)
129 mItemIndex = _position;
144 void ComboBox::notifyListChangePosition(ListBox* _widget,
size_t _position)
146 mItemIndex = _position;
176 void ComboBox::notifyListMouseItemActivate(
ListBox* _widget,
size_t _position)
178 mItemIndex = _position;
192 void ComboBox::notifyMouseWheel(Widget* _sender,
int _rel)
237 void ComboBox::notifyMousePressed(Widget* _sender,
int _left,
int _top, MouseButton _id)
240 Base::notifyMousePressed(_sender, _left, _top, _id);
246 notifyButtonPressed(
nullptr, _left, _top, _id);
249 void ComboBox::notifyEditTextChange(EditBox* _sender)
264 void ComboBox::showList()
272 IntCoord coord = calculateListPosition();
277 ControllerFadeAlpha* controller = createControllerFadeAlpha(COMBO_ALPHA_MAX, COMBO_ALPHA_COEF,
true);
288 void ComboBox::actionWidgetHide(Widget* _widget, ControllerItem* _controller)
290 _widget->setVisible(
false);
291 _widget->setEnabled(
true);
294 void ComboBox::hideList()
300 ControllerFadeAlpha* controller = createControllerFadeAlpha(COMBO_ALPHA_MIN, COMBO_ALPHA_COEF,
false);
301 controller->eventPostAction +=
newDelegate(
this, &ComboBox::actionWidgetHide);
364 ControllerFadeAlpha* ComboBox::createControllerFadeAlpha(
float _alpha,
float _coef,
bool _enable)
383 mFlowDirection = _value;
386 IntCoord ComboBox::calculateListPosition()
392 length = mMaxListLength;
394 if (mMaxListLength > 0 && length > mMaxListLength)
395 length = mMaxListLength;
412 if ((coord.
top - length) >= 0)
420 if ((coord.
right() + length) <= sizeView.
width)
423 coord.
left -= length;
424 coord.
width = length;
428 if ((coord.
left - length) >= 0)
429 coord.
left -= length;
432 coord.
width = length;
441 if (_key ==
"ModeDrop")
445 else if (_key ==
"FlowDirection")
449 else if (_key ==
"MaxListLength")
453 else if (_key ==
"SmoothShow")
457 else if (_key ==
"AddItem")
529 mShowSmooth = _value;
539 mMaxListLength = _value;
544 return mMaxListLength;
549 return mFlowDirection;
586 if (mList !=
nullptr)
void addItem(Widget *_widget, ControllerItem *_item)
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
void setItemDataAt(size_t _index, Any _data)
Replace an item data at a specified position.
const UString & getItemNameAt(size_t _index)
Get item name from specified position.
void setSmoothShow(bool _value)
Set smooth show of list.
bool getComboModeDrop() const
Get drop list mode flag.
void setItemDataAt(size_t _index, Any _data)
Replace an item data at a specified position.
void clearIndexSelected()
delegates::IDelegate0 * newDelegate(void(*_func)())
static InputManager & getInstance()
void beginToItemFirst()
Move all elements so first becomes visible.
virtual const UString & _getItemNameAt(size_t _index)
size_t getItemCount() const
Get number of items.
virtual void onKeyButtonPressed(KeyCode _key, Char _char)
virtual void shutdownOverride()
FlowDirection getFlowDirection() const
Get direction, where drop down list appears.
size_t getIndexSelected() const
Get index of selected item (ITEM_NONE if none selected)
void setItemNameAt(size_t _index, const UString &_name)
Replace an item name at a specified position.
void removeItemAt(size_t _index)
Remove item at a specified position.
void setIndexSelected(size_t _index)
Select specified _index.
ListBox properties. ListBox_skin_childs Skin childs. ListBox widget description should be here...
bool getSmoothShow() const
Get smooth show of list flag.
virtual void _resetContainer(bool _update)
void beginToItemAt(size_t _index)
Move all elements so specified becomes visible.
EventPair< EventHandle_WidgetSizeT, EventHandle_ListPtrSizeT > eventListChangePosition
types::TCoord< int > IntCoord
size_t getItemCount() const
Get number of items.
size_t findItemIndexWith(const UString &_name)
Search item, returns the position of the first occurrence in array or ITEM_NONE if item not found...
void setItemNameAt(size_t _index, const UString &_name)
Replace an item name at a specified position.
virtual void initialiseOverride()
const float COMBO_ALPHA_COEF
virtual void _resetContainer(bool _update)
EventPair< EventHandle_WidgetVoid, EventHandle_ComboBoxPtrSizeT > eventComboAccept
void insertItemAt(size_t _index, const UString &_name, Any _data=Any::Null)
Insert an item into a array at a specified position.
void setComboModeDrop(bool _value)
Set drop list mode (text can not be edited)
virtual void setCoord(const IntCoord &_value)
void beginToItemLast()
Move all elements so last becomes visible.
static const std::string & getClassTypeName()
void setMaxListLength(int _value)
Get max list length.
void insertItemAt(size_t _index, const UString &_name, Any _data=Any::Null)
Insert an item into a array at a specified position.
void setAlpha(float _value)
#define MYGUI_ASSERT_RANGE_AND_NONE(index, size, owner)
void setCoef(float _value)
EventPair< EventHandle_WidgetSizeT, EventHandle_ListPtrSizeT > eventListMouseItemActivate
const UString & getItemNameAt(size_t _index)
Get item name from specified position.
void clearIndexSelected()
Clear item selection.
void removeItemAt(size_t _index)
Remove item at a specified position.
virtual void _setItemNameAt(size_t _index, const UString &_name)
void setEnabled(bool _value)
virtual void setCaption(const UString &_value)
Type * castType(bool _throw=true)
int getMaxListLength() const
Set max list length.
size_t findItemIndexWith(const UString &_name)
Search item, returns the position of the first occurrence in array or ITEM_NONE if item not found...
int getOptimalHeight()
Return optimal height to fit all items in ListBox.
IntCoord getAbsoluteCoord() const
virtual size_t _getItemCount()
void clearItemDataAt(size_t _index)
Clear an item data at a specified position.
void beginToItemFirst()
Move all elements so first becomes visible.
EventPair< EventHandle_WidgetSizeT, EventHandle_ListPtrSizeT > eventListSelectAccept
void beginToItemSelected()
Move all elements so selected becomes visible.
void setFlowDirection(FlowDirection _value)
Set direction, where drop down list appears (TopToBottom by default).
void removeAllItems()
Remove all items.
virtual void _removeItemAt(size_t _index)
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditTextChange
EventPair< EventHandle_WidgetSizeT, EventHandle_ComboBoxPtrSizeT > eventComboChangePosition
static const std::string & getClassTypeName()
void addItem(const UString &_name, Any _data=Any::Null)
Add an item to the end of a array.
void setIndexSelected(size_t _index)
void setEditStatic(bool _value)
const float COMBO_ALPHA_MAX
void beginToItemAt(size_t _index)
Move all elements so specified becomes visible.
const float COMBO_ALPHA_MIN
virtual void _addItem(const MyGUI::UString &_name)
void removeAllItems()
Remove all items.
const std::string & getUserString(const std::string &_key) const
ControllerItem * createItem(const std::string &_type)