MyGUI 3.0.1
|
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_VSCROLL_H__ 00024 #define __MYGUI_VSCROLL_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 #include "MyGUI_Widget.h" 00028 #include "MyGUI_EventPair.h" 00029 00030 namespace MyGUI 00031 { 00032 00033 typedef delegates::CDelegate2<VScroll*, size_t> EventHandle_VScrollPtrSizeT; 00034 00035 class MYGUI_EXPORT VScroll : 00036 public Widget 00037 { 00038 MYGUI_RTTI_DERIVED( VScroll ) 00039 00040 public: 00041 VScroll(); 00042 00044 void setScrollRange(size_t _value); 00046 size_t getScrollRange() { return mScrollRange; } 00047 00049 void setScrollPosition(size_t _value); 00051 size_t getScrollPosition() { return mScrollPosition; } 00052 00056 void setScrollPage(size_t _value) { mScrollPage = _value; } 00058 size_t getScrollPage() { return mScrollPage; } 00059 00063 void setScrollViewPage(size_t _value) { mScrollViewPage = _value; } 00065 size_t getScrollViewPage() { return mScrollViewPage; } 00066 00068 virtual int getLineSize(); 00069 00073 virtual void setTrackSize(int _value); 00075 virtual int getTrackSize(); 00076 00078 void setMinTrackSize(int _value) { mMinTrackSize = _value; } 00080 int getMinTrackSize() { return mMinTrackSize; } 00081 00086 void setMoveToClick(bool _value) { mMoveToClick = _value; } 00088 bool getMoveToClick() { return mMoveToClick; } 00089 00091 virtual void setPosition(const IntPoint& _value); 00093 virtual void setSize(const IntSize& _value); 00095 virtual void setCoord(const IntCoord& _value); 00096 00098 void setPosition(int _left, int _top) { setPosition(IntPoint(_left, _top)); } 00100 void setSize(int _width, int _height) { setSize(IntSize(_width, _height)); } 00102 void setCoord(int _left, int _top, int _width, int _height) { setCoord(IntCoord(_left, _top, _width, _height)); } 00103 00105 virtual void setProperty(const std::string& _key, const std::string& _value); 00106 00107 /*event:*/ 00113 EventPair<EventHandle_WidgetSizeT, EventHandle_VScrollPtrSizeT> eventScrollChangePosition; 00114 00115 00116 /*internal:*/ 00117 virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name); 00118 00119 /*obsolete:*/ 00120 #ifndef MYGUI_DONT_USE_OBSOLETE 00121 00122 MYGUI_OBSOLETE("use : void Widget::setCoord(const IntCoord& _coord)") 00123 void setPosition(const IntCoord& _coord) { setCoord(_coord); } 00124 MYGUI_OBSOLETE("use : void Widget::setCoord(int _left, int _top, int _width, int _height)") 00125 void setPosition(int _left, int _top, int _width, int _height) { setCoord(_left, _top, _width, _height); } 00126 00127 #endif // MYGUI_DONT_USE_OBSOLETE 00128 00129 protected: 00130 virtual ~VScroll(); 00131 00132 void baseChangeWidgetSkin(ResourceSkin* _info); 00133 00134 virtual void updateTrack(); 00135 virtual void TrackMove(int _left, int _top); 00136 00137 virtual void onMouseWheel(int _rel); 00138 00139 void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id); 00140 void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id); 00141 void notifyMouseDrag(Widget* _sender, int _left, int _top); 00142 void notifyMouseWheel(Widget* _sender, int _rel); 00143 00144 private: 00145 void initialiseWidgetSkin(ResourceSkin* _info); 00146 void shutdownWidgetSkin(); 00147 00148 protected: 00149 // наши кнопки 00150 Button* mWidgetStart; 00151 Button* mWidgetEnd; 00152 Button* mWidgetTrack; 00153 // куски между кнопками 00154 Button* mWidgetFirstPart; 00155 Button* mWidgetSecondPart; 00156 00157 // смещение внутри окна 00158 IntPoint mPreActionOffset; 00159 00160 // диапазон на который трек может двигаться 00161 size_t mSkinRangeStart; 00162 size_t mSkinRangeEnd; 00163 00164 size_t mScrollRange; 00165 size_t mScrollPosition; 00166 size_t mScrollPage; // на сколько перещелкивать, при щелчке на кнопке 00167 size_t mScrollViewPage; // на сколько перещелкивать, при щелчке по полосе 00168 00169 int mMinTrackSize; 00170 bool mMoveToClick; 00171 00172 }; 00173 00174 } // namespace MyGUI 00175 00176 #endif // __MYGUI_VSCROLL_H__