Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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_
Property to access the fade in time in seconds of the popup menu.
Definition: CEGUIPopupMenuProperties.h:51
static const String WidgetTypeName
Window factory name.
Definition: CEGUIPopupMenu.h:60
bool d_fading
true if this popup menu is fading in/out. false if not
Definition: CEGUIPopupMenu.h:228
bool isPopupMenuOpen(void) const
Find out if this popup menu is open or closed;.
Definition: CEGUIPopupMenu.h:91
float d_fadeOutTime
The time in seconds it takes for this popup menu to fade out.
Definition: CEGUIPopupMenu.h:226
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIMenuBase.h:223
Class that holds the size (width & height) of something.
Definition: CEGUISize.h:43
Property to access the fade out time in seconds of the popup menu.
Definition: CEGUIPopupMenuProperties.h:76
Abstract base class for menus.
Definition: CEGUIMenuBase.h:53
float d_fadeInTime
The time in seconds it takes for this popup menu to fade in.
Definition: CEGUIPopupMenu.h:227
float getFadeInTime(void) const
Get the fade in time for this popup menu.
Definition: CEGUIPopupMenu.h:73
bool d_isOpen
true if this popup menu is open. false if not.
Definition: CEGUIPopupMenu.h:230
bool d_fadingOut
true if this popup menu is fading out. false if fading in.
Definition: CEGUIPopupMenu.h:229
void setFadeInTime(float fadetime)
Set the fade in time for this popup menu.
Definition: CEGUIPopupMenu.h:105
Base class for popup menus.
Definition: CEGUIPopupMenu.h:53
void setFadeOutTime(float fadetime)
Set the fade out time for this popup menu.
Definition: CEGUIPopupMenu.h:116
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: CEGUIInputEvent.h:245
float d_fadeElapsed
The time in seconds this popup menu has been fading.
Definition: CEGUIPopupMenu.h:225
float getFadeOutTime(void) const
Get the fade out time for this popup menu.
Definition: CEGUIPopupMenu.h:84
static const String EventNamespace
Namespace for global events.
Definition: CEGUIPopupMenu.h:59
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: CEGUIInputEvent.h:274
virtual bool testClassName_impl(const String &class_name) const
Return whether this window was inherited from the given class name at some point in the inheritance h...
Definition: CEGUIPopupMenu.h:203
float d_origAlpha
The original alpha of this window.
Definition: CEGUIPopupMenu.h:224
String class used within the GUI system.
Definition: CEGUIString.h:57