Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
MenuBase.h
1 /***********************************************************************
2  filename: CEGUIMenuBase.h
3  created: 5/4/2005
4  author: Tomas Lindquist Olsen (based on code by Paul D Turner)
5 
6  purpose: Interface to base class for MenuBase widget
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIMenuBase_h_
31 #define _CEGUIMenuBase_h_
32 
33 #include "../Base.h"
34 #include "../Window.h"
35 #include "./ItemListBase.h"
36 
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
47 
52 class CEGUIEXPORT MenuBase : public ItemListBase
53 {
54 public:
55  static const String EventNamespace;
56 
57 
58  /*************************************************************************
59  Event name constants
60  *************************************************************************/
61  // generated internally by Window
66  static const String EventPopupOpened;
71  static const String EventPopupClosed;
72 
73 
74  /*************************************************************************
75  Accessor type functions
76  *************************************************************************/
84  float getItemSpacing(void) const
85  {
86  return d_itemSpacing;
87  }
88 
89 
97  bool isMultiplePopupsAllowed(void) const
98  {
99  return d_allowMultiplePopups;
100  }
101 
109  bool getAutoCloseNestedPopups(void) const
110  {
111  return d_autoCloseNestedPopups;
112  }
113 
121  MenuItem* getPopupMenuItem(void) const
122  {
123  return d_popupItem;
124  }
125 
126 
127  /*************************************************************************
128  Manipulators
129  *************************************************************************/
134  void setItemSpacing(float spacing)
135  {
136  d_itemSpacing = spacing;
137  handleUpdatedItemData();
138  }
139 
140 
148  void changePopupMenuItem(MenuItem* item);
149 
150 
155  void setAllowMultiplePopups(bool setting);
156 
161  void setAutoCloseNestedPopups(bool setting)
162  {
163  d_autoCloseNestedPopups = setting;
164  }
169  void setPopupMenuItemClosing();
170 
171 
172  /*************************************************************************
173  Construction and Destruction
174  *************************************************************************/
179  MenuBase(const String& type, const String& name);
180 
181 
186  virtual ~MenuBase(void);
187 
188 
189 protected:
190  /*************************************************************************
191  New Event Handlers
192  *************************************************************************/
197  virtual void onPopupOpened(WindowEventArgs& e);
198 
199 
204  virtual void onPopupClosed(WindowEventArgs& e);
205 
206  // overridden from base
207  virtual void onChildRemoved(ElementEventArgs& e);
208  virtual void onHidden(WindowEventArgs& e);
209 
210  /*************************************************************************
211  Implementation Data
212  *************************************************************************/
214 
218 
219 
220 private:
221  /*************************************************************************
222  Private methods
223  *************************************************************************/
224  void addMenuBaseProperties(void);
225 };
226 
227 } // End of CEGUI namespace section
228 
229 
230 #if defined(_MSC_VER)
231 # pragma warning(pop)
232 #endif
233 
234 #endif // end of guard _CEGUIMenuBase_h_