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 INCLUDED_VCL_SLIDER_HXX
21 #define INCLUDED_VCL_SLIDER_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/ctrl.hxx>
25 #include <vcl/scrbar.hxx>
27 class VCL_DLLPUBLIC Slider
: public Control
30 Rectangle maChannel1Rect
;
31 Rectangle maChannel2Rect
;
32 Rectangle maThumbRect
;
35 long mnThumbPixOffset
;
38 long mnChannelPixOffset
;
39 long mnChannelPixRange
;
41 long mnChannelPixBottom
;
48 sal_uInt16 mnDragDraw
;
49 sal_uInt16 mnDrawFlags
;
50 sal_uInt16 mnStateFlags
;
51 ScrollType meScrollType
;
57 using Control::ImplInitSettings
;
58 using Window::ImplInit
;
59 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
60 SAL_DLLPRIVATE
void ImplInitSettings();
61 SAL_DLLPRIVATE
void ImplUpdateRects( bool bUpdate
= true );
62 SAL_DLLPRIVATE
long ImplCalcThumbPos( long nPixPos
);
63 SAL_DLLPRIVATE
long ImplCalcThumbPosPix( long nPos
);
64 SAL_DLLPRIVATE
void ImplCalc( bool bUpdate
= true );
65 SAL_DLLPRIVATE
void ImplDraw(vcl::RenderContext
& rRenderContext
, sal_uInt16 nDrawFlags
);
66 SAL_DLLPRIVATE
bool ImplIsPageUp( const Point
& rPos
);
67 SAL_DLLPRIVATE
bool ImplIsPageDown( const Point
& rPos
);
68 SAL_DLLPRIVATE
long ImplSlide( long nNewPos
, bool bCallEndSlide
);
69 SAL_DLLPRIVATE
long ImplDoAction( bool bCallEndSlide
);
70 SAL_DLLPRIVATE
void ImplDoMouseAction( const Point
& rPos
, bool bCallAction
= true );
71 SAL_DLLPRIVATE
long ImplDoSlide( long nNewPos
);
72 SAL_DLLPRIVATE
long ImplDoSlideAction( ScrollType eScrollType
);
75 Slider( vcl::Window
* pParent
, WinBits nStyle
= WB_HORZ
);
77 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
78 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
79 virtual void Tracking( const TrackingEvent
& rTEvt
) SAL_OVERRIDE
;
80 virtual void KeyInput( const KeyEvent
& rKEvt
) SAL_OVERRIDE
;
81 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
82 virtual void Resize() SAL_OVERRIDE
;
83 virtual void RequestHelp( const HelpEvent
& rHEvt
) SAL_OVERRIDE
;
84 virtual void StateChanged( StateChangedType nType
) SAL_OVERRIDE
;
85 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) SAL_OVERRIDE
;
90 void EnableDrag( bool bEnable
= true )
91 { mbFullDrag
= bEnable
; }
92 bool IsDragEnabled() const { return mbFullDrag
; }
94 void SetRangeMin(long nNewRange
);
95 long GetRangeMin() const { return mnMinRange
; }
96 void SetRangeMax(long nNewRange
);
97 long GetRangeMax() const { return mnMaxRange
; }
98 void SetRange( const Range
& rRange
);
99 Range
GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); }
100 void SetThumbPos( long nThumbPos
);
101 long GetThumbPos() const { return mnThumbPos
; }
102 void SetLineSize( long nNewSize
) { mnLineSize
= nNewSize
; }
103 long GetLineSize() const { return mnLineSize
; }
104 void SetPageSize( long nNewSize
) { mnPageSize
= nNewSize
; }
105 long GetPageSize() const { return mnPageSize
; }
107 long GetDelta() const { return mnDelta
; }
109 Size
CalcWindowSizePixel();
111 void SetSlideHdl( const Link
<>& rLink
) { maSlideHdl
= rLink
; }
112 const Link
<>& GetSlideHdl() const { return maSlideHdl
; }
113 void SetEndSlideHdl( const Link
<>& rLink
) { maEndSlideHdl
= rLink
; }
114 const Link
<>& GetEndSlideHdl() const { return maEndSlideHdl
; }
117 #endif // INCLUDED_VCL_SLIDER_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */