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
00138 Window* createWindow(const String& type, const String& name = "", const String& prefix = "");
00139
00140
00153 void destroyWindow(Window* window);
00154
00155
00168 void destroyWindow(const String& window);
00169
00170
00183 Window* getWindow(const String& name) const;
00184
00185
00196 bool isWindowPresent(const String& name) const;
00197
00198
00208 void destroyAllWindows(void);
00209
00210
00256 Window* loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = 0, void* userdata = 0);
00257
00258 Window* loadWindowLayout(const String& filename, bool generateRandomPrefix);
00259
00268 bool isDeadPoolEmpty(void) const;
00269
00281 void cleanDeadPool(void);
00282
00300 void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
00301
00319 void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
00320
00337 void renameWindow(const String& window, const String& new_name);
00338
00352 void renameWindow(Window* window, const String& new_name);
00353
00362 static const String& getDefaultResourceGroup()
00363 { return d_defaultResourceGroup; }
00364
00375 static void setDefaultResourceGroup(const String& resourceGroup)
00376 { d_defaultResourceGroup = resourceGroup; }
00377
00391 void lock();
00392
00406 void unlock();
00407
00424 bool isLocked() const;
00425
00426 private:
00427
00428
00429
00434 String generateUniqueWindowName();
00435
00436 String generateUniqueWindowPrefix();
00437
00438
00439
00440
00441 static const char GUILayoutSchemaName[];
00442
00443
00444
00445
00446
00447 typedef std::map<String, Window*, String::FastLessCompare> WindowRegistry;
00448 typedef std::vector<Window*> WindowVector;
00449
00450 WindowRegistry d_windowRegistry;
00451 WindowVector d_deathrow;
00452
00453 unsigned long d_uid_counter;
00454 static String d_defaultResourceGroup;
00455
00456 uint d_lockCount;
00457
00458 public:
00459
00460
00461
00462 typedef ConstBaseIterator<WindowRegistry> WindowIterator;
00463
00468 WindowIterator getIterator(void) const;
00469
00480 void DEBUG_dumpWindowNames(String zone);
00481 };
00482
00483 }
00484
00485 #if defined(_MSC_VER)
00486 # pragma warning(pop)
00487 #endif
00488
00489 #endif // end of guard _CEGUIWindowManager_h_