LibreOffice Module vcl (master)  1
slider.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_VCL_SLIDER_HXX
21 #define INCLUDED_VCL_SLIDER_HXX
22 
23 #include <vcl/dllapi.h>
24 #include <vcl/ctrl.hxx>
25 #include <vcl/scrbar.hxx>
26 
27 class Slider final : public Control
28 {
29 private:
33  long mnStartPos;
34  long mnMouseOff;
42  long mnMinRange;
43  long mnMaxRange;
44  long mnThumbPos;
45  long mnLineSize;
46  long mnPageSize;
47  sal_uInt16 mnStateFlags;
49  bool mbCalcSize;
50 
52 
54  using Window::ImplInit;
55  void ImplInit( vcl::Window* pParent, WinBits nStyle );
56  void ImplInitSettings();
57  void ImplUpdateRects( bool bUpdate = true );
58  long ImplCalcThumbPos( long nPixPos );
59  long ImplCalcThumbPosPix( long nPos );
60  void ImplCalc( bool bUpdate = true );
61  void ImplDraw(vcl::RenderContext& rRenderContext);
62  bool ImplIsPageUp( const Point& rPos );
63  bool ImplIsPageDown( const Point& rPos );
64  long ImplSlide( long nNewPos );
65  long ImplDoAction( );
66  void ImplDoMouseAction( const Point& rPos, bool bCallAction );
67  void ImplDoSlide( long nNewPos );
68  void ImplDoSlideAction( ScrollType eScrollType );
69 
70 public:
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;
81 
82  void Slide();
83 
84  void SetRangeMin(long nNewRange);
85  long GetRangeMin() const { return mnMinRange; }
86  void SetRangeMax(long nNewRange);
87  long GetRangeMax() const { return mnMaxRange; }
88  void SetRange( const Range& rRange );
89  void SetThumbPos( long nThumbPos );
90  long GetThumbPos() const { return mnThumbPos; }
91  void SetLineSize( long nNewSize ) { mnLineSize = nNewSize; }
92  long GetLineSize() const { return mnLineSize; }
93  void SetPageSize( long nNewSize ) { mnPageSize = nNewSize; }
94  long GetPageSize() const { return mnPageSize; }
95 
97 
98  void SetSlideHdl( const Link<Slider*,void>& rLink ) { maSlideHdl = rLink; }
99 };
100 
101 #endif // INCLUDED_VCL_SLIDER_HXX
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long mnStartPos
Definition: slider.hxx:33
void SetPageSize(long nNewSize)
Definition: slider.hxx:93
void SetSlideHdl(const Link< Slider *, void > &rLink)
Definition: slider.hxx:98
long GetLineSize() const
Definition: slider.hxx:92
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: slider.cxx:723
long mnLineSize
Definition: slider.hxx:45
long GetRangeMin() const
Definition: slider.hxx:85
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: slider.cxx:605
void ImplDraw(vcl::RenderContext &rRenderContext)
Definition: slider.cxx:326
Link< Slider *, void > maSlideHdl
Definition: slider.hxx:51
void SetRange(const Range &rRange)
Definition: slider.cxx:850
long mnThumbPixPos
Definition: slider.hxx:37
void ImplCalc(bool bUpdate=true)
Definition: slider.cxx:229
long ImplCalcThumbPos(long nPixPos)
Definition: slider.cxx:205
long GetThumbPos() const
Definition: slider.hxx:90
long ImplSlide(long nNewPos)
Definition: slider.cxx:499
void SetLineSize(long nNewSize)
Definition: slider.hxx:91
virtual void StateChanged(StateChangedType nType) override
Definition: slider.cxx:777
void SetRangeMin(long nNewRange)
Definition: slider.cxx:840
long mnMouseOff
Definition: slider.hxx:34
virtual void Resize() override
Definition: slider.cxx:768
StateChangedType
Definition: window.hxx:310
sal_Int64 WinBits
void SetThumbPos(long nThumbPos)
Definition: slider.cxx:874
void ImplDoSlideAction(ScrollType eScrollType)
Definition: slider.cxx:593
void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:39
void ImplDoMouseAction(const Point &rPos, bool bCallAction)
Definition: slider.cxx:540
ScrollType meScrollType
Definition: slider.hxx:48
long mnPageSize
Definition: slider.hxx:46
long GetRangeMax() const
Definition: slider.hxx:87
tools::Rectangle maChannel1Rect
Definition: slider.hxx:30
void Slide()
Definition: slider.cxx:835
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: slider.cxx:823
Size CalcWindowSizePixel()
Definition: slider.cxx:888
long ImplDoAction()
Definition: slider.cxx:511
long mnMinRange
Definition: slider.hxx:42
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: slider.cxx:647
bool ImplIsPageUp(const Point &rPos)
Definition: slider.cxx:465
ScrollType
Definition: scrbar.hxx:28
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
long GetPageSize() const
Definition: slider.hxx:94
long mnThumbPixOffset
Definition: slider.hxx:35
Slider(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:64
long mnChannelPixRange
Definition: slider.hxx:39
long mnThumbPos
Definition: slider.hxx:44
void ImplDoSlide(long nNewPos)
Definition: slider.cxx:583
long mnThumbPixRange
Definition: slider.hxx:36
long ImplCalcThumbPosPix(long nPos)
Definition: slider.cxx:214
Definition: ctrl.hxx:33
void ImplUpdateRects(bool bUpdate=true)
Definition: slider.cxx:98
void ImplInitSettings()
Definition: slider.cxx:75
long mnThumbSize
Definition: slider.hxx:38
bool ImplIsPageDown(const Point &rPos)
Definition: slider.cxx:482
long mnChannelPixTop
Definition: slider.hxx:40
long mnMaxRange
Definition: slider.hxx:43
tools::Rectangle maThumbRect
Definition: slider.hxx:32
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: slider.cxx:651
void ImplInitSettings()
Definition: ctrl.cxx:428
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: slider.cxx:763
tools::Rectangle maChannel2Rect
Definition: slider.hxx:31
sal_uInt16 mnStateFlags
Definition: slider.hxx:47
virtual ~Slider() override
Definition: slider.cxx:70
bool mbCalcSize
Definition: slider.hxx:49
long mnChannelPixBottom
Definition: slider.hxx:41
void SetRangeMax(long nNewRange)
Definition: slider.cxx:845