summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-21 12:16:18 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-22 00:15:46 +0100
commit59cba4298dae0caf0f1ba72a830d8f4edf48756d (patch)
treef984de512f93130a01f3599e520ad879ec2f9b9a
parent11e857374fb44a1a24fb07948e3ee300f09b6a11 (diff)
notebookbar: Pass menu button as parent for its menu
Use the Notebookbar menu button as parent for its menu. This also makes the button position be used as the reference. This allows to drop the now unused NotebookbarTabControlBase::GetHeaderHeight. Also, set the reference point to be at the bottom of the button, so the menu opens below it instead of approximately in the middle, which matches how other menu buttons behave. To test: Set "Tabbed" for the UI variant in "View" -> "User Interface", then click the "Hamburger menu" button in the notebookbar. Change-Id: I0717fad73ff7a42d2bdaaa53a73d055234003d3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176927 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
-rw-r--r--include/vcl/tabctrl.hxx1
-rw-r--r--sfx2/source/notebookbar/NotebookbarTabControl.cxx6
-rw-r--r--vcl/source/control/tabctrl.cxx5
3 files changed, 4 insertions, 8 deletions
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 9ac3b334497e..28987536ad9c 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -190,7 +190,6 @@ public:
Control* GetOpenMenu();
virtual Size calculateRequisition() const override;
- static sal_uInt16 GetHeaderHeight();
protected:
virtual bool ImplPlaceTabs( tools::Long nWidth ) override;
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 6b08a6a56e33..b8a82b8bb00f 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -349,8 +349,10 @@ IMPL_LINK(NotebookbarTabControl, OpenNotebookbarPopupMenu, NotebookBar*, pNotebo
return;
xPopupController->setPopupMenu(xPopupMenu);
- Point aPos(pNotebookbar->GetSizePixel().getWidth(), NotebookbarTabControl::GetHeaderHeight() - ICON_SIZE + 10);
- xPopupMenu->execute(pNotebookbar->GetComponentInterface(),
+ Control* pOpenMenuButton = GetOpenMenu();
+ assert(pOpenMenuButton);
+ Point aPos(pOpenMenuButton->GetSizePixel().getWidth(), pOpenMenuButton->GetSizePixel().getHeight());
+ xPopupMenu->execute(pOpenMenuButton->GetComponentInterface(),
css::awt::Rectangle(aPos.X(), aPos.Y(), 1, 1),
css::awt::PopupMenuDirection::EXECUTE_DOWN);
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 0cf5b5eac808..5aa5c831617c 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2306,11 +2306,6 @@ void NotebookbarTabControlBase::ImplActivateTabPage( bool bNext )
SelectTabPage( TabControl::GetPageId( nCurPos ) );
}
-sal_uInt16 NotebookbarTabControlBase::GetHeaderHeight()
-{
- return m_nHeaderHeight;
-}
-
bool NotebookbarTabControlBase::ImplPlaceTabs( tools::Long nWidth )
{
if ( nWidth <= 0 )