MyGUI 3.2.2

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
15 namespace MyGUI
16 {
17
21 class MYGUI_EXPORT MenuItem :
22 public Button,
23 public IItem,
24 public MemberObsolete<MenuItem>
25 {
26 MYGUI_RTTI_DERIVED( MenuItem )
27
28 public:
29 MenuItem();
30
32 virtual void setCaption(const UString& _value);
33
35 virtual void setFontName(const std::string& _value);
36
38 virtual void setFontHeight(int _value);
39
41 void setItemName(const UString& _value);
43 const UString& getItemName();
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();
62
64 size_t getItemIndex();
65
67 MenuControl* createItemChild();
68
70 template <typename Type>
71 Type* createItemChildT()
72 {
73 return mOwner->createItemChildT<Type>(this);
74 }
75
77 void setItemType(MenuItemType _value);
79 MenuItemType getItemType();
80
82 void setItemChildVisible(bool _value);
83
85 MenuControl* getMenuCtrlParent();
86
88 MenuControl* getItemChild();
89
90 bool getItemChecked() const;
91 void setItemChecked(bool _value);
92
93 /*internal:*/
94 virtual IItemContainer* _getItemContainer();
95 IntSize _getContentSize();
96
97 protected:
98 virtual void initialiseOverride();
99 virtual void shutdownOverride();
100
101 virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
102
103 virtual void onWidgetCreated(Widget* _widget);
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_
MyGUI::Widget
Widget properties. Widget_skin_childs Skin childs. Widget widget description should be here...
Definition: MyGUI_Widget.h:29
MyGUI_Prerequest.h
MyGUI_IItem.h
MyGUI::types::TSize< int >
MyGUI::Any
Definition: MyGUI_Any.h:63
MyGUI_Button.h
MyGUI::IItemContainer
Definition: MyGUI_IItemContainer.h:18
MyGUI::Button
Button properties. Button_skin_childs Skin childs. Button widget description should be here...
Definition: MyGUI_Button.h:19
MyGUI
Definition: MyGUI_ActionController.h:14
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MyGUI::IItem
Definition: MyGUI_IItem.h:17