mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
allow StringCompletion to match anywhere
This commit is contained in:
parent
23c7d564e2
commit
4eb9285659
2 changed files with 18 additions and 1 deletions
|
|
@ -38,11 +38,13 @@ class LIBGTKMM2EXT_API StringCompletion : public Gtk::EntryCompletion
|
|||
void delete_string (Glib::ustring str);
|
||||
void insert_vector (std::vector<Glib::ustring> strVector, bool norepeat = true);
|
||||
|
||||
void set_match_anywhere ();
|
||||
|
||||
static Glib::RefPtr<StringCompletion> create();
|
||||
static Glib::RefPtr<StringCompletion> create (std::vector<Glib::ustring> strVector, bool norepeat = true);
|
||||
|
||||
protected:
|
||||
Glib::RefPtr<Gtk::ListStore> m_refCompletionModel;
|
||||
Glib::RefPtr<Gtk::ListStore> m_refCompletionModel;
|
||||
|
||||
class CompletionRecord : public Gtk::TreeModel::ColumnRecord
|
||||
{
|
||||
|
|
@ -57,6 +59,8 @@ class LIBGTKMM2EXT_API StringCompletion : public Gtk::EntryCompletion
|
|||
CompletionRecord m_completionRecord;
|
||||
bool _delete_string (const Gtk::TreeModel::iterator &iter, const Glib::ustring &str);
|
||||
bool _string_exists (const Glib::ustring &str);
|
||||
bool match_anywhere (Glib::ustring const & str, Gtk::TreeModel::const_iterator const & iter);
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -105,3 +105,16 @@ StringCompletion::insert_vector (std::vector<Glib::ustring> strVector, bool nore
|
|||
this->add_string (s, norepeat);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
StringCompletion::match_anywhere (Glib::ustring const & str, Gtk::TreeModel::const_iterator const & iter)
|
||||
{
|
||||
Glib::ustring r = Gtk::TreeModel::Row (*iter)[m_completionRecord.col_text];
|
||||
return r.find (str) != Glib::ustring::npos;
|
||||
}
|
||||
|
||||
void
|
||||
StringCompletion::set_match_anywhere ()
|
||||
{
|
||||
set_match_func (sigc::mem_fun (this, &StringCompletion::match_anywhere));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue