diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-02 16:44:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-08-03 20:23:49 +0200 |
commit | 6c12f6dca251ba583297090def8aa9597a818c14 (patch) | |
tree | 8437a70e0df8c00684d8f2bee45796f562b44d1e /include/vcl | |
parent | adc15ce09e5f7fbcf5857238a9898f96da5acb9f (diff) |
tdf#117388 use native scrollbar under gtk in writer
with the motivation that for gtk4 theming for vcl scrollbar isn't
available, so it looks super yuck but this should also support the
long-press scrolling thing under gtk3 as a side effect.
Change-Id: Iada5a66087d5aa982f9213d7ec0a05f6177f4e66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137750
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/scrbar.hxx | 40 | ||||
-rw-r--r-- | include/vcl/scrollable.hxx | 50 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 2 | ||||
-rw-r--r-- | include/vcl/window.hxx | 7 |
4 files changed, 78 insertions, 21 deletions
diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx index 240a1c7e8aa9..dd8f309152b6 100644 --- a/include/vcl/scrbar.hxx +++ b/include/vcl/scrbar.hxx @@ -22,11 +22,13 @@ #include <vcl/dllapi.h> #include <vcl/ctrl.hxx> +#include <vcl/scrollable.hxx> #include <memory> struct ImplScrollBarData; class VCL_DLLPUBLIC ScrollBar : public Control + , public Scrollable { private: tools::Rectangle maBtn1Rect; @@ -97,27 +99,29 @@ public: void Scroll(); virtual void EndScroll(); - tools::Long DoScroll( tools::Long nNewPos ); - tools::Long DoScrollAction( ScrollType eScrollType ); + tools::Long DoScroll( tools::Long nNewPos ) override; + tools::Long DoScrollAction( ScrollType eScrollType ); void EnableDrag() { mbFullDrag = true; } - void SetRangeMin( tools::Long nNewRange ); - tools::Long GetRangeMin() const { return mnMinRange; } - void SetRangeMax( tools::Long nNewRange ); - tools::Long GetRangeMax() const { return mnMaxRange; } - void SetRange( const Range& rRange ); - Range GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); } - void SetThumbPos( tools::Long nThumbPos ); - tools::Long GetThumbPos() const { return mnThumbPos; } - void SetLineSize( tools::Long nNewSize ) { mnLineSize = nNewSize; } - tools::Long GetLineSize() const { return mnLineSize; } - void SetPageSize( tools::Long nNewSize ) { mnPageSize = nNewSize; } - tools::Long GetPageSize() const { return mnPageSize; } - void SetVisibleSize( tools::Long nNewSize ); - tools::Long GetVisibleSize() const { return mnVisibleSize; } - - tools::Long GetDelta() const { return mnDelta; } + void SetRangeMin( tools::Long nNewRange ) override; + tools::Long GetRangeMin() const override { return mnMinRange; } + void SetRangeMax( tools::Long nNewRange ) override; + tools::Long GetRangeMax() const override { return mnMaxRange; } + void SetRange( const Range& rRange ) override; + Range GetRange() const override { return Range( GetRangeMin(), GetRangeMax() ); } + void SetThumbPos( tools::Long nThumbPos ) override; + tools::Long GetThumbPos() const override { return mnThumbPos; } + void SetLineSize( tools::Long nNewSize ) override { mnLineSize = nNewSize; } + tools::Long GetLineSize() const override { return mnLineSize; } + void SetPageSize( tools::Long nNewSize ) override { mnPageSize = nNewSize; } + tools::Long GetPageSize() const override { return mnPageSize; } + void SetVisibleSize( tools::Long nNewSize ) override; + tools::Long GetVisibleSize() const override { return mnVisibleSize; } + + bool Inactive() const override; + + tools::Long GetDelta() const { return mnDelta; } ScrollType GetType() const { return meScrollType; } void SetScrollHdl( const Link<ScrollBar*,void>& rLink ) { maScrollHdl = rLink; } diff --git a/include/vcl/scrollable.hxx b/include/vcl/scrollable.hxx new file mode 100644 index 000000000000..7544fe9b0e15 --- /dev/null +++ b/include/vcl/scrollable.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <tools/long.hxx> +#include <vcl/dllapi.h> + +class VCL_DLLPUBLIC Scrollable +{ +public: + virtual tools::Long DoScroll(tools::Long nNewPos) = 0; + + virtual void SetRangeMin(tools::Long nNewRange) = 0; + virtual tools::Long GetRangeMin() const = 0; + virtual void SetRangeMax(tools::Long nNewRange) = 0; + virtual tools::Long GetRangeMax() const = 0; + virtual void SetRange(const Range& rRange) = 0; + virtual Range GetRange() const = 0; + virtual void SetThumbPos(tools::Long nThumbPos) = 0; + virtual tools::Long GetThumbPos() const = 0; + virtual void SetLineSize(tools::Long nNewSize) = 0; + virtual tools::Long GetLineSize() const = 0; + virtual void SetPageSize(tools::Long nNewSize) = 0; + virtual tools::Long GetPageSize() const = 0; + virtual void SetVisibleSize(tools::Long nNewSize) = 0; + virtual tools::Long GetVisibleSize() const = 0; + + virtual bool Inactive() const = 0; + + virtual ~Scrollable() {} +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 1c3f19ab94ae..c886ba2af075 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2510,7 +2510,9 @@ public: virtual void adjustment_set_upper(int upper) = 0; virtual int adjustment_get_page_size() const = 0; virtual void adjustment_set_page_size(int size) = 0; + virtual int adjustment_get_page_increment() const = 0; virtual void adjustment_set_page_increment(int size) = 0; + virtual int adjustment_get_step_increment() const = 0; virtual void adjustment_set_step_increment(int size) = 0; virtual int adjustment_get_lower() const = 0; virtual void adjustment_set_lower(int upper) = 0; diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 51324a2c8060..2494f8852a68 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -43,6 +43,7 @@ struct SystemParentData; class ImplBorderWindow; class Timer; class DockingManager; +class Scrollable; class ScrollBar; class FixedText; class MouseEvent; @@ -687,7 +688,7 @@ private: SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*); SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*); - SAL_DLLPRIVATE static void ImplHandleScroll(ScrollBar* pHScrl, double nX, ScrollBar* pVScrl, double nY); + SAL_DLLPRIVATE static void ImplHandleScroll(Scrollable* pHScrl, double nX, Scrollable* pVScrl, double nY); SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const; SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const; @@ -1086,8 +1087,8 @@ public: void EndAutoScroll(); bool HandleScrollCommand( const CommandEvent& rCmd, - ScrollBar* pHScrl, - ScrollBar* pVScrl ); + Scrollable* pHScrl, + Scrollable* pVScrl ); virtual const SystemEnvData* GetSystemData() const; |