MyGUI 3.4.1
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
22 public Button,
23 public IItem,
24 public MemberObsolete<MenuItem>
25 {
27
28 public:
29 MenuItem();
30
32 void setCaption(const UString& _value) override;
33
35 void setFontName(const std::string& _value) override;
36
38 void setFontHeight(int _value) override;
39
41 void setItemName(const UString& _value);
43 const UString& getItemName() const;
44
46 void setItemData(Any _value);
47
49 template <typename ValueType>
50 ValueType* getItemData(bool _throw = true)
51 {
52 return mOwner->getItemData<ValueType>(this, _throw);
53 }
54
56 void removeItem();
57
59 void setItemId(const std::string& _value);
61 const std::string& getItemId() const;
62
64 size_t getItemIndex() const;
65
67 MenuControl* createItemChild();
68
70 template <typename Type>
72 {
73 return mOwner->createItemChildT<Type>(this);
74 }
75
77 void setItemType(MenuItemType _value);
79 MenuItemType getItemType() const;
80
82 void setItemChildVisible(bool _value);
83
85 MenuControl* getMenuCtrlParent() const;
86
88 MenuControl* getItemChild() const;
89
90 bool getItemChecked() const;
91 void setItemChecked(bool _value);
92
93 /*internal:*/
94 IItemContainer* _getItemContainer() const override;
95 IntSize _getContentSize() const;
96
97 protected:
98 void initialiseOverride() override;
99 void shutdownOverride() override;
100
101 void setPropertyOverride(const std::string& _key, const std::string& _value) override;
102
103 void onWidgetCreated(Widget* _widget) override;
104
105 private:
106 void updateCheck();
107
108 private:
109 MenuControl* mOwner;
110 IntSize mMinSize;
111 Widget* mCheck;
112 bool mCheckValue;
113 };
114
115} // namespace MyGUI
116
117#endif // MYGUI_MENU_ITEM_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:48
widget description should be here.
Definition: MyGUI_Button.h:22
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.
Definition: MyGUI_Widget.h:37