gtkmm 4.16.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::EntryCompletion Class Reference

Completion functionality for Gtk::Entry. More...

#include <gtkmm/entrycompletion.h>

Inheritance diagram for Gtk::EntryCompletion:
Inheritance graph
[legend]

Public Types

typedef sigc::slot< bool(const Glib::ustring &, const TreeModel::const_iterator &)> SlotMatch
 For example, bool on_match(const Glib::ustring& key, const TreeModel::const_iterator& iter);.
 
- Public Types inherited from Gtk::CellLayout
typedef sigc::slot< void(const TreeModel::const_iterator &)> SlotCellData
 

Public Member Functions

 EntryCompletion (EntryCompletion &&src) noexcept
 
EntryCompletionoperator= (EntryCompletion &&src) noexcept
 
 ~EntryCompletion () noexcept override
 
GtkEntryCompletiongobj ()
 Provides access to the underlying C GObject.
 
const GtkEntryCompletiongobj () const
 Provides access to the underlying C GObject.
 
GtkEntryCompletiongobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
Entryget_entry ()
 Gets the entry completion has been attached to.
 
const Entryget_entry () const
 Gets the entry completion has been attached to.
 
void set_model (const Glib::RefPtr< TreeModel > &model)
 Sets the model for a Gtk::EntryCompletion.
 
Glib::RefPtr< TreeModelget_model ()
 Returns the model the Gtk::EntryCompletion is using as data source.
 
Glib::RefPtr< const TreeModelget_model () const
 Returns the model the Gtk::EntryCompletion is using as data source.
 
void unset_model ()
 Remove the model from the EntryCompletion.
 
void set_match_func (const SlotMatch &slot)
 
void set_minimum_key_length (int length)
 Requires the length of the search key for completion to be at least length.
 
int get_minimum_key_length () const
 Returns the minimum key length as set for completion.
 
Glib::ustring compute_prefix (const Glib::ustring &key)
 Computes the common prefix that is shared by all rows in completion that start with key.
 
void complete ()
 Requests a completion operation, or in other words a refiltering of the current list with completions, using the current key.
 
void insert_prefix ()
 Requests a prefix insertion.
 
void set_inline_completion (bool inline_completion=true)
 Sets whether the common prefix of the possible completions should be automatically inserted in the entry.
 
bool get_inline_completion () const
 Returns whether the common prefix of the possible completions should be automatically inserted in the entry.
 
void set_inline_selection (bool inline_selection=true)
 Sets whether it is possible to cycle through the possible completions inside the entry.
 
bool get_inline_selection () const
 Returns true if inline-selection mode is turned on.
 
void set_popup_completion (bool popup_completion=true)
 Sets whether the completions should be presented in a popup window.
 
bool get_popup_completion () const
 Returns whether the completions should be presented in a popup window.
 
void set_popup_set_width (bool popup_set_width=true)
 Sets whether the completion popup window will be resized to be the same width as the entry.
 
bool get_popup_set_width () const
 Returns whether the completion popup window will be resized to the width of the entry.
 
void set_popup_single_match (bool popup_single_match=true)
 Sets whether the completion popup window will appear even if there is only a single match.
 
bool get_popup_single_match () const
 Returns whether the completion popup window will appear even if there is only a single match.
 
Glib::ustring get_completion_prefix () const
 Get the original text entered by the user that triggered the completion or an empty string if there's no completion ongoing.
 
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.
 
void set_text_column (int column)
 Convenience function for setting up the most used case of this code: a completion list with just strings.
 
int get_text_column () const
 Returns the column in the model of completion to get strings from.
 
Glib::SignalProxy< bool(const TreeModel::iterator &)> signal_match_selected ()
 Emitted when a match from the list is selected.
 
Glib::SignalProxy< bool(const TreeModel::iterator &)> signal_cursor_on_match ()
 Emitted when a match from the cursor is on a match of the list.
 
Glib::SignalProxy< bool(const Glib::ustring &)> signal_insert_prefix ()
 
Glib::SignalProxy< void()> signal_no_matches ()
 
Glib::PropertyProxy< Glib::RefPtr< Gtk::TreeModel > > property_model ()
 The model used as data source.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gtk::TreeModel > > property_model () const
 The model used as data source.
 
Glib::PropertyProxy< int > property_minimum_key_length ()
 The minimum key length as set for completion.
 
Glib::PropertyProxy_ReadOnly< int > property_minimum_key_length () const
 The minimum key length as set for completion.
 
Glib::PropertyProxy< int > property_text_column ()
 The column of the model containing the strings.
 
Glib::PropertyProxy_ReadOnly< int > property_text_column () const
 The column of the model containing the strings.
 
Glib::PropertyProxy< bool > property_inline_completion ()
 Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
 
Glib::PropertyProxy_ReadOnly< bool > property_inline_completion () const
 Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
 
Glib::PropertyProxy< bool > property_popup_completion ()
 Determines whether the possible completions should be shown in a popup window.
 
Glib::PropertyProxy_ReadOnly< bool > property_popup_completion () const
 Determines whether the possible completions should be shown in a popup window.
 
Glib::PropertyProxy< bool > property_popup_set_width ()
 Determines whether the completions popup window will be resized to the width of the entry.
 
Glib::PropertyProxy_ReadOnly< bool > property_popup_set_width () const
 Determines whether the completions popup window will be resized to the width of the entry.
 
Glib::PropertyProxy< bool > property_popup_single_match ()
 Determines whether the completions popup window will shown for a single possible completion.
 
Glib::PropertyProxy_ReadOnly< bool > property_popup_single_match () const
 Determines whether the completions popup window will shown for a single possible completion.
 
Glib::PropertyProxy< bool > property_inline_selection ()
 Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
 
Glib::PropertyProxy_ReadOnly< bool > property_inline_selection () const
 Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< CellArea > > property_cell_area () const
 The Gtk::CellArea used to layout cell renderers in the treeview column.
 
- Public Member Functions inherited from Gtk::CellLayout
 CellLayout (CellLayout &&src) noexcept
 
CellLayoutoperator= (CellLayout &&src) noexcept
 
 ~CellLayout () noexcept override
 
GtkCellLayoutgobj ()
 Provides access to the underlying C GObject.
 
const GtkCellLayoutgobj () const
 Provides access to the underlying C GObject.
 
template<class ColumnType >
void pack_start (const TreeModelColumn< ColumnType > &model_column, bool expand=true)
 
void pack_start (CellRenderer &cell, bool expand=true)
 Packs the cell into the beginning of cell_layout.
 
void pack_end (CellRenderer &cell, bool expand=true)
 Adds the cell to the end of cell_layout.
 
std::vector< CellRenderer * > get_cells ()
 Returns the cell renderers which have been added to cell_layout.
 
std::vector< const CellRenderer * > get_cells () const
 Returns the cell renderers which have been added to cell_layout.
 
CellRendererget_first_cell ()
 Gets the CellRenderer for the first column if any has been added, or nullptr otherwise.
 
const CellRendererget_first_cell () const
 Gets the CellRenderer for the first column if any has been added, or nullptr otherwise.
 
void clear ()
 Unsets all the mappings on all renderers on cell_layout and removes all renderers from cell_layout.
 
void add_attribute (CellRenderer &cell, const Glib::ustring &attribute, int column)
 Adds an attribute mapping to the list in cell_layout.
 
void add_attribute (const Glib::PropertyProxy_Base &property, const TreeModelColumnBase &column)
 
void add_attribute (CellRenderer &cell, const Glib::ustring &attribute, const TreeModelColumnBase &column)
 
void set_cell_data_func (CellRenderer &cell, const SlotCellData &slot)
 
void clear_attributes (CellRenderer &cell)
 Clears all existing attributes previously set with set_attributes().
 
void reorder (CellRenderer &cell, int position)
 Re-inserts cell at position.
 
Glib::RefPtr< CellAreaget_area ()
 Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be nullptr if no Gtk::CellArea is used by cell_layout.
 
Glib::RefPtr< const CellAreaget_area () const
 Returns the underlying Gtk::CellArea which might be cell_layout if called on a Gtk::CellArea or might be nullptr if no Gtk::CellArea is used by cell_layout.
 
template<class T_ModelColumnType >
void pack_start (const TreeModelColumn< T_ModelColumnType > &column, bool expand)
 
- Public Member Functions inherited from Gtk::Buildable
 Buildable (Buildable &&src) noexcept
 
Buildableoperator= (Buildable &&src) noexcept
 
 ~Buildable () noexcept override
 
GtkBuildablegobj ()
 Provides access to the underlying C GObject.
 
const GtkBuildablegobj () const
 Provides access to the underlying C GObject.
 
Glib::ustring get_buildable_id () const
 Gets the ID of the buildable object.
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< EntryCompletioncreate ()
 
- Static Public Member Functions inherited from Gtk::CellLayout
static void add_interface (GType gtype_implementer)
 
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
- Static Public Member Functions inherited from Gtk::Buildable
static void add_interface (GType gtype_implementer)
 
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 

Protected Member Functions

 EntryCompletion ()
 
- Protected Member Functions inherited from Gtk::CellLayout
 CellLayout ()
 You should derive from this class to use it.
 
virtual void pack_start_vfunc (CellRenderer *cell, bool expand)
 
virtual void pack_end_vfunc (CellRenderer *cell, bool expand)
 
virtual void clear_vfunc ()
 
virtual void add_attribute_vfunc (CellRenderer *cell, const Glib::ustring &attribute, int column)
 
virtual void clear_attributes_vfunc (CellRenderer *cell)
 
virtual void reorder_vfunc (CellRenderer *cell, int position)
 
- Protected Member Functions inherited from Gtk::Buildable
 Buildable ()
 You should derive from this class to use it.
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::EntryCompletionwrap (GtkEntryCompletion *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Detailed Description

Completion functionality for Gtk::Entry.

Gtk::EntryCompletion is an auxiliary object to be used in conjunction with Gtk::Entry to provide the completion functionality.

It derives from Gtk::CellLayout, to allow the user to add extra cells to the Gtk::TreeView with completion matches.

"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().

Deprecated:
4.10: GtkEntryCompletion will be removed in GTK 5.

Member Typedef Documentation

◆ SlotMatch

For example, bool on_match(const Glib::ustring& key, const TreeModel::const_iterator& iter);.

Constructor & Destructor Documentation

◆ EntryCompletion() [1/2]

Gtk::EntryCompletion::EntryCompletion ( EntryCompletion &&  src)
noexcept

◆ ~EntryCompletion()

Gtk::EntryCompletion::~EntryCompletion ( )
overridenoexcept

◆ EntryCompletion() [2/2]

Gtk::EntryCompletion::EntryCompletion ( )
protected

Member Function Documentation

◆ complete()

void Gtk::EntryCompletion::complete ( )

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.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

◆ compute_prefix()

Glib::ustring Gtk::EntryCompletion::compute_prefix ( const Glib::ustring &  key)

Computes the common prefix that is shared by all rows in completion that start with key.

If no row matches key, nullptr will be returned. Note that a text column must have been set for this function to work, see set_text_column() for details.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
keyThe text to complete for.
Returns
The common prefix all rows starting with key.

◆ create()

static Glib::RefPtr< EntryCompletion > Gtk::EntryCompletion::create ( )
static

◆ get_completion_prefix()

Glib::ustring Gtk::EntryCompletion::get_completion_prefix ( ) const

Get the original text entered by the user that triggered the completion or an empty string if there's no completion ongoing.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
The prefix for the current completion.

◆ get_entry() [1/2]

Entry * Gtk::EntryCompletion::get_entry ( )

Gets the entry completion has been attached to.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
The entry completion has been attached to.

◆ get_entry() [2/2]

const Entry * Gtk::EntryCompletion::get_entry ( ) const

Gets the entry completion has been attached to.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
The entry completion has been attached to.

◆ get_inline_completion()

bool Gtk::EntryCompletion::get_inline_completion ( ) const

Returns whether the common prefix of the possible completions should be automatically inserted in the entry.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
true if inline completion is turned on.

◆ get_inline_selection()

bool Gtk::EntryCompletion::get_inline_selection ( ) const

Returns true if inline-selection mode is turned on.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
true if inline-selection mode is on.

◆ get_minimum_key_length()

int Gtk::EntryCompletion::get_minimum_key_length ( ) const

Returns the minimum key length as set for completion.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
The currently used minimum key length.

◆ get_model() [1/2]

Glib::RefPtr< TreeModel > Gtk::EntryCompletion::get_model ( )

Returns the model the Gtk::EntryCompletion is using as data source.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
A Gtk::TreeModel.

◆ get_model() [2/2]

Glib::RefPtr< const TreeModel > Gtk::EntryCompletion::get_model ( ) const

Returns the model the Gtk::EntryCompletion is using as data source.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
A Gtk::TreeModel.

◆ get_popup_completion()

bool Gtk::EntryCompletion::get_popup_completion ( ) const

Returns whether the completions should be presented in a popup window.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
true if popup completion is turned on.

◆ get_popup_set_width()

bool Gtk::EntryCompletion::get_popup_set_width ( ) const

Returns whether the completion popup window will be resized to the width of the entry.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
true if the popup window will be resized to the width of the entry.

◆ get_popup_single_match()

bool Gtk::EntryCompletion::get_popup_single_match ( ) const

Returns whether the completion popup window will appear even if there is only a single match.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
true if the popup window will appear regardless of the number of matches.

◆ get_text_column()

int Gtk::EntryCompletion::get_text_column ( ) const

Returns the column in the model of completion to get strings from.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Returns
The column containing the strings.

◆ get_type()

static GType Gtk::EntryCompletion::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GtkEntryCompletion * Gtk::EntryCompletion::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkEntryCompletion * Gtk::EntryCompletion::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkEntryCompletion * Gtk::EntryCompletion::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ insert_prefix()

void Gtk::EntryCompletion::insert_prefix ( )

Requests a prefix insertion.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

◆ operator=()

EntryCompletion & Gtk::EntryCompletion::operator= ( EntryCompletion &&  src)
noexcept

◆ property_cell_area()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< CellArea > > Gtk::EntryCompletion::property_cell_area ( ) const

The Gtk::CellArea used to layout cell renderers in the treeview column.

If no area is specified when creating the entry completion with Gtk::EntryCompletion::new_with_area(), a horizontally oriented Gtk::CellAreaBox will be used.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_inline_completion() [1/2]

Glib::PropertyProxy< bool > Gtk::EntryCompletion::property_inline_completion ( )

Determines whether the common prefix of the possible completions should be inserted automatically in the entry.

Note that this requires text-column to be set, even if you are using a custom match function.

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_inline_completion() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::EntryCompletion::property_inline_completion ( ) const

Determines whether the common prefix of the possible completions should be inserted automatically in the entry.

Note that this requires text-column to be set, even if you are using a custom match function.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_inline_selection() [1/2]

Glib::PropertyProxy< bool > Gtk::EntryCompletion::property_inline_selection ( )

Determines whether the possible completions on the popup will appear in the entry as you navigate through them.

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_inline_selection() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::EntryCompletion::property_inline_selection ( ) const

Determines whether the possible completions on the popup will appear in the entry as you navigate through them.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_minimum_key_length() [1/2]

Glib::PropertyProxy< int > Gtk::EntryCompletion::property_minimum_key_length ( )

The minimum key length as set for completion.

Default value: 1

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_minimum_key_length() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::EntryCompletion::property_minimum_key_length ( ) const

The minimum key length as set for completion.

Default value: 1

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_model() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Gtk::TreeModel > > Gtk::EntryCompletion::property_model ( )

The model used as data source.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_model() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gtk::TreeModel > > Gtk::EntryCompletion::property_model ( ) const

The model used as data source.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_popup_completion() [1/2]

Glib::PropertyProxy< bool > Gtk::EntryCompletion::property_popup_completion ( )

Determines whether the possible completions should be shown in a popup window.

Default value: true

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_popup_completion() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::EntryCompletion::property_popup_completion ( ) const

Determines whether the possible completions should be shown in a popup window.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_popup_set_width() [1/2]

Glib::PropertyProxy< bool > Gtk::EntryCompletion::property_popup_set_width ( )

Determines whether the completions popup window will be resized to the width of the entry.

Default value: true

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_popup_set_width() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::EntryCompletion::property_popup_set_width ( ) const

Determines whether the completions popup window will be resized to the width of the entry.

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_popup_single_match() [1/2]

Glib::PropertyProxy< bool > Gtk::EntryCompletion::property_popup_single_match ( )

Determines whether the completions popup window will shown for a single possible completion.

You probably want to set this to false if you are using property_inline_completion().

Default value: true

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_popup_single_match() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::EntryCompletion::property_popup_single_match ( ) const

Determines whether the completions popup window will shown for a single possible completion.

You probably want to set this to false if you are using property_inline_completion().

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_text_column() [1/2]

Glib::PropertyProxy< int > Gtk::EntryCompletion::property_text_column ( )

The column of the model containing the strings.

Note that the strings must be UTF-8.

Default value: -1

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_text_column() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::EntryCompletion::property_text_column ( ) const

The column of the model containing the strings.

Note that the strings must be UTF-8.

Default value: -1

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_inline_completion()

void Gtk::EntryCompletion::set_inline_completion ( bool  inline_completion = true)

Sets whether the common prefix of the possible completions should be automatically inserted in the entry.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
inline_completiontrue to do inline completion.

◆ set_inline_selection()

void Gtk::EntryCompletion::set_inline_selection ( bool  inline_selection = true)

Sets whether it is possible to cycle through the possible completions inside the entry.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
inline_selectiontrue to do inline selection.

◆ set_match_func()

void Gtk::EntryCompletion::set_match_func ( const SlotMatch slot)

◆ set_minimum_key_length()

void Gtk::EntryCompletion::set_minimum_key_length ( int  length)

Requires the length of the search key for completion to be at least 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).

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
lengthThe minimum length of the key in order to start completing.

◆ set_model()

void Gtk::EntryCompletion::set_model ( const Glib::RefPtr< TreeModel > &  model)

Sets the model for a Gtk::EntryCompletion.

If completion already has a model set, it will remove it before setting the new model. Use unset_model() to unset the old model.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
modelThe Gtk::TreeModel.

◆ set_popup_completion()

void Gtk::EntryCompletion::set_popup_completion ( bool  popup_completion = true)

Sets whether the completions should be presented in a popup window.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
popup_completiontrue to do popup completion.

◆ set_popup_set_width()

void Gtk::EntryCompletion::set_popup_set_width ( bool  popup_set_width = true)

Sets whether the completion popup window will be resized to be the same width as the entry.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
popup_set_widthtrue to make the width of the popup the same as the entry.

◆ set_popup_single_match()

void Gtk::EntryCompletion::set_popup_single_match ( bool  popup_single_match = true)

Sets whether the completion popup window will appear even if there is only a single match.

You may want to set this to false if you are using property_inline_completion().

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
popup_single_matchtrue if the popup should appear even for a single match.

◆ set_text_column() [1/2]

void Gtk::EntryCompletion::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 completion to have a list displaying all (and just) strings in the completion list, and to get those strings from column in the model of 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 property_text_column() property directly.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
columnThe column in the model of completion to get strings from.

◆ set_text_column() [2/2]

void Gtk::EntryCompletion::set_text_column ( int  column)

Convenience function for setting up the most used case of this code: a completion list with just strings.

This function will set up completion to have a list displaying all (and just) strings in the completion list, and to get those strings from column in the model of 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 property_text_column() property directly.

Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.

Parameters
columnThe column in the model of completion to get strings from.

◆ signal_cursor_on_match()

Glib::SignalProxy< bool(const TreeModel::iterator &)> Gtk::EntryCompletion::signal_cursor_on_match ( )

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 iter.

Parameters
modelThe TreeModel containing the matches
iterA TreeModel::iterator positioned at the selected match
Returns
true if the signal has been handled
Prototype:
bool on_cursor_on_match(const TreeModel::iterator& iter)

◆ signal_insert_prefix()

Glib::SignalProxy< bool(const Glib::ustring &)> Gtk::EntryCompletion::signal_insert_prefix ( )
Slot Prototype:
bool on_my_insert_prefix(const Glib::ustring& prefix)

Flags: Run Last

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 prefix into the entry - e.g. the entry used in the Gtk::FileChooser inserts only the part of the prefix up to the next '/'.

Parameters
prefixThe common prefix of all possible completions.
Returns
true if the signal has been handled.

◆ signal_match_selected()

Glib::SignalProxy< bool(const TreeModel::iterator &)> Gtk::EntryCompletion::signal_match_selected ( )

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 iter.

It is necessary to connect your signal handler before the default one, which would otherwise return true, a value which signifies that the signal has been handled, thus preventing any other handler from being invoked.

To do this, pass false to this signal proxy's connect() method. For example: completion->signal_match_selected().connect(sigc::mem_fun(* this, & YourClass::on_completion_match_selected), false);

Parameters
modelThe TreeModel containing the matches
iterA TreeModel::iterator positioned at the selected match
Returns
true if the signal has been handled
Prototype:
bool on_match_selected(const TreeModel::iterator& iter)

◆ signal_no_matches()

Glib::SignalProxy< void()> Gtk::EntryCompletion::signal_no_matches ( )
Slot Prototype:
void on_my_no_matches()

Flags: Run Last

Emitted when the filter model has zero number of rows in completion_complete method.

In other words when Gtk::EntryCompletion is out of suggestions.

◆ unset_model()

void Gtk::EntryCompletion::unset_model ( )

Remove the model from the EntryCompletion.

See also
set_model().

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gtk::EntryCompletion > wrap ( GtkEntryCompletion object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.