Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUIButtonBase.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIButtonBase.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for ButtonBase widget
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIButtonBase_h_
00027 #define _CEGUIButtonBase_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUIButtonBaseProperties.h"
00032 
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00043 
00048 class CEGUIBASE_API ButtonBase : public Window
00049 {
00050 public:
00051         /*************************************************************************
00052                 Constants
00053         *************************************************************************/
00054         // default colours for text label rendering
00055         static const colour             DefaultNormalLabelColour;               
00056         static const colour             DefaultHoverLabelColour;                
00057         static const colour             DefaultPushedLabelColour;               
00058         static const colour             DefaultDisabledLabelColour;             
00059 
00060 
00061         /*************************************************************************
00062                 Accessor type functions
00063         *************************************************************************/
00071         bool    isHovering(void) const                  {return d_hovering;}
00072 
00073 
00081         bool    isPushed(void) const                    {return d_pushed;}
00082 
00083 
00091         colour  getNormalTextColour(void) const                 {return d_normalColour;}
00092 
00093 
00101         colour  getHoverTextColour(void) const                  {return d_hoverColour;}
00102 
00103 
00111         colour  getPushedTextColour(void) const                 {return d_pushedColour;}
00112 
00113 
00121         colour  getDisabledTextColour(void) const               {return d_disabledColour;}
00122 
00123 
00124         /*************************************************************************
00125                 Manipulators
00126         *************************************************************************/
00137         void    setNormalTextColour(const colour& colour);
00138 
00139 
00150         void    setHoverTextColour(const colour& colour);
00151 
00152 
00163         void    setPushedTextColour(const colour& colour);
00164 
00165 
00176         void    setDisabledTextColour(const colour& colour);
00177 
00178 
00179         /*************************************************************************
00180                 Construction and Destruction
00181         *************************************************************************/
00186         ButtonBase(const String& type, const String& name);
00187 
00188 
00193         virtual ~ButtonBase(void);
00194 
00195 
00196 protected:
00197         /*************************************************************************
00198                 Overridden event handlers
00199         *************************************************************************/
00200         virtual void    onMouseMove(MouseEventArgs& e);
00201         virtual void    onMouseButtonDown(MouseEventArgs& e);
00202         virtual void    onMouseButtonUp(MouseEventArgs& e);
00203         virtual void    onCaptureLost(WindowEventArgs& e);
00204         virtual void    onMouseLeaves(MouseEventArgs& e);
00205 
00206 
00207         /*************************************************************************
00208                 Implementation Functions
00209         *************************************************************************/
00220         void    updateInternalState(const Point& mouse_pos);
00221 
00222 
00223         /*************************************************************************
00224                 Implementation Rendering Functions
00225         *************************************************************************/
00236         virtual void    drawSelf(float z);
00237 
00238 
00249         virtual void    drawNormal(float z)             = 0;
00250 
00251 
00262         virtual void    drawHover(float z)                      {drawNormal(z);}
00263 
00264 
00275         virtual void    drawPushed(float z)             {drawNormal(z);}
00276 
00277 
00288         virtual void    drawDisabled(float z)           {drawNormal(z);}
00289 
00290 
00291         /*************************************************************************
00292                 Implementation Data
00293         *************************************************************************/
00294         bool    d_pushed;                       
00295         bool    d_hovering;                     
00296 
00297         // common rendering setting data
00298         colour  d_normalColour;                                 
00299         colour  d_hoverColour;                                  
00300         colour  d_pushedColour;                                 
00301         colour  d_disabledColour;                               
00302 
00303 private:
00304         /*************************************************************************
00305                 Static Properties for this class
00306         *************************************************************************/
00307         static ButtonBaseProperties::NormalTextColour   d_normalTextColourProperty;
00308         static ButtonBaseProperties::HoverTextColour    d_hoverTextColourProperty;
00309         static ButtonBaseProperties::PushedTextColour   d_pushedTextColourProperty;
00310         static ButtonBaseProperties::DisabledTextColour d_disabledTextColourProperty;
00311 
00312         /*************************************************************************
00313                 Private methods
00314         *************************************************************************/
00315         void    addButtonBaseProperties(void);
00316 };
00317 
00318 } // End of  CEGUI namespace section
00319 
00320 #if defined(_MSC_VER)
00321 #       pragma warning(pop)
00322 #endif
00323 
00324 #endif  // end of guard _CEGUIButtonBase_h_

Generated on Wed Feb 16 12:41:05 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1