CEGUIWindowManager.h

00001 /***********************************************************************
00002         filename:       CEGUIWindowManager.h
00003         created:        21/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines the interface for the WindowManager object
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIWindowManager_h_
00031 #define _CEGUIWindowManager_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUIString.h"
00035 #include "CEGUISingleton.h"
00036 #include "CEGUILogger.h"
00037 #include "CEGUIIteratorBase.h"
00038 #include <map>
00039 #include <vector>
00040 
00041 #if defined(_MSC_VER)
00042 #       pragma warning(push)
00043 #       pragma warning(disable : 4275)
00044 #       pragma warning(disable : 4251)
00045 #endif
00046 
00047 
00048 // Start of CEGUI namespace section
00049 namespace CEGUI
00050 {
00060 class CEGUIEXPORT WindowManager : public Singleton <WindowManager>
00061 {
00062 public:
00063     /*************************************************************************
00064         Public static data
00065     *************************************************************************/
00066     static const String GeneratedWindowNameBase;      
00067 
00089         typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
00090         
00091         /*************************************************************************
00092                 Construction and Destruction
00093         *************************************************************************/
00102         WindowManager(void);
00103 
00104 
00112         ~WindowManager(void);
00113 
00114 
00115         /*************************************************************************
00116                 Window Related Methods
00117         *************************************************************************/
00136         Window* createWindow(const String& type, const String& name = "");
00137 
00138 
00151         void    destroyWindow(Window* window);
00152 
00153 
00166         void    destroyWindow(const String& window);
00167 
00168 
00181         Window* getWindow(const String& name) const;
00182 
00183 
00194         bool    isWindowPresent(const String& name) const;
00195 
00196 
00206         void    destroyAllWindows(void);
00207 
00208 
00239         Window* loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = 0, void* userdata = 0);
00240 
00249     bool isDeadPoolEmpty(void) const;
00250 
00262     void cleanDeadPool(void);
00263 
00281     void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
00282 
00300     void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
00301 
00318     void renameWindow(const String& window, const String& new_name);
00319 
00333     void renameWindow(Window* window, const String& new_name);
00334 
00343     static const String& getDefaultResourceGroup()
00344         { return d_defaultResourceGroup; }
00345 
00356     static void setDefaultResourceGroup(const String& resourceGroup)
00357         { d_defaultResourceGroup = resourceGroup; }
00358 
00359 private:
00360     /*************************************************************************
00361         Implementation Methods
00362     *************************************************************************/
00367     String generateUniqueWindowName();
00368 
00369         /*************************************************************************
00370                 Implementation Constants
00371         *************************************************************************/
00372         static const char       GUILayoutSchemaName[];                  
00373 
00374 
00375         /*************************************************************************
00376                 Implementation Data
00377         *************************************************************************/
00378         typedef std::map<String, Window*, String::FastLessCompare>                      WindowRegistry;                         
00379     typedef std::vector<Window*>    WindowVector;   
00380 
00381         WindowRegistry                  d_windowRegistry;                       
00382     WindowVector    d_deathrow;     
00383 
00384     unsigned long   d_uid_counter;  
00385     static String d_defaultResourceGroup;   
00386 
00387 public:
00388         /*************************************************************************
00389                 Iterator stuff
00390         *************************************************************************/
00391         typedef ConstBaseIterator<WindowRegistry>       WindowIterator;
00392 
00397         WindowIterator  getIterator(void) const;
00398 };
00399 
00400 } // End of  CEGUI namespace section
00401 
00402 #if defined(_MSC_VER)
00403 #       pragma warning(pop)
00404 #endif
00405 
00406 #endif  // end of guard _CEGUIWindowManager_h_

Generated on Sun Nov 5 14:35:28 2006 for Crazy Eddies GUI System by  doxygen 1.4.7