23 #ifndef __MYGUI_LIST_H__
24 #define __MYGUI_LIST_H__
48 size_t getItemCount()
const {
return mItemsInfo.size(); }
57 void removeItemAt(
size_t _index);
60 void removeAllItems();
63 void swapItemsAt(
size_t _index1,
size_t _index2);
67 size_t findItemIndexWith(
const UString& _name);
77 void setIndexSelected(
size_t _index);
87 void setItemDataAt(
size_t _index,
Any _data);
93 template <
typename ValueType>
94 ValueType * getItemDataAt(
size_t _index,
bool _throw =
true)
97 return mItemsInfo[_index].second.castType<ValueType>(_throw);
105 void setItemNameAt(
size_t _index,
const UString& _name);
108 const UString& getItemNameAt(
size_t _index);
115 void beginToItemAt(
size_t _index);
136 bool isItemVisibleAt(
size_t _index,
bool _fill =
true);
142 void setScrollVisible(
bool _visible);
144 void setScrollPosition(
size_t _position);
149 virtual void setPosition(
const IntPoint& _value);
151 virtual void setSize(
const IntSize& _value);
153 virtual void setCoord(
const IntCoord& _value);
164 int getOptimalHeight();
167 virtual void setProperty(
const std::string& _key,
const std::string& _value);
210 void _setItemFocus(
size_t _position,
bool _focus);
211 void _sendEventChangeScroll(
size_t _position);
216 #ifndef MYGUI_DONT_USE_OBSOLETE
218 MYGUI_OBSOLETE(
"use : void Widget::setCoord(const IntCoord& _coord)")
219 void setPosition(const
IntCoord& _coord) { setCoord(_coord); }
220 MYGUI_OBSOLETE(
"use : void Widget::setCoord(int _left, int _top, int _width, int _height)")
221 void setPosition(
int _left,
int _top,
int _width,
int _height) { setCoord(_left, _top, _width, _height); }
224 size_t getItemIndexSelected() {
return getIndexSelected(); }
225 MYGUI_OBSOLETE(
"use : void List::setIndexSelected(size_t _index)")
226 void setItemSelectedAt(
size_t _index) { setIndexSelected(_index); }
228 void clearItemSelected() { clearIndexSelected(); }
230 MYGUI_OBSOLETE(
"use : void List::insertItemAt(size_t _index, const UString& _name)")
231 void insertItem(
size_t _index, const
UString& _item) { insertItemAt(_index, _item); }
232 MYGUI_OBSOLETE(
"use : void List::setItemNameAt(size_t _index, const UString& _name)")
233 void setItem(
size_t _index, const
UString& _item) { setItemNameAt(_index, _item); }
234 MYGUI_OBSOLETE(
"use : const UString& List::getItemNameAt(size_t _index)")
235 const
UString& getItem(
size_t _index) {
return getItemNameAt(_index); }
237 void deleteItem(
size_t _index) { removeItemAt(_index); }
239 void deleteAllItems() { removeAllItems(); }
240 MYGUI_OBSOLETE(
"use : size_t List::findItemIndexWith(const UString& _name)")
241 size_t findItem(const
UString& _item) {
return findItemIndexWith(_item); }
243 size_t getItemSelect() {
return getIndexSelected(); }
245 void resetItemSelect() { clearIndexSelected(); }
246 MYGUI_OBSOLETE(
"use : void List::setIndexSelected(size_t _index)")
247 void setItemSelect(
size_t _index) { setIndexSelected(_index); }
249 void beginToIndex(
size_t _index) { beginToItemAt(_index); }
251 void beginToStart() { beginToItemFirst(); }
253 void beginToEnd() { beginToItemLast(); }
255 void beginToSelect() { beginToItemSelected(); }
256 MYGUI_OBSOLETE(
"use : bool List::isItemVisibleAt(size_t _index, bool _fill)")
257 bool isItemVisible(
size_t _index,
bool _fill = true) {
return isItemVisibleAt(_index, _fill); }
258 MYGUI_OBSOLETE(
"use : bool List::isItemSelectedVisible(bool _fill)")
259 bool isItemSelectVisible(
bool _fill = true) {
return isItemSelectedVisible(_fill); }
261 #endif // MYGUI_DONT_USE_OBSOLETE
268 void onMouseWheel(
int _rel);
269 void onKeyLostFocus(
Widget* _new);
270 void onKeySetFocus(
Widget* _old);
273 void notifyScrollChangePosition(
VScroll* _sender,
size_t _rel);
275 void notifyMouseDoubleClick(
Widget* _sender);
276 void notifyMouseWheel(
Widget* _sender,
int _rel);
277 void notifyMouseSetFocus(
Widget* _sender,
Widget* _old);
278 void notifyMouseLostFocus(
Widget* _sender,
Widget* _new);
281 void updateLine(
bool _reset =
false);
282 void _setScrollView(
size_t _position);
285 void _redrawItemRange(
size_t _start = 0);
288 void _redrawItem(
size_t _index);
291 void _selectIndex(
size_t _index,
bool _select);
297 void shutdownWidgetSkin();
298 void _checkMapping(
const std::string& _owner);
300 Widget* _getClientWidget();
301 const Widget* _getClientWidget()
const;
304 std::string mSkinLine;
314 size_t mLastRedrawLine;
319 typedef std::pair<UString, Any> PairItem;
320 typedef std::vector<PairItem> VectorItemInfo;
321 VectorItemInfo mItemsInfo;
325 bool mNeedVisibleScroll;
333 #endif // __MYGUI_LIST_H__