1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SV_SLIDER_HXX
21 #define _SV_SLIDER_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/ctrl.hxx>
26 // for enum ScrollType
27 #include <vcl/scrbar.hxx>
33 class VCL_DLLPUBLIC Slider
: public Control
36 Rectangle maChannel1Rect
;
37 Rectangle maChannel2Rect
;
38 Rectangle maThumbRect
;
41 long mnThumbPixOffset
;
44 long mnChannelPixOffset
;
45 long mnChannelPixRange
;
47 long mnChannelPixBottom
;
54 sal_uInt16 mnDragDraw
;
55 sal_uInt16 mnStateFlags
;
56 ScrollType meScrollType
;
62 using Control::ImplInitSettings
;
63 using Window::ImplInit
;
64 SAL_DLLPRIVATE
void ImplInit( Window
* pParent
, WinBits nStyle
);
65 SAL_DLLPRIVATE
void ImplInitSettings();
66 SAL_DLLPRIVATE
void ImplUpdateRects( sal_Bool bUpdate
= sal_True
);
67 SAL_DLLPRIVATE
long ImplCalcThumbPos( long nPixPos
);
68 SAL_DLLPRIVATE
long ImplCalcThumbPosPix( long nPos
);
69 SAL_DLLPRIVATE
void ImplCalc( sal_Bool bUpdate
= sal_True
);
70 SAL_DLLPRIVATE
void ImplDraw( sal_uInt16 nDrawFlags
);
71 SAL_DLLPRIVATE sal_Bool
ImplIsPageUp( const Point
& rPos
);
72 SAL_DLLPRIVATE sal_Bool
ImplIsPageDown( const Point
& rPos
);
73 SAL_DLLPRIVATE
long ImplSlide( long nNewPos
, sal_Bool bCallEndSlide
);
74 SAL_DLLPRIVATE
long ImplDoAction( sal_Bool bCallEndSlide
);
75 SAL_DLLPRIVATE
void ImplDoMouseAction( const Point
& rPos
, sal_Bool bCallAction
= sal_True
);
76 SAL_DLLPRIVATE
long ImplDoSlide( long nNewPos
);
77 SAL_DLLPRIVATE
long ImplDoSlideAction( ScrollType eScrollType
);
80 Slider( Window
* pParent
, WinBits nStyle
= WB_HORZ
);
82 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
83 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
84 virtual void Tracking( const TrackingEvent
& rTEvt
);
85 virtual void KeyInput( const KeyEvent
& rKEvt
);
86 virtual void Paint( const Rectangle
& rRect
);
87 virtual void Resize();
88 virtual void RequestHelp( const HelpEvent
& rHEvt
);
89 virtual void StateChanged( StateChangedType nType
);
90 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
93 virtual void EndSlide();
95 void EnableDrag( sal_Bool bEnable
= sal_True
)
96 { mbFullDrag
= bEnable
; }
97 sal_Bool
IsDragEnabled() const { return mbFullDrag
; }
99 long GetRangeMin() const { return mnMinRange
; }
100 long GetRangeMax() const { return mnMaxRange
; }
101 void SetRange( const Range
& rRange
);
102 Range
GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); }
103 void SetThumbPos( long nThumbPos
);
104 long GetThumbPos() const { return mnThumbPos
; }
105 void SetLineSize( long nNewSize
) { mnLineSize
= nNewSize
; }
106 long GetLineSize() const { return mnLineSize
; }
107 void SetPageSize( long nNewSize
) { mnPageSize
= nNewSize
; }
108 long GetPageSize() const { return mnPageSize
; }
110 long GetDelta() const { return mnDelta
; }
112 Size
CalcWindowSizePixel();
114 void SetSlideHdl( const Link
& rLink
) { maSlideHdl
= rLink
; }
115 const Link
& GetSlideHdl() const { return maSlideHdl
; }
116 void SetEndSlideHdl( const Link
& rLink
) { maEndSlideHdl
= rLink
; }
117 const Link
& GetEndSlideHdl() const { return maEndSlideHdl
; }
120 #endif // _SV_SLIDER_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */