CEGUIRenderableElement.h

00001 /************************************************************************
00002         filename:       CEGUIRenderableElement.h
00003         created:        14/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface for base class of a 'higher-level' renderable
00007                                 UI entity.
00008 *************************************************************************/
00009 /*************************************************************************
00010     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00011     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00012 
00013     This library is free software; you can redistribute it and/or
00014     modify it under the terms of the GNU Lesser General Public
00015     License as published by the Free Software Foundation; either
00016     version 2.1 of the License, or (at your option) any later version.
00017 
00018     This library is distributed in the hope that it will be useful,
00019     but WITHOUT ANY WARRANTY; without even the implied warranty of
00020     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021     Lesser General Public License for more details.
00022 
00023     You should have received a copy of the GNU Lesser General Public
00024     License along with this library; if not, write to the Free Software
00025     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 *************************************************************************/
00027 #ifndef _CEGUIRenderableElement_h_
00028 #define _CEGUIRenderableElement_h_
00029 
00030 #include "CEGUIBase.h"
00031 #include "CEGUISystem.h"
00032 #include "CEGUIColourRect.h"
00033 #include "CEGUIVector.h"
00034 #include "CEGUIRenderCache.h"
00035 
00036 // Start of CEGUI namespace section
00037 namespace CEGUI
00038 {
00043 class CEGUIEXPORT RenderableElement
00044 {
00045 public:
00046         /*************************************************************************
00047                 Drawing methods
00048         *************************************************************************/
00060         void    draw(const Vector3& position, const Rect& clip_rect);
00061 
00072     void draw(RenderCache& renderCache) const;
00073 
00074         /*************************************************************************
00075                 Accessors
00076         *************************************************************************/
00084         RenderableElement*      getNextElement(void) const                      {return d_next;}
00085 
00086 
00094         const ColourRect&       getColours(void) const                                          {return d_colours;}
00095 
00096 
00106         Point   getPosition(void) const                                                 {return Point(d_area.d_left, d_area.d_top);}
00107 
00108 
00116         Size    getSize(void) const                             {return Size(d_area.getWidth(), d_area.getHeight());}
00117 
00118 
00126         const Rect&     getRect(void) const                             {return d_area;}
00127 
00128 
00138         bool    isColourRectPerImage(bool setting) const                {return d_useColoursPerImage;}
00139 
00140 
00141         /*************************************************************************
00142                 Manipulators
00143         *************************************************************************/
00158         void    setNextElement(RenderableElement* element)              {d_next = element;}
00159 
00160 
00171         void    setColours(const ColourRect& colours)                   {d_colours = colours;}
00172 
00173 
00193         void    setColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00194 
00195 
00208         void    setPosition(const Point& position)                              {d_area.setPosition(position);}
00209 
00210 
00218         void    setSize(const Size& size)               {d_area.setSize(size);}
00219 
00220 
00231         void    setRect(const Rect& area)               {d_area = area;}
00232 
00233 
00246         void    setColourRectPerImage(bool setting)             {d_useColoursPerImage = setting;}
00247 
00248 
00249         /*************************************************************************
00250                 Construction / Destruction
00251         *************************************************************************/
00256         RenderableElement(void);
00257 
00258 
00259 
00264         virtual ~RenderableElement(void);
00265 
00266 
00267 protected:
00268         /*************************************************************************
00269                 Implementation methods
00270         *************************************************************************/
00284         virtual void    draw_impl(const Vector3& position, const Rect& clip_rect) const = 0;
00285 
00296     virtual void draw_impl(RenderCache& renderCache) const = 0;
00297 
00298 
00299         /*************************************************************************
00300                 Implementation Data
00301         *************************************************************************/
00302         RenderableElement*      d_next;         
00303         ColourRect      d_colours;                      
00304         Rect            d_area;                         
00305         bool            d_useColoursPerImage;   
00306 };
00307 
00308 } // End of  CEGUI namespace section
00309 
00310 
00311 #endif  // end of guard _CEGUIRenderableElement_h_

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