include/vcl/weld.hxx | 7 ++++--- vcl/source/app/salvtables.cxx | 2 +- vcl/unx/gtk3/gtkinst.cxx | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
New commits: commit fc7b5f21e08f8a98be2c1f586a51e14b4dab822e Author: Michael Weghorn <[email protected]> AuthorDate: Tue Dec 9 19:54:25 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Dec 10 17:41:15 2025 +0100 tdf#130857 weld: Unify context menu event handling a bit Let weld::TreeView::signal_popup_menu return the return value of the handler it calls, and call the method instead of the handler directly in the GTK and vcl subclasses. Make weld::TreeView::m_aPopupMenuHdl private, as it's now only directly used from within the class itself. Change-Id: I4f5c693596e76bbdfbb172468e584174fe0df6c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195337 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 397d57a6500c..f41deb1e3248 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1034,6 +1034,9 @@ public: private: OUString m_sSavedValue; + // if handler returns true, then menu has been shown and event is consumed + Link<const CommandEvent&, bool> m_aPopupMenuHdl; + protected: Link<TreeView&, void> m_aSelectionChangedHdl; Link<TreeView&, bool> m_aRowActivatedHdl; @@ -1047,8 +1050,6 @@ protected: Link<const TreeIter&, bool> m_aCollapsingHdl; Link<TreeView&, void> m_aVisibleRangeChangedHdl; Link<TreeView&, void> m_aModelChangedHdl; - // if handler returns true, then menu has been shown and event is consumed - Link<const CommandEvent&, bool> m_aPopupMenuHdl; // if handler returns true, drag is disallowed, consumer can change bool // arg to false to disable the treeview default dnd icon Link<bool&, bool> m_aDragBeginHdl; @@ -1101,7 +1102,7 @@ protected: return m_aEditingDoneHdl.Call(rIterText); } - void signal_popup_menu(const CommandEvent& rCommand) { m_aPopupMenuHdl.Call(rCommand); } + bool signal_popup_menu(const CommandEvent& rCommand) { return m_aPopupMenuHdl.Call(rCommand); } Link<const TreeIter&, OUString> m_aQueryTooltipHdl; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 5f7abc62d94b..84cf51936c19 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5238,7 +5238,7 @@ bool SalInstanceTreeView::ExpandRow(const SalInstanceTreeIter& rIter) IMPL_LINK(SalInstanceTreeView, PopupMenuHdl, const CommandEvent&, rEvent, bool) { - return m_aPopupMenuHdl.Call(rEvent); + return signal_popup_menu(rEvent); } IMPL_LINK(SalInstanceTreeView, EditingEntryHdl, SvTreeListEntry*, pEntry, bool) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index e44d8ef516f2..2d72f83fbaee 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -13981,7 +13981,7 @@ private: virtual bool signal_popup_menu(const CommandEvent& rCEvt) override { - return m_aPopupMenuHdl.Call(rCEvt); + return weld::TreeView::signal_popup_menu(rCEvt); } void insert_row(GtkTreeIter& iter, const GtkTreeIter* parent, int pos, const OUString* pId, const OUString* pText, commit 8dfbc656d178e87126ea37d08042e49d5c3d4e76 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Dec 9 19:55:20 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Wed Dec 10 17:41:06 2025 +0100 weld: Fix typo in weld::TreeView::m_aPopupMenuHdl doc Change-Id: Ia3fc556cfeca5894be1ca5762fd7de7631e145dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195336 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index f6042b723602..397d57a6500c 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1047,7 +1047,7 @@ protected: Link<const TreeIter&, bool> m_aCollapsingHdl; Link<TreeView&, void> m_aVisibleRangeChangedHdl; Link<TreeView&, void> m_aModelChangedHdl; - // if handler returns true, then menu has been show and event is consumed + // if handler returns true, then menu has been shown and event is consumed Link<const CommandEvent&, bool> m_aPopupMenuHdl; // if handler returns true, drag is disallowed, consumer can change bool // arg to false to disable the treeview default dnd icon
