source: GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableImage.h @ 1030

Revision 1030, 7.4 KB checked in by gumbau, 18 years ago (diff)

Ogre Stuff initial import

Line 
1/************************************************************************
2        filename:       CEGUIRenderableImage.h
3        created:        17/4/2004
4        author:         Paul D Turner
5       
6        purpose:        Interface to renderable image UI entity
7*************************************************************************/
8/*************************************************************************
9    Crazy Eddie's GUI System (http://www.cegui.org.uk)
10    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
11
12    This library is free software; you can redistribute it and/or
13    modify it under the terms of the GNU Lesser General Public
14    License as published by the Free Software Foundation; either
15    version 2.1 of the License, or (at your option) any later version.
16
17    This library is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20    Lesser General Public License for more details.
21
22    You should have received a copy of the GNU Lesser General Public
23    License along with this library; if not, write to the Free Software
24    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25*************************************************************************/
26#ifndef _CEGUIRenderableImage_h_
27#define _CEGUIRenderableImage_h_
28
29#include "CEGUIBase.h"
30#include "CEGUIRenderableElement.h"
31
32
33// Start of CEGUI namespace section
34namespace CEGUI
35{
36/*!
37\brief
38        A higher order GUI entity that represents a renderable image with formatting options.
39
40        This class is intended to be used where a (usually top-level) GUI element needs to draw an image that requires some additional
41        formatting.  It is possible to specify the Image that is to be rendered, as well as the horizontal and vertical formatting
42        required.
43*/
44class CEGUIEXPORT RenderableImage : public RenderableElement
45{
46public:
47        /*************************************************************************
48                Formatting Enumerations
49        *************************************************************************/
50        /*!
51        \brief
52                Enumeration of horizontal formatting options for a RenderableImage
53        */
54        enum HorzFormatting
55        {
56                LeftAligned,    //!< Image will be rendered at it's natural size and with it's left edge aligned with the left edge of the RenderableImage rect.
57                RightAligned,   //!< Image will be rendered at it's natural size and with it's right edge aligned with the right edge of the RenderableImage rect.
58                HorzCentred,    //!< Image will be rendered at it's natural size and horizontally centred within the RenderableImage rect.
59                HorzStretched,  //!< Image will be horizontally stretched to cover the entire width of the RenderableImage rect.
60                HorzTiled               //!< Image will be tiled horizontally across the width of the RenderableImage rect.  The rightmost tile will be clipped to remain within the rect.
61        };
62
63
64        /*!
65        \brief
66                Enumeration of vertical formatting options for a RenderableImage
67        */
68        enum VertFormatting
69        {
70                TopAligned,             //!< Image will be rendered at it's natural size and with it's top edge aligned with the top edge of the RenderableImage rect.
71                BottomAligned,  //!< Image will be rendered at it's natural size and with it's bottom edge aligned with the bottom edge of the RenderableImage rect.
72                VertCentred,    //!< Image will be rendered at it's natural size and vertically centred within the RenderableImage rect.
73                VertStretched,  //!< Image will be vertically stretched to cover the entire height of the RenderableImage rect.
74                VertTiled               //!< Image will be tiled vertically down the height of the RenderableImage rect.  The bottommost tile will be clipped to remain within the rect.
75        };
76
77
78        /*************************************************************************
79                Construction / Destruction
80        *************************************************************************/
81        /*!
82        \brief
83                Default constructor for RenderableImage objects.
84        */
85        RenderableImage(void);
86
87
88        /*!
89        \brief
90                Destructor for RenderableImage objects
91        */
92        virtual ~RenderableImage(void);
93
94
95        /*************************************************************************
96                Public Interface
97        *************************************************************************/
98        /*!
99        \brief
100                Set the Image object to be drawn by this RenderableImage.
101
102        \param image
103                Pointer to the Image object to be rendered.  Can be NULL to specify no image is to be rendered.
104       
105        \return
106                Nothing.
107        */
108        void    setImage(const Image* image)            {d_image = image;}
109
110
111        /*!
112        \brief
113                Set the required horizontal formatting
114
115        \param formatting
116                One of the HorzFormatting values specifying the formatting required.
117
118        \return
119                Nothing
120        */
121        void    setHorzFormatting(HorzFormatting formatting)                    {d_horzFormat = formatting;}
122               
123
124        /*!
125        \brief
126                Set the required vertical formatting
127
128        \param formatting
129                One of the VertFormatting values specifying the formatting required.
130
131        \return
132                Nothing
133        */
134        void    setVertFormatting(VertFormatting formatting)                    {d_vertFormat = formatting;}
135       
136       
137        /*!
138        \brief
139                Set the required quad split mode
140
141        \param split_mode
142                One of the QuadSplitMode values specifying the way quads are split into triangles.
143
144        \return
145                Nothing
146        */
147        void    setQuadSplitMode(QuadSplitMode split_mode)                              {d_quadSplitMode = split_mode;}
148
149
150        /*!
151        \brief
152                Return the Image object currently set to be rendered.
153
154        \return
155                Pointer to the current Image object set for this RenderableImage.  May return NULL if no image is set.
156        */
157        const Image*    getImage(void) const            {return d_image;}
158
159
160        /*!
161        \brief
162                Return current horizontal formatting setting.
163
164        \return
165                One of the HorzFormatting values specifying the formatting set.
166        */
167        HorzFormatting  getHorzFormatting(void) const                           {return d_horzFormat;}
168
169
170        /*!
171        \brief
172                Return current vertical formatting setting.
173
174        \return
175                One of the VertFormatting values specifying the formatting set.
176        */
177        VertFormatting  getVertFormatting(void) const                           {return d_vertFormat;}
178       
179       
180        /*!
181        \brief
182                Return current quad split mode setting.
183
184        \return
185                One of the QuadSplitMode values specifying the way quads are split into triangles.
186        */
187        QuadSplitMode   getQuadSplitMode(void) const                            {return d_quadSplitMode;}
188
189
190protected:
191        /*************************************************************************
192                Implementation functions
193        *************************************************************************/
194        /*!
195        \brief
196                Renders the imagery for a RenderableImage element.
197
198        \param position
199                Vector3 object describing the final rendering position for the object.
200
201        \param clip_rect
202                Rect object describing the clipping area for the rendering.  No rendering will be performed outside this area.
203
204        \return
205                Nothing.
206        */
207        void draw_impl(const Vector3& position, const Rect& clip_rect) const;
208
209
210        /*************************************************************************
211                Implementation Data
212        *************************************************************************/
213        HorzFormatting  d_horzFormat;           //!< Currently set horizontal formatting option.
214        VertFormatting  d_vertFormat;           //!< Currently set vertical formatting option.
215        QuadSplitMode   d_quadSplitMode;        //!< Currently set quad split mode
216        const Image*    d_image;                        //!< Pointer to the actual Image to be displayed.
217};
218
219} // End of  CEGUI namespace section
220
221
222#endif  // end of guard _CEGUIRenderableImage_h_
Note: See TracBrowser for help on using the repository browser.