MyGUI  3.2.1
MyGUI_PointerManager.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_POINTER_MANAGER_H__
00008 #define __MYGUI_POINTER_MANAGER_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_Singleton.h"
00012 #include "MyGUI_IUnlinkWidget.h"
00013 #include "MyGUI_ImageBox.h"
00014 #include "MyGUI_IPointer.h"
00015 #include "MyGUI_BackwardCompatibility.h"
00016 
00017 namespace MyGUI
00018 {
00019 
00020     class MYGUI_EXPORT PointerManager :
00021         public Singleton<PointerManager>,
00022         public IUnlinkWidget,
00023         public MemberObsolete<PointerManager>
00024     {
00025     public:
00026         PointerManager();
00027 
00028         void initialise();
00029         void shutdown();
00030 
00032         void setVisible(bool _visible);
00034         bool isVisible() const;
00035 
00039         void setPointer(const std::string& _name);
00041         void resetToDefaultPointer();
00042 
00044         const std::string& getDefaultPointer() const;
00046         void setDefaultPointer(const std::string& _value);
00047 
00049         const std::string& getLayerName() const;
00051         void setLayerName(const std::string& _value);
00052 
00054         IPointer* getByName(const std::string& _name) const;
00055 
00056         /*events:*/
00061         delegates::CMultiDelegate1<const std::string&> eventChangeMousePointer;
00062 
00063     private:
00064         void _unlinkWidget(Widget* _widget);
00065         void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
00066 
00067         // создает виджет
00068         Widget* baseCreateWidget(WidgetStyle _style, const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _layer, const std::string& _name);
00069 
00070         // удяляет неудачника
00071         void _destroyChildWidget(Widget* _widget);
00072 
00073         // удаляет всех детей
00074         void _destroyAllChildWidget();
00075 
00076         void Update();
00077 
00078         void notifyFrameStart(float _time);
00079         void notifyChangeMouseFocus(Widget* _widget);
00080         void setPointer(const std::string& _name, Widget* _owner);
00081 
00082     private:
00083         // вектор всех детей виджетов
00084         VectorWidgetPtr mWidgetChild;
00085 
00086         std::string mDefaultName;
00087         IntPoint mPoint;
00088         IntPoint mOldPoint;
00089         bool mVisible;
00090         std::string mLayerName;
00091         std::string mSkinName;
00092 
00093         Widget* mWidgetOwner;
00094         ImageBox* mMousePointer;
00095         IPointer* mPointer;
00096         std::string mCurrentMousePointer;
00097 
00098         bool mIsInitialise;
00099         std::string mXmlPointerTagName;
00100         std::string mXmlPropertyTagName;
00101         std::string mXmlDefaultPointerValue;
00102     };
00103 
00104 } // namespace MyGUI
00105 
00106 #endif // __MYGUI_POINTER_MANAGER_H__