vcl/inc/bitmaps.hlst | 2 + vcl/source/window/toolbox.cxx | 74 +++++------------------------------------- 2 files changed, 11 insertions(+), 65 deletions(-)
New commits: commit e8acfdb4428523e10fe63728f36bc0d8ddd9a9d8 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Wed Sep 4 16:07:42 2019 +0200 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Thu Sep 5 11:05:39 2019 +0200 Resolves tdf#125296 - Replace hard-coded chevron by themable icon Chevron now taken from sfx2/res/chevron.png Vertical toolbars don't have a rotated icon anymore Change-Id: Idf6c11ba818b8ca1860da61cb51d3003aff01e56 Reviewed-on: https://gerrit.libreoffice.org/78604 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/vcl/inc/bitmaps.hlst b/vcl/inc/bitmaps.hlst index 1aa8d16a28cb..667bf76b3ade 100644 --- a/vcl/inc/bitmaps.hlst +++ b/vcl/inc/bitmaps.hlst @@ -216,6 +216,8 @@ #define RID_CURSOR_HIDE_WHITESPACE "vcl/res/hide_whitespace.png" #define RID_CURSOR_SHOW_WHITESPACE "vcl/res/show_whitespace.png" +#define CHEVRON "sfx2/res/chevron.png" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index dc95384128cf..fbc18c08e7cd 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -31,6 +31,7 @@ #include <vcl/settings.hxx> #include <vcl/vclstatuslistener.hxx> #include <vcl/ptrstyle.hxx> +#include <bitmaps.hlst> #include <tools/poly.hxx> #include <svl/imageitm.hxx> @@ -2356,72 +2357,15 @@ IMPL_LINK_NOARG(ToolBox, ImplUpdateHdl, Timer *, void) ImplFormat(); } -static void ImplDrawMoreIndicator(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, bool bRotate ) +static void ImplDrawMoreIndicator(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { - rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); - rRenderContext.SetLineColor(); - - if (rRenderContext.GetSettings().GetStyleSettings().GetFaceColor().IsDark()) - rRenderContext.SetFillColor(COL_WHITE); - else - rRenderContext.SetFillColor(COL_BLACK); - float fScaleFactor = rRenderContext.GetDPIScaleFactor(); - - int linewidth = 1 * fScaleFactor; - int space = 4 * fScaleFactor; - - if( !bRotate ) - { - long width = 8 * fScaleFactor; - long height = 5 * fScaleFactor; - - //Keep odd b/c drawing code works better - if ( height % 2 == 0 ) - height--; - - long heightOrig = height; - - long x = rRect.Left() + (rRect.getWidth() - width)/2 + 1; - long y = rRect.Top() + (rRect.getHeight() - height)/2 + 1; - while( height >= 1) - { - rRenderContext.DrawRect( tools::Rectangle( x, y, x + linewidth, y ) ); - x += space; - rRenderContext.DrawRect( tools::Rectangle( x, y, x + linewidth, y ) ); - x -= space; - y++; - if( height <= heightOrig / 2 + 1) x--; - else x++; - height--; - } - } - else - { - long width = 5 * fScaleFactor; - long height = 8 * fScaleFactor; - - //Keep odd b/c drawing code works better - if (width % 2 == 0) - width--; - - long widthOrig = width; + const Image pImage = Image(StockImage::Yes, CHEVRON); + Size aImageSize = pImage.GetSizePixel(); + long x = rRect.Left() + (rRect.getWidth() - aImageSize.Width())/2; + long y = rRect.Top() + (rRect.getHeight() - aImageSize.Height())/2; + DrawImageFlags nImageStyle = DrawImageFlags::NONE; - long x = rRect.Left() + (rRect.getWidth() - width)/2 + 1; - long y = rRect.Top() + (rRect.getHeight() - height)/2 + 1; - while( width >= 1) - { - rRenderContext.DrawRect( tools::Rectangle( x, y, x, y + linewidth ) ); - y += space; - rRenderContext.DrawRect( tools::Rectangle( x, y, x, y + linewidth ) ); - y -= space; - x++; - if( width <= widthOrig / 2 + 1) y--; - else y++; - width--; - } - } - - rRenderContext.Pop(); + rRenderContext.DrawImage(Point(x,y), pImage, nImageStyle); } static void ImplDrawDropdownArrow(vcl::RenderContext& rRenderContext, const tools::Rectangle& rDropDownRect, bool bSetColor, bool bRotate ) @@ -2496,7 +2440,7 @@ void ToolBox::ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighl ImplDrawButton(rRenderContext, mpData->maMenubuttonItem.maRect, 2, false, true, false ); if (ImplHasClippedItems()) - ImplDrawMoreIndicator(rRenderContext, mpData->maMenubuttonItem.maRect, !mbHorz); + ImplDrawMoreIndicator(rRenderContext, mpData->maMenubuttonItem.maRect); // store highlight state mpData->mbMenubuttonSelected = bHighlight; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits