Crazy Eddies GUI System  0.7.2
CEGUIPopupMenu.h
1 /***********************************************************************
2  filename: CEGUIPopupMenu.h
3  created: 27/3/2005
4  author: Tomas Lindquist Olsen (based on code by Paul D Turner)
5 
6  purpose: Interface to base class for PopupMenu 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 _CEGUIPopupMenu_h_
31 #define _CEGUIPopupMenu_h_
32 
33 #include "../CEGUIBase.h"
34 #include "../CEGUIWindow.h"
35 #include "CEGUIPopupMenuProperties.h"
36 #include "CEGUIMenuBase.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 PopupMenu : public MenuBase
54 {
55 public:
56  /************************************************************************
57  Constants
58  *************************************************************************/
59  static const String EventNamespace;
60  static const String WidgetTypeName;
61 
62  /*************************************************************************
63  Accessor type functions
64  *************************************************************************/
73  float getFadeInTime(void) const {return d_fadeInTime;}
74 
75 
84  float getFadeOutTime(void) const {return d_fadeOutTime;}
85 
86 
91  bool isPopupMenuOpen(void) const {return d_isOpen;}
92 
93 
94  /*************************************************************************
95  Manipulators
96  *************************************************************************/
105  void setFadeInTime(float fadetime) {d_fadeInTime=fadetime;}
106 
107 
116  void setFadeOutTime(float fadetime) {d_fadeOutTime=fadetime;}
117 
118 
126  void openPopupMenu(bool notify=true);
127 
128 
136  void closePopupMenu(bool notify=true);
137 
138 
139  /*************************************************************************
140  Construction and Destruction
141  *************************************************************************/
146  PopupMenu(const String& type, const String& name);
147 
148 
153  virtual ~PopupMenu(void);
154 
155 
156 protected:
157  /*************************************************************************
158  Implementation Functions
159  *************************************************************************/
170  virtual void updateSelf(float elapsed);
171 
172 
180  virtual void layoutItemWidgets(void);
181 
182 
190  virtual Size getContentSize(void) const;
191 
192 
203  virtual bool testClassName_impl(const String& class_name) const
204  {
205  if (class_name=="PopupMenu") return true;
206  return MenuBase::testClassName_impl(class_name);
207  }
208 
209 
210  /*************************************************************************
211  Overridden event handlers
212  *************************************************************************/
213  virtual void onAlphaChanged(WindowEventArgs& e);
214  virtual void onDestructionStarted(WindowEventArgs& e);
215  virtual void onShown(WindowEventArgs& e);
216  virtual void onHidden(WindowEventArgs& e);
217  virtual void onMouseButtonDown(MouseEventArgs& e);
218  virtual void onMouseButtonUp(MouseEventArgs& e);
219 
220 
221  /*************************************************************************
222  Implementation Data
223  *************************************************************************/
224  float d_origAlpha;
227  float d_fadeInTime;
228  bool d_fading;
229  bool d_fadingOut;
230  bool d_isOpen;
231 
232 
233 private:
234  /*************************************************************************
235  Static Properties for this class
236  *************************************************************************/
237  static PopupMenuProperties::FadeInTime d_fadeInTimeProperty;
238  static PopupMenuProperties::FadeOutTime d_fadeOutTimeProperty;
239 
240 
241  /*************************************************************************
242  Private methods
243  *************************************************************************/
244  void addPopupMenuProperties(void);
245 };
246 
247 
248 } // End of CEGUI namespace section
249 
250 
251 #if defined(_MSC_VER)
252 # pragma warning(pop)
253 #endif
254 
255 
256 #endif // end of guard _CEGUIPopupMenu_h_