Crazy Eddies GUI System: CEGUIWindowManager.h Source File

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

# 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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00011
    00012     This library is free software; you can redistribute it and/or
    00013     modify it under the terms of the GNU Lesser General Public
    00014     License as published by the Free Software Foundation; either
    00015     version 2.1 of the License, or (at your option) any later version.
    00016
    00017     This library is distributed in the hope that it will be useful,
    00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020     Lesser General Public License for more details.
    00021
    00022     You should have received a copy of the GNU Lesser General Public
    00023     License along with this library; if not, write to the Free Software
    00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025 *************************************************************************/
    00026 #ifndef _CEGUIWindowManager_h_
    00027 #define _CEGUIWindowManager_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIString.h"
    00031 #include "CEGUISingleton.h"
    00032 #include "CEGUILogger.h"
    00033 #include "CEGUIIteratorBase.h"
    00034 #include <map>
    00035 #include <vector>
    00036
    00037 #if defined(_MSC_VER)
    00038 #       pragma warning(push)
    00039 #       pragma warning(disable : 4275)
    00040 #       pragma warning(disable : 4251)
    00041 #endif
    00042
    00043
    00044 // Start of CEGUI namespace section
    00045 namespace CEGUI
    00046 {
    00056 class CEGUIEXPORT WindowManager : public Singleton <WindowManager>
    00057 {
    00058 public:
    00059     /*************************************************************************
    00060         Public static data
    00061     *************************************************************************/
    00062     static const String GeneratedWindowNameBase;
    00063
    00085         typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
    00086
    00087         /*************************************************************************
    00088                 Construction and Destruction
    00089         *************************************************************************/
    00098         WindowManager(void);
    00099
    00100
    00108         ~WindowManager(void);
    00109
    00110
    00118         static  WindowManager&  getSingleton(void);
    00119
    00120
    00128         static  WindowManager*  getSingletonPtr(void);
    00129
    00130
    00131         /*************************************************************************
    00132                 Window Related Methods
    00133         *************************************************************************/
    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 = NULL, void* userdata = NULL);
    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
    00334     void renameWindow(const String& window, const String& new_name);
    00335
    00349     void renameWindow(Window* window, const String& new_name);
    00350
    00351 private:
    00352     /*************************************************************************
    00353         Implementation Methods
    00354     *************************************************************************/
    00359     String generateUniqueWindowName();
    00360
    00361         /*************************************************************************
    00362                 Implementation Constants
    00363         *************************************************************************/
    00364         static const char       GUILayoutSchemaName[];
    00365
    00366
    00367         /*************************************************************************
    00368                 Implementation Data
    00369         *************************************************************************/
    00370         typedef std::map<String, Window*>                       WindowRegistry;
    00371     typedef std::vector<Window*>    WindowVector;
    00372
    00373         WindowRegistry                  d_windowRegistry;
    00374     WindowVector    d_deathrow;
    00375
    00376     unsigned long   d_uid_counter;
    00377
    00378 public:
    00379         /*************************************************************************
    00380                 Iterator stuff
    00381         *************************************************************************/
    00382         typedef ConstBaseIterator<WindowRegistry>       WindowIterator;
    00383
    00388         WindowIterator  getIterator(void) const;
    00389 };
    00390
    00391 } // End of  CEGUI namespace section
    00392
    00393 #if defined(_MSC_VER)
    00394 #       pragma warning(pop)
    00395 #endif
    00396
    00397 #endif  // end of guard _CEGUIWindowManager_h_