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

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

adding ogre 1.2 and dependencies

Line 
1/************************************************************************
2    filename:   CEGUIFalWidgetLookFeel.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 _CEGUIFalWidgetLookFeel_h_
25#define _CEGUIFalWidgetLookFeel_h_
26
27#include "falagard/CEGUIFalStateImagery.h"
28#include "falagard/CEGUIFalWidgetComponent.h"
29#include "falagard/CEGUIFalImagerySection.h"
30#include "falagard/CEGUIFalPropertyInitialiser.h"
31#include "falagard/CEGUIFalPropertyDefinition.h"
32#include "falagard/CEGUIFalNamedArea.h"
33#include <map>
34
35#if defined(_MSC_VER)
36#       pragma warning(push)
37#       pragma warning(disable : 4251)
38#endif
39
40
41// Start of CEGUI namespace section
42namespace CEGUI
43{
44    /*!
45    \brief
46        Class that encapsulates look & feel information for a particular widget type.
47    */
48    class CEGUIEXPORT WidgetLookFeel
49    {
50    public:
51        WidgetLookFeel(const String& name);
52        WidgetLookFeel() {}
53
54        /*!
55        \brief
56            Return a const reference to the StateImagery object for the specified state.
57
58        \return
59            StateImagery object for the requested state.
60        */
61        const StateImagery& getStateImagery(const CEGUI::String& state) const;
62
63        /*!
64        \brief
65            Return a const reference to the ImagerySection object with the specified name.
66
67        \return
68            ImagerySection object with the specified name.
69        */
70        const ImagerySection& getImagerySection(const CEGUI::String& section) const;
71
72        /*!
73        \brief
74            Return the name of the widget look.
75
76        \return
77            String object holding the name of the WidgetLookFeel.
78        */
79        const String& getName() const;
80
81        /*!
82        \brief
83            Add an ImagerySection to the WidgetLookFeel.
84
85        \param section
86            ImagerySection object to be added.
87
88        \return Nothing.
89        */
90        void addImagerySection(const ImagerySection& section);
91
92        /*!
93        \brief
94            Add a WidgetComponent to the WidgetLookFeel.
95
96        \param widget
97            WidgetComponent object to be added.
98
99        \return Nothing.
100        */
101        void addWidgetComponent(const WidgetComponent& widget);
102
103        /*!
104        \brief
105            Add a state specification (StateImagery object) to the WidgetLookFeel.
106
107        \param section
108            StateImagery object to be added.
109
110        \return Nothing.
111        */
112        void addStateSpecification(const StateImagery& state);
113
114        /*!
115        \brief
116            Add a property initialiser to the WidgetLookFeel.
117
118        \param initialiser
119            PropertyInitialiser object to be added.
120
121        \return Nothing.
122        */
123        void addPropertyInitialiser(const PropertyInitialiser& initialiser);
124
125        /*!
126        \brief
127            Clear all ImagerySections from the WidgetLookFeel.
128
129        \return
130            Nothing.
131        */
132        void clearImagerySections();
133
134        /*!
135        \brief
136            Clear all WidgetComponents from the WidgetLookFeel.
137
138        \return
139            Nothing.
140        */
141        void clearWidgetComponents();
142
143        /*!
144        \brief
145            Clear all StateImagery objects from the WidgetLookFeel.
146
147        \return
148            Nothing.
149        */
150        void clearStateSpecifications();
151
152        /*!
153        \brief
154            Clear all PropertyInitialiser objects from the WidgetLookFeel.
155
156        \return
157            Nothing.
158        */
159        void clearPropertyInitialisers();
160
161        /*!
162        \brief
163            Initialise the given window using PropertyInitialsers and component widgets
164            specified for this WidgetLookFeel.
165
166        \param widget
167            Window based object to be initialised.
168
169        \return
170            Nothing.
171        */
172        void initialiseWidget(Window& widget) const;
173
174        /*!
175        \brief
176            Return whether imagery is defined for the given state.
177
178        \param state
179            String object containing name of state to look for.
180
181        \return
182            - true if imagery exists for the specified state,
183            - false if no imagery exists for the specified state.
184        */
185        bool isStateImageryPresent(const String& state) const;
186
187        /*!
188        \brief
189            Adds a named area to the WidgetLookFeel.
190
191        \param area
192            NamedArea to be added.
193
194        \return
195            Nothing.
196        */
197        void addNamedArea(const NamedArea& area);
198
199        /*!
200        \brief
201            Clear all defined named areas from the WidgetLookFeel
202
203        \return
204            Nothing.
205        */
206        void clearNamedAreas();
207
208        /*!
209        \brief
210            Return the NamedArea with the specified name.
211
212        \param name
213            String object holding the name of the NamedArea to be returned.
214
215        \return
216            The requested NamedArea object.
217        */
218        const NamedArea& getNamedArea(const String& name) const;
219
220        /*!
221        \brief
222            return whether a NamedArea object with the specified name exists for this WidgetLookFeel.
223
224        \param name
225            String holding the name of the NamedArea to check for.
226
227        \return
228            - true if a named area with the requested name is defined for this WidgetLookFeel.
229            - false if no such named area is defined for this WidgetLookFeel.
230        */
231        bool isNamedAreaDefined(const String& name) const;
232
233        /*!
234        \brief
235            Layout the child widgets defined for this WidgetLookFeel which are attached to the given window.
236
237        \param owner
238            Window object that has the child widgets that require laying out.
239
240        \return
241            Nothing.
242        */
243        void layoutChildWidgets(const Window& owner) const;
244
245        /*!
246        \brief
247            Adds a property definition to the WidgetLookFeel.
248
249        \param propdef
250            PropertyDefinition to be added.
251
252        \return
253            Nothing.
254        */
255        void addPropertyDefinition(const PropertyDefinition& propdef);
256
257        /*!
258        \brief
259            Clear all defined property definitions from the WidgetLookFeel
260
261        \return
262            Nothing.
263        */
264        void clearPropertyDefinitions();
265
266        /*!
267        \brief
268            Writes an xml representation of this WidgetLookFeel to \a out_stream.
269
270        \param out_stream
271            Stream where xml data should be output.
272
273        \return
274            Nothing.
275        */
276        void writeXMLToStream(OutStream& out_stream) const;
277
278        /*!
279        \brief
280            Uses the WindowManager to rename the child windows that are
281            created for this WidgetLookFeel.
282
283        \param widget
284            The target Window containing the child windows that are to be
285            renamed.
286
287        \param newBaseName
288            String object holding the new base name that will be used when
289            constructing new names for the child windows.
290        */
291        void renameChildren(const Window& widget, const String& newBaseName) const;
292
293    private:
294        typedef std::map<String, StateImagery>    StateList;
295        typedef std::map<String, ImagerySection>  ImageryList;
296        typedef std::map<String, NamedArea>       NamedAreaList;
297        typedef std::vector<WidgetComponent>      WidgetList;
298        typedef std::vector<PropertyInitialiser>  PropertyList;
299        typedef std::vector<PropertyDefinition>   PropertyDefinitionList;
300
301        CEGUI::String   d_lookName;         //!< Name of this WidgetLookFeel.
302        ImageryList     d_imagerySections;  //!< Collection of ImagerySection objects.
303        WidgetList      d_childWidgets;     //!< Collection of WidgetComponent objects.
304        StateList       d_stateImagery;     //!< Collection of StateImagery objects.
305        PropertyList    d_properties;       //!< Collection of PropertyInitialser objects.
306        NamedAreaList   d_namedAreas;       //!< Collection of NamedArea objects.
307        mutable PropertyDefinitionList  d_propertyDefinitions;  //!< Collection of PropertyDefinition objects.
308    };
309
310
311} // End of  CEGUI namespace section
312
313
314#if defined(_MSC_VER)
315#       pragma warning(pop)
316#endif
317
318#endif  // end of guard _CEGUIFalWidgetLookFeel_h_
Note: See TracBrowser for help on using the repository browser.