7 #ifndef __MYGUI_MENU_CONTROL_H__
8 #define __MYGUI_MENU_CONTROL_H__
73 virtual void setVisible(
bool _value);
76 void setVisibleSmooth(
bool _value);
82 size_t getItemCount()
const;
93 void removeItemAt(
size_t _index);
98 void removeAllItems();
105 size_t getItemIndex(
MenuItem* _item);
108 size_t findItemIndex(
MenuItem* _item);
117 void setItemDataAt(
size_t _index,
Any _data);
122 void clearItemDataAt(
size_t _index);
124 void clearItemData(
MenuItem* _item);
127 template <
typename ValueType>
128 ValueType* getItemDataAt(
size_t _index,
bool _throw =
true)
131 return mItemsInfo[_index].data.castType<ValueType>(_throw);
134 template <
typename ValueType>
135 ValueType* getItemData(
MenuItem* _item,
bool _throw =
true)
137 return getItemDataAt<ValueType>(getItemIndex(_item), _throw);
141 void setItemIdAt(
size_t _index,
const std::string& _id);
143 void setItemId(
MenuItem* _item,
const std::string& _id);
146 const std::string& getItemIdAt(
size_t _index);
148 const std::string& getItemId(
MenuItem* _item);
151 MenuItem* getItemById(
const std::string& _id);
154 MenuItem* findItemById(
const std::string& _id,
bool _recursive =
false);
157 size_t getItemIndexById(
const std::string& _id);
162 void setItemNameAt(
size_t _index,
const UString& _name);
167 const UString& getItemNameAt(
size_t _index);
172 size_t findItemIndexWith(
const UString& _name);
175 void setItemChildVisibleAt(
size_t _index,
bool _visible);
177 void setItemChildVisible(
MenuItem* _item,
bool _visible);
183 template <
typename Type>
184 Type* createItemChildTAt(
size_t _index)
186 return static_cast<Type*
>(createItemChildByType(_index, Type::getClassTypeName()));
190 template <
typename Type>
193 return createItemChildTAt<Type>(getItemIndex(_item));
209 void removeItemChildAt(
size_t _index);
212 void removeItemChild(
MenuItem* _item);
227 void setPopupAccept(
bool _value);
229 bool getPopupAccept()
const;
235 void setVerticalAlignment(
bool _value);
237 bool getVerticalAlignment()
const;
256 void _notifyDeleteItem(
MenuItem* _item);
257 void _notifyDeletePopup(
MenuItem* _item);
258 void _notifyUpdateName(
MenuItem* _item);
262 virtual size_t _getItemCount();
264 virtual void _removeItemAt(
size_t _index);
265 virtual Widget* _getItemAt(
size_t _index);
266 virtual void _setItemNameAt(
size_t _index,
const UString& _name);
267 virtual const UString& _getItemNameAt(
size_t _index);
268 virtual void _setItemSelected(
IItem* _item);
270 void _updateItems(
size_t _index);
271 void _updateSizeForEmpty();
274 virtual void initialiseOverride();
275 virtual void shutdownOverride();
277 virtual void onKeyChangeRootFocus(
bool _focus);
279 virtual void onWidgetCreated(
Widget* _widget);
281 virtual void setPropertyOverride(
const std::string& _key,
const std::string& _value);
284 void notifyRootKeyChangeFocus(
Widget* _sender,
bool _focus);
285 void notifyMouseButtonClick(
Widget* _sender);
286 void notifyMouseSetFocus(
Widget* _sender,
Widget* _new);
288 const std::string& getSkinByType(
MenuItemType _type)
const;
289 std::string getIconIndexByType(
MenuItemType _type)
const;
293 MenuItemType getItemType(
bool _submenu,
bool _separator)
const;
295 void notifyMenuCtrlAccept(
MenuItem* _item);
297 Widget* createItemChildByType(
size_t _index,
const std::string& _type);
303 Widget* _getClientWidget();
305 void _setItemChildVisibleAt(
size_t _index,
bool _visible,
bool _smooth);
318 std::string mItemNormalSkin;
319 std::string mItemPopupSkin;
320 std::string mItemSeparatorSkin;
322 std::string mSubMenuSkin;
323 std::string mSubMenuLayer;
328 bool mVerticalAlignment;
334 bool mChangeChildSkin;
336 bool mInternalCreateChild;
341 #endif // __MYGUI_MENU_CONTROL_H__