# CEGUIRenderableImage.h

    00001 /************************************************************************
    00002         filename:       CEGUIRenderableImage.h
    00003         created:        17/4/2004
    00004         author:         Paul D Turner
    00005
    00006         purpose:        Interface to renderable image UI entity
    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 _CEGUIRenderableImage_h_
    00027 #define _CEGUIRenderableImage_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIRenderableElement.h"
    00031
    00032
    00033 // Start of CEGUI namespace section
    00034 namespace CEGUI
    00035 {
    00044 class CEGUIEXPORT RenderableImage : public RenderableElement
    00045 {
    00046 public:
    00047         /*************************************************************************
    00048                 Formatting Enumerations
    00049         *************************************************************************/
    00054         enum HorzFormatting
    00055         {
    00056                 LeftAligned,
    00057                 RightAligned,
    00058                 HorzCentred,
    00059                 HorzStretched,
    00060                 HorzTiled
    00061         };
    00062
    00063
    00068         enum VertFormatting
    00069         {
    00070                 TopAligned,
    00071                 BottomAligned,
    00072                 VertCentred,
    00073                 VertStretched,
    00074                 VertTiled
    00075         };
    00076
    00077
    00078         /*************************************************************************
    00079                 Construction / Destruction
    00080         *************************************************************************/
    00085         RenderableImage(void);
    00086
    00087
    00092         virtual ~RenderableImage(void);
    00093
    00094
    00095         /*************************************************************************
    00096                 Public Interface
    00097         *************************************************************************/
    00108         void    setImage(const Image* image)            {d_image = image;}
    00109
    00110
    00121         void    setHorzFormatting(HorzFormatting formatting)                    {d_horzFormat = formatting;}
    00122
    00123
    00134         void    setVertFormatting(VertFormatting formatting)                    {d_vertFormat = formatting;}
    00135
    00136
    00147         void    setQuadSplitMode(QuadSplitMode split_mode)                              {d_quadSplitMode = split_mode;}
    00148
    00149
    00157         const Image*    getImage(void) const            {return d_image;}
    00158
    00159
    00167         HorzFormatting  getHorzFormatting(void) const                           {return d_horzFormat;}
    00168
    00169
    00177         VertFormatting  getVertFormatting(void) const                           {return d_vertFormat;}
    00178
    00179
    00187         QuadSplitMode   getQuadSplitMode(void) const                            {return d_quadSplitMode;}
    00188
    00189
    00190 protected:
    00191         /*************************************************************************
    00192                 Implementation functions
    00193         *************************************************************************/
    00207         void draw_impl(const Vector3& position, const Rect& clip_rect) const;
    00208
    00209     // implements abstract method
    00210     void draw_impl(RenderCache& renderCache) const;
    00211
    00216     uint getHorzTileCount() const;
    00217
    00222     uint getVertTileCount() const;
    00223
    00228     float getBaseXCoord(const Size& sz) const;
    00229
    00234     float getBaseYCoord(const Size& sz) const;
    00235
    00240     Size getDestinationSize() const;
    00241
    00242         /*************************************************************************
    00243                 Implementation Data
    00244         *************************************************************************/
    00245         HorzFormatting  d_horzFormat;
    00246         VertFormatting  d_vertFormat;
    00247         QuadSplitMode   d_quadSplitMode;
    00248         const Image*    d_image;
    00249 };
    00250
    00251 } // End of  CEGUI namespace section
    00252
    00253
    00254 #endif  // end of guard _CEGUIRenderableImage_h_