/usr/include/gtkmm-2.4/gtkmm/entrycompletion.h is in libgtkmm-2.4-dev 1:2.24.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | // -*- c++ -*-
// Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
#ifndef _GTKMM_ENTRYCOMPLETION_H
#define _GTKMM_ENTRYCOMPLETION_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
/* $Id: entrycompletion.hg,v 1.24 2006/07/19 16:58:50 murrayc Exp $ */
/* Copyright (C) 2003 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtkmm/widget.h>
#include <gtkmm/treemodel.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GtkEntryCompletion GtkEntryCompletion;
typedef struct _GtkEntryCompletionClass GtkEntryCompletionClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gtk
{ class EntryCompletion_Class; } // namespace Gtk
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gtk
{
class Entry;
//TODO: This should derive+implement from CellLayout, when we can break ABI.
//Then we should add "It derives from the Gtk::CellLayout, to allow the user to add extra cells to the Gtk::TreeView with completion matches".
/** Completion functionality for Gtk::Entry.
*
* Gtk::EntryCompletion is an auxiliary object to be used in conjunction with
* Gtk::Entry to provide the completion functionality.
*
* "Completion functionality" means that when the user modifies the text in the
* entry, Gtk::EntryCompletion checks which rows in the model match the current
* content of the entry, and displays a list of matches. By default, the
* matching is done by comparing the entry text case-insensitively against
* the text column of the model (see set_text_column()),
* but this can be overridden with a custom match function (see set_match_func()).
*
* When the user selects a completion, the content of the entry is updated.
* By default, the content of the entry is replaced by the text column of the
* model, but this can be overridden by connecting to the match_selected signal
* and updating the entry in the signal handler. Note that you should return true
* from the signal handler to suppress the default behaviour.
*
* To add completion functionality to an entry, use Gtk::Entry::set_completion().
*
* In addition to regular completion matches, which will be inserted into
* the entry when they are selected, Gtk::EntryCompletion also allows the display of
* "actions" in the popup window. Their appearance is similar to menu items,
* to differentiate them clearly from completion strings. When an action is
* selected, the action_activated signal is emitted.
*/
class EntryCompletion : public Glib::Object
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef EntryCompletion CppObjectType;
typedef EntryCompletion_Class CppClassType;
typedef GtkEntryCompletion BaseObjectType;
typedef GtkEntryCompletionClass BaseClassType;
private: friend class EntryCompletion_Class;
static CppClassType entrycompletion_class_;
private:
// noncopyable
EntryCompletion(const EntryCompletion&);
EntryCompletion& operator=(const EntryCompletion&);
protected:
explicit EntryCompletion(const Glib::ConstructParams& construct_params);
explicit EntryCompletion(GtkEntryCompletion* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
virtual ~EntryCompletion();
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
GtkEntryCompletion* gobj() { return reinterpret_cast<GtkEntryCompletion*>(gobject_); }
///Provides access to the underlying C GObject.
const GtkEntryCompletion* gobj() const { return reinterpret_cast<GtkEntryCompletion*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GtkEntryCompletion* gobj_copy();
private:
protected:
EntryCompletion();
public:
static Glib::RefPtr<EntryCompletion> create();
//Careful, this actually returns a GtkWidget*, so it might not always be a GtkEntry in future GTK+ versions.
/** Gets the entry @a completion has been attached to.
*
* @newin{2,4}
*
* @return The entry @a completion has been attached to.
*/
Entry* get_entry();
/** Gets the entry @a completion has been attached to.
*
* @newin{2,4}
*
* @return The entry @a completion has been attached to.
*/
const Entry* get_entry() const;
/** Sets the model for a Gtk::EntryCompletion. If @a completion already has
* a model set, it will remove it before setting the new model.
* Use unset_model() to unset the old model.
*
* @newin{2,4}
*
* @param model The Gtk::TreeModel.
*/
void set_model(const Glib::RefPtr<TreeModel>& model);
/** Returns the model the Gtk::EntryCompletion is using as data source.
* Returns <tt>0</tt> if the model is unset.
*
* @newin{2,4}
*
* @return A Gtk::TreeModel, or <tt>0</tt> if none
* is currently being used.
*/
Glib::RefPtr<TreeModel> get_model();
/** Returns the model the Gtk::EntryCompletion is using as data source.
* Returns <tt>0</tt> if the model is unset.
*
* @newin{2,4}
*
* @return A Gtk::TreeModel, or <tt>0</tt> if none
* is currently being used.
*/
Glib::RefPtr<const TreeModel> get_model() const;
/** Remove the model from the EntryCompletion.
*
* @see set_model().
*
* @newin{2,16}
*/
void unset_model();
/// For example, bool on_match(const Glib::ustring& key, const TreeModel::const_iterator& iter);
typedef sigc::slot<bool, const Glib::ustring&, const TreeModel::const_iterator&> SlotMatch;
void set_match_func(const SlotMatch& slot);
/** Requires the length of the search key for @a completion to be at least
* @a length. This is useful for long lists, where completing using a small
* key takes a lot of time and will come up with meaningless results anyway
* (ie, a too large dataset).
*
* @newin{2,4}
*
* @param length The minimum length of the key in order to start completing.
*/
void set_minimum_key_length(int length);
/** Returns the minimum key length as set for @a completion.
*
* @newin{2,4}
*
* @return The currently used minimum key length.
*/
int get_minimum_key_length() const;
/** Requests a completion operation, or in other words a refiltering of the
* current list with completions, using the current key. The completion list
* view will be updated accordingly.
*
* @newin{2,4}
*/
void complete();
/** Requests a prefix insertion.
*
* @newin{2,6}
*/
void insert_prefix();
//We reordered the parameters, compared to the C version, so that we can have method overloads without the index.
// TODO: We would really like an insert() which before-inserts an iterator, like ListStore::insert(),
// but there is no EntryCompletion::insert_before() for us to use.
void insert_action_text(const Glib::ustring& text, int index);
void prepend_action_text(const Glib::ustring& text);
//TODO: Add append_action_text() somehow? It would be slow if we count the children each time. murrayc.
void insert_action_markup(const Glib::ustring& markup, int index);
void prepend_action_markup(const Glib::ustring& markup);
//TODO: Change default - it would be nicer to delete the last action instead of the first.
/** Deletes the action at @a index from @a completion's action list.
*
* @newin{2,4}
*
* @param index The index of the item to Delete.
*/
void delete_action(int index = 0);
/** Sets whether the common prefix of the possible completions should
* be automatically inserted in the entry.
*
* @newin{2,6}
*
* @param inline_completion <tt>true</tt> to do inline completion.
*/
void set_inline_completion(bool inline_completion = true);
/** Returns whether the common prefix of the possible completions should
* be automatically inserted in the entry.
*
* @newin{2,6}
*
* @return <tt>true</tt> if inline completion is turned on.
*/
bool get_inline_completion() const;
/** Sets whether it is possible to cycle through the possible completions
* inside the entry.
*
* @newin{2,12}
*
* @param inline_selection <tt>true</tt> to do inline selection.
*/
void set_inline_selection(bool inline_selection = true);
/** Returns <tt>true</tt> if inline-selection mode is turned on.
*
* @newin{2,12}
*
* @return <tt>true</tt> if inline-selection mode is on.
*/
bool get_inline_selection() const;
/** Sets whether the completions should be presented in a popup window.
*
* @newin{2,6}
*
* @param popup_completion <tt>true</tt> to do popup completion.
*/
void set_popup_completion(bool popup_completion = true);
/** Returns whether the completions should be presented in a popup window.
*
* @newin{2,6}
*
* @return <tt>true</tt> if popup completion is turned on.
*/
bool get_popup_completion() const;
/** Sets whether the completion popup window will be resized to be the same
* width as the entry.
*
* @newin{2,8}
*
* @param popup_set_width <tt>true</tt> to make the width of the popup the same as the entry.
*/
void set_popup_set_width(bool popup_set_width = true);
/** Returns whether the completion popup window will be resized to the
* width of the entry.
*
* @newin{2,8}
*
* @return <tt>true</tt> if the popup window will be resized to the width of
* the entry.
*/
bool get_popup_set_width() const;
#ifndef GTKMM_DISABLE_DEPRECATED
/** Sets whether the completion popup window will appear even if there is
* only a single match. You may want to set this to <tt>false</tt> if you
* are using inline
* completion.
*
* @newin{2,8}
*
* @deprecated Use set_popup_single_match() instead. This function was wrongly named.
*
* @param popup_single_match <tt>true</tt> if the popup should appear even for a single
* match.
*/
void set_popup_single_width(bool popup_single_match = true);
#endif // GTKMM_DISABLE_DEPRECATED
/** Sets whether the completion popup window will appear even if there is
* only a single match. You may want to set this to <tt>false</tt> if you
* are using inline
* completion.
*
* @newin{2,8}
*
* @param popup_single_match <tt>true</tt> if the popup should appear even for a single
* match.
*/
void set_popup_single_match(bool popup_single_match = true);
/** Returns whether the completion popup window will appear even if there is
* only a single match.
*
* @newin{2,8}
*
* @return <tt>true</tt> if the popup window will appear regardless of the
* number of matches.
*/
bool get_popup_single_match() const;
/** Get the original text entered by the user that triggered
* the completion or an empty string if there's no completion ongoing.
*
* @return The prefix for the current completion
*
* @newin{2,12}.
*/
Glib::ustring get_completion_prefix() const;
/** Convenience function for setting up the most used case of this code: a
* completion list with just strings. This function will set up @a completion
* to have a list displaying all (and just) strings in the completion list,
* and to get those strings from @a column in the model of @a completion.
*
* This functions creates and adds a Gtk::CellRendererText for the selected
* column. If you need to set the text column, but don't want the cell
* renderer, use Glib::object_set() to set the ::text_column property directly.
*
* @newin{2,4}
*
* @param column The column in the model of @a completion to get strings from.
*/
void set_text_column(const TreeModelColumnBase& column);
/** Convenience function for setting up the most used case of this code: a
* completion list with just strings. This function will set up @a completion
* to have a list displaying all (and just) strings in the completion list,
* and to get those strings from @a column in the model of @a completion.
*
* This functions creates and adds a Gtk::CellRendererText for the selected
* column. If you need to set the text column, but don't want the cell
* renderer, use Glib::object_set() to set the ::text_column property directly.
*
* @newin{2,4}
*
* @param column The column in the model of @a completion to get strings from.
*/
void set_text_column(int column);
#ifndef GTKMM_DISABLE_DEPRECATED
/** Returns the column in the model of @a completion to get strings from.
*
* @newin{2,6}
*
* @deprecated Use the const version of this method.
*
* @return The column containing the strings.
*/
int get_text_column();
#endif // GTKMM_DISABLE_DEPRECATED
/** Returns the column in the model of @a completion to get strings from.
*
* @newin{2,6}
*
* @return The column containing the strings.
*/
int get_text_column() const;
/** Emitted when an action is activated.
*
* @param index The index of the activated action.
*
* @par Slot Prototype:
* <tt>void on_my_%action_activated(int index)</tt>
*
*/
Glib::SignalProxy1< void,int > signal_action_activated();
//We completely hand-code these signals because we want to change how the parameters are wrapped,
//because we need both the iter and the model to make the C++ iter.
/** Emitted when a match from the list is selected.
* The default behaviour is to replace the contents of the
* entry with the contents of the text column in the row
* pointed to by @a iter.
*
* It is necessary to connect your signal handler <i>before</i>
* the default one, which would otherwise return <tt>true</tt>,
* a value which signifies that the signal has been handled,
* thus preventing any other handler from being invoked.
*
* To do this, pass <tt>false</tt> to this signal proxy's
* <tt>connect()</tt> method. For example:
* <tt> completion->signal_match_selected().connect(sigc::mem_fun(*this, &YourClass::on_completion_match_selected), false); </tt>
*
* @param model The TreeModel containing the matches
* @param iter A TreeModel::iterator positioned at the selected match
* @result true if the signal has been handled
*
* @par Prototype:
* <tt>bool %on_match_selected(const TreeModel::iterator& iter)</tt>
*/
Glib::SignalProxy1< bool, const TreeModel::iterator& > signal_match_selected();
/** Emitted when a match from the cursor is on a match
* of the list. The default behaviour is to replace the contents
* of the entry with the contents of the text column in the row
* pointed to by @a iter.
*
* @param model The TreeModel containing the matches
* @param iter A TreeModel::iterator positioned at the selected match
* @result true if the signal has been handled
*
* @par Prototype:
* <tt>bool %on_cursor_on_match(const TreeModel::iterator& iter)</tt>
*
* @newin{2,12}
*/
Glib::SignalProxy1< bool, const TreeModel::iterator& > signal_cursor_on_match();
//We use no_default_handler for these signals, because we can not add a new vfunc without breaking ABI.
//TODO: Remove no_default_handler when we do an ABI-break-with-parallel-install.
/** Emitted when the inline autocompletion is triggered.
* The default behaviour is to make the entry display the
* whole prefix and select the newly inserted part.
*
* Applications may connect to this signal in order to insert only a
* smaller part of the @a prefix into the entry - e.g. the entry used in
* the FileChooser inserts only the part of the prefix up to the
* next '/'.
*
* @newin{2,6}
*
* @param prefix The common prefix of all possible completions.
* @result true if the signal has been handled
*
* @par Slot Prototype:
* <tt>bool on_my_%insert_prefix(const Glib::ustring& prefix)</tt>
*
*/
Glib::SignalProxy1< bool,const Glib::ustring& > signal_insert_prefix();
/** The model to find matches in.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::RefPtr<Gtk::TreeModel> > property_model() ;
/** The model to find matches in.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gtk::TreeModel> > property_model() const;
/** Minimum length of the search key in order to look up matches.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< int > property_minimum_key_length() ;
/** Minimum length of the search key in order to look up matches.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_minimum_key_length() const;
/** The column of the model containing the strings.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< int > property_text_column() ;
/** The column of the model containing the strings.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_text_column() const;
/** Whether the common prefix should be inserted automatically.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_inline_completion() ;
/** Whether the common prefix should be inserted automatically.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_inline_completion() const;
/** Whether the completions should be shown in a popup window.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_popup_completion() ;
/** Whether the completions should be shown in a popup window.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_popup_completion() const;
/** If TRUE, the popup window will have the same size as the entry.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_popup_set_width() ;
/** If TRUE, the popup window will have the same size as the entry.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_popup_set_width() const;
/** If TRUE, the popup window will appear for a single match.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_popup_single_match() ;
/** If TRUE, the popup window will appear for a single match.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_popup_single_match() const;
/** Your description here.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_inline_selection() ;
/** Your description here.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_inline_selection() const;
protected:
//Default Signal Handler:
virtual bool on_match_selected(const TreeModel::iterator& iter);
//No default handler for on_cursor_on_match(), to preserver ABI. TODO: Add this when we can break ABI.
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
/// This is a default handler for the signal signal_action_activated().
virtual void on_action_activated(int index);
};
} // namespace Gtk
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gtk::EntryCompletion
*/
Glib::RefPtr<Gtk::EntryCompletion> wrap(GtkEntryCompletion* object, bool take_copy = false);
}
#endif /* _GTKMM_ENTRYCOMPLETION_H */
|