MyGUI  3.2.0
MyGUI_ScrollBar.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_SCROLL_BAR_H__
00023 #define __MYGUI_SCROLL_BAR_H__
00024 
00025 #include "MyGUI_Prerequest.h"
00026 #include "MyGUI_Widget.h"
00027 
00028 namespace MyGUI
00029 {
00030 
00031     typedef delegates::CMultiDelegate2<ScrollBar*, size_t> EventHandle_ScrollBarPtrSizeT;
00032 
00033     class MYGUI_EXPORT ScrollBar :
00034         public Widget,
00035         public MemberObsolete<ScrollBar>
00036     {
00037         MYGUI_RTTI_DERIVED( ScrollBar )
00038 
00039     public:
00040         ScrollBar();
00041 
00043         void setVerticalAlignment(bool _value);
00045         bool getVerticalAlignment() const;
00046 
00048         void setScrollRange(size_t _value);
00050         size_t getScrollRange() const;
00051 
00053         void setScrollPosition(size_t _value);
00055         size_t getScrollPosition() const;
00056 
00060         void setScrollPage(size_t _value);
00062         size_t getScrollPage() const;
00063 
00067         void setScrollViewPage(size_t _value);
00069         size_t getScrollViewPage() const;
00070 
00072         int getLineSize() const;
00073 
00077         void setTrackSize(int _value);
00079         int getTrackSize() const;
00080 
00082         void setMinTrackSize(int _value);
00084         int getMinTrackSize() const;
00085 
00090         void setMoveToClick(bool _value);
00092         bool getMoveToClick() const;
00093 
00095         virtual void setPosition(const IntPoint& _value);
00097         virtual void setSize(const IntSize& _value);
00099         virtual void setCoord(const IntCoord& _value);
00100 
00102         void setPosition(int _left, int _top);
00104         void setSize(int _width, int _height);
00106         void setCoord(int _left, int _top, int _width, int _height);
00107 
00108     /*events:*/
00114         EventHandle_ScrollBarPtrSizeT
00115             eventScrollChangePosition;
00116 
00117     protected:
00118         virtual void initialiseOverride();
00119         virtual void shutdownOverride();
00120 
00121         void updateTrack();
00122         void TrackMove(int _left, int _top);
00123 
00124         virtual void onMouseWheel(int _rel);
00125 
00126         void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
00127         void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id);
00128         void notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id);
00129         void notifyMouseWheel(Widget* _sender, int _rel);
00130 
00131         virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
00132 
00133         int getTrackPlaceLength() const;
00134 
00135     protected:
00136         // наши кнопки
00137         Button* mWidgetStart;
00138         Button* mWidgetEnd;
00139         Button* mWidgetTrack;
00140         // куски между кнопками
00141         Widget* mWidgetFirstPart;
00142         Widget* mWidgetSecondPart;
00143 
00144         // смещение внутри окна
00145         IntPoint mPreActionOffset;
00146 
00147         // диапазон на который трек может двигаться
00148         size_t mSkinRangeStart;
00149         size_t mSkinRangeEnd;
00150 
00151         size_t mScrollRange;
00152         size_t mScrollPosition;
00153         size_t mScrollPage; // на сколько перещелкивать, при щелчке на кнопке
00154         size_t mScrollViewPage; // на сколько перещелкивать, при щелчке по полосе
00155 
00156         int mMinTrackSize;
00157         bool mMoveToClick;
00158 
00159         bool mVerticalAlignment;
00160     };
00161 
00162 } // namespace MyGUI
00163 
00164 #endif // __MYGUI_SCROLL_BAR_H__