source: GTP/trunk/Lib/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenu.h @ 1809

Revision 1809, 6.5 KB checked in by gumbau, 18 years ago (diff)
Line 
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    Crazy Eddie's GUI System (http://www.cegui.org.uk)
10    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
11
12    This library is free software; you can redistribute it and/or
13    modify it under the terms of the GNU Lesser General Public
14    License as published by the Free Software Foundation; either
15    version 2.1 of the License, or (at your option) any later version.
16
17    This library is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20    Lesser General Public License for more details.
21
22    You should have received a copy of the GNU Lesser General Public
23    License along with this library; if not, write to the Free Software
24    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25*************************************************************************/
26#ifndef _CEGUIPopupMenu_h_
27#define _CEGUIPopupMenu_h_
28
29#include "CEGUIBase.h"
30#include "CEGUIWindow.h"
31#include "elements/CEGUIPopupMenuProperties.h"
32#include "elements/CEGUIMenuBase.h"
33
34
35#if defined(_MSC_VER)
36#       pragma warning(push)
37#       pragma warning(disable : 4251)
38#endif
39
40
41// Start of CEGUI namespace section
42namespace CEGUI
43{
44
45/*!
46\brief
47        Base class for popup menus
48*/
49class CEGUIEXPORT PopupMenu : public MenuBase
50{
51public:
52        static const String EventNamespace;                             //!< Namespace for global events
53
54        /*************************************************************************
55                Accessor type functions
56        *************************************************************************/
57        /*!
58        \brief
59                Get the fade in time for this popup menu.
60
61        \return
62                The time in seconds that it takes for the popup to fade in.
63                0 if fading is disabled.
64        */
65        float   getFadeInTime(void) const                       {return d_fadeInTime;}
66
67
68        /*!
69        \brief
70                Get the fade out time for this popup menu.
71
72        \return
73                The time in seconds that it takes for the popup to fade out.
74                0 if fading is disabled.
75        */
76        float   getFadeOutTime(void) const                      {return d_fadeOutTime;}
77
78
79        /*************************************************************************
80                Manipulators
81        *************************************************************************/
82        /*!
83        \brief
84                Set the fade in time for this popup menu.
85
86        \param fadetime
87                The time in seconds that it takes for the popup to fade in.
88                If this parameter is zero, fading is disabled.
89        */
90        void    setFadeInTime(float fadetime)           {d_fadeInTime=fadetime;}
91
92
93        /*!
94        \brief
95                Set the fade out time for this popup menu.
96
97        \param fadetime
98                The time in seconds that it takes for the popup to fade out.
99                If this parameter is zero, fading is disabled.
100        */
101        void    setFadeOutTime(float fadetime)          {d_fadeOutTime=fadetime;}
102
103        /*!
104        \brief
105                Tells the popup menu to open.
106        */
107        void    openPopupMenu(void);
108
109
110        /*!
111        \brief
112                Tells the popup menu to close.
113        */
114        void    closePopupMenu(void);
115
116
117        /*************************************************************************
118                Construction and Destruction
119        *************************************************************************/
120        /*!
121        \brief
122                Constructor for PopupMenu objects
123        */
124        PopupMenu(const String& type, const String& name);
125
126
127        /*!
128        \brief
129                Destructor for PopupMenu objects
130        */
131        virtual ~PopupMenu(void);
132
133
134protected:
135        /*************************************************************************
136                Implementation Functions
137        *************************************************************************/
138        /*!
139        \brief
140        Perform actual update processing for this Window.
141
142        \param elapsed
143        float value indicating the number of seconds elapsed since the last update call.
144
145        \return
146        Nothing.
147        */
148        virtual void    updateSelf(float elapsed);
149
150
151        /*!
152        \brief
153                Setup size and position for the item widgets attached to this Listbox
154
155        \return
156                Nothing.
157        */
158        virtual void    layoutItemWidgets(void);
159
160
161        /*!
162        \brief
163                Resizes the popup menu to exactly fit the content that is attached to it.
164
165        \return
166                Nothing.
167        */
168        virtual Size getContentSize(void);
169
170
171        /*!
172        \brief
173                Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
174
175        \param class_name
176                The class name that is to be checked.
177
178        \return
179                true if this window was inherited from \a class_name. false if not.
180        */
181        virtual bool    testClassName_impl(const String& class_name) const
182        {
183                if (class_name==(const utf8*)"PopupMenu")       return true;
184                return MenuBase::testClassName_impl(class_name);
185        }
186
187
188        /*************************************************************************
189                Overridden event handlers
190        *************************************************************************/
191        virtual void onAlphaChanged(WindowEventArgs& e);
192
193
194        /*************************************************************************
195                Implementation Data
196        *************************************************************************/
197        float d_origAlpha;                      //!< The original alpha of this window.
198
199        float d_fadeElapsed;            //!< The time in seconds this popup menu has been fading.
200        float d_fadeOutTime;            //!< The time in seconds it takes for this popup menu to fade out.
201        float d_fadeInTime;                     //!< The time in seconds it takes for this popup menu to fade in.
202        bool d_fading;                          //!< true if this popup menu is fading in/out. false if not
203        bool d_fadingOut;                       //!< true if this popup menu is fading out. false if fading in.
204
205private:
206        /*************************************************************************
207        Static Properties for this class
208        *************************************************************************/
209        static PopupMenuProperties::FadeInTime  d_fadeInTimeProperty;
210        static PopupMenuProperties::FadeOutTime d_fadeOutTimeProperty;
211
212
213        /*************************************************************************
214        Private methods
215        *************************************************************************/
216        void    addPopupMenuProperties(void);
217};
218
219} // End of  CEGUI namespace section
220
221
222#if defined(_MSC_VER)
223#       pragma warning(pop)
224#endif
225
226
227#endif  // end of guard _CEGUIPopupMenu_h_
Note: See TracBrowser for help on using the repository browser.