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 = "", const String& prefix = "");
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         
00241         Window* loadWindowLayout(const String& filename, bool generateRandomPrefix);
00242 
00251     bool isDeadPoolEmpty(void) const;
00252 
00264     void cleanDeadPool(void);
00265 
00283     void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
00284 
00302     void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
00303 
00320     void renameWindow(const String& window, const String& new_name);
00321 
00335     void renameWindow(Window* window, const String& new_name);
00336 
00345     static const String& getDefaultResourceGroup()
00346         { return d_defaultResourceGroup; }
00347 
00358     static void setDefaultResourceGroup(const String& resourceGroup)
00359         { d_defaultResourceGroup = resourceGroup; }
00360 
00361 private:
00362     /*************************************************************************
00363         Implementation Methods
00364     *************************************************************************/
00369     String generateUniqueWindowName();
00370 
00371         String generateUniqueWindowPrefix();
00372 
00373         /*************************************************************************
00374                 Implementation Constants
00375         *************************************************************************/
00376         static const char       GUILayoutSchemaName[];                  
00377 
00378 
00379         /*************************************************************************
00380                 Implementation Data
00381         *************************************************************************/
00382         typedef std::map<String, Window*, String::FastLessCompare>                      WindowRegistry;                         
00383     typedef std::vector<Window*>    WindowVector;   
00384 
00385         WindowRegistry                  d_windowRegistry;                       
00386     WindowVector    d_deathrow;     
00387 
00388     unsigned long   d_uid_counter;  
00389     static String d_defaultResourceGroup;   
00390 
00391 public:
00392         /*************************************************************************
00393                 Iterator stuff
00394         *************************************************************************/
00395         typedef ConstBaseIterator<WindowRegistry>       WindowIterator;
00396 
00401         WindowIterator  getIterator(void) const;
00402 
00413     void DEBUG_dumpWindowNames(String zone);    
00414 };
00415 
00416 } // End of  CEGUI namespace section
00417 
00418 #if defined(_MSC_VER)
00419 #       pragma warning(pop)
00420 #endif
00421 
00422 #endif  // end of guard _CEGUIWindowManager_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4