MyGUI  3.2.0
MyGUI_MenuItem.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_MENU_ITEM_H__
23 #define __MYGUI_MENU_ITEM_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Button.h"
27 #include "MyGUI_MenuControl.h"
28 #include "MyGUI_IItem.h"
29 
30 namespace MyGUI
31 {
32 
34  public Button,
35  public IItem,
36  public MemberObsolete<MenuItem>
37  {
39 
40  public:
41  MenuItem();
42 
44  virtual void setCaption(const UString& _value);
45 
47  void setItemName(const UString& _value);
49  const UString& getItemName();
50 
52  void setItemData(Any _value);
53 
55  template <typename ValueType>
56  ValueType* getItemData(bool _throw = true)
57  {
58  return mOwner->getItemData<ValueType>(this, _throw);
59  }
60 
62  void removeItem();
63 
65  void setItemId(const std::string& _value);
67  const std::string& getItemId();
68 
70  size_t getItemIndex();
71 
73  MenuControl* createItemChild();
74 
76  template <typename Type>
77  Type* createItemChildT()
78  {
79  return mOwner->createItemChildT<Type>(this);
80  }
81 
83  void setItemType(MenuItemType _value);
85  MenuItemType getItemType();
86 
88  void setItemChildVisible(bool _value);
89 
91  MenuControl* getMenuCtrlParent();
92 
94  MenuControl* getItemChild();
95 
96  bool getItemChecked() const;
97  void setItemChecked(bool _value);
98 
99  /*internal:*/
100  virtual IItemContainer* _getItemContainer();
101  IntSize _getContentSize();
102 
103  protected:
104  virtual void initialiseOverride();
105  virtual void shutdownOverride();
106 
107  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
108 
109  virtual void onWidgetCreated(Widget* _widget);
110 
111  private:
112  void updateCheck();
113 
114  private:
115  MenuControl* mOwner;
116  IntSize mMinSize;
117  Widget* mCheck;
118  bool mCheckValue;
119  };
120 
121 } // namespace MyGUI
122 
123 #endif // __MYGUI_MENU_ITEM_H__