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;
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
00107
00116 WindowManager(void);
00117
00118
00126 ~WindowManager(void);
00127
00128
00129
00130
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
00467
00472 String generateUniqueWindowName();
00473
00475 void initialiseRenderEffect(Window* wnd, const String& effect) const;
00476
00477
00478
00479
00480 static const char GUILayoutSchemaName[];
00481
00482
00483
00484
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
00500
00501 typedef ConstBaseIterator<WindowRegistry> WindowIterator;
00502
00507 WindowIterator getIterator(void) const;
00508
00519 void DEBUG_dumpWindowNames(String zone);
00520 };
00521
00522 }
00523
00524 #if defined(_MSC_VER)
00525 # pragma warning(pop)
00526 #endif
00527
00528 #endif // end of guard _CEGUIWindowManager_h_