Crazy Eddies GUI System  0.7.1
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
63  static const String EventPopupOpened;
64  static const String EventPopupClosed;
65 
66 
67  /*************************************************************************
68  Accessor type functions
69  *************************************************************************/
77  float getItemSpacing(void) const {return d_itemSpacing;}
78 
79 
87  bool isMultiplePopupsAllowed(void) const {return d_allowMultiplePopups;}
88 
89 
97  MenuItem* getPopupMenuItem(void) const {return d_popupItem;}
98 
99 
100  /*************************************************************************
101  Manipulators
102  *************************************************************************/
107  void setItemSpacing(float spacing) {d_itemSpacing=spacing; handleUpdatedItemData();}
108 
109 
117  void changePopupMenuItem(MenuItem* item);
118 
119 
124  void setAllowMultiplePopups(bool setting);
125 
126 
127  /*************************************************************************
128  Construction and Destruction
129  *************************************************************************/
134  MenuBase(const String& type, const String& name);
135 
136 
141  virtual ~MenuBase(void);
142 
143 
144 protected:
145  /*************************************************************************
146  New Event Handlers
147  *************************************************************************/
152  virtual void onPopupOpened(WindowEventArgs& e);
153 
154 
159  virtual void onPopupClosed(WindowEventArgs& e);
160 
161  // overridden from base
162  virtual void onChildRemoved(WindowEventArgs& e);
163 
164  /*************************************************************************
165  Implementation Functions
166  *************************************************************************/
177  virtual bool testClassName_impl(const String& class_name) const
178  {
179  if (class_name=="MenuBase") return true;
180  return ItemListBase::testClassName_impl(class_name);
181  }
182 
183 
184  /*************************************************************************
185  Implementation Data
186  *************************************************************************/
188 
191 
192 
193 private:
194  /*************************************************************************
195  Static Properties for this class
196  *************************************************************************/
197  static MenuBaseProperties::ItemSpacing d_itemSpacingProperty;
198  static MenuBaseProperties::AllowMultiplePopups d_allowMultiplePopupsProperty;
199 
200  /*************************************************************************
201  Private methods
202  *************************************************************************/
203  void addMenuBaseProperties(void);
204 };
205 
206 } // End of CEGUI namespace section
207 
208 
209 #if defined(_MSC_VER)
210 # pragma warning(pop)
211 #endif
212 
213 #endif // end of guard _CEGUIMenuBase_h_