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 = "");
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
00249 bool isDeadPoolEmpty(void) const;
00250
00262 void cleanDeadPool(void);
00263
00281 void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
00282
00300 void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
00301
00318 void renameWindow(const String& window, const String& new_name);
00319
00333 void renameWindow(Window* window, const String& new_name);
00334
00343 static const String& getDefaultResourceGroup()
00344 { return d_defaultResourceGroup; }
00345
00356 static void setDefaultResourceGroup(const String& resourceGroup)
00357 { d_defaultResourceGroup = resourceGroup; }
00358
00359 private:
00360
00361
00362
00367 String generateUniqueWindowName();
00368
00369
00370
00371
00372 static const char GUILayoutSchemaName[];
00373
00374
00375
00376
00377
00378 typedef std::map<String, Window*, String::FastLessCompare> WindowRegistry;
00379 typedef std::vector<Window*> WindowVector;
00380
00381 WindowRegistry d_windowRegistry;
00382 WindowVector d_deathrow;
00383
00384 unsigned long d_uid_counter;
00385 static String d_defaultResourceGroup;
00386
00387 public:
00388
00389
00390
00391 typedef ConstBaseIterator<WindowRegistry> WindowIterator;
00392
00397 WindowIterator getIterator(void) const;
00398 };
00399
00400 }
00401
00402 #if defined(_MSC_VER)
00403 # pragma warning(pop)
00404 #endif
00405
00406 #endif // end of guard _CEGUIWindowManager_h_