CEGUIMenuBase.h

00001 /***********************************************************************
00002         filename:       CEGUIMenuBase.h
00003         created:        5/4/2005
00004         author:         Tomas Lindquist Olsen (based on code by Paul D Turner)
00005         
00006         purpose:        Interface to base class for MenuBase 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 _CEGUIMenuBase_h_
00031 #define _CEGUIMenuBase_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUIWindow.h"
00035 #include "elements/CEGUIMenuBaseProperties.h"
00036 #include "elements/CEGUIItemListBase.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 MenuBase : public ItemListBase
00054 {
00055 public:
00056         static const String EventNamespace;                             
00057 
00058 
00059         /*************************************************************************
00060                 Event name constants
00061         *************************************************************************/
00062         // generated internally by Window
00063         static const String EventPopupOpened;                                   
00064         static const String EventPopupClosed;                                   
00065 
00066 
00067         /*************************************************************************
00068                 Accessor type functions
00069         *************************************************************************/
00077         float   getItemSpacing(void) const                                      {return d_itemSpacing;}
00078 
00079 
00087         bool    isMultiplePopupsAllowed(void) const                     {return d_allowMultiplePopups;}
00088 
00089 
00097         MenuItem*       getPopupMenuItem(void) const                            {return d_popupItem;}
00098 
00099 
00100         /*************************************************************************
00101                 Manipulators
00102         *************************************************************************/
00107         void    setItemSpacing(float spacing)                           {d_itemSpacing=spacing; handleUpdatedItemData();}
00108 
00109 
00117         void    changePopupMenuItem(MenuItem* item);
00118 
00119 
00124         void    setAllowMultiplePopups(bool setting);
00125 
00126 
00127         /*************************************************************************
00128                 Construction and Destruction
00129         *************************************************************************/
00134         MenuBase(const String& type, const String& name);
00135 
00136 
00141         virtual ~MenuBase(void);
00142 
00143 
00144 protected:
00145         /*************************************************************************
00146                 New Event Handlers
00147         *************************************************************************/
00152         virtual void    onPopupOpened(WindowEventArgs& e);
00153 
00154 
00159         virtual void    onPopupClosed(WindowEventArgs& e);
00160 
00161     // overridden from base
00162     virtual void onChildRemoved(WindowEventArgs& e);
00163 
00164         /*************************************************************************
00165                 Implementation Functions
00166         *************************************************************************/
00177         virtual bool    testClassName_impl(const String& class_name) const
00178         {
00179                 if (class_name=="MenuBase")     return true;
00180                 return ItemListBase::testClassName_impl(class_name);
00181         }
00182 
00183 
00184         /*************************************************************************
00185                 Implementation Data
00186         *************************************************************************/
00187         float d_itemSpacing;            
00188         
00189         MenuItem* d_popupItem;      
00190         bool d_allowMultiplePopups;     
00191 
00192 
00193 private:
00194         /*************************************************************************
00195         Static Properties for this class
00196         *************************************************************************/
00197         static MenuBaseProperties::ItemSpacing                  d_itemSpacingProperty;
00198         static MenuBaseProperties::AllowMultiplePopups  d_allowMultiplePopupsProperty;
00199 
00200         /*************************************************************************
00201         Private methods
00202         *************************************************************************/
00203         void    addMenuBaseProperties(void);
00204 };
00205 
00206 } // End of  CEGUI namespace section
00207 
00208 
00209 #if defined(_MSC_VER)
00210 #       pragma warning(pop)
00211 #endif
00212 
00213 #endif  // end of guard _CEGUIMenuBase_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4