source: OGRE/trunk/ogre_dependencies/Dependencies/include/CEGUI/falagard/CEGUIFalImagerySection.h @ 692

Revision 692, 8.8 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1/************************************************************************
2    filename:   CEGUIFalImagerySection.h
3    created:    Mon Jun 13 2005
4    author:     Paul D Turner <paul@cegui.org.uk>
5*************************************************************************/
6/*************************************************************************
7    Crazy Eddie's GUI System (http://www.cegui.org.uk)
8    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
9 
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Lesser General Public
12    License as published by the Free Software Foundation; either
13    version 2.1 of the License, or (at your option) any later version.
14 
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Lesser General Public License for more details.
19 
20    You should have received a copy of the GNU Lesser General Public
21    License along with this library; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23*************************************************************************/
24#ifndef _CEGUIFalImagerySection_h_
25#define _CEGUIFalImagerySection_h_
26
27#include "falagard/CEGUIFalImageryComponent.h"
28#include "falagard/CEGUIFalTextComponent.h"
29#include "falagard/CEGUIFalFrameComponent.h"
30
31#if defined(_MSC_VER)
32#       pragma warning(push)
33#       pragma warning(disable : 4251)
34#endif
35
36// Start of CEGUI namespace section
37namespace CEGUI
38{
39    /*!
40    \brief
41        Class that encapsulates a re-usable collection of imagery specifications.
42    */
43    class CEGUIEXPORT ImagerySection
44    {
45    public:
46        /*!
47        \brief
48            Constructor.
49        */
50        ImagerySection();
51
52        /*!
53        \brief
54            ImagerySection constructor.  Name must be supplied, masterColours are set to 0xFFFFFFFF by default.
55
56        \param name
57            Name of the new ImagerySection.
58        */
59        ImagerySection(const String& name);
60
61        /*!
62        \brief
63            Render the ImagerySection.
64
65        \param srcWindow
66            Window object to be used when calculating pixel values from BaseDim values.
67
68        \param base_z
69            base z value to be used for all imagery in the section.
70
71        \param modColours
72            ColourRect specifying colours to be modulated with the ImagerySection's master colours.  May be 0.
73
74        \return
75            Nothing.
76        */
77        void render(Window& srcWindow, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
78
79        /*!
80        \brief
81            Render the ImagerySection.
82
83        \param srcWindow
84            Window object to be used when calculating pixel values from BaseDim values.
85
86        \param baseRect
87            Rect object to be used when calculating pixel values from BaseDim values.
88
89        \param base_z
90            base z value to be used for all imagery in the section.
91
92        \param modColours
93            ColourRect specifying colours to be modulated with the ImagerySection's master colours.  May be 0.
94
95        \return
96            Nothing.
97        */
98        void render(Window& srcWindow, const Rect& baseRect, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
99
100        /*!
101        \brief
102            Add an ImageryComponent to this ImagerySection.
103
104        \param img
105            ImageryComponent to be added to the section (a copy is made)
106
107        \return
108            Nothing
109        */
110        void addImageryComponent(const ImageryComponent& img);
111
112        /*!
113        \brief
114            Clear all ImageryComponents from this ImagerySection.
115
116        \return
117            Nothing
118        */
119        void clearImageryComponents();
120
121        /*!
122        \brief
123            Add a TextComponent to this ImagerySection.
124
125        \param text
126            TextComponent to be added to the section (a copy is made)
127
128        \return
129            Nothing
130        */
131        void addTextComponent(const TextComponent& text);
132
133        /*!
134        \brief
135            Clear all TextComponents from this ImagerySection.
136
137        \return
138            Nothing
139        */
140        void clearTextComponents();
141
142        /*!
143        \brief
144            Clear all FrameComponents from this ImagerySection.
145
146        \return
147            Nothing
148        */
149        void clearFrameComponents();
150
151        /*!
152        \brief
153            Add a FrameComponent to this ImagerySection.
154
155        \param frame
156            FrameComponent to be added to the section (a copy is made)
157
158        \return
159            Nothing
160        */
161        void addFrameComponent(const FrameComponent& frame);
162
163        /*!
164        \brief
165            Return the current master colours set for this ImagerySection.
166
167        \return
168            ColourRect describing the master colour values in use for this ImagerySection.
169        */
170        const ColourRect& getMasterColours() const;
171
172        /*!
173        \brief
174            Set the master colours to be used for this ImagerySection.
175
176        \param cols
177            ColourRect describing the colours to be set as the master colours for this ImagerySection.
178
179        \return
180            Nothing.
181        */
182        void setMasterColours(const ColourRect& cols);
183
184        /*!
185        \brief
186            Return the name of this ImagerySection.
187
188        \return
189            String object holding the name of the ImagerySection.
190        */
191        const String& getName() const;
192
193        /*!
194        \brief
195            Set the name of the property where master colour values can be obtained.
196
197        \param property
198            String containing the name of the property.
199
200        \return
201            Nothing.
202        */
203        void setMasterColoursPropertySource(const String& property);
204
205        /*!
206        \brief
207            Set whether the master colours property source represents a full ColourRect.
208
209        \param setting
210            - true if the master colours property will access a ColourRect object.
211            - false if the master colours property will access a colour object.
212
213        \return
214            Nothing.
215        */
216        void setMasterColoursPropertyIsColourRect(bool setting = true);
217
218        /*!
219        \brief
220            Return smallest Rect that could contain all imagery within this section.
221        */
222        Rect getBoundingRect(const Window& wnd) const;
223
224        /*!
225        \brief
226            Return smallest Rect that could contain all imagery within this section.
227        */
228        Rect getBoundingRect(const Window& wnd, const Rect& rect) const;
229
230        /*!
231        \brief
232            Writes an xml representation of this ImagerySection to \a out_stream.
233
234        \param out_stream
235            Stream where xml data should be output.
236
237        \return
238            Nothing.
239        */
240        void writeXMLToStream(OutStream& out_stream) const;
241
242    protected:
243        /*!
244        \brief
245            Helper method to initialise a ColourRect with appropriate values according to the way the
246            ImagerySection is set up.
247
248            This will try and get values from multiple places:
249                - a property attached to \a wnd
250                - or the integral d_masterColours value.
251        */
252        void initMasterColourRect(const Window& wnd, ColourRect& cr) const;
253
254    private:
255        typedef std::vector<ImageryComponent> ImageryList;
256        typedef std::vector<TextComponent> TextList;
257        typedef std::vector<FrameComponent> FrameList;
258
259        CEGUI::String       d_name;             //!< Holds the name of the ImagerySection.
260        CEGUI::ColourRect   d_masterColours;    //!< Naster colours for the the ImagerySection (combined with colours of each ImageryComponent).
261        FrameList           d_frames;           //!< Collection of FrameComponent objects to be drawn for this ImagerySection.
262        ImageryList         d_images;           //!< Collection of ImageryComponent objects to be drawn for this ImagerySection.
263        TextList            d_texts;            //!< Collection of TextComponent objects to be drawn for this ImagerySection.
264        String              d_colourPropertyName;   //!< name of property to fetch colours from.
265        bool                d_colourProperyIsRect;  //!< true if the colour property will fetch a full ColourRect.
266    };
267
268} // End of  CEGUI namespace section
269
270
271#if defined(_MSC_VER)
272#       pragma warning(pop)
273#endif
274
275#endif  // end of guard _CEGUIFalImagerySection_h_
Note: See TracBrowser for help on using the repository browser.