source: GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImagesetManager.h @ 1092

Revision 1092, 6.4 KB checked in by gumbau, 18 years ago (diff)

LodStrips? and LODTrees demos

Line 
1/************************************************************************
2        filename:       CEGUIImagesetManager.h
3        created:        21/2/2004
4        author:         Paul D Turner
5       
6        purpose:        Defines interface for ImagesetManager 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 _CEGUIImagesetManager_h_
27#define _CEGUIImagesetManager_h_
28
29#include "CEGUIBase.h"
30#include "CEGUIString.h"
31#include "CEGUISingleton.h"
32#include "CEGUIIteratorBase.h"
33#include <map>
34
35
36#if defined(_MSC_VER)
37#       pragma warning(push)
38#       pragma warning(disable : 4275)
39#       pragma warning(disable : 4251)
40#endif
41
42
43// Start of CEGUI namespace section
44namespace CEGUI
45{
46/*!
47\brief
48        Class providing a shared library of Imageset objects to the system.
49
50        The ImagesetManager is used to create, access, and destroy Imageset objects.  The idea is that
51        the ImagesetManager will function as a central repository for imagery used within the GUI system,
52        and that such imagery can be accessed, via a unique name, by any interested party within the system.
53*/
54class CEGUIEXPORT ImagesetManager : public Singleton<ImagesetManager>
55{
56public:
57        /*!
58        \brief
59                Constructor for ImagesetManager objects
60        */
61        ImagesetManager(void);
62
63
64        /*!
65        \brief
66                Destructor for ImagesetManager objects
67        */
68        ~ImagesetManager(void);
69
70
71        /*!
72        \brief
73                Return singleton ImagesetManager object
74
75        \return
76                Singleton ImagesetManager object
77        */
78        static  ImagesetManager&        getSingleton(void);
79
80
81        /*!
82        \brief
83                Return pointer to singleton ImagesetManager object
84
85        \return
86                Pointer to singleton ImagesetManager object
87        */
88        static  ImagesetManager*        getSingletonPtr(void);
89
90
91        /*!
92        \brief
93                Create a Imageset object with the given name and Texture
94
95                The created Imageset will be of limited use, and will require one or more images to be defined for the set.
96
97        \param name
98                String object containing the unique name for the Imageset being created.
99
100        \param texture
101                Texture object to be associated with the Imageset
102
103        \return
104                Pointer to the newly created Imageset object
105
106        \exception AlreadyExistsException       Thrown if an Imageset named \a name is already present in the system.
107        */
108        Imageset*       createImageset(const String& name, Texture* texture);
109
110        /*!
111        \brief
112                Create an Imageset object from the specified file
113
114        \param filename
115                String object holding the name of the Imageset definition file which should be used to create the Imageset
116
117    \param resourceGroup
118        Resource group identifier to be passed to the resource manager.  NB: This affects the
119        imageset xml file only, the texture loaded may have its own group specified in the XML file.
120
121        \return
122                Pointer to the newly created Imageset object
123
124        \exception      AlreadyExistsException  Thrown if an Imageset named \a name is already present in the system.
125        \exception      FileIOException                 Thrown if something goes wrong while processing the file \a filename.
126        */
127        Imageset*       createImageset(const String& filename, const String& resourceGroup = "");
128
129
130        /*!
131        \brief
132                Destroys the Imageset with the specified name
133
134        \param name
135                String object containing the name of the Imageset to be destroyed.  If no such Imageset exists, nothing happens.
136
137        \return
138                Nothing.
139        */
140        void    destroyImageset(const String& name);
141
142        /*!
143        \brief
144                Destroys the given Imageset object
145
146        \param imageset
147                Pointer to the Imageset to be destroyed.  If no such Imageset exists, nothing happens.
148
149        \return
150                Nothing.
151        */
152        void    destroyImageset(Imageset* imageset);
153
154
155        /*!
156        \brief
157                Destroys all Imageset objects registered in the system
158
159        \return
160                Nothing
161        */
162        void    destroyAllImagesets(void);
163
164
165        /*!
166        \brief
167                Returns a pointer to the Imageset object with the specified name
168
169        \param name
170                String object containing the name of the Imageset to return a pointer to
171
172        \return
173                Pointer to the requested Imageset object
174
175        \exception      UnknownObjectException  Thrown if no Imageset named \a name is present in within the system
176        */
177        Imageset*       getImageset(const String& name) const;
178
179
180        /*!
181        \brief
182                Check for the existence of a named Imageset
183
184        \param name
185                String object containing the name of the Imageset to look for
186
187        \return
188                true if an Imageset named \a name is presently loaded in the system, else false.
189        */
190        bool    isImagesetPresent(const String& name) const                     {return d_imagesets.find(name) != d_imagesets.end();}
191
192
193        /*!
194        \brief
195                Notify the ImagesetManager of the current (usually new) display resolution.
196
197        \param size
198                Size object describing the display resolution
199
200        \return
201                Nothing
202        */
203        void    notifyScreenResolution(const Size& size);
204
205
206private:
207        /*************************************************************************
208                Implementation Data
209        *************************************************************************/
210        typedef std::map<String, Imageset*>             ImagesetRegistry;
211        ImagesetRegistry        d_imagesets;
212
213public:
214        /*************************************************************************
215                Iterator stuff
216        *************************************************************************/
217        typedef ConstBaseIterator<ImagesetRegistry>     ImagesetIterator;
218
219        /*!
220        \brief
221                Return a ImagesetManager::ImagesetIterator object to iterate over the available Imageset objects.
222        */
223        ImagesetIterator        getIterator(void) const;
224};
225
226} // End of  CEGUI namespace section
227
228#if defined(_MSC_VER)
229#       pragma warning(pop)
230#endif
231
232#endif  // end of guard _CEGUIImageSetManager_h_
Note: See TracBrowser for help on using the repository browser.