MyGUI 3.4.3
MyGUI_MenuItem.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_MENU_ITEM_H_
8#define MYGUI_MENU_ITEM_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Button.h"
12#include "MyGUI_MenuControl.h"
13#include "MyGUI_IItem.h"
14
15namespace MyGUI
16{
17
21 class MYGUI_EXPORT MenuItem : public Button, public IItem, public MemberObsolete<MenuItem>
22 {
24
25 public:
27 void setCaption(const UString& _value) override;
28
30 void setFontName(std::string_view _value) override;
31
33 void setFontHeight(int _value) override;
34
36 void setItemName(const UString& _value);
38 const UString& getItemName() const;
39
41 void setItemData(Any _data);
42
44 template<typename ValueType>
45 ValueType* getItemData(bool _throw = true)
46 {
47 return mOwner->getItemData<ValueType>(this, _throw);
48 }
49
51 void removeItem();
52
54 void setItemId(std::string_view _id);
56 const std::string& getItemId() const;
57
59 size_t getItemIndex() const;
60
62 MenuControl* createItemChild();
63
65 template<typename Type>
67 {
68 return mOwner->createItemChildT<Type>(this);
69 }
70
72 void setItemType(MenuItemType _type);
74 MenuItemType getItemType() const;
75
77 void setItemChildVisible(bool _visible);
78
80 MenuControl* getMenuCtrlParent() const;
81
83 MenuControl* getItemChild() const;
84
85 bool getItemChecked() const;
86 void setItemChecked(bool _value);
87
88 /*internal:*/
89 IItemContainer* _getItemContainer() const override;
90 IntSize _getContentSize() const;
91
92 protected:
93 void initialiseOverride() override;
94 void shutdownOverride() override;
95
96 void setPropertyOverride(std::string_view _key, std::string_view _value) override;
97
98 void onWidgetCreated(Widget* _widget) override;
99
100 private:
101 void updateCheck();
102
103 private:
104 MenuControl* mOwner{nullptr};
105 IntSize mMinSize{10, 10};
106 Widget* mCheck{nullptr};
107 bool mCheckValue{false};
108 };
109
110} // namespace MyGUI
111
112#endif // MYGUI_MENU_ITEM_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
widget description should be here.
widget description should be here.
widget description should be here.
Type * createItemChildT()
ValueType * getItemData(bool _throw=true)
Get item data.
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
widget description should be here.