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

Revision 1809, 5.6 KB checked in by gumbau, 18 years ago (diff)
Line 
1/************************************************************************
2        filename:       CEGUIScheme.h
3        created:        21/2/2004
4        author:         Paul D Turner
5       
6        purpose:        Defines abstract base class for the GUI Scheme object.
7*************************************************************************/
8/*************************************************************************
9    Crazy Eddie's GUI System (http://www.cegui.org.uk)
10    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
11
12    This library is free software; you can redistribute it and/or
13    modify it under the terms of the GNU Lesser General Public
14    License as published by the Free Software Foundation; either
15    version 2.1 of the License, or (at your option) any later version.
16
17    This library is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20    Lesser General Public License for more details.
21
22    You should have received a copy of the GNU Lesser General Public
23    License along with this library; if not, write to the Free Software
24    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25*************************************************************************/
26#ifndef _CEGUIScheme_h_
27#define _CEGUIScheme_h_
28
29#include "CEGUIBase.h"
30#include "CEGUIString.h"
31#include "CEGUISchemeManager.h"
32
33#include <vector>
34
35
36#if defined(_MSC_VER)
37#       pragma warning(push)
38#       pragma warning(disable : 4251)
39#endif
40
41
42// Start of CEGUI namespace section
43namespace CEGUI
44{
45/*!
46\brief
47        A class that groups a set of GUI elements and initialises the system to access those elements.
48
49        A GUI Scheme is a high-level construct that loads and initialises various lower-level objects
50        and registers them within the system for usage.  So, for example, a Scheme might create some
51        Imageset objects, some Font objects, and register a collection of WindowFactory objects within
52        the system which would then be in a state to serve those elements to client code.
53*/
54class CEGUIEXPORT Scheme
55{
56        friend class Scheme_xmlHandler;
57public:
58        /*!
59        \brief
60                Loads all resources for this scheme.
61
62        \return
63                Nothing.
64        */
65        void    loadResources(void);
66
67
68        /*!
69        \brief
70                Unloads all resources for this scheme.  This should be used very carefully.
71
72        \return
73                Nothing.
74        */
75        void    unloadResources(void);
76
77
78        /*!
79        \brief
80                Return whether the resources for this Scheme are all loaded.
81
82        \return
83                true if all resources for the Scheme are loaded and available, or false of one or more resource is not currently loaded.
84        */
85        bool    resourcesLoaded(void) const;
86
87
88        /*!
89        \brief
90                Return the name of this Scheme.
91
92        \return
93                String object containing the name of this Scheme.
94        */
95        const String& getName(void) const               {return d_name;}
96
97private:
98        /*************************************************************************
99                Implementation Constants
100        *************************************************************************/
101        static const char       GUISchemeSchemaName[];                  //!< Filename of the XML schema used for validating GUIScheme files.
102
103        /*************************************************************************
104                Friends
105        *************************************************************************/
106        friend  Scheme* SchemeManager::loadScheme(const String& scheme_filename, const String& resourceGroup);
107        friend  void    SchemeManager::unloadScheme(const String& scheme_name);
108
109
110        /*************************************************************************
111                Construction and Destruction
112        *************************************************************************/
113        /*!
114        \brief
115                Creates a scheme object from the data specified in the file \a filename
116
117        \param filename
118                String object holding the name of the file to use when creating this Scheme object.
119
120    \param resourceGroup
121        Group identifier to be passed to the resource provider when loading the scheme
122        specification file.
123
124        \return
125                Nothing.
126        */
127        Scheme(const String& filename, const String& resourceGroup);
128
129
130public:         // for luabind compatibility
131        /*!
132        \brief
133                Destroys a Scheme object
134
135        \return
136                Nothing
137        */
138        ~Scheme(void);
139
140       
141private:
142        /*************************************************************************
143                Structs used to hold scheme information
144        *************************************************************************/
145        struct LoadableUIElement
146        {
147                String  name;
148                String  filename;
149        String  resourceGroup;
150        };
151
152        struct  UIElementFactory
153        {
154                String name;
155        };
156
157        struct  UIModule
158        {
159                String name;
160                FactoryModule*  module;
161                std::vector<UIElementFactory>   factories;
162        };
163
164        struct AliasMapping
165        {
166                String aliasName;
167                String targetName;
168        };
169
170    struct FalagardMapping
171    {
172        String windowName;
173        String targetName;
174        String lookName;
175    };
176
177        /*************************************************************************
178                Implementation Data
179        *************************************************************************/
180        String  d_name;                 //!< the name of this scheme.
181
182        std::vector<LoadableUIElement>          d_imagesets;
183        std::vector<LoadableUIElement>          d_imagesetsFromImages;
184        std::vector<LoadableUIElement>          d_fonts;
185        std::vector<UIModule>                           d_widgetModules;
186        std::vector<AliasMapping>                       d_aliasMappings;
187    std::vector<LoadableUIElement>              d_looknfeels;
188    std::vector<FalagardMapping>        d_falagardMappings;
189};
190
191} // End of  CEGUI namespace section
192
193#if defined(_MSC_VER)
194#       pragma warning(pop)
195#endif
196
197#endif  // end of guard _CEGUIScheme_h_
Note: See TracBrowser for help on using the repository browser.