diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-06-15 19:45:50 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-06-16 01:36:37 +0200 |
commit | 0cdcaff7005e02280c8f6190a179ba12c9b567ca (patch) | |
tree | 8d55dad753d617a21f56955e53eeb5d58b75db75 /vcl | |
parent | 71b787473ae0f5289eb53e27671c1d407b8924e6 (diff) |
tdf#133877 use optimal size for hamburger button
This way it'll properly scale, instead of using the fixed 28 pixel
dimension. This is a hack, which is used a few more times in VCL.
Still this should not be needed, but done automatically.
If there aren't any constraints, just return the optimal size!
Change-Id: I8aa32645ea95cba28d0daf56f0be27c15153b6c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96390
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 4d483d943dc0..484b457574bd 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -85,7 +85,6 @@ struct ImplTabCtrlData // for the Tab positions #define TAB_PAGERECT 0xFFFF -#define HAMBURGER_DIM 28 void TabControl::ImplInit( vcl::Window* pParent, WinBits nStyle ) { @@ -2192,9 +2191,9 @@ NotebookbarTabControlBase::NotebookbarTabControlBase(vcl::Window* pParent) , eLastContext(vcl::EnumContext::Context::Any) { m_pOpenMenu = VclPtr<PushButton>::Create( this , WB_CENTER | WB_VCENTER ); - m_pOpenMenu->SetSizePixel(Size(HAMBURGER_DIM, HAMBURGER_DIM)); m_pOpenMenu->SetClickHdl(LINK(this, NotebookbarTabControlBase, OpenMenu)); m_pOpenMenu->SetModeImage(Image(StockImage::Yes, SV_RESID_BITMAP_NOTEBOOKBAR)); + m_pOpenMenu->SetSizePixel(m_pOpenMenu->GetOptimalSize()); m_pOpenMenu->Show(); } @@ -2301,7 +2300,8 @@ bool NotebookbarTabControlBase::ImplPlaceTabs( long nWidth ) if (!m_pOpenMenu || m_pOpenMenu->isDisposed()) return false; - long nMaxWidth = nWidth - HAMBURGER_DIM; + const long nHamburgerWidth = m_pOpenMenu->GetSizePixel().Width(); + long nMaxWidth = nWidth - nHamburgerWidth; long nShortcutsWidth = m_pShortcuts != nullptr ? m_pShortcuts->GetSizePixel().getWidth() + 1 : 0; long nFullWidth = nShortcutsWidth; @@ -2369,7 +2369,7 @@ bool NotebookbarTabControlBase::ImplPlaceTabs( long nWidth ) long nPosY = (m_nHeaderHeight - m_pOpenMenu->GetSizePixel().getHeight()) / 2; // position the menu - m_pOpenMenu->SetPosPixel(Point(nWidth - HAMBURGER_DIM, nPosY)); + m_pOpenMenu->SetPosPixel(Point(nWidth - nHamburgerWidth, nPosY)); return true; } |