[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Nov 15 19:10:05 UTC 2020
include/vcl/weld.hxx | 2 ++
vcl/inc/salvtables.hxx | 1 +
vcl/source/app/salvtables.cxx | 4 ++++
vcl/unx/gtk3/gtk3gtkinst.cxx | 10 ++++++++++
4 files changed, 17 insertions(+)
New commits:
commit 8a92373a20dfce8112e45bd80f0f6c927224ff98
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Nov 14 20:01:52 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Nov 15 20:09:24 2020 +0100
add Menu::get_id
Change-Id: I608db63f700312f7d7ffc6bfbd0e03971bfb00e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105845
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 7387db806350..28dd95818293 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2174,6 +2174,8 @@ public:
// return the number of toplevel nodes
virtual int n_children() const = 0;
+ virtual OString get_id(int pos) const = 0;
+
virtual ~Menu() {}
};
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 7eff04d56c7e..f3f4a585cecf 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -151,6 +151,7 @@ public:
TriState eCheckRadioFalse) override;
virtual void insert_separator(int pos, const OUString& rId) override;
virtual void remove(const OString& rId) override;
+ virtual OString get_id(int pos) const override;
virtual int n_children() const override;
PopupMenu* getMenu() const;
virtual ~SalInstanceMenu() override;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 585dd36325a3..82e742c62da9 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -763,6 +763,10 @@ void SalInstanceMenu::remove(const OString& rId)
m_xMenu->RemoveItem(m_xMenu->GetItemPos(m_xMenu->GetItemId(rId)));
}
int SalInstanceMenu::n_children() const { return m_xMenu->GetItemCount(); }
+OString SalInstanceMenu::get_id(int pos) const
+{
+ return m_xMenu->GetItemIdent(m_xMenu->GetItemId(pos));
+}
PopupMenu* SalInstanceMenu::getMenu() const { return m_xMenu.get(); }
SalInstanceMenu::~SalInstanceMenu()
{
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a74533faa787..1b53f714a6ec 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8156,6 +8156,16 @@ public:
gtk_menu_reorder_child(m_pMenu, pItem, pos);
}
+ virtual OString get_id(int pos) const override
+ {
+ GList* pChildren = gtk_container_get_children(GTK_CONTAINER(m_pMenu));
+ gpointer pMenuItem = g_list_nth_data(pChildren, pos);
+ const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pMenuItem));
+ OString id(pStr, pStr ? strlen(pStr) : 0);
+ g_list_free(pChildren);
+ return id;
+ }
+
virtual int n_children() const override
{
GList* pChildren = gtk_container_get_children(GTK_CONTAINER(m_pMenu));
More information about the Libreoffice-commits
mailing list