Crazy Eddies GUI System: CEGUIPopupMenu.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIPopupMenu.h

    00001 /***********************************************************************
    00002     filename:   CEGUIPopupMenu.h
    00003     created:    27/3/2005
    00004     author:     Tomas Lindquist Olsen (based on code by Paul D Turner)
    00005
    00006     purpose:    Interface to base class for PopupMenu widget
    00007 *************************************************************************/
    00008 /***************************************************************************
    00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
    00010  *
    00011  *   Permission is hereby granted, free of charge, to any person obtaining
    00012  *   a copy of this software and associated documentation files (the
    00013  *   "Software"), to deal in the Software without restriction, including
    00014  *   without limitation the rights to use, copy, modify, merge, publish,
    00015  *   distribute, sublicense, and/or sell copies of the Software, and to
    00016  *   permit persons to whom the Software is furnished to do so, subject to
    00017  *   the following conditions:
    00018  *
    00019  *   The above copyright notice and this permission notice shall be
    00020  *   included in all copies or substantial portions of the Software.
    00021  *
    00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00028  *   OTHER DEALINGS IN THE SOFTWARE.
    00029  ***************************************************************************/
    00030 #ifndef _CEGUIPopupMenu_h_
    00031 #define _CEGUIPopupMenu_h_
    00032
    00033 #include "../CEGUIBase.h"
    00034 #include "../CEGUIWindow.h"
    00035 #include "CEGUIPopupMenuProperties.h"
    00036 #include "CEGUIMenuBase.h"
    00037
    00038
    00039 #if defined(_MSC_VER)
    00040 #    pragma warning(push)
    00041 #    pragma warning(disable : 4251)
    00042 #endif
    00043
    00044
    00045 // Start of CEGUI namespace section
    00046 namespace CEGUI
    00047 {
    00048
    00053 class CEGUIEXPORT PopupMenu : public MenuBase
    00054 {
    00055 public:
    00056     /************************************************************************
    00057         Constants
    00058     *************************************************************************/
    00059     static const String EventNamespace;
    00060     static const String WidgetTypeName;
    00061
    00062     /*************************************************************************
    00063         Accessor type functions
    00064     *************************************************************************/
    00073     float getFadeInTime(void) const      {return d_fadeInTime;}
    00074
    00075
    00084     float getFadeOutTime(void) const     {return d_fadeOutTime;}
    00085
    00086
    00091     bool isPopupMenuOpen(void) const     {return d_isOpen;}
    00092
    00093
    00094     /*************************************************************************
    00095         Manipulators
    00096     *************************************************************************/
    00105     void    setFadeInTime(float fadetime)         {d_fadeInTime=fadetime;}
    00106
    00107
    00116     void    setFadeOutTime(float fadetime)        {d_fadeOutTime=fadetime;}
    00117
    00118
    00126     void    openPopupMenu(bool notify=true);
    00127
    00128
    00136     void    closePopupMenu(bool notify=true);
    00137
    00138
    00139     /*************************************************************************
    00140         Construction and Destruction
    00141     *************************************************************************/
    00146     PopupMenu(const String& type, const String& name);
    00147
    00148
    00153     virtual ~PopupMenu(void);
    00154
    00155
    00156 protected:
    00157     /*************************************************************************
    00158         Implementation Functions
    00159     *************************************************************************/
    00170     virtual void    updateSelf(float elapsed);
    00171
    00172
    00180     virtual void    layoutItemWidgets(void);
    00181
    00182
    00190     virtual Size getContentSize(void) const;
    00191
    00192
    00203     virtual bool    testClassName_impl(const String& class_name) const
    00204     {
    00205         if (class_name=="PopupMenu")    return true;
    00206         return MenuBase::testClassName_impl(class_name);
    00207     }
    00208
    00209
    00210     /*************************************************************************
    00211         Overridden event handlers
    00212     *************************************************************************/
    00213     virtual void onAlphaChanged(WindowEventArgs& e);
    00214         virtual void onDestructionStarted(WindowEventArgs& e);
    00215         virtual void onShown(WindowEventArgs& e);
    00216         virtual void onHidden(WindowEventArgs& e);
    00217         virtual void onMouseButtonDown(MouseEventArgs& e);
    00218         virtual void onMouseButtonUp(MouseEventArgs& e);
    00219
    00220
    00221     /*************************************************************************
    00222         Implementation Data
    00223     *************************************************************************/
    00224     float d_origAlpha;
    00225     float d_fadeElapsed;
    00226     float d_fadeOutTime;
    00227     float d_fadeInTime;
    00228     bool d_fading;
    00229     bool d_fadingOut;
    00230     bool d_isOpen;
    00231
    00232
    00233 private:
    00234     /*************************************************************************
    00235     Static Properties for this class
    00236     *************************************************************************/
    00237     static PopupMenuProperties::FadeInTime  d_fadeInTimeProperty;
    00238     static PopupMenuProperties::FadeOutTime d_fadeOutTimeProperty;
    00239
    00240
    00241     /*************************************************************************
    00242     Private methods
    00243     *************************************************************************/
    00244     void    addPopupMenuProperties(void);
    00245 };
    00246
    00247
    00248 } // End of  CEGUI namespace section
    00249
    00250
    00251 #if defined(_MSC_VER)
    00252 #    pragma warning(pop)
    00253 #endif
    00254
    00255
    00256 #endif    // end of guard _CEGUIPopupMenu_h_