summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-12-09 15:35:50 +0100
committerTomaž Vajngerl <quikee@gmail.com>2016-12-09 14:42:06 +0000
commit99fd3b2a2759864caf519dfd89173e301b74c24e (patch)
treef3688e9cb53f7299d66f35aca3df6c3e362b499f /vcl
parent19a4eaab9a55a2ecb33b727bad6307c5a2badc23 (diff)
vcl: set toolbox size correctly when using 32px icons
Change-Id: Ifacff75f80bc8401ccff2a4d4dc90e56e3b4aa84 Reviewed-on: https://gerrit.libreoffice.org/31801 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/toolbox.cxx5
-rw-r--r--vcl/source/window/toolbox2.cxx24
2 files changed, 18 insertions, 11 deletions
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 6ad9c21822fe..5095ef21ed45 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1671,9 +1671,8 @@ bool ToolBox::ImplCalcItem()
long nDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
// set defaults if image or text is needed but empty
- float fDPIScaleFactor = GetDPIScaleFactor();
- nDefWidth = GetDefaultImageSize().Width() * fDPIScaleFactor;
- nDefHeight = GetDefaultImageSize().Height() * fDPIScaleFactor;
+ nDefWidth = GetDefaultImageSize().Width();
+ nDefHeight = GetDefaultImageSize().Height();
mnWinHeight = 0;
// determine minimum size necessary in NWF
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 38d8dd7a4531..73af1121e980 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -633,20 +633,28 @@ ToolBoxButtonSize ToolBox::GetToolboxButtonSize() const
return mpData->meButtonSize;
}
-/*static*/ Size ToolBox::GetDefaultImageSize(bool bLarge)
+/*static*/ Size ToolBox::GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize)
{
- const long TB_SMALLIMAGESIZE = 16;
- if (!bLarge) {
- return Size(TB_SMALLIMAGESIZE, TB_SMALLIMAGESIZE);
- }
+ float fScaleFactor = Application::GetDefaultDevice()->GetDPIScaleFactor();
+
+ Size aUnscaledSize = Size(16, 16);
- OUString iconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
- return vcl::IconThemeInfo::SizeByThemeName(iconTheme);
+ if (eToolBoxButtonSize == ToolBoxButtonSize::Large)
+ {
+ OUString iconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+ aUnscaledSize = vcl::IconThemeInfo::SizeByThemeName(iconTheme);
+ }
+ else if (eToolBoxButtonSize == ToolBoxButtonSize::Size32)
+ {
+ aUnscaledSize = Size(32, 32);
+ }
+ return Size(aUnscaledSize.Width() * fScaleFactor,
+ aUnscaledSize.Height() * fScaleFactor);
}
Size ToolBox::GetDefaultImageSize() const
{
- return GetDefaultImageSize( GetToolboxButtonSize() == ToolBoxButtonSize::Large );
+ return GetDefaultImageSize(GetToolboxButtonSize());
}
void ToolBox::SetAlign( WindowAlign eNewAlign )