include/vcl/settings.hxx    |    1 +
 vcl/source/app/settings.cxx |   14 ++++++++++++++
 vcl/source/window/menu.cxx  |    6 ++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 907e2344e03463542e5a6c30f3057ec6fc07bda1
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Tue May 11 09:28:12 2021 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Mon Jun 28 09:55:44 2021 +0200

    tdf#76258 Use correct icon size for color filter popup colors
    
    Change-Id: Icda5ee2cc4c02d6da5cc3f45c30416ad503eaa20
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115378
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
    (cherry picked from commit 5b01ad53aba40956a164500c4267990f7d2d8dd7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116593
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 75894432f05d..44bc36271366 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -518,6 +518,7 @@ public:
 
     void                            SetToolbarIconSize( ToolbarIconSize nSize 
);
     ToolbarIconSize                 GetToolbarIconSize() const;
+    Size                            GetToolbarIconSizePixel() const;
 
     /** Set the icon theme to use. */
     void                            SetIconTheme(const OUString&);
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index a621f6c61fd4..719062d8c581 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -1916,6 +1916,20 @@ StyleSettings::GetToolbarIconSize() const
     return mxData->mnToolbarIconSize;
 }
 
+Size StyleSettings::GetToolbarIconSizePixel() const
+{
+    switch (GetToolbarIconSize())
+    {
+        case ToolbarIconSize::Large:
+            return Size(24, 24);
+        case ToolbarIconSize::Size32:
+            return Size(32, 32);
+        case ToolbarIconSize::Small:
+        default:
+            return Size(16, 16);
+    }
+}
+
 const DialogStyle&
 StyleSettings::GetDialogStyle() const
 {
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 918910444a70..38780b020f2a 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1013,10 +1013,12 @@ OUString Menu::GetItemText( sal_uInt16 nItemId ) const
 
 void Menu::SetItemColor(sal_uInt16 nItemId, const Color& rColor)
 {
-    Bitmap aBmp(Size(50, 50), 24);
+    StyleSettings aSettings = Application::GetSettings().GetStyleSettings();
+    auto iconSize = aSettings.GetToolbarIconSizePixel();
+    Bitmap aBmp(iconSize, 24);
     BitmapWriteAccess aBmpAccess(aBmp);
     aBmpAccess.SetFillColor(rColor);
-    aBmpAccess.FillRect(tools::Rectangle(0, 0, 49, 49));
+    aBmpAccess.FillRect(tools::Rectangle(0, 0, iconSize.Width() - 1, 
iconSize.Height() - 1));
     BitmapEx aBmpEx(aBmp);
     Image aImage(aBmpEx);
     SetItemImage(nItemId, aImage);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to