include/vcl/weld.hxx                          |    5 +++--
 sd/source/ui/annotations/annotationwindow.cxx |    6 +++---
 sfx2/source/control/thumbnailview.cxx         |    2 +-
 svtools/source/control/valueset.cxx           |    2 +-
 svx/source/dialog/charmap.cxx                 |    2 +-
 sw/source/uibase/dbui/mailmergehelper.cxx     |    2 +-
 sw/source/uibase/docvw/AnnotationWin2.cxx     |    8 +++++---
 vcl/source/app/salvtables.cxx                 |   14 ++++++++++----
 vcl/source/window/printdlg.cxx                |    2 +-
 vcl/unx/gtk3/gtk3gtkinst.cxx                  |   15 ++++++++++-----
 10 files changed, 36 insertions(+), 22 deletions(-)

New commits:
commit b925043f64179c23c5f7cfbc20b7c46cebdd1a26
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Feb 19 10:13:15 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Feb 19 13:33:09 2021 +0100

    rename get_vscroll_width to get_scroll_thickness
    
    and add split customize_scrollbars to form a separate set_scroll_thickness
    
    Change-Id: Ia4b1c85d6ae85b0fb7aeb852d3a91b36b63143db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111207
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 2c0c5f6b5724..14c7e77b33ea 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -400,11 +400,12 @@ public:
     {
         m_aVChangeHdl = rLink;
     }
-    virtual int get_vscroll_width() const = 0;
+    virtual int get_scroll_thickness() const = 0;
+    virtual void set_scroll_thickness(int nThickness) = 0;
 
     //trying to use custom color for a scrollbar is generally a bad idea.
     virtual void customize_scrollbars(const Color& rBackgroundColor, const 
Color& rShadowColor,
-                                      const Color& rFaceColor, int 
nMaxThickness)
+                                      const Color& rFaceColor)
         = 0;
 };
 
diff --git a/sd/source/ui/annotations/annotationwindow.cxx 
b/sd/source/ui/annotations/annotationwindow.cxx
index 00413a9b8ca2..d83e60f6f0ba 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -412,7 +412,7 @@ void AnnotationContents::DoResize()
     if( aTextHeight > aHeight )
     {
         // we need vertical scrollbars and have to reduce the width
-        aWidth -= mxVScrollbar->get_vscroll_width();
+        aWidth -= mxVScrollbar->get_scroll_thickness();
         mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
     }
     else
@@ -582,8 +582,8 @@ void AnnotationContents::SetColor()
 
     mxVScrollbar->customize_scrollbars(maColorLight,
                                        maColorDark,
-                                       maColor,
-                                       GetPrefScrollbarWidth());
+                                       maColor);
+    mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
 }
 
 void AnnotationContents::GetFocus()
diff --git a/sfx2/source/control/thumbnailview.cxx 
b/sfx2/source/control/thumbnailview.cxx
index c3ebe3bfe903..071e73f54c9c 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -359,7 +359,7 @@ void ThumbnailView::CalculateItemPositions(bool 
bScrollBarUsed)
         nScrollRatio = 0;
 
     // calculate ScrollBar width
-    tools::Long nScrBarWidth = mbAllowVScrollBar ? 
mxScrolledWindow->get_vscroll_width() : 0;
+    tools::Long nScrBarWidth = mbAllowVScrollBar ? 
mxScrolledWindow->get_scroll_thickness() : 0;
 
     // calculate maximum number of visible columns
     mnCols = static_cast<sal_uInt16>((aWinSize.Width()-nScrBarWidth) / 
mnItemWidth);
diff --git a/svtools/source/control/valueset.cxx 
b/svtools/source/control/valueset.cxx
index ce6bbaacba2a..c36605225faa 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1684,7 +1684,7 @@ void ValueSet::ImplInsertItem( 
std::unique_ptr<ValueSetItem> pItem, const size_t
 int ValueSet::GetScrollWidth() const
 {
     if (mxScrolledWindow)
-        return mxScrolledWindow->get_vscroll_width();
+        return mxScrolledWindow->get_scroll_thickness();
     return 0;
 }
 
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index a96e404353d1..253b744e3a0d 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -85,7 +85,7 @@ void SvxShowCharSet::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
     nY = aSize.Height() / ROW_COUNT;
 
     // tdf#121232 set a size request that will result in a 0 m_nXGap by default
-    mxScrollArea->set_size_request(COLUMN_COUNT * nX + 
mxScrollArea->get_vscroll_width() + 2,
+    mxScrollArea->set_size_request(COLUMN_COUNT * nX + 
mxScrollArea->get_scroll_thickness() + 2,
                                    ROW_COUNT * nY);
 }
 
diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx 
b/sw/source/uibase/dbui/mailmergehelper.cxx
index 0d086e9c8b29..2ef71463f870 100644
--- a/sw/source/uibase/dbui/mailmergehelper.cxx
+++ b/sw/source/uibase/dbui/mailmergehelper.cxx
@@ -388,7 +388,7 @@ void SwAddressPreview::Paint(vcl::RenderContext& 
rRenderContext, const tools::Re
     sal_uInt16 nStartRow = 0;
     if (m_xVScrollBar->get_vpolicy() != VclPolicyType::NEVER)
     {
-        aSize.AdjustWidth(-m_xVScrollBar->get_vscroll_width());
+        aSize.AdjustWidth(-m_xVScrollBar->get_scroll_thickness());
         nStartRow = m_xVScrollBar->vadjustment_get_value();
     }
     Size aPartSize(aSize.Width() / pImpl->nColumns,
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 133f6aa440e0..dc68377d2d7e 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -460,6 +460,9 @@ void SwAnnotationWin::Rescale()
         mxMetadataDate->set_font(aFont);
     if (mxMetadataResolved)
         mxMetadataResolved->set_font(aFont);
+    if (mxVScrollbar)
+        mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
+
 }
 
 void SwAnnotationWin::SetPosAndSize()
@@ -694,7 +697,7 @@ void SwAnnotationWin::DoResize()
     if (aTextHeight > aHeight)
     {
         // we need vertical scrollbars and have to reduce the width
-        aWidth -= mxVScrollbar->get_vscroll_width();
+        aWidth -= mxVScrollbar->get_scroll_thickness();
         mxVScrollbar->set_vpolicy(VclPolicyType::ALWAYS);
     }
     else
@@ -816,8 +819,7 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color 
aColorLight, Color aColorA
 
     mxVScrollbar->customize_scrollbars(mColorLight,
                                        mColorAnchor,
-                                       mColorDark,
-                                       GetPrefScrollbarWidth());
+                                       mColorDark);
 }
 
 void SwAnnotationWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition 
eSidebarPosition)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 31964747cd11..7bb05907ecba 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2223,13 +2223,21 @@ public:
         return VclPolicyType::NEVER;
     }
 
-    virtual int get_vscroll_width() const override
+    virtual int get_scroll_thickness() const override
     {
         return 
m_xScrolledWindow->getVertScrollBar().get_preferred_size().Width();
     }
 
+    virtual void set_scroll_thickness(int nThickness) override
+    {
+        ScrollBar& rHorzScrollBar = m_xScrolledWindow->getHorzScrollBar();
+        ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
+        rHorzScrollBar.set_height_request(nThickness);
+        rVertScrollBar.set_width_request(nThickness);
+    }
+
     virtual void customize_scrollbars(const Color& rBackgroundColor, const 
Color& rShadowColor,
-                                      const Color& rFaceColor, int nThickness) 
override
+                                      const Color& rFaceColor) override
     {
         ScrollBar& rHorzScrollBar = m_xScrolledWindow->getHorzScrollBar();
         ScrollBar& rVertScrollBar = m_xScrolledWindow->getVertScrollBar();
@@ -2237,8 +2245,6 @@ public:
                              rFaceColor);
         customize_scrollbars(rVertScrollBar, Color(0, 0, 0), rBackgroundColor, 
rShadowColor,
                              rFaceColor);
-        rHorzScrollBar.set_height_request(nThickness);
-        rVertScrollBar.set_width_request(nThickness);
     }
 
     virtual ~SalInstanceScrolledWindow() override
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index f5fac8531094..a6352f16384a 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -683,7 +683,7 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, const 
std::shared_ptr<PrinterC
 
     // lock the dialog height, regardless of later expander state
     mxScrolledWindow->set_size_request(
-        mxScrolledWindow->get_preferred_size().Width() + 
mxScrolledWindow->get_vscroll_width(),
+        mxScrolledWindow->get_preferred_size().Width() + 
mxScrolledWindow->get_scroll_thickness(),
         mxScrolledWindow->get_preferred_size().Height());
 }
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a8191a29a2ed..470fae9387ea 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5956,13 +5956,21 @@ public:
         return GtkToVcl(eGtkVPolicy);
     }
 
-    virtual int get_vscroll_width() const override
+    virtual int get_scroll_thickness() const override
     {
         if (gtk_scrolled_window_get_overlay_scrolling(m_pScrolledWindow))
             return 0;
         return 
gtk_widget_get_allocated_width(gtk_scrolled_window_get_vscrollbar(m_pScrolledWindow));
     }
 
+    virtual void set_scroll_thickness(int nThickness) override
+    {
+        GtkWidget *pHorzBar = 
gtk_scrolled_window_get_hscrollbar(m_pScrolledWindow);
+        GtkWidget *pVertBar = 
gtk_scrolled_window_get_vscrollbar(m_pScrolledWindow);
+        gtk_widget_set_size_request(pHorzBar, -1, nThickness);
+        gtk_widget_set_size_request(pVertBar, nThickness, -1);
+    }
+
     virtual void disable_notify_events() override
     {
         g_signal_handler_block(m_pVAdjustment, m_nVAdjustChangedSignalId);
@@ -5979,7 +5987,7 @@ public:
 
     virtual void customize_scrollbars(const Color& rBackgroundColor,
                                       const Color& rShadowColor,
-                                      const Color& rFaceColor, int nThickness) 
override
+                                      const Color& rFaceColor) override
     {
         GtkWidget *pHorzBar = 
gtk_scrolled_window_get_hscrollbar(m_pScrolledWindow);
         GtkWidget *pVertBar = 
gtk_scrolled_window_get_vscrollbar(m_pScrolledWindow);
@@ -6005,9 +6013,6 @@ public:
                                        
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
         gtk_style_context_add_provider(pVertContext, 
GTK_STYLE_PROVIDER(m_pScrollBarCssProvider),
                                        
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-        gtk_widget_set_size_request(pHorzBar, -1, nThickness);
-        gtk_widget_set_size_request(pVertBar, nThickness, -1);
     }
 
     virtual ~GtkInstanceScrolledWindow() override
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to