~ubuntu-branches/ubuntu/quantal/gtkmm3.0/quantal

« back to all changes in this revision

Viewing changes to gtk/src/entrycompletion.hg

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2012-09-28 09:25:06 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20120928092506-9h63ais5o750a8sk
Tags: 3.5.13-0ubuntu1
* New upstream release
* debian/control:
  - Bump build-depends on libglibmm-2.4-dev, libgtk-3-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: entrycompletion.hg,v 1.24 2006/07/19 16:58:50 murrayc Exp $ */
2
 
 
3
1
/* Copyright (C) 2003 The gtkmm Development Team
4
2
 *
5
3
 * This library is free software; you can redistribute it and/or
20
18
#include <gtkmm/widget.h>
21
19
#include <gtkmm/celllayout.h>
22
20
#include <gtkmm/treemodel.h>
23
 
 
 
21
 
24
22
_DEFS(gtkmm,gtk)
25
23
_PINCLUDE(glibmm/private/object_p.h)
26
24
 
34
32
 
35
33
/** Completion functionality for Gtk::Entry.
36
34
 *
37
 
 * Gtk::EntryCompletion is an auxiliary object to be used in conjunction with 
38
 
 * Gtk::Entry to provide the completion functionality. 
39
 
 * 
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.
 
37
 *
 
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()).
46
44
 *
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.
52
 
 * 
 
50
 *
53
51
 * To add completion functionality to an entry, use Gtk::Entry::set_completion().
54
 
 * 
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. 
 
52
 *
 
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.
60
58
 */
61
59
class EntryCompletion
62
60
 : public Glib::Object,
91
89
 
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;
94
 
  
 
92
 
95
93
  void set_match_func(const SlotMatch& slot);
96
94
  _IGNORE(gtk_entry_completion_set_match_func)
97
 
  
 
95
 
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)
145
143
 
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.
150
148
   *
151
149
   * It is necessary to connect your signal handler <i>before</i>
160
158
   * @param model The TreeModel containing the matches
161
159
   * @param iter A TreeModel::iterator positioned at the selected match
162
160
   * @result true if the signal has been handled
163
 
   * 
 
161
   *
164
162
   * @par Prototype:
165
163
   * <tt>bool %on_match_selected(const TreeModel::iterator& iter)</tt>
166
164
   */
168
166
 
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.
173
171
   *
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
177
 
   * 
 
175
   *
178
176
   * @par Prototype:
179
177
   * <tt>bool %on_cursor_on_match(const TreeModel::iterator& iter)</tt>
180
178
   *
212
210
protected:
213
211
 
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.
217
215
};
218
216
 
219
217
} // namespace Gtk