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

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

adding ogre 1.2 and dependencies

Line 
1/************************************************************************
2    filename:   CEGUIFalComponentBase.h
3    created:    Mon Jul 18 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 _CEGUIFalComponentBase_h_
25#define _CEGUIFalComponentBase_h_
26
27#include "falagard/CEGUIFalDimensions.h"
28#include "CEGUIWindow.h"
29
30// Start of CEGUI namespace section
31namespace CEGUI
32{
33    /*!
34    \brief
35        Common base class used for renderable components within an ImagerySection.
36    */
37    class CEGUIEXPORT FalagardComponentBase
38    {
39    public:
40        /*!
41        \brief
42            Constructor
43        */
44        FalagardComponentBase();
45
46        /*!
47        \brief
48            Destructor
49        */
50        virtual ~FalagardComponentBase();
51
52        /*!
53        \brief
54            Render this component.  More correctly, the component is cached for rendering.
55
56        \param srcWindow
57            Window to use as the base for translating the component's ComponentArea into pixel values.
58
59        \param base_z
60            The z value to use for rendering the component.  Note that this is not the final z value to use, but
61            some z offset from a currently unknown starting value.
62
63        \param modColours
64            ColourRect describing colours that are to be modulated with the component's stored colour values
65            to calculate a set of 'final' colour values to be used.  May be 0.
66
67        \return
68            Nothing.
69        */
70        void render(Window& srcWindow, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
71
72        /*!
73        \brief
74            Render this component.  More correctly, the component is cached for rendering.
75
76        \param srcWindow
77            Window to use as the base for translating the component's ComponentArea into pixel values.
78
79        \param baseRect
80            Rect to use as the base for translating the component's ComponentArea into pixel values.
81
82        \param base_z
83            The z value to use for rendering the component.  Note that this is not the final z value to use, but
84            some z offset from a currently unknown starting value.
85
86        \param modColours
87            ColourRect describing colours that are to be modulated with the component's stored colour values
88            to calculate a set of 'final' colour values to be used.  May be 0.
89
90        \return
91            Nothing.
92        */
93        void render(Window& srcWindow, const Rect& baseRect, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
94
95        /*!
96        \brief
97            Return the ComponentArea of this ImageryComponent.
98
99        \return
100            ComponentArea object describing the ImageryComponent's current target area.
101        */
102        const ComponentArea& getComponentArea() const;
103
104        /*!
105        \brief
106            Set the ImageryComponent's ComponentArea.
107
108        \param area
109            ComponentArea object describing a new target area for the ImageryComponent.
110
111        \return
112            Nothing.
113        */
114        void setComponentArea(const ComponentArea& area);
115
116        /*!
117        \brief
118            Return the ColourRect set for use by this ImageryComponent.
119
120        \return
121            ColourRect object holding the colours currently in use by this ImageryComponent.
122        */
123        const ColourRect& getColours() const;
124
125        /*!
126        \brief
127            Set the colours to be used by this ImageryComponent.
128
129        \param cols
130            ColourRect object describing the colours to be used by this ImageryComponent.
131        */
132        void setColours(const ColourRect& cols);
133
134        /*!
135        \brief
136            Set the name of the property where colour values can be obtained.
137
138        \param property
139            String containing the name of the property.
140
141        \return
142            Nothing.
143        */
144        void setColoursPropertySource(const String& property);
145
146        /*!
147        \brief
148            Set whether the colours property source represents a full ColourRect.
149
150        \param setting
151            - true if the colours property will access a ColourRect object.
152            - false if the colours property will access a colour object.
153
154        \return
155            Nothing.
156        */
157        void setColoursPropertyIsColourRect(bool setting = true);
158
159        /*!
160        \brief
161            Set the name of the property where vertical formatting option can be obtained.
162
163        \param property
164            String containing the name of the property.
165
166        \return
167            Nothing.
168        */
169        void setVertFormattingPropertySource(const String& property);
170
171        /*!
172        \brief
173            Set the name of the property where horizontal formatting option can be obtained.
174
175        \param property
176            String containing the name of the property.
177
178        \return
179            Nothing.
180        */
181        void setHorzFormattingPropertySource(const String& property);
182
183    protected:
184        /*!
185        \brief
186            Helper method to initialise a ColourRect with appropriate values according to the way the
187            ImageryComponent is set up.
188
189            This will try and get values from multiple places:
190                - a property attached to \a wnd
191                - or the integral d_colours value.
192        */
193        void initColoursRect(const Window& wnd, const ColourRect* modCols, ColourRect& cr) const;
194
195        /*!
196        \brief
197            Method to do main render caching work.
198        */
199        virtual void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const = 0;
200
201        /*!
202        \brief
203            Writes xml for the colours to a OutStream.  Will prefer property colours before explicit.
204
205        \note
206            This is intended as a helper method for sub-classes when outputting xml to a stream.
207
208        \return
209            - true if xml element was written.
210            - false if nothing was output due to the formatting not being set (sub-class may then choose to do something else.)
211        */
212        bool writeColoursXML(OutStream& out_stream) const;
213
214        /*!
215        \brief
216            Writes xml for the vertical formatting to a OutStream if such a property is defined.
217
218        \note
219            This is intended as a helper method for sub-classes when outputting xml to a stream.
220
221        \return
222            - true if xml element was written.
223            - false if nothing was output due to the formatting not being set (sub-class may then choose to do something else.)
224        */
225        bool writeVertFormatXML(OutStream& out_stream) const;
226
227        /*!
228        \brief
229            Writes xml for the horizontal formatting to a OutStream if such a property is defined.
230
231        \note
232            This is intended as a helper method for sub-classes when outputting xml to a stream.
233
234        \return
235            - true if xml element was written.
236            - false if nothing was output due to the formatting not being set (sub-class may then choose to do something else.)
237        */
238        bool writeHorzFormatXML(OutStream& out_stream) const;
239
240
241        // data fields
242        ComponentArea   d_area;                 //!< Destination area for this component.
243        ColourRect      d_colours;              //!< base colours to be applied when rendering the image component.
244        String          d_colourPropertyName;   //!< name of property to fetch colours from.
245        bool            d_colourProperyIsRect;  //!< true if the colour property will fetch a full ColourRect.
246        String          d_vertFormatPropertyName;   //!< name of property to fetch vertical formatting setting from.
247        String          d_horzFormatPropertyName;   //!< name of property to fetch horizontal formatting setting from.
248    };
249} // End of  CEGUI namespace section
250
251
252#endif  // end of guard _CEGUIFalComponentBase_h_
Note: See TracBrowser for help on using the repository browser.