diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-13 21:39:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-14 20:18:41 +0200 |
commit | 2b9f23b9b8a62d82691233d789e830b3bde7b3da (patch) | |
tree | 786c9332f5bbfbc475c3eee80fdf5744e9deefbd /vcl | |
parent | 19be86249dcc5b13b3c95f5469600fa2bc1b749b (diff) |
weld SwFrameAddPage
Change-Id: Ia63e22d01c6bcc08f50d3e1b12943094660c7fd0
Reviewed-on: https://gerrit.libreoffice.org/61758
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/salvtables.cxx | 17 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 5 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 36 |
3 files changed, 58 insertions, 0 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ffae3928610e..aed6316810e9 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2399,6 +2399,12 @@ public: m_xComboBox->SetEntryData(nInsertedAt, new OUString(*pId)); } + virtual void insert_separator(int pos) override + { + auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos; + m_xComboBox->AddSeparator(nInsertPos - 1); + } + virtual bool has_entry() const override { return false; @@ -2496,6 +2502,12 @@ public: m_xComboBox->SetEntryData(nInsertedAt, new OUString(*pId)); } + virtual void insert_separator(int pos) override + { + auto nInsertPos = pos == -1 ? m_xComboBox->GetEntryCount() : pos; + m_xComboBox->AddSeparator(nInsertPos - 1); + } + virtual void set_entry_text(const OUString& rText) override { m_xComboBox->SetText(rText); @@ -2562,6 +2574,11 @@ public: rEntry.AddEventListener(LINK(this, SalInstanceEntryTreeView, KeyPressListener)); } + virtual void insert_separator(int /*pos*/) override + { + assert(false); + } + virtual void make_sorted() override { vcl::Window *pTreeView = m_pTreeView->getWidget(); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f114df9deaa7..03a2946417b2 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1294,6 +1294,11 @@ void ComboBox::SetSeparatorPos( sal_Int32 n ) m_pImpl->m_pImplLB->SetSeparatorPos( n ); } +void ComboBox::AddSeparator( sal_Int32 n ) +{ + m_pImpl->m_pImplLB->AddSeparator( n ); +} + void ComboBox::SetMRUEntries( const OUString& rEntries ) { m_pImpl->m_pImplLB->SetMRUEntries( rEntries, ';' ); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 7caca86815a7..dd69aad8ad98 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -4833,6 +4833,7 @@ private: GtkMenu* m_pMenu; std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter; vcl::QuickSelectionEngine m_aQuickSelectionEngine; + std::vector<int> m_aSeparatorRows; gboolean m_bPopupActive; gulong m_nChangedSignalId; gulong m_nPopupShownSignalId; @@ -4940,6 +4941,20 @@ private: g_object_unref(pCompletion); } + bool separator_function(int nIndex) + { + return std::find(m_aSeparatorRows.begin(), m_aSeparatorRows.end(), nIndex) != m_aSeparatorRows.end(); + } + + static gboolean separatorFunction(GtkTreeModel* pTreeModel, GtkTreeIter* pIter, gpointer widget) + { + GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget); + GtkTreePath* path = gtk_tree_model_get_path(pTreeModel, pIter); + int nIndex = gtk_tree_path_get_indices(path)[0]; + gtk_tree_path_free(path); + return pThis->separator_function(nIndex); + } + // in the absence of a built-in solution for https://gitlab.gnome.org/GNOME/gtk/issues/310 // a) support typeahead for the case where there is no entry widget, typing ahead // into the button itself will select via the vcl selection engine, a matching @@ -5237,6 +5252,7 @@ public: GtkTreeIter iter; gtk_tree_model_iter_nth_child(m_pTreeModel, &iter, nullptr, pos); gtk_list_store_remove(GTK_LIST_STORE(m_pTreeModel), &iter); + m_aSeparatorRows.erase(std::remove(m_aSeparatorRows.begin(), m_aSeparatorRows.end(), pos), m_aSeparatorRows.end()); enable_notify_events(); bodge_wayland_menu_not_appearing(); } @@ -5250,6 +5266,19 @@ public: bodge_wayland_menu_not_appearing(); } + virtual void insert_separator(int pos) override + { + disable_notify_events(); + GtkTreeIter iter; + pos = pos == -1 ? get_count() : pos; + m_aSeparatorRows.push_back(pos); + if (!gtk_combo_box_get_row_separator_func(m_pComboBox)) + gtk_combo_box_set_row_separator_func(m_pComboBox, separatorFunction, this, nullptr); + insert_row(GTK_LIST_STORE(m_pTreeModel), iter, pos, nullptr, "", nullptr, nullptr); + enable_notify_events(); + bodge_wayland_menu_not_appearing(); + } + virtual int get_count() const override { return gtk_tree_model_iter_n_children(m_pTreeModel, nullptr); @@ -5269,6 +5298,8 @@ public: { disable_notify_events(); gtk_list_store_clear(GTK_LIST_STORE(m_pTreeModel)); + m_aSeparatorRows.clear(); + gtk_combo_box_set_row_separator_func(m_pComboBox, nullptr, nullptr, nullptr); enable_notify_events(); bodge_wayland_menu_not_appearing(); } @@ -5456,6 +5487,11 @@ public: m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this); } + virtual void insert_separator(int /*pos*/) override + { + assert(false); + } + virtual void make_sorted() override { GtkWidget* pTreeView = m_pTreeView->getWidget(); |