7#ifndef MYGUI_MENU_CONTROL_H_
8#define MYGUI_MENU_CONTROL_H_
73 void setVisible(
bool _value)
override;
76 void setVisibleSmooth(
bool _value);
82 size_t getItemCount()
const;
93 void removeItemAt(
size_t _index);
98 void removeAllItems();
102 MenuItem* getItemAt(
size_t _index)
const;
105 size_t getItemIndex(
const MenuItem* _item)
const;
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>
131 return mItemsInfo[_index].data.castType<ValueType>(_throw);
134 template <
typename ValueType>
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)
const;
148 const std::string& getItemId(
const MenuItem* _item)
const;
151 MenuItem* getItemById(
const std::string& _id)
const;
154 MenuItem* findItemById(
const std::string& _id,
bool _recursive =
false);
157 size_t getItemIndexById(
const std::string& _id)
const;
162 void setItemNameAt(
size_t _index,
const UString& _name);
167 const UString& getItemNameAt(
size_t _index)
const;
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>
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;
232 MenuItem* getMenuItemParent()
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 size_t _getItemCount()
const override;
264 void _removeItemAt(
size_t _index)
override;
265 Widget* _getItemAt(
size_t _index)
const override;
266 void _setItemNameAt(
size_t _index,
const UString& _name)
override;
267 const UString& _getItemNameAt(
size_t _index)
const override;
268 void _setItemSelected(
IItem* _item)
override;
270 void _updateItems(
size_t _index);
271 void _updateSizeForEmpty();
274 void initialiseOverride()
override;
275 void shutdownOverride()
override;
277 void onKeyChangeRootFocus(
bool _focus)
override;
279 void onWidgetCreated(
Widget* _widget)
override;
281 void setPropertyOverride(
const std::string& _key,
const std::string& _value)
override;
284 void notifyRootKeyChangeFocus(
Widget* _sender,
bool _focus)
const;
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 void _setItemChildVisibleAt(
size_t _index,
bool _visible,
bool _smooth);
316 std::string mItemNormalSkin;
317 std::string mItemPopupSkin;
318 std::string mItemSeparatorSkin;
320 std::string mSubMenuSkin;
321 std::string mSubMenuLayer;
326 bool mVerticalAlignment;
332 bool mChangeChildSkin;
333 bool mInternalCreateChild;
#define MYGUI_ASSERT_RANGE(index, size, owner)
#define MYGUI_RTTI_DERIVED(DerivedType)
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
delegates::CMultiDelegate2< MenuControl *, MenuItem * > EventHandle_MenuCtrlPtrMenuItemPtr
delegates::CMultiDelegate1< MenuControl * > EventHandle_MenuCtrlPtr