Crazy Eddies GUI System  0.7.2
CEGUIMenuBase.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 "../CEGUIBase.h"
34 #include "../CEGUIWindow.h"
35 #include "CEGUIMenuBaseProperties.h"
36 #include "CEGUIItemListBase.h"
37 
38 
39 #if defined(_MSC_VER)
40 # pragma warning(push)
41 # pragma warning(disable : 4251)
42 #endif
43 
44 
45 // Start of CEGUI namespace section
46 namespace CEGUI
47 {
48 
53 class CEGUIEXPORT MenuBase : public ItemListBase
54 {
55 public:
56  static const String EventNamespace;
57 
58 
59  /*************************************************************************
60  Event name constants
61  *************************************************************************/
62  // generated internally by Window
67  static const String EventPopupOpened;
72  static const String EventPopupClosed;
73 
74 
75  /*************************************************************************
76  Accessor type functions
77  *************************************************************************/
85  float getItemSpacing(void) const {return d_itemSpacing;}
86 
87 
95  bool isMultiplePopupsAllowed(void) const {return d_allowMultiplePopups;}
96 
97 
105  MenuItem* getPopupMenuItem(void) const {return d_popupItem;}
106 
107 
108  /*************************************************************************
109  Manipulators
110  *************************************************************************/
115  void setItemSpacing(float spacing) {d_itemSpacing=spacing; handleUpdatedItemData();}
116 
117 
125  void changePopupMenuItem(MenuItem* item);
126 
127 
132  void setAllowMultiplePopups(bool setting);
133 
134 
135  /*************************************************************************
136  Construction and Destruction
137  *************************************************************************/
142  MenuBase(const String& type, const String& name);
143 
144 
149  virtual ~MenuBase(void);
150 
151 
152 protected:
153  /*************************************************************************
154  New Event Handlers
155  *************************************************************************/
160  virtual void onPopupOpened(WindowEventArgs& e);
161 
162 
167  virtual void onPopupClosed(WindowEventArgs& e);
168 
169  // overridden from base
170  virtual void onChildRemoved(WindowEventArgs& e);
171 
172  /*************************************************************************
173  Implementation Functions
174  *************************************************************************/
185  virtual bool testClassName_impl(const String& class_name) const
186  {
187  if (class_name=="MenuBase") return true;
188  return ItemListBase::testClassName_impl(class_name);
189  }
190 
191 
192  /*************************************************************************
193  Implementation Data
194  *************************************************************************/
196 
199 
200 
201 private:
202  /*************************************************************************
203  Static Properties for this class
204  *************************************************************************/
205  static MenuBaseProperties::ItemSpacing d_itemSpacingProperty;
206  static MenuBaseProperties::AllowMultiplePopups d_allowMultiplePopupsProperty;
207 
208  /*************************************************************************
209  Private methods
210  *************************************************************************/
211  void addMenuBaseProperties(void);
212 };
213 
214 } // End of CEGUI namespace section
215 
216 
217 #if defined(_MSC_VER)
218 # pragma warning(pop)
219 #endif
220 
221 #endif // end of guard _CEGUIMenuBase_h_