MyGUI  3.2.1
MyGUI_LayoutManager.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_LAYOUT_MANAGER_H__
00008 #define __MYGUI_LAYOUT_MANAGER_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_Singleton.h"
00012 #include "MyGUI_XmlDocument.h"
00013 #include "MyGUI_WidgetDefines.h"
00014 #include "MyGUI_ResourceLayout.h"
00015 #include "MyGUI_BackwardCompatibility.h"
00016 
00017 namespace MyGUI
00018 {
00019 
00020     typedef delegates::CMultiDelegate3<Widget*, const std::string&, const std::string&> EventHandle_AddUserStringDelegate;
00021 
00022     class MYGUI_EXPORT LayoutManager :
00023         public Singleton<LayoutManager>,
00024         public MemberObsolete<LayoutManager>
00025     {
00026     public:
00027         LayoutManager();
00028 
00029         void initialise();
00030         void shutdown();
00031 
00038         VectorWidgetPtr loadLayout(const std::string& _file, const std::string& _prefix = "", Widget* _parent = nullptr);
00039 
00041         void unloadLayout(VectorWidgetPtr& _widgets);
00042 
00044         ResourceLayout* getByName(const std::string& _name, bool _throw = true) const;
00045 
00047         bool isExist(const std::string& _name) const;
00048 
00056         EventHandle_AddUserStringDelegate eventAddUserString;
00057 
00058         const std::string& getCurrentLayout() const;
00059 
00060     private:
00061         void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
00062 
00063     private:
00064         bool mIsInitialise;
00065         std::string mCurrentLayoutName;
00066         std::string mXmlLayoutTagName;
00067     };
00068 
00069 } // namespace MyGUI
00070 
00071 #endif // __MYGUI_LAYOUT_MANAGER_H__