CEGUIStaticImage.h

00001 /************************************************************************
00002         filename:       CEGUIStaticImage.h
00003         created:        4/6/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface for the static image 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 _CEGUIStaticImage_h_
00027 #define _CEGUIStaticImage_h_
00028 
00029 #include "elements/CEGUIStatic.h"
00030 #include "CEGUIRenderableImage.h"
00031 #include "elements/CEGUIStaticImageProperties.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 {
00050 class CEGUIEXPORT StaticImage : public Static
00051 {
00052 public:
00053         static const String EventNamespace;                             
00054 
00055 
00056         /*************************************************************************
00057                 Formatting Enumerations
00058         *************************************************************************/
00063         enum HorzFormatting
00064         {
00065                 LeftAligned,    
00066                 RightAligned,   
00067                 HorzCentred,    
00068                 HorzStretched,  
00069                 HorzTiled               
00070         };
00071 
00072 
00077         enum VertFormatting
00078         {
00079                 TopAligned,             
00080                 BottomAligned,  
00081                 VertCentred,    
00082                 VertStretched,  
00083                 VertTiled               
00084         };
00085 
00086 
00087         /*************************************************************************
00088                 Construction and Destruction
00089         *************************************************************************/
00094         StaticImage(const String& type, const String& name);
00095 
00096 
00101         virtual ~StaticImage(void);
00102 
00103 
00104         /*************************************************************************
00105                 Accessors
00106         *************************************************************************/
00114         const Image*    getImage(void) const            {return d_image.getImage();}
00115 
00116 
00124         ColourRect      getImageColours(void) const             {return d_imageCols;}
00125 
00126         
00134         HorzFormatting  getHorizontalFormatting(void) const             {return (HorzFormatting)d_image.getHorzFormatting();}
00135 
00136 
00144         VertFormatting  getVerticalFormatting(void) const               {return (VertFormatting)d_image.getVertFormatting();}
00145 
00146 
00147         /*************************************************************************
00148                 Manipulators
00149         *************************************************************************/
00160         void    setImage(const Image* image);
00161 
00162 
00178         void    setImage(const String& imageset, const String& image);
00179 
00180 
00191         void    setImageColours(const ColourRect& colours);
00192 
00193 
00213         void    setImageColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00214 
00215 
00226         void    setImageColours(const colour& col)              {setImageColours(col, col, col, col);}
00227 
00228 
00242         void    setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
00243 
00244 
00255         void    setVerticalFormatting(VertFormatting v_fmt);
00256 
00257 
00268         void    setHorizontalFormatting(HorzFormatting h_fmt);
00269 
00270 
00271 protected:
00272         /*************************************************************************
00273                 Overridden from base class
00274         *************************************************************************/
00275         virtual void populateRenderCache();
00276 
00277         
00278         /*************************************************************************
00279                 Event handling
00280         *************************************************************************/
00281         virtual void    onSized(WindowEventArgs& e);
00282         virtual void    onAlphaChanged(WindowEventArgs& e);
00283         virtual void    onStaticFrameChanged(WindowEventArgs& e);
00284 
00285 
00286         /*************************************************************************
00287                 Implementation Methods
00288         *************************************************************************/
00294         void    updateRenderableImageColours(void);
00295 
00296 
00307         virtual bool    testClassName_impl(const String& class_name) const
00308         {
00309                 if (class_name==(const utf8*)"StaticImage")     return true;
00310                 return Static::testClassName_impl(class_name);
00311         }
00312 
00313 
00314         /*************************************************************************
00315                 Implementation Data
00316         *************************************************************************/
00317         RenderableImage d_image;                
00318         ColourRect              d_imageCols;    
00319 
00320 
00321 private:
00322         /*************************************************************************
00323                 Static Properties for this class
00324         *************************************************************************/
00325         static StaticImageProperties::Image                             d_imageProperty;
00326         static StaticImageProperties::ImageColours              d_imageColoursProperty;
00327         static StaticImageProperties::VertFormatting    d_vertFormattingProperty;
00328         static StaticImageProperties::HorzFormatting    d_horzFormattingProperty;
00329 
00330 
00331         /*************************************************************************
00332                 Private methods
00333         *************************************************************************/
00334         void    addStaticImageProperties(void);
00335 };
00336 
00337 } // End of  CEGUI namespace section
00338 
00339 #if defined(_MSC_VER)
00340 #       pragma warning(pop)
00341 #endif
00342 
00343 #endif  // end of guard _CEGUIStaticImage_h_

Generated on Sat Nov 26 10:09:55 2005 for Crazy Eddies GUI System by  doxygen 1.4.5