Crazy Eddies GUI System: CEGUIWindowManager.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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 "CEGUIEventSet.h"
    00039 #include <map>
    00040 #include <vector>
    00041
    00042 #if defined(_MSC_VER)
    00043 #       pragma warning(push)
    00044 #       pragma warning(disable : 4275)
    00045 #       pragma warning(disable : 4251)
    00046 #endif
    00047
    00048
    00049 // Start of CEGUI namespace section
    00050 namespace CEGUI
    00051 {
    00061 class CEGUIEXPORT WindowManager : public Singleton <WindowManager>,
    00062                                   public EventSet
    00063 {
    00064 public:
    00065     /*************************************************************************
    00066         Public static data
    00067     *************************************************************************/
    00068     static const String GeneratedWindowNameBase;
    00069
    00070     static const String EventNamespace;
    00075     static const String EventWindowCreated;
    00080     static const String EventWindowDestroyed;
    00081
    00103         typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
    00104
    00105         /*************************************************************************
    00106                 Construction and Destruction
    00107         *************************************************************************/
    00116         WindowManager(void);
    00117
    00118
    00126         ~WindowManager(void);
    00127
    00128
    00129         /*************************************************************************
    00130                 Window Related Methods
    00131         *************************************************************************/
    00152         Window* createWindow(const String& type, const String& name = "");
    00153
    00154
    00167         void    destroyWindow(Window* window);
    00168
    00169
    00182         void    destroyWindow(const String& window);
    00183
    00184
    00197         Window* getWindow(const String& name) const;
    00198
    00199
    00210         bool    isWindowPresent(const String& name) const;
    00211
    00212
    00222         void    destroyAllWindows(void);
    00223
    00224
    00255         Window* loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = 0, void* userdata = 0);
    00256
    00265     bool isDeadPoolEmpty(void) const;
    00266
    00278     void cleanDeadPool(void);
    00279
    00297     void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
    00298
    00316     void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
    00317
    00337     void saveWindowLayout(const String& window, const String& filename, const bool writeParent = false) const;
    00338
    00357     void saveWindowLayout(const Window& window, const String& filename, const bool writeParent = false) const;
    00358
    00375     void renameWindow(const String& window, const String& new_name);
    00376
    00390     void renameWindow(Window* window, const String& new_name);
    00391
    00400     static const String& getDefaultResourceGroup()
    00401         { return d_defaultResourceGroup; }
    00402
    00413     static void setDefaultResourceGroup(const String& resourceGroup)
    00414         { d_defaultResourceGroup = resourceGroup; }
    00415
    00429     void lock();
    00430
    00444     void unlock();
    00445
    00462     bool isLocked() const;
    00463
    00464 private:
    00465     /*************************************************************************
    00466         Implementation Methods
    00467     *************************************************************************/
    00472     String generateUniqueWindowName();
    00473
    00475     void initialiseRenderEffect(Window* wnd, const String& effect) const;
    00476
    00477         /*************************************************************************
    00478                 Implementation Constants
    00479         *************************************************************************/
    00480         static const char       GUILayoutSchemaName[];
    00481
    00482
    00483         /*************************************************************************
    00484                 Implementation Data
    00485         *************************************************************************/
    00486         typedef std::map<String, Window*, String::FastLessCompare>                      WindowRegistry;
    00487     typedef std::vector<Window*>    WindowVector;
    00488
    00489         WindowRegistry                  d_windowRegistry;
    00490     WindowVector    d_deathrow;
    00491
    00492     unsigned long   d_uid_counter;
    00493     static String d_defaultResourceGroup;
    00494
    00495     uint    d_lockCount;
    00496
    00497 public:
    00498         /*************************************************************************
    00499                 Iterator stuff
    00500         *************************************************************************/
    00501         typedef ConstBaseIterator<WindowRegistry>       WindowIterator;
    00502
    00507         WindowIterator  getIterator(void) const;
    00508
    00519     void DEBUG_dumpWindowNames(String zone);
    00520 };
    00521
    00522 } // End of  CEGUI namespace section
    00523
    00524 #if defined(_MSC_VER)
    00525 #       pragma warning(pop)
    00526 #endif
    00527
    00528 #endif  // end of guard _CEGUIWindowManager_h_