7#ifndef MYGUI_MENU_CONTROL_H_
8#define MYGUI_MENU_CONTROL_H_
72 void setVisible(
bool _visible)
override;
75 void setVisibleSmooth(
bool _visible);
81 size_t getItemCount()
const;
88 std::string_view
_id = {},
95 std::string_view
_id = {},
96 Any _data = Any::Null);
100 const UString& _name,
101 MenuItemType _type = MenuItemType::Normal,
102 std::string_view _id = {},
103 Any _data = Any::Null);
106 void removeItemAt(
size_t _index);
108 void removeItem(MenuItem* _item);
111 void removeAllItems();
115 MenuItem* getItemAt(
size_t _index)
const;
118 size_t getItemIndex(
const MenuItem* _item)
const;
121 size_t findItemIndex(MenuItem* _item);
124 MenuItem* findItemWith(
const UString& _name);
130 void setItemDataAt(
size_t _index, Any _data);
132 void setItemData(MenuItem* _item, Any _data);
135 void clearItemDataAt(
size_t _index);
137 void clearItemData(MenuItem* _item);
140 template<
typename ValueType>
147 template<
typename ValueType>
154 void setItemIdAt(
size_t _index, std::string_view
_id);
159 const std::string& getItemIdAt(
size_t _index)
const;
170 size_t getItemIndexById(std::string_view
_id)
const;
196 template<
typename Type>
199 return static_cast<Type*
>(createItemChildByType(
_index, Type::getClassTypeName()));
203 template<
typename Type>
222 void removeItemChildAt(
size_t _index);
240 void setPopupAccept(
bool _value);
242 bool getPopupAccept()
const;
245 MenuItem* getMenuItemParent()
const;
248 void setVerticalAlignment(
bool _value);
250 bool getVerticalAlignment()
const;
275 size_t _getItemCount()
const override;
277 void _removeItemAt(
size_t _index)
override;
283 void _updateItems(
size_t _index);
284 void _updateSizeForEmpty();
287 void initialiseOverride()
override;
288 void shutdownOverride()
override;
290 void onKeyChangeRootFocus(
bool _focus)
override;
294 void setPropertyOverride(std::string_view
_key, std::string_view
_value)
override;
317 std::string_view
_id,
325 bool mHideByAccept{
true};
327 bool mMenuDropMode{
false};
328 bool mIsMenuDrop{
true};
329 bool mHideByLostKey{
false};
330 bool mResizeToContent{
true};
333 VectorMenuItemInfo mItemsInfo;
335 std::string mItemNormalSkin;
336 std::string mItemPopupSkin;
337 std::string mItemSeparatorSkin;
339 std::string mSubMenuSkin;
340 std::string mSubMenuLayer;
343 bool mShutdown{
false};
345 bool mVerticalAlignment{
true};
346 int mDistanceButton{0};
347 bool mPopupAccept{
false};
348 MenuItem* mOwner{
nullptr};
349 bool mAnimateSmooth{
false};
351 bool mChangeChildSkin{
false};
352 bool mInternalCreateChild{
false};
#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.