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/toolkit/scrbar.hxx>
27 class Slider final
: public Control
30 tools::Rectangle maChannel1Rect
;
31 tools::Rectangle maChannel2Rect
;
32 tools::Rectangle maThumbRect
;
33 tools::Long mnStartPos
;
34 tools::Long mnMouseOff
;
35 tools::Long mnThumbPixOffset
;
36 tools::Long mnThumbPixRange
;
37 tools::Long mnThumbPixPos
;
38 tools::Long mnThumbSize
;
39 tools::Long mnChannelPixRange
;
40 tools::Long mnChannelPixTop
;
41 tools::Long mnChannelPixBottom
;
42 tools::Long mnMinRange
;
43 tools::Long mnMaxRange
;
44 tools::Long mnThumbPos
;
45 tools::Long mnLineSize
;
46 tools::Long mnPageSize
;
47 sal_uInt16 mnStateFlags
;
48 ScrollType meScrollType
;
51 Link
<Slider
*,void> maSlideHdl
;
53 using Control::ImplInitSettings
;
54 using Window::ImplInit
;
55 void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
56 void ImplInitSettings();
57 void ImplUpdateRects( bool bUpdate
= true );
58 tools::Long
ImplCalcThumbPos( tools::Long nPixPos
) const;
59 tools::Long
ImplCalcThumbPosPix( tools::Long nPos
) const;
60 void ImplCalc( bool bUpdate
= true );
61 void ImplDraw(vcl::RenderContext
& rRenderContext
);
62 bool ImplIsPageUp( const Point
& rPos
) const;
63 bool ImplIsPageDown( const Point
& rPos
) const;
64 tools::Long
ImplSlide( tools::Long nNewPos
);
65 tools::Long
ImplDoAction( );
66 void ImplDoMouseAction( const Point
& rPos
, bool bCallAction
);
67 void ImplDoSlide( tools::Long nNewPos
);
68 void ImplDoSlideAction( ScrollType eScrollType
);
71 Slider( vcl::Window
* pParent
, WinBits nStyle
);
72 virtual ~Slider() override
;
73 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
74 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) override
;
75 virtual void Tracking( const TrackingEvent
& rTEvt
) override
;
76 virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
77 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
78 virtual void Resize() override
;
79 virtual void StateChanged( StateChangedType nType
) override
;
80 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
84 void SetRangeMin(tools::Long nNewRange
);
85 tools::Long
GetRangeMin() const { return mnMinRange
; }
86 void SetRangeMax(tools::Long nNewRange
);
87 tools::Long
GetRangeMax() const { return mnMaxRange
; }
88 void SetRange( const Range
& rRange
);
89 void SetThumbPos( tools::Long nThumbPos
);
90 tools::Long
GetThumbPos() const { return mnThumbPos
; }
91 void SetLineSize( tools::Long nNewSize
) { mnLineSize
= nNewSize
; }
92 tools::Long
GetLineSize() const { return mnLineSize
; }
93 void SetPageSize( tools::Long nNewSize
) { mnPageSize
= nNewSize
; }
94 tools::Long
GetPageSize() const { return mnPageSize
; }
96 Size
CalcWindowSizePixel() const;
98 void SetSlideHdl( const Link
<Slider
*,void>& rLink
) { maSlideHdl
= rLink
; }
101 #endif // INCLUDED_VCL_SLIDER_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */