source: GTP/trunk/Lib/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookManager.h @ 1809

Revision 1809, 7.7 KB checked in by gumbau, 18 years ago (diff)
Line 
1/************************************************************************
2    filename:   CEGUIFalWidgetLookManager.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 _CEGUIFalWidgetLookManager_h_
25#define _CEGUIFalWidgetLookManager_h_
26
27#include "CEGUISingleton.h"
28#include "CEGUIString.h"
29#include "CEGUIExceptions.h"
30#include "falagard/CEGUIFalWidgetLookFeel.h"
31#include <map>
32
33#if defined(_MSC_VER)
34#       pragma warning(push)
35#       pragma warning(disable : 4251)
36#       pragma warning(disable : 4275)
37#endif
38
39// Start of CEGUI namespace section
40namespace CEGUI
41{
42    /*!
43    \brief
44        Manager class that gives top-level access to widget data based "look and feel" specifications loaded into the system.
45    */
46    class CEGUIEXPORT WidgetLookManager : public Singleton<WidgetLookManager>
47    {
48    public:
49        /*!
50        \brief
51            Constructor.
52        */
53        WidgetLookManager();
54
55        /*!
56        \brief
57            Destructor
58        */
59        ~WidgetLookManager();
60
61        /*!
62              \brief
63                        Return singleton WidgetLookManager object
64
65              \return
66                        Singleton WidgetLookManager object
67              */
68              static    WidgetLookManager&      getSingleton(void);
69
70
71              /*!
72              \brief
73                        Return pointer to singleton WindowFactoryManager object
74
75              \return
76                        Pointer to singleton WindowFactoryManager object
77              */
78              static    WidgetLookManager*      getSingletonPtr(void);
79
80
81        /*!
82        \brief
83            Parses a file containing window look & feel specifications (in the form of XML).
84
85        \note
86            If the new file contains specifications for widget types that are already specified, it is not an error;
87            the previous definitions are overwritten by the new data.  An entry will appear in the log each time any
88            look & feel component is overwritten.
89
90        \param filename
91            String object containing the filename of a file containing the widget look & feel data
92
93        \param resourceGroup
94            Resource group identifier to pass to the resource provider when loading the file.
95
96        \return
97            Nothing.
98
99        \exception      FileIOException                         thrown if there was some problem accessing or parsing the file \a filename
100        \exception      InvalidRequestException         thrown if an invalid filename was provided.
101        */
102        void parseLookNFeelSpecification(const String& filename, const String& resourceGroup = "");
103
104
105        /*!
106        \brief
107            Return whether a WidgetLookFeel has been created with the specified name.
108
109        \param widget
110            String object holding the name of a widget look to test for.
111
112        \return
113            - true if a WindowLookFeel named \a widget is available.
114            - false if so such WindowLookFeel is currently available.
115        */
116        bool isWidgetLookAvailable(const String& widget) const;
117
118
119        /*!
120        \brief
121            Return a const reference to a WidgetLookFeel object which has the specified name.
122
123        \param widget
124            String object holding the name of a widget look that is to be returned.
125
126        \return
127            const reference to the requested WidgetLookFeel object.
128
129        \exception UnknownObjectException   thrown if no WindowLookFeel is available with the requested name.
130        */
131        const WidgetLookFeel& getWidgetLook(const String& widget) const;
132
133
134        /*!
135        \brief
136            Erase the WidgetLookFeel that has the specified name.
137
138        \param widget
139            String object holding the name of a widget look to be erased.  If no such WindowLookFeel exists, nothing
140            happens.
141
142        \return
143            Nothing.
144        */
145        void eraseWidgetLook(const String& widget);
146
147
148        /*!
149        \brief
150            Add the given WidgetLookFeel.
151
152        \note
153            If the WidgetLookFeel specification uses a name that already exists within the system, it is not an error;
154            the previous definition is overwritten by the new data.  An entry will appear in the log each time any
155            look & feel component is overwritten.
156
157        \param look
158            WidgetLookFeel object to be added to the system.  NB: The WidgetLookFeel is copied, no change of ownership of the
159            input object occurrs.
160
161        \return
162            Nothing.
163        */
164        void addWidgetLook(const WidgetLookFeel& look);
165
166        /*!
167        \brief
168            Writes the xml header and opening 'Falagard' tags to a stream.
169        */
170        void writeFalagardXMLHeadToStream(OutStream& out_stream) const;
171
172        /*!
173        \brief
174            Writes closing xml 'Falagard' tag to a stream.
175
176        \param out_stream
177            OutStream where XML data should be sent.
178        */
179        void writeFalagardXMLTailToStream(OutStream& out_stream) const;
180
181        /*!
182        \brief
183            Writes a complete Widge Look to a stream.  Note that xml file header and
184            falagard opening/closing tags will also be written.
185
186        \param name
187            String holding the name of the widget look to be output to the stream.
188
189        \param out_stream
190            OutStream where XML data should be sent.
191        */
192        void writeWidgetLookToStream(const String& name, OutStream& out_stream) const;
193
194        /*!
195        \brief
196            Writes a series of complete Widge Look objects to a stream.  Note that xml file header and
197            falagard opening/closing tags will also be written.
198
199            The \a prefix specifies a name prefix common to all widget looks to be written, you could
200            specify this as "TaharezLook/" and then any defined widget look starting with that prefix, such
201            as "TaharezLook/Button" and "TaharezLook/Listbox" will be written to the stream.
202
203        \param prefix
204            String holding the widget look name prefix, which will be used when searching for the widget looks
205            to be output to the stream.
206
207        \param out_stream
208            OutStream where XML data should be sent.
209        */
210        void writeWidgetLookSeriesToStream(const String& prefix, OutStream& out_stream) const;
211
212
213    private:
214        static const String FalagardSchemaName;     //!< Name of schema file used for XML validation.
215
216        typedef std::map<String, WidgetLookFeel> WidgetLookList;
217        WidgetLookList  d_widgetLooks;
218    };
219
220} // End of  CEGUI namespace section
221
222
223#if defined(_MSC_VER)
224#       pragma warning(pop)
225#endif
226
227#endif  // end of guard _CEGUIFalWidgetLookManager_h_
Note: See TracBrowser for help on using the repository browser.