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

CEGUIStatic.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIStatic.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for Static 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 _CEGUIStatic_h_
00027 #define _CEGUIStatic_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "CEGUIRenderableFrame.h"
00032 #include "elements/CEGUIStaticProperties.h"
00033 
00034 
00035 #if defined(_MSC_VER)
00036 #       pragma warning(push)
00037 #       pragma warning(disable : 4251)
00038 #endif
00039 
00040 
00041 // Start of CEGUI namespace section
00042 namespace CEGUI
00043 {
00048 class CEGUIBASE_API Static : public Window
00049 {
00050 public:
00051         static const String EventNamespace;                             
00052 
00053 
00054         /*************************************************************************
00055                 Accessors
00056         *************************************************************************/
00064         bool    isFrameEnabled(void) const              {return d_frameEnabled;}
00065 
00066 
00074         bool    isBackgroundEnabled(void) const         {return d_backgroundEnabled;}
00075 
00076 
00084         ColourRect      getFrameColours(void) const             {return d_frameCols;}
00085 
00086 
00094         ColourRect      getBackgroundColours(void) const                {return d_backgroundCols;}
00095 
00096 
00097         // overridden so derived classes are auto-clipped to within the inner area of the frame when it's active.
00098         virtual Rect    getUnclippedInnerRect(void) const;
00099 
00100 
00112         const Image*    getImageForFrameLocation(FrameLocation location) const;
00113 
00114 
00123         const Image* getBackgroundImage(void) const;
00124 
00125 
00126         /*************************************************************************
00127                 Manipulators
00128         *************************************************************************/
00138         void    setFrameEnabled(bool setting);
00139 
00140 
00172         void    setFrameImages(const Image* topleft, const Image* topright, const Image* bottomleft, const Image* bottomright, const Image* left, const Image* top, const Image* right, const Image* bottom);
00173 
00174 
00185         void    setFrameColours(const ColourRect& colours);
00186 
00187 
00207         void    setFrameColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00208 
00209 
00220         void    setFrameColours(const colour& col)              {setFrameColours(col, col, col, col);}
00221 
00222 
00230         void    setBackgroundEnabled(bool setting);
00231 
00232 
00243         void    setBackgroundImage(const Image* image);
00244 
00245 
00261         void    setBackgroundImage(const String& imageset, const String& image);
00262 
00263 
00274         void    setBackgroundColours(const ColourRect& colours);
00275 
00276 
00296         void    setBackgroundColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00297 
00298 
00309         void    setBackgroundColours(const colour& col)         {setBackgroundColours(col, col, col, col);}
00310 
00311 
00326         void    setImageForFrameLocation(FrameLocation location, const Image* image);
00327 
00328 
00329         /*************************************************************************
00330                 Construction and Destruction
00331         *************************************************************************/
00336         Static(const String& type, const String& name);
00337 
00338 
00343         virtual ~Static(void);
00344 
00345 
00346 protected:
00347         /*************************************************************************
00348                 Overridden from base class
00349         *************************************************************************/
00360         virtual void    drawSelf(float z);
00361 
00362 
00363         /*************************************************************************
00364                 Event handling
00365         *************************************************************************/
00366         virtual void    onSized(WindowEventArgs& e);
00367         virtual void    onAlphaChanged(WindowEventArgs& e);
00368 
00369 
00370         /*************************************************************************
00371                 Implementation methods
00372         *************************************************************************/
00378         void    updateRenderableFrameColours(void);
00379 
00380 
00385         colour  calculateModulatedAlphaColour(const colour& col, float alpha) const;
00386 
00387 
00395         virtual void    onStaticFrameChanged(WindowEventArgs& e)        {}
00396 
00397 
00398         /*************************************************************************
00399                 Implementation Data
00400         *************************************************************************/
00401         bool                            d_frameEnabled;         
00402         ColourRect                      d_frameCols;            
00403         RenderableFrame         d_frame;                        
00404         bool                            d_backgroundEnabled;
00405         ColourRect                      d_backgroundCols;       
00406         const Image*            d_background;           
00407 
00408         // cache of frame edge sizes
00409         float   d_left_width;                   
00410         float   d_right_width;                  
00411         float   d_top_height;                   
00412         float   d_bottom_height;                
00413 
00414 
00415 private:
00416         /*************************************************************************
00417                 Static Properties for this class
00418         *************************************************************************/
00419         static StaticProperties::FrameEnabled                           d_frameEnabledProperty;
00420         static StaticProperties::BackgroundEnabled                      d_backgroundEnabledProperty;
00421         static StaticProperties::FrameColours                           d_frameColoursProperty;
00422         static StaticProperties::BackgroundColours                      d_backgroundColoursProperty;
00423         static StaticProperties::BackgroundImage                        d_backgroundImageProperty;
00424         static StaticProperties::TopLeftFrameImage                      d_topLeftFrameProperty;
00425         static StaticProperties::TopRightFrameImage                     d_topRightFrameProperty;
00426         static StaticProperties::BottomLeftFrameImage           d_bottomLeftFrameProperty;
00427         static StaticProperties::BottomRightFrameImage          d_bottomRightFrameProperty;
00428         static StaticProperties::LeftFrameImage                         d_leftFrameProperty;
00429         static StaticProperties::RightFrameImage                        d_rightFrameProperty;
00430         static StaticProperties::TopFrameImage                          d_topFrameProperty;
00431         static StaticProperties::BottomFrameImage                       d_bottomFrameProperty;
00432 
00433 
00434         /*************************************************************************
00435                 Private methods
00436         *************************************************************************/
00437         void    addStaticProperties(void);
00438 };
00439 
00440 
00441 } // End of  CEGUI namespace section
00442 
00443 #if defined(_MSC_VER)
00444 #       pragma warning(pop)
00445 #endif
00446 
00447 #endif  // end of guard _CEGUIStatic_h_

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