MyGUI  3.2.0
MyGUI_PointerManager.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_POINTER_MANAGER_H__
00023 #define __MYGUI_POINTER_MANAGER_H__
00024 
00025 #include "MyGUI_Prerequest.h"
00026 #include "MyGUI_Singleton.h"
00027 #include "MyGUI_IUnlinkWidget.h"
00028 #include "MyGUI_ImageBox.h"
00029 #include "MyGUI_IPointer.h"
00030 #include "MyGUI_BackwardCompatibility.h"
00031 
00032 namespace MyGUI
00033 {
00034 
00035     class MYGUI_EXPORT PointerManager :
00036         public Singleton<PointerManager>,
00037         public IUnlinkWidget,
00038         public MemberObsolete<PointerManager>
00039     {
00040     public:
00041         PointerManager();
00042 
00043         void initialise();
00044         void shutdown();
00045 
00047         void setVisible(bool _visible);
00049         bool isVisible() const;
00050 
00054         void setPointer(const std::string& _name);
00056         void resetToDefaultPointer();
00057 
00059         const std::string& getDefaultPointer() const;
00061         void setDefaultPointer(const std::string& _value);
00062 
00064         const std::string& getLayerName() const;
00066         void setLayerName(const std::string& _value);
00067 
00069         IPointer* getByName(const std::string& _name) const;
00070 
00071     /*events:*/
00076         delegates::CMultiDelegate1<const std::string&>
00077             eventChangeMousePointer;
00078 
00079     private:
00080         void _unlinkWidget(Widget* _widget);
00081         void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
00082 
00083         // создает виджет
00084         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);
00085 
00086         // удяляет неудачника
00087         void _destroyChildWidget(Widget* _widget);
00088 
00089         // удаляет всех детей
00090         void _destroyAllChildWidget();
00091 
00092         void Update();
00093 
00094         void notifyFrameStart(float _time);
00095         void notifyChangeMouseFocus(Widget* _widget);
00096         void setPointer(const std::string& _name, Widget* _owner);
00097 
00098     private:
00099         // вектор всех детей виджетов
00100         VectorWidgetPtr mWidgetChild;
00101 
00102         std::string mDefaultName;
00103         IntPoint mPoint;
00104         bool mVisible;
00105         std::string mLayerName;
00106         std::string mSkinName;
00107 
00108         Widget* mWidgetOwner;
00109         ImageBox* mMousePointer;
00110         IPointer* mPointer;
00111         std::string mCurrentMousePointer;
00112 
00113         bool mIsInitialise;
00114     };
00115 
00116 } // namespace MyGUI
00117 
00118 #endif // __MYGUI_POINTER_MANAGER_H__