Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/slider.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
20
#pragma once
21
22
#include <vcl/ctrl.hxx>
23
24
class Slider final : public Control
25
{
26
private:
27
    tools::Rectangle       maChannel1Rect;
28
    tools::Rectangle       maChannel2Rect;
29
    tools::Rectangle       maThumbRect;
30
    tools::Long            mnStartPos;
31
    tools::Long            mnMouseOff;
32
    tools::Long            mnThumbPixOffset;
33
    tools::Long            mnThumbPixRange;
34
    tools::Long            mnThumbPixPos;
35
    tools::Long            mnThumbSize;
36
    tools::Long            mnChannelPixRange;
37
    tools::Long            mnChannelPixTop;
38
    tools::Long            mnChannelPixBottom;
39
    tools::Long            mnMinRange;
40
    tools::Long            mnMaxRange;
41
    tools::Long            mnThumbPos;
42
    tools::Long            mnLineSize;
43
    tools::Long            mnPageSize;
44
    sal_uInt16      mnStateFlags;
45
    ScrollType      meScrollType;
46
    bool            mbCalcSize;
47
48
    Link<Slider*,void>   maSlideHdl;
49
50
    using Control::ImplInitSettings;
51
    using Window::ImplInit;
52
    void ImplInitSettings();
53
    void ImplUpdateRects( bool bUpdate = true );
54
    tools::Long ImplCalcThumbPos( tools::Long nPixPos ) const;
55
    tools::Long ImplCalcThumbPosPix( tools::Long nPos ) const;
56
    void ImplCalc( bool bUpdate = true );
57
    void ImplDraw(vcl::RenderContext& rRenderContext);
58
    bool ImplIsPageUp( const Point& rPos ) const;
59
    bool ImplIsPageDown( const Point& rPos ) const;
60
    tools::Long ImplSlide( tools::Long nNewPos );
61
    tools::Long ImplDoAction( );
62
    void ImplDoMouseAction( const Point& rPos, bool bCallAction );
63
    void ImplDoSlide( tools::Long nNewPos );
64
    void ImplDoSlideAction( ScrollType eScrollType );
65
66
public:
67
                    Slider( vcl::Window* pParent, WinBits nStyle);
68
    virtual         ~Slider() override;
69
    virtual void    MouseButtonDown( const MouseEvent& rMEvt ) override;
70
    virtual void    MouseButtonUp( const MouseEvent& rMEvt ) override;
71
    virtual void    Tracking( const TrackingEvent& rTEvt ) override;
72
    virtual void    KeyInput( const KeyEvent& rKEvt ) override;
73
    virtual void    Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
74
    virtual void    Resize() override;
75
    virtual void    StateChanged( StateChangedType nType ) override;
76
    virtual void    DataChanged( const DataChangedEvent& rDCEvt ) override;
77
78
    void            Slide();
79
80
    void            SetRangeMin(tools::Long nNewRange);
81
0
    tools::Long            GetRangeMin() const { return mnMinRange; }
82
    void            SetRangeMax(tools::Long nNewRange);
83
0
    tools::Long            GetRangeMax() const { return mnMaxRange; }
84
    void            SetRange( const Range& rRange );
85
    void            SetThumbPos( tools::Long nThumbPos );
86
0
    tools::Long            GetThumbPos() const { return mnThumbPos; }
87
0
    void            SetLineSize( tools::Long nNewSize ) { mnLineSize = nNewSize; }
88
0
    tools::Long            GetLineSize() const { return mnLineSize; }
89
0
    void            SetPageSize( tools::Long nNewSize ) { mnPageSize = nNewSize; }
90
0
    tools::Long            GetPageSize() const { return mnPageSize; }
91
92
    Size            CalcWindowSizePixel() const;
93
94
0
    void            SetSlideHdl( const Link<Slider*,void>& rLink ) { maSlideHdl = rLink; }
95
};
96
97
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */