MyGUI  3.2.1
MyGUI_LayerManager.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_LAYER_MANAGER_H__
00008 #define __MYGUI_LAYER_MANAGER_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_Singleton.h"
00012 #include "MyGUI_Enumerator.h"
00013 #include "MyGUI_XmlDocument.h"
00014 #include "MyGUI_IUnlinkWidget.h"
00015 #include "MyGUI_ResourceManager.h"
00016 #include "MyGUI_ILayer.h"
00017 #include "MyGUI_BackwardCompatibility.h"
00018 
00019 namespace MyGUI
00020 {
00021 
00022     class MYGUI_EXPORT LayerManager :
00023         public Singleton<LayerManager>,
00024         public IUnlinkWidget,
00025         public MemberObsolete<LayerManager>
00026     {
00027     public:
00028         typedef std::vector<ILayer*> VectorLayer;
00029         typedef Enumerator<VectorLayer> EnumeratorLayer;
00030 
00031     public:
00032         LayerManager();
00033 
00034         void initialise();
00035         void shutdown();
00036 
00041         void attachToLayerNode(const std::string& _name, Widget* _item);
00045         void detachFromLayer(Widget* _item);
00046 
00050         void upLayerItem(Widget* _item);
00051 
00053         bool isExist(const std::string& _name) const;
00055         EnumeratorLayer getEnumerator() const;
00056 
00058         ILayer* getByName(const std::string& _name, bool _throw = true) const;
00059 
00060         size_t getLayerCount() const;
00061 
00062         ILayer* getLayer(size_t _index);
00063 
00065         Widget* getWidgetFromPoint(int _left, int _top);
00066 
00068         void renderToTarget(IRenderTarget* _target, bool _update);
00069 
00070         void resizeView(const IntSize& _viewSize);
00071 
00072         const std::string& getCategoryName() const;
00073 
00074     private:
00075         void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
00076         void _unlinkWidget(Widget* _widget);
00077 
00078         void clear();
00079 
00080         void merge(VectorLayer& _layers);
00081         void destroy(ILayer* _layer);
00082 
00083     private:
00084         VectorLayer mLayerNodes;
00085 
00086         bool mIsInitialise;
00087         std::string mCategoryName;
00088     };
00089 
00090 } // namespace MyGUI
00091 
00092 #endif // __MYGUI_LAYER_MANAGER_H__