MyGUI  3.0.1
MyGUI_PointerManager.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_POINTER_MANAGER_H__
24 #define __MYGUI_POINTER_MANAGER_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_Instance.h"
28 #include "MyGUI_IUnlinkWidget.h"
29 #include "MyGUI_IWidgetCreator.h"
30 #include "MyGUI_StaticImage.h"
31 #include "MyGUI_IPointer.h"
32 
33 namespace MyGUI
34 {
35 
37  public IUnlinkWidget,
38  public IWidgetCreator
39  {
41 
42  public:
43  void initialise();
44  void shutdown();
45 
46  public:
48  bool load(const std::string& _file);
49 
50  void _load(xml::ElementPtr _node, const std::string& _file, Version _version);
51 
53  void setVisible(bool _visible);
55  bool isVisible() const { return mVisible; }
56 
60  void setPointer(const std::string& _name);
62  void resetToDefaultPointer();
63 
65  const std::string& getDefaultPointer() { return mDefaultName; }
67  void setDeafultPointer(const std::string& _value);
68 
69  const std::string& getLayerName() { return mLayerName; }
70  void setLayerName(const std::string& _value);
71 
73  IPointer* getByName(const std::string& _name) const;
74 
75  /*event:*/
82 
83  /*obsolete:*/
84 #ifndef MYGUI_DONT_USE_OBSOLETE
85 
86  MYGUI_OBSOLETE("use : void PointerManager::setVisible(bool _visible)")
87  void show() { setVisible(true); }
88  MYGUI_OBSOLETE("use : void PointerManager::setVisible(bool _visible)")
89  void hide() { setVisible(false); }
90  MYGUI_OBSOLETE("use : bool PointerManager::isVisible()")
91  bool isShow() { return isVisible(); }
92 
93 #endif // MYGUI_DONT_USE_OBSOLETE
94 
95  private:
96  void _unlinkWidget(Widget* _widget);
97 
98  // создает виджет
99  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);
100 
101  // удяляет неудачника
102  virtual void _destroyChildWidget(Widget* _widget);
103 
104  // удаляет всех детей
105  virtual void _destroyAllChildWidget();
106 
107  void Update();
108 
109  void notifyFrameStart(float _time);
110  void notifyChangeMouseFocus(Widget* _widget);
111  void setPointer(const std::string& _name, Widget* _owner);
112 
113  private:
114  // вектор всех детей виджетов
115  VectorWidgetPtr mWidgetChild;
116 
117  std::string mDefaultName;
118  IntPoint mPoint;
119  bool mVisible;
120  std::string mLayerName;
121  std::string mSkinName;
122 
123  Widget* mWidgetOwner;
124  StaticImage* mMousePointer;
125  IPointer* mPointer;
126  std::string mCurrentMousePointer;
127  };
128 
129 } // namespace MyGUI
130 
131 #endif // __MYGUI_POINTER_MANAGER_H__