1 /* 2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 3 * Distributed under the MIT License 4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 5 */ 6 7 #ifndef MYGUI_SCROLL_VIEW_H_ 8 #define MYGUI_SCROLL_VIEW_H_ 9 10 #include "MyGUI_Prerequest.h" 11 #include "MyGUI_Widget.h" 12 #include "MyGUI_ScrollViewBase.h" 13 14 namespace MyGUI 15 { 16 17 /** \brief @wpage{ScrollView} 18 ScrollView widget description should be here. 19 */ 20 class MYGUI_EXPORT ScrollView : 21 public Widget, 22 protected ScrollViewBase, 23 public MemberObsolete<ScrollView> 24 { 25 MYGUI_RTTI_DERIVED( ScrollView ) 26 27 public: 28 ScrollView(); 29 30 //! @copydoc Widget::setPosition(const IntPoint& _value) 31 void setPosition(const IntPoint& _value) override; 32 //! @copydoc Widget::setSize(const IntSize& _value) 33 void setSize(const IntSize& _value) override; 34 //! @copydoc Widget::setCoord(const IntCoord& _value) 35 void setCoord(const IntCoord& _value) override; 36 37 using Widget::setPosition; 38 using Widget::setSize; 39 using Widget::setCoord; 40 41 /** Show VScroll when content size larger than view */ 42 void setVisibleVScroll(bool _value); 43 /** Get Show VScroll flag */ 44 bool isVisibleVScroll() const; 45 46 /** Show HScroll when content size larger than view */ 47 void setVisibleHScroll(bool _value); 48 /** Get Show HScroll flag */ 49 bool isVisibleHScroll() const; 50 51 /** Set canvas align */ 52 void setCanvasAlign(Align _value); 53 /** Get canvas align */ 54 Align getCanvasAlign() const; 55 56 /** Set canvas size */ 57 void setCanvasSize(const IntSize& _value); 58 /** Set canvas size */ 59 void setCanvasSize(int _width, int _height); 60 /** Get canvas size */ 61 IntSize getCanvasSize(); 62 63 /** Get view area coordinates. */ 64 IntCoord getViewCoord() const; 65 66 /** Set view area offset. */ 67 void setViewOffset(const IntPoint& _value); 68 /** Get view area offset. */ 69 IntPoint getViewOffset() const; 70 71 protected: 72 void initialiseOverride() override; 73 void shutdownOverride() override; 74 75 void notifyScrollChangePosition(ScrollBar* _sender, size_t _position); 76 void notifyMouseWheel(Widget* _sender, int _rel); 77 78 void updateView(); 79 80 void setPropertyOverride(const std::string& _key, const std::string& _value) override; 81 82 ScrollBar* getVScroll(); 83 84 private: 85 // размер данных 86 IntSize getContentSize() override; 87 // смещение данных 88 IntPoint getContentPosition() override; 89 // размер окна, через которые видно данные 90 IntSize getViewSize() override; 91 void setContentPosition(const IntPoint& _point) override; 92 // размер на который прокручиваются данные при щелчке по скролу 93 size_t getVScrollPage() override; 94 size_t getHScrollPage() override; 95 96 Align getContentAlign() override; 97 98 protected: 99 Align mContentAlign; 100 }; 101 102 } // namespace MyGUI 103 104 #endif // MYGUI_SCROLL_VIEW_H_ 105