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 #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
00045 namespace CEGUI
00046 {
00056 class CEGUIEXPORT WindowManager : public Singleton <WindowManager>
00057 {
00058 public:
00059
00060
00061
00062 static const String GeneratedWindowNameBase;
00063
00085 typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
00086
00087
00088
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
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
00354
00359 String generateUniqueWindowName();
00360
00361
00362
00363
00364 static const char GUILayoutSchemaName[];
00365
00366
00367
00368
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
00381
00382 typedef ConstBaseIterator<WindowRegistry> WindowIterator;
00383
00388 WindowIterator getIterator(void) const;
00389 };
00390
00391 }
00392
00393 #if defined(_MSC_VER)
00394 # pragma warning(pop)
00395 #endif
00396
00397 #endif // end of guard _CEGUIWindowManager_h_