summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2019-09-04 16:07:42 +0200
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2019-09-05 11:05:39 +0200
commite8acfdb4428523e10fe63728f36bc0d8ddd9a9d8 (patch)
tree1529cd9c9271df4073fc6e61919c2fe19728e4ea
parent9d52758d7db507948e1f70f8c6d47b05a1fdefb3 (diff)
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.grandin@collabora.co.uk> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r--vcl/inc/bitmaps.hlst2
-rw-r--r--vcl/source/window/toolbox.cxx74
2 files changed, 11 insertions, 65 deletions
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;