summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-09 10:11:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-09 17:03:02 +0100
commit1327fa4b1dff932500c690c263840fde192988ed (patch)
treeabe937f8396eb4ce5fc3255c00014f54819c3cbe /vcl/unx
parent17747ef473d71dc3aa62242f4ddb5a94aa0da983 (diff)
add hook for on-demand welded toolbar popover creation
Change-Id: I662976a62281909e30d5b256e10ddcf2ceee2595 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86474 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bc7802987366..bc53e4cf3cce 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7116,7 +7116,10 @@ private:
OString id(pStr, pStr ? strlen(pStr) : 0);
m_aMap[id] = pToolItem;
if (pMenuButton)
+ {
m_aMenuButtonMap[id] = std::make_unique<GtkInstanceMenuButton>(pMenuButton, m_pBuilder, false);
+ g_signal_connect(pToolItem, "show-menu", G_CALLBACK(signalItemShowMenu), this);
+ }
g_signal_connect(pToolItem, "clicked", G_CALLBACK(signalItemClicked), this);
}
@@ -7133,6 +7136,19 @@ private:
signal_clicked(OString(pStr, pStr ? strlen(pStr) : 0));
}
+ static void signalItemShowMenu(GtkMenuToolButton* pItem, gpointer widget)
+ {
+ GtkInstanceToolbar* pThis = static_cast<GtkInstanceToolbar*>(widget);
+ SolarMutexGuard aGuard;
+ pThis->signal_item_show_menu(pItem);
+ }
+
+ void signal_item_show_menu(GtkMenuToolButton* pItem)
+ {
+ const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pItem));
+ signal_show_menu(OString(pStr, pStr ? strlen(pStr) : 0));
+ }
+
static void set_item_image(GtkToolButton* pItem, const css::uno::Reference<css::graphic::XGraphic>& rIcon)
{
GtkWidget* pImage = nullptr;
@@ -7171,13 +7187,19 @@ public:
void disable_item_notify_events()
{
for (auto& a : m_aMap)
+ {
g_signal_handlers_block_by_func(a.second, reinterpret_cast<void*>(signalItemClicked), this);
+ g_signal_handlers_block_by_func(a.second, reinterpret_cast<void*>(signalItemShowMenu), this);
+ }
}
void enable_item_notify_events()
{
for (auto& a : m_aMap)
+ {
+ g_signal_handlers_unblock_by_func(a.second, reinterpret_cast<void*>(signalItemShowMenu), this);
g_signal_handlers_unblock_by_func(a.second, reinterpret_cast<void*>(signalItemClicked), this);
+ }
}
virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override