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 <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
00049 namespace CEGUI
00050 {
00060 class CEGUIEXPORT WindowManager : public Singleton <WindowManager>
00061 {
00062 public:
00063
00064
00065
00066 static const String GeneratedWindowNameBase;
00067
00089 typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
00090
00091
00092
00093
00102 WindowManager(void);
00103
00104
00112 ~WindowManager(void);
00113
00114
00115
00116
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
00364
00369 String generateUniqueWindowName();
00370
00371 String generateUniqueWindowPrefix();
00372
00373
00374
00375
00376 static const char GUILayoutSchemaName[];
00377
00378
00379
00380
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
00394
00395 typedef ConstBaseIterator<WindowRegistry> WindowIterator;
00396
00401 WindowIterator getIterator(void) const;
00402
00413 void DEBUG_dumpWindowNames(String zone);
00414 };
00415
00416 }
00417
00418 #if defined(_MSC_VER)
00419 # pragma warning(pop)
00420 #endif
00421
00422 #endif // end of guard _CEGUIWindowManager_h_