summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-27 13:01:46 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2019-12-05 08:01:42 +0100
commitbfe0b8776332b9cf80ca87742f59b9e713fa2977 (patch)
treef70e3eb685d6ae97bccb3940a24fe7fadab5e439
parenttdf#128976: properly calculate default value when writing XLS (diff)
downloadcore-bfe0b8776332b9cf80ca87742f59b9e713fa2977.tar.gz
core-bfe0b8776332b9cf80ca87742f59b9e713fa2977.zip
get_active should be true when activated but menu not yet shown
Change-Id: Ia2a7cbf5b47eab6d09c78eb9d18233e18b628a3f Reviewed-on: https://gerrit.libreoffice.org/83906 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit f8719f68f8c073c0ad473507b16fc4bd99e79baa) Reviewed-on: https://gerrit.libreoffice.org/83987 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--include/vcl/menubtn.hxx3
-rw-r--r--vcl/source/app/salvtables.cxx2
-rw-r--r--vcl/source/control/menubtn.cxx14
3 files changed, 16 insertions, 3 deletions
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index 90d42fc607fc..5c3008a792cb 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -38,6 +38,7 @@ private:
OString msCurItemIdent;
sal_uInt16 mnCurItemId;
bool mbDelayMenu;
+ bool mbStartingMenu;
Link<MenuButton*,void> maActivateHdl;
Link<MenuButton*,void> maSelectHdl;
@@ -62,7 +63,7 @@ public:
virtual void Select();
void ExecuteMenu();
- bool MenuShown() const;
+ bool InPopupMode() const;
void CancelMenu();
//if false then the whole button launches the menu
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 8dd4d4a53914..8d775803e6b1 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1918,7 +1918,7 @@ public:
virtual bool get_active() const override
{
- return m_xMenuButton->MenuShown();
+ return m_xMenuButton->InPopupMode();
}
virtual void set_inconsistent(bool /*inconsistent*/) override
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index ccf336a46375..b92877117d5d 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -38,10 +38,15 @@ void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
void MenuButton::ExecuteMenu()
{
+ mbStartingMenu = true;
+
Activate();
if (!mpMenu && !mpFloatingWindow)
+ {
+ mbStartingMenu = false;
return;
+ }
Size aSize = GetSizePixel();
SetPressed( true );
@@ -71,6 +76,9 @@ void MenuButton::ExecuteMenu()
vcl::Window::GetDockingManager()->StartPopupMode(mpFloatingWindow, aRect, nFlags);
}
}
+
+ mbStartingMenu = false;
+
SetPressed(false);
if (mnCurItemId)
{
@@ -98,8 +106,11 @@ void MenuButton::CancelMenu()
}
}
-bool MenuButton::MenuShown() const
+bool MenuButton::InPopupMode() const
{
+ if (mbStartingMenu)
+ return true;
+
if (!mpMenu && !mpFloatingWindow)
return false;
@@ -118,6 +129,7 @@ MenuButton::MenuButton( vcl::Window* pParent, WinBits nWinBits )
: PushButton(WindowType::MENUBUTTON)
, mnCurItemId(0)
, mbDelayMenu(false)
+ , mbStartingMenu(false)
{
mnDDStyle = PushButtonDropdownStyle::MenuButton;
ImplInit(pParent, nWinBits);