MyGUI 3.0.1

MyGUI_PointerManager.h

Go to the documentation of this file.
00001 
00007 /*
00008     This file is part of MyGUI.
00009 
00010     MyGUI is free software: you can redistribute it and/or modify
00011     it under the terms of the GNU Lesser General Public License as published by
00012     the Free Software Foundation, either version 3 of the License, or
00013     (at your option) any later version.
00014 
00015     MyGUI is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU Lesser General Public License for more details.
00019 
00020     You should have received a copy of the GNU Lesser General Public License
00021     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 #ifndef __MYGUI_POINTER_MANAGER_H__
00024 #define __MYGUI_POINTER_MANAGER_H__
00025 
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Instance.h"
00028 #include "MyGUI_IUnlinkWidget.h"
00029 #include "MyGUI_IWidgetCreator.h"
00030 #include "MyGUI_StaticImage.h"
00031 #include "MyGUI_IPointer.h"
00032 
00033 namespace MyGUI
00034 {
00035 
00036     class MYGUI_EXPORT PointerManager :
00037         public IUnlinkWidget,
00038         public IWidgetCreator
00039     {
00040         MYGUI_INSTANCE_HEADER( PointerManager )
00041 
00042     public:
00043         void initialise();
00044         void shutdown();
00045 
00046     public:
00048         bool load(const std::string& _file);
00049 
00050         void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
00051 
00053         void setVisible(bool _visible);
00055         bool isVisible() const { return mVisible; }
00056 
00060         void setPointer(const std::string& _name);
00062         void resetToDefaultPointer();
00063 
00065         const std::string& getDefaultPointer() { return mDefaultName; }
00067         void setDeafultPointer(const std::string& _value);
00068 
00069         const std::string& getLayerName() { return mLayerName; }
00070         void setLayerName(const std::string& _value);
00071 
00073         IPointer* getByName(const std::string& _name) const;
00074 
00075     /*event:*/
00080         delegates::CMultiDelegate1<const std::string &>
00081             eventChangeMousePointer;
00082 
00083     /*obsolete:*/
00084 #ifndef MYGUI_DONT_USE_OBSOLETE
00085 
00086         MYGUI_OBSOLETE("use : void PointerManager::setVisible(bool _visible)")
00087         void show() { setVisible(true); }
00088         MYGUI_OBSOLETE("use : void PointerManager::setVisible(bool _visible)")
00089         void hide() { setVisible(false); }
00090         MYGUI_OBSOLETE("use : bool PointerManager::isVisible()")
00091         bool isShow() { return isVisible(); }
00092 
00093 #endif // MYGUI_DONT_USE_OBSOLETE
00094 
00095     private:
00096         void _unlinkWidget(Widget* _widget);
00097 
00098         // создает виджет
00099         virtual 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);
00100 
00101         // удяляет неудачника
00102         virtual void _destroyChildWidget(Widget* _widget);
00103 
00104         // удаляет всех детей
00105         virtual void _destroyAllChildWidget();
00106 
00107         void Update();
00108 
00109         void notifyFrameStart(float _time);
00110         void notifyChangeMouseFocus(Widget* _widget);
00111         void setPointer(const std::string& _name, Widget* _owner);
00112 
00113     private:
00114         // вектор всех детей виджетов
00115         VectorWidgetPtr mWidgetChild;
00116 
00117         std::string mDefaultName;
00118         IntPoint mPoint;
00119         bool mVisible;
00120         std::string mLayerName;
00121         std::string mSkinName;
00122 
00123         Widget* mWidgetOwner;
00124         StaticImage* mMousePointer;
00125         IPointer* mPointer;
00126         std::string mCurrentMousePointer;
00127     };
00128 
00129 } // namespace MyGUI
00130 
00131 #endif // __MYGUI_POINTER_MANAGER_H__
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines