MyGUI 3.4.1
MyGUI_ComboBox.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_COMBO_BOX_H_
8#define MYGUI_COMBO_BOX_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_EditBox.h"
12#include "MyGUI_ListBox.h"
13#include "MyGUI_Any.h"
14#include "MyGUI_EventPair.h"
16#include "MyGUI_FlowDirection.h"
17#include "MyGUI_IItem.h"
19
20namespace MyGUI
21{
22
24
29 public EditBox,
30 public IItemContainer,
31 public MemberObsolete<ComboBox>
32 {
34
35 public:
36 ComboBox();
37
38 //------------------------------------------------------------------------------//
39 // манипуляции айтемами
40
42 size_t getItemCount() const;
43
45 void insertItemAt(size_t _index, const UString& _name, Any _data = Any::Null);
46
48 void addItem(const UString& _name, Any _data = Any::Null);
49
51 void removeItemAt(size_t _index);
52
54 void removeAllItems();
55
56
58 size_t findItemIndexWith(const UString& _name);
59
60
61 //------------------------------------------------------------------------------//
62 // манипуляции выделениями
63
65 size_t getIndexSelected() const;
66
68 void setIndexSelected(size_t _index);
69
71 void clearIndexSelected();
72
73
74 //------------------------------------------------------------------------------//
75 // манипуляции данными
76
78 void setItemDataAt(size_t _index, Any _data);
79
81 void clearItemDataAt(size_t _index);
82
84 template <typename ValueType>
85 ValueType* getItemDataAt(size_t _index, bool _throw = true)
86 {
87 return mList->getItemDataAt<ValueType>(_index, _throw);
88 }
89
90
91 //------------------------------------------------------------------------------//
92 // манипуляции отображением
93
95 void setItemNameAt(size_t _index, const UString& _name);
96
98 const UString& getItemNameAt(size_t _index) const;
99
100
101 //------------------------------------------------------------------------------//
102 // манипуляции выдимостью
103
105 void beginToItemAt(size_t _index);
106
108 void beginToItemFirst();
109
111 void beginToItemLast();
112
114 void beginToItemSelected();
115
116
117 //------------------------------------------------------------------------------------//
118 // методы для управления отображением
119
121 void setComboModeDrop(bool _value);
123 bool getComboModeDrop() const;
124
126 void setSmoothShow(bool _value);
128 bool getSmoothShow() const;
129
131 void setMaxListLength(int _value);
133 int getMaxListLength() const;
134
135 // RENAME
137 void setFlowDirection(FlowDirection _value);
139 FlowDirection getFlowDirection() const;
140
141 /*events:*/
149
156
157 /*internal:*/
158 // IItemContainer impl
159 size_t _getItemCount() const override;
160 void _addItem(const MyGUI::UString& _name) override;
161 void _removeItemAt(size_t _index) override;
162 void _setItemNameAt(size_t _index, const UString& _name) override;
163 const UString& _getItemNameAt(size_t _index) const override;
164
165 void _resetContainer(bool _update) override;
166
167 protected:
168 void initialiseOverride() override;
169 void shutdownOverride() override;
170
171 void onKeyButtonPressed(KeyCode _key, Char _char) override;
172
173 void setPropertyOverride(const std::string& _key, const std::string& _value) override;
174
175 private:
176 void notifyButtonPressed(Widget* _sender, int _left, int _top, MouseButton _id);
177 void notifyListLostFocus(Widget* _sender, MyGUI::Widget* _new);
178 void notifyListSelectAccept(ListBox* _widget, size_t _position);
179 void notifyListMouseItemActivate(ListBox* _widget, size_t _position);
180 void notifyListChangePosition(ListBox* _widget, size_t _position);
181 void notifyMouseWheel(Widget* _sender, int _rel);
182 void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
183 void notifyEditTextChange(EditBox* _sender);
184 void notifyToolTip(Widget* _sender, const ToolTipInfo& _info);
185
186 void showList();
187 void hideList();
188
189 void actionWidgetHide(Widget* _widget, ControllerItem* _controller);
190
191 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
192 IntCoord calculateListPosition();
193
194 private:
195 Button* mButton;
196 ListBox* mList;
197
198 bool mListShow;
199 int mMaxListLength;
200 size_t mItemIndex;
201 bool mModeDrop;
202 bool mDropMouse;
203 bool mShowSmooth;
204
205 FlowDirection mFlowDirection;
206 };
207
208} // namespace MyGUI
209
210#endif // MYGUI_COMBO_BOX_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:48
static AnyEmpty Null
Definition: MyGUI_Any.h:59
widget description should be here.
Definition: MyGUI_Button.h:22
widget description should be here.
EventPair< EventHandle_WidgetVoid, EventHandle_ComboBoxPtrSizeT > eventComboAccept
EventPair< EventHandle_WidgetSizeT, EventHandle_ComboBoxPtrSizeT > eventComboChangePosition
ValueType * getItemDataAt(size_t _index, bool _throw=true)
Get item data from specified position.
widget description should be here.
Definition: MyGUI_EditBox.h:29
widget description should be here.
Definition: MyGUI_ListBox.h:31
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
widget description should be here.
Definition: MyGUI_Widget.h:37
void actionWidgetHide(Widget *_widget, ControllerItem *_controller)
delegates::CMultiDelegate2< ComboBox *, size_t > EventHandle_ComboBoxPtrSizeT
unsigned int Char
Definition: MyGUI_Types.h:49