LibreOffice Module vcl (master)  1
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
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 .
18  */
23 #include <vcl/dllapi.h>
24 #include <vcl/ctrl.hxx>
25 #include <vcl/scrbar.hxx>
27 class Slider final : public Control
28 {
29 private:
47  sal_uInt16 mnStateFlags;
49  bool mbCalcSize;
54  using Window::ImplInit;
55  void ImplInit( vcl::Window* pParent, WinBits nStyle );
56  void ImplInitSettings();
57  void ImplUpdateRects( bool bUpdate = true );
60  void ImplCalc( bool bUpdate = true );
61  void ImplDraw(vcl::RenderContext& rRenderContext);
62  bool ImplIsPageUp( const Point& rPos );
63  bool ImplIsPageDown( const Point& rPos );
66  void ImplDoMouseAction( const Point& rPos, bool bCallAction );
67  void ImplDoSlide( tools::Long nNewPos );
68  void ImplDoSlideAction( ScrollType eScrollType );
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;
82  void Slide();
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; }
98  void SetSlideHdl( const Link<Slider*,void>& rLink ) { maSlideHdl = rLink; }
99 };
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetSlideHdl(const Link< Slider *, void > &rLink)
Definition: slider.hxx:98
tools::Long mnLineSize
Definition: slider.hxx:45
tools::Long mnMaxRange
Definition: slider.hxx:43
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: slider.cxx:722
void SetRangeMax(tools::Long nNewRange)
Definition: slider.cxx:844
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: slider.cxx:604
tools::Long mnMinRange
Definition: slider.hxx:42
tools::Long mnThumbPixRange
Definition: slider.hxx:36
long Long
void ImplDraw(vcl::RenderContext &rRenderContext)
Definition: slider.cxx:326
Link< Slider *, void > maSlideHdl
Definition: slider.hxx:51
tools::Long mnThumbPixOffset
Definition: slider.hxx:35
tools::Long GetRangeMax() const
Definition: slider.hxx:87
void SetRange(const Range &rRange)
Definition: slider.cxx:849
void ImplCalc(bool bUpdate=true)
Definition: slider.cxx:229
tools::Long mnChannelPixRange
Definition: slider.hxx:39
virtual void StateChanged(StateChangedType nType) override
Definition: slider.cxx:776
tools::Long mnPageSize
Definition: slider.hxx:46
tools::Long GetLineSize() const
Definition: slider.hxx:92
virtual void Resize() override
Definition: slider.cxx:767
tools::Long mnThumbPixPos
Definition: slider.hxx:37
Definition: window.hxx:317
sal_Int64 WinBits
void ImplDoSlideAction(ScrollType eScrollType)
Definition: slider.cxx:592
tools::Long mnChannelPixTop
Definition: slider.hxx:40
tools::Long mnChannelPixBottom
Definition: slider.hxx:41
void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:39
void SetThumbPos(tools::Long nThumbPos)
Definition: slider.cxx:873
void ImplDoMouseAction(const Point &rPos, bool bCallAction)
Definition: slider.cxx:539
ScrollType meScrollType
Definition: slider.hxx:48
tools::Rectangle maChannel1Rect
Definition: slider.hxx:30
void Slide()
Definition: slider.cxx:834
tools::Long GetPageSize() const
Definition: slider.hxx:94
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: slider.cxx:822
Size CalcWindowSizePixel()
Definition: slider.cxx:887
tools::Long ImplDoAction()
Definition: slider.cxx:510
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: slider.cxx:646
bool ImplIsPageUp(const Point &rPos)
Definition: slider.cxx:464
Definition: scrbar.hxx:28
tools::Long mnThumbPos
Definition: slider.hxx:44
tools::Long ImplSlide(tools::Long nNewPos)
Definition: slider.cxx:498
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
tools::Long ImplCalcThumbPosPix(tools::Long nPos)
Definition: slider.cxx:214
Slider(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:64
tools::Long mnThumbSize
Definition: slider.hxx:38
tools::Long GetThumbPos() const
Definition: slider.hxx:90
tools::Long mnMouseOff
Definition: slider.hxx:34
Definition: ctrl.hxx:33
void ImplUpdateRects(bool bUpdate=true)
Definition: slider.cxx:98
void SetRangeMin(tools::Long nNewRange)
Definition: slider.cxx:839
void ImplInitSettings()
Definition: slider.cxx:75
bool ImplIsPageDown(const Point &rPos)
Definition: slider.cxx:481
tools::Long GetRangeMin() const
Definition: slider.hxx:85
tools::Rectangle maThumbRect
Definition: slider.hxx:32
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: slider.cxx:650
void ImplInitSettings()
Definition: ctrl.cxx:428
tools::Long ImplCalcThumbPos(tools::Long nPixPos)
Definition: slider.cxx:205
void ImplDoSlide(tools::Long nNewPos)
Definition: slider.cxx:582
void SetPageSize(tools::Long nNewSize)
Definition: slider.hxx:93
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: slider.cxx:762
tools::Rectangle maChannel2Rect
Definition: slider.hxx:31
sal_uInt16 mnStateFlags
Definition: slider.hxx:47
virtual ~Slider() override
Definition: slider.cxx:70
void SetLineSize(tools::Long nNewSize)
Definition: slider.hxx:91
bool mbCalcSize
Definition: slider.hxx:49
tools::Long mnStartPos
Definition: slider.hxx:33