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 -*- */
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 */
20#pragma once
23#error "don't use this in new code"
26#include <vcl/dllapi.h>
27#include <vcl/ctrl.hxx>
28#include <vcl/scrollable.hxx>
29#include <memory>
33class VCL_DLLPUBLIC ScrollBar final : public Control
34 , public Scrollable
43 std::unique_ptr<ImplScrollBarData> mpData;
56 sal_uInt16 mnStateFlags;
63 SAL_DLLPRIVATE tools::Rectangle* ImplFindPartRect( const Point& rPt );
64 using Window::ImplInit;
65 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
66 SAL_DLLPRIVATE void ImplInitStyle( WinBits nStyle );
67 SAL_DLLPRIVATE void ImplUpdateRects( bool bUpdate = true );
68 SAL_DLLPRIVATE tools::Long ImplCalcThumbPos( tools::Long nPixPos ) const;
69 SAL_DLLPRIVATE tools::Long ImplCalcThumbPosPix( tools::Long nPos ) const;
70 SAL_DLLPRIVATE void ImplCalc( bool bUpdate = true );
71 SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
72 using Window::ImplScroll;
73 SAL_DLLPRIVATE tools::Long ImplScroll( tools::Long nNewPos, bool bCallEndScroll );
74 SAL_DLLPRIVATE tools::Long ImplDoAction( bool bCallEndScroll );
75 SAL_DLLPRIVATE void ImplDoMouseAction( const Point& rPos, bool bCallAction = true );
76 SAL_DLLPRIVATE void ImplInvert();
77 SAL_DLLPRIVATE bool ImplDrawNative(vcl::RenderContext& rRenderContext, sal_uInt16 SystemTextColorFlags);
78 SAL_DLLPRIVATE void ImplDragThumb( const Point& rMousePos );
79 SAL_DLLPRIVATE Size getCurrentCalcSize() const;
80 DECL_DLLPRIVATE_LINK( ImplAutoTimerHdl, Timer*, void );
83 explicit ScrollBar( vcl::Window* pParent, WinBits nStyle = WB_VERT );
84 virtual ~ScrollBar() override;
85 virtual void dispose() override;
87 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
88 virtual void Tracking(const TrackingEvent& rTEvt) override;
89 virtual void KeyInput(const KeyEvent& rKEvt) override;
90 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
91 virtual void Draw(OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags) override;
92 virtual void Move() override;
93 virtual void Resize() override;
94 virtual void StateChanged(StateChangedType nType) override;
95 virtual void DataChanged(const DataChangedEvent& rDCEvt) override;
96 virtual bool PreNotify(NotifyEvent& rNEvt) override;
97 virtual void GetFocus() override;
98 virtual void LoseFocus() override;
99 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
101 using Window::Scroll;
102 void Scroll();
103 void EndScroll();
105 tools::Long DoScroll( tools::Long nNewPos ) override;
106 tools::Long DoScrollAction( ScrollType eScrollType );
108 void EnableDrag() { mbFullDrag = true; }
110 void SetRangeMin( tools::Long nNewRange ) override;
111 tools::Long GetRangeMin() const override { return mnMinRange; }
112 void SetRangeMax( tools::Long nNewRange ) override;
113 tools::Long GetRangeMax() const override { return mnMaxRange; }
114 void SetRange( const Range& rRange ) override;
115 Range GetRange() const override { return Range( GetRangeMin(), GetRangeMax() ); }
116 void SetThumbPos( tools::Long nThumbPos ) override;
117 tools::Long GetThumbPos() const override { return mnThumbPos; }
118 void SetLineSize( tools::Long nNewSize ) override { mnLineSize = nNewSize; }
119 tools::Long GetLineSize() const override { return mnLineSize; }
120 void SetPageSize( tools::Long nNewSize ) override { mnPageSize = nNewSize; }
121 tools::Long GetPageSize() const override { return mnPageSize; }
122 void SetVisibleSize( tools::Long nNewSize ) override;
123 tools::Long GetVisibleSize() const override { return mnVisibleSize; }
125 bool Inactive() const override;
127 tools::Long GetDelta() const { return mnDelta; }
128 ScrollType GetType() const { return meScrollType; }
130 void SetScrollHdl( const Link<ScrollBar*,void>& rLink ) { maScrollHdl = rLink; }
131 const Link<ScrollBar*,void>& GetScrollHdl() const { return maScrollHdl; }
132 void SetEndScrollHdl( const Link<ScrollBar*,void>& rLink ) { maEndScrollHdl = rLink; }
134 virtual Size GetOptimalSize() const override;
141 using Window::ImplInit;
142 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
144 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
147 explicit ScrollBarBox( vcl::Window* pParent, WinBits nStyle = 0 );
149 virtual void StateChanged( StateChangedType nType ) override;
150 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
153/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: ctrl.hxx:80
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: ctrl.cxx:413
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:256
virtual void Resize() override
Definition: ctrl.cxx:77
virtual Size GetOptimalSize() const override
Definition: ctrl.cxx:369
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: ctrl.cxx:61
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
ScrollType meScrollType
Definition: scrbar.hxx:57
bool mbFullDrag
Definition: scrbar.hxx:59
sal_uInt16 mnStateFlags
Definition: scrbar.hxx:56
Link< ScrollBar *, void > maScrollHdl
Definition: scrbar.hxx:60
tools::Long mnMinRange
Definition: scrbar.hxx:49
tools::Long mnVisibleSize
Definition: scrbar.hxx:52
tools::Rectangle maBtn1Rect
Definition: scrbar.hxx:37
std::unique_ptr< ImplScrollBarData > mpData
Definition: scrbar.hxx:43
Range GetRange() const override
Definition: scrbar.hxx:115
tools::Rectangle maThumbRect
Definition: scrbar.hxx:41
void EnableDrag()
Definition: scrbar.hxx:108
tools::Long mnThumbPixPos
Definition: scrbar.hxx:47
void SetScrollHdl(const Link< ScrollBar *, void > &rLink)
Definition: scrbar.hxx:130
void SetEndScrollHdl(const Link< ScrollBar *, void > &rLink)
Definition: scrbar.hxx:132
tools::Long GetLineSize() const override
Definition: scrbar.hxx:119
tools::Rectangle maTrackRect
Definition: scrbar.hxx:42
tools::Long mnStartPos
Definition: scrbar.hxx:44
void SetLineSize(tools::Long nNewSize) override
Definition: scrbar.hxx:118
tools::Rectangle maBtn2Rect
Definition: scrbar.hxx:38
DECL_DLLPRIVATE_LINK(ImplAutoTimerHdl, Timer *, void)
tools::Long GetDelta() const
Definition: scrbar.hxx:127
void SetPageSize(tools::Long nNewSize) override
Definition: scrbar.hxx:120
tools::Long mnThumbPos
Definition: scrbar.hxx:51
tools::Rectangle maPage2Rect
Definition: scrbar.hxx:40
tools::Long GetRangeMin() const override
Definition: scrbar.hxx:111
tools::Long mnMouseOff
Definition: scrbar.hxx:45
tools::Long mnPageSize
Definition: scrbar.hxx:54
tools::Long GetPageSize() const override
Definition: scrbar.hxx:121
ScrollType GetType() const
Definition: scrbar.hxx:128
tools::Long mnThumbPixSize
Definition: scrbar.hxx:48
tools::Long mnDelta
Definition: scrbar.hxx:55
const Link< ScrollBar *, void > & GetScrollHdl() const
Definition: scrbar.hxx:131
tools::Long mnMaxRange
Definition: scrbar.hxx:50
tools::Long mnThumbPixRange
Definition: scrbar.hxx:46
tools::Long mnLineSize
Definition: scrbar.hxx:53
bool mbCalcSize
Definition: scrbar.hxx:58
Link< ScrollBar *, void > maEndScrollHdl
Definition: scrbar.hxx:61
tools::Rectangle maPage1Rect
Definition: scrbar.hxx:39
tools::Long GetVisibleSize() const override
Definition: scrbar.hxx:123
tools::Long GetRangeMax() const override
Definition: scrbar.hxx:113
tools::Long GetThumbPos() const override
Definition: scrbar.hxx:117
virtual void SetRangeMin(tools::Long nNewRange)=0
virtual void SetRange(const Range &rRange)=0
virtual bool Inactive() const =0
virtual void SetVisibleSize(tools::Long nNewSize)=0
virtual void SetThumbPos(tools::Long nThumbPos)=0
virtual tools::Long GetRangeMin() const =0
virtual tools::Long DoScroll(tools::Long nNewPos)=0
virtual void SetRangeMax(tools::Long nNewRange)=0
virtual tools::Long GetRangeMax() const =0
Definition: timer.hxx:27
SAL_DLLPRIVATE void ImplScroll(const tools::Rectangle &rRect, tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags)
Definition: paint.cxx:1635
virtual void GetFocus()
Definition: window.cxx:1841
virtual void Tracking(const TrackingEvent &rTEvt)
Definition: window.cxx:1932
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1805
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
virtual void Move()
Definition: window.cxx:1833
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:52
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Definition: window.cxx:2944
virtual void Draw(::OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags)
Definition: window.cxx:1829
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual void LoseFocus()
Definition: window.cxx:1855
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:941
Definition: dllapi.h:29
long Long
Definition: vclenum.hxx:372
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_VERT
Definition: wintypes.hxx:145