00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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
00050 namespace CEGUI
00051 {
00061 class CEGUIEXPORT WindowManager : public Singleton <WindowManager>,
00062 public EventSet
00063 {
00064 public:
00065
00066
00067
00068 static const String GeneratedWindowNameBase;
00069
00070 static const String EventNamespace;
00072 static const String EventWindowCreated;
00074 static const String EventWindowDestroyed;
00075
00097 typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
00098
00099
00100
00101
00110 WindowManager(void);
00111
00112
00120 ~WindowManager(void);
00121
00122
00123
00124
00125
00146 Window* createWindow(const String& type, const String& name = "");
00147
00148
00161 void destroyWindow(Window* window);
00162
00163
00176 void destroyWindow(const String& window);
00177
00178
00191 Window* getWindow(const String& name) const;
00192
00193
00204 bool isWindowPresent(const String& name) const;
00205
00206
00216 void destroyAllWindows(void);
00217
00218
00249 Window* loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = 0, void* userdata = 0);
00250
00259 bool isDeadPoolEmpty(void) const;
00260
00272 void cleanDeadPool(void);
00273
00291 void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
00292
00310 void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
00311
00328 void renameWindow(const String& window, const String& new_name);
00329
00343 void renameWindow(Window* window, const String& new_name);
00344
00353 static const String& getDefaultResourceGroup()
00354 { return d_defaultResourceGroup; }
00355
00366 static void setDefaultResourceGroup(const String& resourceGroup)
00367 { d_defaultResourceGroup = resourceGroup; }
00368
00382 void lock();
00383
00397 void unlock();
00398
00415 bool isLocked() const;
00416
00417 private:
00418
00419
00420
00425 String generateUniqueWindowName();
00426
00427
00428
00429
00430 static const char GUILayoutSchemaName[];
00431
00432
00433
00434
00435
00436 typedef std::map<String, Window*, String::FastLessCompare> WindowRegistry;
00437 typedef std::vector<Window*> WindowVector;
00438
00439 WindowRegistry d_windowRegistry;
00440 WindowVector d_deathrow;
00441
00442 unsigned long d_uid_counter;
00443 static String d_defaultResourceGroup;
00444
00445 uint d_lockCount;
00446
00447 public:
00448
00449
00450
00451 typedef ConstBaseIterator<WindowRegistry> WindowIterator;
00452
00457 WindowIterator getIterator(void) const;
00458
00469 void DEBUG_dumpWindowNames(String zone);
00470 };
00471
00472 }
00473
00474 #if defined(_MSC_VER)
00475 # pragma warning(pop)
00476 #endif
00477
00478 #endif // end of guard _CEGUIWindowManager_h_