1 | /************************************************************************
|
---|
2 | filename: CEGUIFalSectionSpecification.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 _CEGUIFalSectionSpecification_h_
|
---|
25 | #define _CEGUIFalSectionSpecification_h_
|
---|
26 |
|
---|
27 | #include "CEGUIWindow.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | // Start of CEGUI namespace section
|
---|
31 | namespace CEGUI
|
---|
32 | {
|
---|
33 | // forward refs
|
---|
34 | class WidgetLookFeel;
|
---|
35 |
|
---|
36 | /*!
|
---|
37 | \brief
|
---|
38 | Class that represents a simple 'link' to an ImagerySection.
|
---|
39 |
|
---|
40 | This class enables sections to be easily re-used, by different states and/or layers, by allowing
|
---|
41 | sections to be specified by name rather than having mutiple copies of the same thing all over the place.
|
---|
42 | */
|
---|
43 | class CEGUIEXPORT SectionSpecification
|
---|
44 | {
|
---|
45 | public:
|
---|
46 | /*!
|
---|
47 | \brief
|
---|
48 | Constructor
|
---|
49 |
|
---|
50 | \param owner
|
---|
51 | String holding the name of the WidgetLookFeel object that contains the target section.
|
---|
52 |
|
---|
53 | \param sectionName
|
---|
54 | String holding the name of the target section.
|
---|
55 | */
|
---|
56 | SectionSpecification(const String& owner, const String& sectionName);
|
---|
57 |
|
---|
58 | /*!
|
---|
59 | \brief
|
---|
60 | Constructor
|
---|
61 |
|
---|
62 | \param owner
|
---|
63 | String holding the name of the WidgetLookFeel object that contains the target section.
|
---|
64 |
|
---|
65 | \param sectionName
|
---|
66 | String holding the name of the target section.
|
---|
67 |
|
---|
68 | \param cols
|
---|
69 | Override colours to be used (modulates sections master colours).
|
---|
70 | */
|
---|
71 | SectionSpecification(const String& owner, const String& sectionName, const ColourRect& cols);
|
---|
72 |
|
---|
73 | /*!
|
---|
74 | \brief
|
---|
75 | Render the section specified by this SectionSpecification.
|
---|
76 |
|
---|
77 | \param srcWindow
|
---|
78 | Window object to be used when calculating pixel values from BaseDim values.
|
---|
79 |
|
---|
80 | \param base_z
|
---|
81 | base z co-ordinate to use for all imagery in the linked section.
|
---|
82 |
|
---|
83 | \return
|
---|
84 | Nothing.
|
---|
85 | */
|
---|
86 | void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
|
---|
87 |
|
---|
88 | /*!
|
---|
89 | \brief
|
---|
90 | Render the section specified by this SectionSpecification.
|
---|
91 |
|
---|
92 | \param srcWindow
|
---|
93 | Window object to be used when calculating pixel values from BaseDim values.
|
---|
94 |
|
---|
95 | \param baseRect
|
---|
96 | Rect object to be used when calculating pixel values from BaseDim values.
|
---|
97 |
|
---|
98 | \param base_z
|
---|
99 | base z co-ordinate to use for all imagery in the linked section.
|
---|
100 |
|
---|
101 | \return
|
---|
102 | Nothing.
|
---|
103 | */
|
---|
104 | void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
|
---|
105 |
|
---|
106 | /*!
|
---|
107 | \brief
|
---|
108 | Return the name of the WidgetLookFeel object containing the target section.
|
---|
109 |
|
---|
110 | \return
|
---|
111 | String object holding the name of the WidgetLookFeel that contains the target ImagerySection.
|
---|
112 | */
|
---|
113 | const String& getOwnerWidgetLookFeel() const;
|
---|
114 |
|
---|
115 | /*!
|
---|
116 | \brief
|
---|
117 | Return the name of the target ImagerySection.
|
---|
118 |
|
---|
119 | \return
|
---|
120 | String object holding the name of the target ImagerySection.
|
---|
121 | */
|
---|
122 | const String& getSectionName() const;
|
---|
123 |
|
---|
124 | /*!
|
---|
125 | \brief
|
---|
126 | Return the current override colours.
|
---|
127 |
|
---|
128 | \return
|
---|
129 | ColourRect holding the colours that will be modulated with the sections master colours if
|
---|
130 | colour override is enabled on this SectionSpecification.
|
---|
131 | */
|
---|
132 | const ColourRect& getOverrideColours() const;
|
---|
133 |
|
---|
134 | /*!
|
---|
135 | \brief
|
---|
136 | Set the override colours to be used by this SectionSpecification.
|
---|
137 |
|
---|
138 | \param cols
|
---|
139 | ColourRect describing the override colours to set for this SectionSpecification.
|
---|
140 |
|
---|
141 | \return
|
---|
142 | Nothing.
|
---|
143 | */
|
---|
144 | void setOverrideColours(const ColourRect& cols);
|
---|
145 |
|
---|
146 | /*!
|
---|
147 | \brief
|
---|
148 | return whether the use of override colours is enabled on this SectionSpecification.
|
---|
149 |
|
---|
150 | \return
|
---|
151 | - true if override colours will be used for this SectionSpecification.
|
---|
152 | - false if override colours will not be used for this SectionSpecification.
|
---|
153 | */
|
---|
154 | bool isUsingOverrideColours() const;
|
---|
155 |
|
---|
156 | /*!
|
---|
157 | \brief
|
---|
158 | Enable or disable the use of override colours for this section.
|
---|
159 |
|
---|
160 | \param setting
|
---|
161 | - true if override colours should be used for this SectionSpecification.
|
---|
162 | - false if override colours should not be used for this SectionSpecification.
|
---|
163 |
|
---|
164 | \return
|
---|
165 | Nothing.
|
---|
166 | */
|
---|
167 | void setUsingOverrideColours(bool setting = true);
|
---|
168 |
|
---|
169 | /*!
|
---|
170 | \brief
|
---|
171 | Set the name of the property where override colour values can be obtained.
|
---|
172 |
|
---|
173 | \param property
|
---|
174 | String containing the name of the property.
|
---|
175 |
|
---|
176 | \return
|
---|
177 | Nothing.
|
---|
178 | */
|
---|
179 | void setOverrideColoursPropertySource(const String& property);
|
---|
180 |
|
---|
181 | /*!
|
---|
182 | \brief
|
---|
183 | Set whether the override colours property source represents a full ColourRect.
|
---|
184 |
|
---|
185 | \param setting
|
---|
186 | - true if the override colours property will access a ColourRect object.
|
---|
187 | - false if the override colours property will access a colour object.
|
---|
188 |
|
---|
189 | \return
|
---|
190 | Nothing.
|
---|
191 | */
|
---|
192 | void setOverrideColoursPropertyIsColourRect(bool setting = true);
|
---|
193 |
|
---|
194 | /*!
|
---|
195 | \brief
|
---|
196 | Writes an xml representation of this SectionSpecification to \a out_stream.
|
---|
197 |
|
---|
198 | \param out_stream
|
---|
199 | Stream where xml data should be output.
|
---|
200 |
|
---|
201 | \return
|
---|
202 | Nothing.
|
---|
203 | */
|
---|
204 | void writeXMLToStream(OutStream& out_stream) const;
|
---|
205 |
|
---|
206 | protected:
|
---|
207 | /*!
|
---|
208 | \brief
|
---|
209 | Helper method to initialise a ColourRect with appropriate values according to the way the
|
---|
210 | section sepcification is set up.
|
---|
211 |
|
---|
212 | This will try and get values from multiple places:
|
---|
213 | - a property attached to \a wnd
|
---|
214 | - the integral d_coloursOverride values.
|
---|
215 | - or default to colour(1,1,1,1);
|
---|
216 | */
|
---|
217 | void initColourRectForOverride(const Window& wnd, ColourRect& cr) const;
|
---|
218 |
|
---|
219 | private:
|
---|
220 | String d_owner; //!< Name of the WidgetLookFeel containing the required section.
|
---|
221 | String d_sectionName; //!< Name of the required section within the specified WidgetLookFeel.
|
---|
222 | ColourRect d_coloursOverride; //!< Colours to use when override is enabled.
|
---|
223 | bool d_usingColourOverride; //!< true if colour override is enabled.
|
---|
224 | String d_colourPropertyName; //!< name of property to fetch colours from.
|
---|
225 | bool d_colourProperyIsRect; //!< true if the colour property will fetch a full ColourRect.
|
---|
226 | };
|
---|
227 |
|
---|
228 |
|
---|
229 | } // End of CEGUI namespace section
|
---|
230 |
|
---|
231 |
|
---|
232 | #endif // end of guard _CEGUIFalSectionSpecification_h_
|
---|