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

CEGUIPushButton.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIPushButton.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for PushButton 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 _CEGUIPushButton_h_
00027 #define _CEGUIPushButton_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "elements/CEGUIButtonBase.h"
00031 #include "elements/CEGUIPushButtonProperties.h"
00032 #include "CEGUIRenderableImage.h"
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 // Start of CEGUI namespace section
00040 namespace CEGUI
00041 {
00046 class CEGUIEXPORT PushButton : public ButtonBase
00047 {
00048 public:
00049         static const String EventNamespace;                             
00050 
00051 
00052         /*************************************************************************
00053                 Event name constants
00054         *************************************************************************/
00055         // generated internally by Window
00056         static const String EventClicked;                                       
00057 
00058         /*************************************************************************
00059                 Construction and Destruction
00060         *************************************************************************/
00065         PushButton(const String& type, const String& name);
00066 
00067 
00072         virtual ~PushButton(void);
00073 
00074     /*************************************************************************
00075         Common Public Interface
00076     *************************************************************************/
00084         bool    isStandardImageryEnabled(void) const;
00085 
00086 
00095         bool    isCustomImageryAutoSized(void) const;
00096 
00106         const RenderableImage*  getNormalImage(void) const;
00107 
00117         const RenderableImage*  getHoverImage(void) const;
00118 
00128         const RenderableImage*  getPushedImage(void) const;
00129 
00139         const RenderableImage*  getDisabledImage(void) const;
00140 
00150     float   getTextXOffset(void) const;
00151 
00162         void    setStandardImageryEnabled(bool setting);
00163 
00174         void    setCustomImageryAutoSized(bool setting);
00175 
00188         void    setNormalImage(const RenderableImage* image);
00189 
00202         void    setHoverImage(const RenderableImage* image);
00203 
00216         void    setPushedImage(const RenderableImage* image);
00217 
00230         void    setDisabledImage(const RenderableImage* image);
00231 
00244     void   setTextXOffset(float offset);
00245 
00246 protected:
00247         /*************************************************************************
00248                 New Event Handlers
00249         *************************************************************************/
00254         virtual void    onClicked(WindowEventArgs& e);
00255 
00256 
00257         /*************************************************************************
00258                 Overridden Event Handlers
00259         *************************************************************************/
00260         virtual void    onMouseButtonUp(MouseEventArgs& e);
00261     virtual void    onSized(WindowEventArgs& e);
00262 
00263 
00264         /*************************************************************************
00265                 Implementation Functions
00266         *************************************************************************/
00271         void    addPushButtonEvents(void);
00272 
00273 
00284         virtual bool    testClassName_impl(const String& class_name) const
00285         {
00286                 if (class_name==(const utf8*)"PushButton")      return true;
00287                 return ButtonBase::testClassName_impl(class_name);
00288         }
00289 
00290 
00291     /*************************************************************************
00292         Data Fields
00293     *************************************************************************/
00294     // flags stating which imagery is to be rendered and how.
00295     bool        d_autoscaleImages;                              
00296     bool        d_useStandardImagery;                   
00297     bool        d_useNormalImage;                               
00298     bool        d_useHoverImage;                                
00299     bool        d_usePushedImage;                               
00300     bool        d_useDisabledImage;                             
00301 
00302     // button RenderableImage objects
00303     RenderableImage             d_normalImage;          
00304     RenderableImage             d_hoverImage;           
00305     RenderableImage             d_pushedImage;          
00306     RenderableImage             d_disabledImage;        
00307 
00308     //text-offset
00309     float d_textXOffset;                
00310 
00311 private:
00312     /*************************************************************************
00313         Static Properties for this class
00314     *************************************************************************/
00315     static PushButtonProperties::NormalImage    d_normalImageProperty;
00316     static PushButtonProperties::PushedImage    d_pushedImageProperty;
00317     static PushButtonProperties::HoverImage     d_hoverImageProperty;
00318     static PushButtonProperties::DisabledImage  d_disabledImageProperty;
00319     static PushButtonProperties::UseStandardImagery d_useStandardImageryProperty;
00320     static PushButtonProperties::TextXOffset    d_textXOffsetProperty;
00321 
00322     /*************************************************************************
00323         Private methods
00324     *************************************************************************/
00325     void        addPushButtonProperties(void);
00326 };
00327 
00328 
00329 } // End of  CEGUI namespace section
00330 
00331 #if defined(_MSC_VER)
00332 #       pragma warning(pop)
00333 #endif
00334 
00335 #endif  // end of guard _CEGUIPushButton_h_

Generated on Wed Sep 7 09:56:33 2005 for Crazy Eddies GUI System by  doxygen 1.4.3