diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-19 17:06:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-19 20:24:18 +0100 |
commit | 6afb18bc5fbc530d6404eac1c9e7191e58de27fc (patch) | |
tree | 3a464e65c70ba36776fcf7babe2b102ddf1f4d24 /vcl | |
parent | 3ed742a0dbe2566007447f9adb0f54f5424bd05d (diff) |
add api to determine number of menu items
Change-Id: I69082c1b564c42be7a14fa36b0ba1dab34a3b5b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87043
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 248a62090f06..1603033ded71 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -921,6 +921,10 @@ public: auto nInsertPos = pos == -1 ? MENU_APPEND : pos; m_xMenu->InsertSeparator(rId.toUtf8(), nInsertPos); } + virtual int n_children() const override + { + return m_xMenu->GetItemCount(); + } PopupMenu* getMenu() const { return m_xMenu.get(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index fdb8d66f68a2..f146049dffd2 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -7056,6 +7056,14 @@ public: gtk_menu_reorder_child(m_pMenu, pItem, pos); } + virtual int n_children() const override + { + GList* pChildren = gtk_container_get_children(GTK_CONTAINER(m_pMenu)); + int nLen = g_list_length(pChildren); + g_list_free(pChildren); + return nLen; + } + virtual ~GtkInstanceMenu() override { clear_extras(); |