source: OGRE/trunk/ogrenew/Dependencies/include/CEGUI/CEGUIRenderableFrame.h @ 657

Revision 657, 7.0 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/************************************************************************
2        filename:       CEGUIRenderableFrame.h
3        created:        14/4/2004
4        author:         Paul D Turner
5       
6        purpose:        Interface to RenderableFrame UI construct
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 _CEGUIRenderableFrame_h_
27#define _CEGUIRenderableFrame_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        Enumeration of positions for a frame.
39*/
40enum FrameLocation
41{
42        Invalid,                        // Value reserved to indicate some invalid or unknown location.
43        TopLeftCorner,          // Top-Left corner of a frame / rectangle.
44        TopRightCorner,         // Top-Right corner of a frame / rectangle.
45        BottomLeftCorner,       // Bottom-Left corner of a frame / rectangle.
46        BottomRightCorner,      // Bottom-Right corner of a frame / rectangle.
47        LeftEdge,                       // Left edge of a frame / rectangle.   
48        TopEdge,                        // Top edge of a frame / rectangle.
49        RightEdge,                      // Right edge of a frame / rectangle.
50        BottomEdge                      // Bottom edge of a frame / rectangle.
51};
52
53
54/*!
55\brief
56        A higher order GUI entity that represents a renderable frame.
57
58        This class is intended to be used where a (usually top-level) GUI element needs to draw a frame that is constructed from
59        a collection of Images.  It is possible to specify the image to use for each of the four corners, which are placed appropriately
60        at their natural size, and the images for the four edges, which are stretched to cover the area between any corner images.  Any
61        of the Images may be omitted, in which case that part of the frame is not drawn.  If the GUI element uses only one image for its
62        frame (usually stretched over the entire area of the element) then a better choice would be to use a RenderableImage, or perform the
63        rendering directly instead.
64*/
65class CEGUIEXPORT RenderableFrame : public RenderableElement
66{
67public:
68        /*************************************************************************
69                Construction / Destruction
70        *************************************************************************/
71        /*!
72        \brief
73                Default constructor for RenderableFrame
74        */
75        RenderableFrame(void);
76
77
78        /*!
79        \brief
80                Destructor for RenderableFrame
81        */
82        virtual ~RenderableFrame(void);
83
84
85        /*!
86        \brief
87                specify the Image objects to use for each part of the frame.  A NULL may be used to omit any part.
88
89        \param topleft
90                Pointer to an Image object to render as the top-left corner of the frame.  Specify NULL to omit this part of the frame.
91
92        \param topright
93                Pointer to an Image object to render as the top-right corner of the frame.  Specify NULL to omit this part of the frame.
94
95        \param bottomleft
96                Pointer to an Image object to render as the bottom-left corner of the frame.  Specify NULL to omit this part of the frame.
97
98        \param bottomright
99                Pointer to an Image object to render as the bottom-right corner of the frame.  Specify NULL to omit this part of the frame.
100
101        \param left
102                Pointer to an Image object to render as the left edge of the frame.  Specify NULL to omit this part of the frame.
103
104        \param top
105                Pointer to an Image object to render as the top edge of the frame.  Specify NULL to omit this part of the frame.
106
107        \param right
108                Pointer to an Image object to render as the right edge of the frame.  Specify NULL to omit this part of the frame.
109
110        \param bottom
111                Pointer to an Image object to render as the bottom edge of the frame.  Specify NULL to omit this part of the frame.
112
113        \return
114                Nothing
115        */
116        void    setImages(const Image* topleft, const Image* topright, const Image* bottomleft, const Image* bottomright, const Image* left, const Image* top, const Image* right, const Image* bottom);
117
118
119        /*!
120        \brief
121                Set the Image to use for the specified location of the frame.
122
123        \param location
124                One of the FrameLocation enumerated values specifying the image to be returned.
125
126        \param image
127                Pointer to the Image to use for the frame location specified in \a location.  May be NULL to indicate the
128                frame component is not required.
129
130        \return
131                Nothing.
132        */
133        void    setImageForLocation(FrameLocation location, const Image* image);
134
135
136
137        /*!
138        \brief
139                Return the Image being used for the specified location of the frame.
140
141        \param location
142                One of the FrameLocation enumerated values specifying the image to be returned.
143
144        \return
145                Pointer to the Image object currently set for the frame location specified in \a location.  May return NULL if no
146                Image is set for the requested position.
147        */
148        const Image*    getImageForLocation(FrameLocation location) const;
149
150
151protected:
152        /*************************************************************************
153                Implementation functions
154        *************************************************************************/
155        /*!
156        \brief
157                Renders the imagery for a RenderableFrame element.
158
159        \param position
160                Vector3 object describing the final rendering position for the object.
161
162        \param clip_rect
163                Rect object describing the clipping area for the rendering.  No rendering will be performed outside this area.
164
165        \return
166                Nothing.
167        */
168        void draw_impl(const Vector3& position, const Rect& clip_rect) const;
169
170
171        /*************************************************************************
172                Implementation Data
173        *************************************************************************/
174        // image pointers
175        const Image*    d_topleft;                      //!< Image to draw for the top-left corner.
176        const Image*    d_topright;                     //!< Image to draw for the top-right corner.
177        const Image*    d_bottomleft;           //!< Image to draw for the bottom-left corner.
178        const Image*    d_bottomright;          //!< Image to draw for the bottom-right corner.
179        const Image*    d_left;                         //!< Image to draw for the left edge.
180        const Image*    d_right;                        //!< Image to draw for the right edge.
181        const Image*    d_top;                          //!< Image to draw for the top edge.
182        const Image*    d_bottom;                       //!< Image to draw for the bottom edge.
183};
184
185} // End of  CEGUI namespace section
186
187
188#endif  // end of guard _CEGUIRenderableFrame_h_
Note: See TracBrowser for help on using the repository browser.