diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-05-11 09:28:12 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-05-11 10:28:32 +0200 |
commit | 5b01ad53aba40956a164500c4267990f7d2d8dd7 (patch) | |
tree | ff3b1117de306a1310d078f05f79c80b618d3b49 | |
parent | 55c17dff49166e8ad036f02fc97db40137158d43 (diff) |
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.mehrbrodt@allotropia.de>
-rw-r--r-- | include/vcl/settings.hxx | 1 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 14 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 6 |
3 files changed, 19 insertions, 2 deletions
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 3130f22ed205..0159e08fb7a4 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -536,6 +536,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 423e3eed679c..0e64a4269e35 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2070,6 +2070,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 128bc4bbcbd1..8f4019dd9d52 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -1025,10 +1025,12 @@ OUString Menu::GetItemText( sal_uInt16 nItemId ) const void Menu::SetItemColor(sal_uInt16 nItemId, const Color& rColor) { - Bitmap aBmp(Size(50, 50), vcl::PixelFormat::N24_BPP); + StyleSettings aSettings = Application::GetSettings().GetStyleSettings(); + auto iconSize = aSettings.GetToolbarIconSizePixel(); + Bitmap aBmp(iconSize, vcl::PixelFormat::N24_BPP); 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); |