35
33
/** Completion functionality for Gtk::Entry.
37
* Gtk::EntryCompletion is an auxiliary object to be used in conjunction with
38
* Gtk::Entry to provide the completion functionality.
40
* "Completion functionality" means that when the user modifies the text in the
41
* entry, Gtk::EntryCompletion checks which rows in the model match the current
35
* Gtk::EntryCompletion is an auxiliary object to be used in conjunction with
36
* Gtk::Entry to provide the completion functionality.
38
* "Completion functionality" means that when the user modifies the text in the
39
* entry, Gtk::EntryCompletion checks which rows in the model match the current
42
40
* content of the entry, and displays a list of matches. By default, the
43
* matching is done by comparing the entry text case-insensitively against
44
* the text column of the model (see set_text_column()),
41
* matching is done by comparing the entry text case-insensitively against
42
* the text column of the model (see set_text_column()),
45
43
* but this can be overridden with a custom match function (see set_match_func()).
47
* When the user selects a completion, the content of the entry is updated.
48
* By default, the content of the entry is replaced by the text column of the
49
* model, but this can be overridden by connecting to the match_selected signal
50
* and updating the entry in the signal handler. Note that you should return true
45
* When the user selects a completion, the content of the entry is updated.
46
* By default, the content of the entry is replaced by the text column of the
47
* model, but this can be overridden by connecting to the match_selected signal
48
* and updating the entry in the signal handler. Note that you should return true
51
49
* from the signal handler to suppress the default behaviour.
53
51
* To add completion functionality to an entry, use Gtk::Entry::set_completion().
55
* In addition to regular completion matches, which will be inserted into
56
* the entry when they are selected, Gtk::EntryCompletion also allows the display of
57
* "actions" in the popup window. Their appearance is similar to menu items,
58
* to differentiate them clearly from completion strings. When an action is
59
* selected, the action_activated signal is emitted.
53
* In addition to regular completion matches, which will be inserted into
54
* the entry when they are selected, Gtk::EntryCompletion also allows the display of
55
* "actions" in the popup window. Their appearance is similar to menu items,
56
* to differentiate them clearly from completion strings. When an action is
57
* selected, the action_activated signal is emitted.
61
59
class EntryCompletion
62
60
: public Glib::Object,
92
90
/// For example, bool on_match(const Glib::ustring& key, const TreeModel::const_iterator& iter);
93
91
typedef sigc::slot<bool, const Glib::ustring&, const TreeModel::const_iterator&> SlotMatch;
95
93
void set_match_func(const SlotMatch& slot);
96
94
_IGNORE(gtk_entry_completion_set_match_func)
98
96
_WRAP_METHOD(void set_minimum_key_length(int length), gtk_entry_completion_set_minimum_key_length)
99
97
_WRAP_METHOD(int get_minimum_key_length() const, gtk_entry_completion_get_minimum_key_length)
100
98
_WRAP_METHOD(Glib::ustring compute_prefix(const Glib::ustring& key), gtk_entry_completion_compute_prefix)
143
141
_IGNORE_SIGNAL(match_selected)
144
142
_IGNORE_SIGNAL(cursor_on_match)
146
/** Emitted when a match from the list is selected.
147
* The default behaviour is to replace the contents of the
148
* entry with the contents of the text column in the row
144
/** Emitted when a match from the list is selected.
145
* The default behaviour is to replace the contents of the
146
* entry with the contents of the text column in the row
149
147
* pointed to by @a iter.
151
149
* It is necessary to connect your signal handler <i>before</i>
169
167
/** Emitted when a match from the cursor is on a match
170
168
* of the list. The default behaviour is to replace the contents
171
* of the entry with the contents of the text column in the row
169
* of the entry with the contents of the text column in the row
172
170
* pointed to by @a iter.
174
172
* @param model The TreeModel containing the matches
175
173
* @param iter A TreeModel::iterator positioned at the selected match
176
174
* @result true if the signal has been handled
178
176
* @par Prototype:
179
177
* <tt>bool %on_cursor_on_match(const TreeModel::iterator& iter)</tt>
214
212
//Default Signal Handler:
215
virtual bool on_match_selected(const TreeModel::iterator& iter);
216
//No default handler for on_cursor_on_match(), to preserver ABI. TODO: Add this when we can break ABI.
213
virtual bool on_match_selected(const TreeModel::iterator& iter);
214
//No default handler for on_cursor_on_match(), to preserver ABI. TODO: Add this when we can break ABI.
219
217
} // namespace Gtk