MyGUI  3.0.1
MyGUI_ScrollView.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_SCROLL_VIEW_H__
24 #define __MYGUI_SCROLL_VIEW_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_Widget.h"
28 #include "MyGUI_ScrollViewBase.h"
29 
30 namespace MyGUI
31 {
32 
34  public Widget,
35  protected ScrollViewBase
36  {
38 
39  public:
40  ScrollView();
41 
43  virtual void setPosition(const IntPoint& _value);
45  virtual void setSize(const IntSize& _value);
47  virtual void setCoord(const IntCoord& _value);
48 
50  void setPosition(int _left, int _top) { setPosition(IntPoint(_left, _top)); }
52  void setSize(int _width, int _height) { setSize(IntSize(_width, _height)); }
54  void setCoord(int _left, int _top, int _width, int _height) { setCoord(IntCoord(_left, _top, _width, _height)); }
55 
57  void setVisibleVScroll(bool _value);
59  bool isVisibleVScroll() { return mVisibleVScroll; }
60 
62  void setVisibleHScroll(bool _value);
64  bool isVisibleHScroll() { return mVisibleHScroll; }
65 
67  void setCanvasAlign(Align _value);
69  Align getCanvasAlign() { return mContentAlign; }
70 
72  void setCanvasSize(const IntSize& _value);
74  void setCanvasSize(int _width, int _height) { setCanvasSize(IntSize(_width, _height)); }
76  IntSize getCanvasSize();
77 
79  const IntCoord& getClientCoord();
80 
82  virtual void setProperty(const std::string& _key, const std::string& _value);
83 
84  /*internal:*/
85  virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
86 
87  /*obsolete:*/
88 #ifndef MYGUI_DONT_USE_OBSOLETE
89 
90  MYGUI_OBSOLETE("use : void Widget::setCoord(const IntCoord& _coord)")
91  void setPosition(const IntCoord& _coord) { setCoord(_coord); }
92  MYGUI_OBSOLETE("use : void Widget::setCoord(int _left, int _top, int _width, int _height)")
93  void setPosition(int _left, int _top, int _width, int _height) { setCoord(_left, _top, _width, _height); }
94 
95  MYGUI_OBSOLETE("use : void ScrollView::setVisibleVScroll(bool _visible)")
96  void showVScroll(bool _visible) { setVisibleVScroll(_visible); }
97  MYGUI_OBSOLETE("use : bool ScrollView::isVisibleVScroll()")
98  bool isShowVScroll() { return isVisibleVScroll(); }
99  MYGUI_OBSOLETE("use : void ScrollView::setVisibleHScroll(bool _visible)")
100  void showHScroll(bool _visible) { setVisibleHScroll(_visible); }
101  MYGUI_OBSOLETE("use : bool ScrollView::isVisibleHScroll()")
102  bool isShowHScroll() { return isVisibleHScroll(); }
103 
104 #endif // MYGUI_DONT_USE_OBSOLETE
105 
106  protected:
107  virtual ~ScrollView();
108 
109  void baseChangeWidgetSkin(ResourceSkin* _info);
110 
111  // переопределяем для присвоению холста
112  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);
113 
114  void notifyMouseSetFocus(Widget* _sender, Widget* _old);
115  void notifyMouseLostFocus(Widget* _sender, Widget* _new);
116  void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
117  void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id);
118 
119  void notifyScrollChangePosition(VScroll* _sender, size_t _position);
120  void notifyMouseWheel(Widget* _sender, int _rel);
121 
122  virtual void onKeyLostFocus(Widget* _new);
123  virtual void onKeySetFocus(Widget* _old);
124 
125  void updateScrollViewState();
126  void updateView();
127 
128  private:
129  void initialiseWidgetSkin(ResourceSkin* _info);
130  void shutdownWidgetSkin();
131 
132  // размер данных
133  virtual IntSize getContentSize();
134  // смещение данных
135  virtual IntPoint getContentPosition();
136  virtual void setContentPosition(const IntPoint& _point);
137  // размер окна, через которые видно данные
138  virtual IntSize getViewSize() const;
139  // размер на который прокручиваются данные при щелчке по скролу
140  virtual size_t getVScrollPage();
141  virtual size_t getHScrollPage();
142 
143  virtual Align getContentAlign() { return mContentAlign; }
144 
145  protected:
146  bool mIsFocus;
148 
151 
152  };
153 
154 } // namespace MyGUI
155 
156 #endif // __MYGUI_SCROLL_VIEW_H__