CtrlLib: SliderCtrl::Jump

git-svn-id: svn://ultimatepp.org/upp/trunk@1971 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-01-28 18:58:26 +00:00
parent 9a6deed2ad
commit 09a9f908b3
2 changed files with 10 additions and 1 deletions

View file

@ -8,6 +8,7 @@ SliderCtrl::SliderCtrl()
, max(100)
, step(1)
, round_step(true)
, jump(false)
{
Transparent();
NoWantFocus();
@ -80,7 +81,13 @@ void SliderCtrl::LeftDown(Point pos, dword keyflags)
else
if(p >= thumb && p < thumb + HoVe(CtrlImg::hthumb().GetSize().cx, CtrlImg::vthumb().GetSize().cy))
SetCapture();
else {
else
if(jump) {
value = ClientToSlider(p);
WhenSlideFinish();
UpdateActionRefresh();
}
else {
if( ( ( p < thumb) && (min == Min() ) ) || ( (p > thumb) && ( min == Max() ) ) )
Dec();
else

View file

@ -2,6 +2,7 @@ class SliderCtrl : public Ctrl {
int value;
int min, max, step;
bool round_step;
bool jump;
int SliderToClient(int value) const;
int ClientToSlider(int x) const;
@ -41,6 +42,7 @@ public:
int GetMax() const { return max; }
bool IsVert() const;
void Jump(bool v = true) { jump = v; }
SliderCtrl& Step(int _step, bool _r = true) { step = _step; round_step = _r; return *this; }
int GetStep() const { return step; }