Trait gtk::prelude::EntryCompletionExt
source · [−]pub trait EntryCompletionExt: 'static {
Show 38 methods
fn complete(&self);
fn compute_prefix(&self, key: &str) -> Option<GString>;
fn delete_action(&self, index_: i32);
fn completion_prefix(&self) -> Option<GString>;
fn is_inline_completion(&self) -> bool;
fn is_inline_selection(&self) -> bool;
fn minimum_key_length(&self) -> i32;
fn model(&self) -> Option<TreeModel>;
fn is_popup_completion(&self) -> bool;
fn is_popup_set_width(&self) -> bool;
fn is_popup_single_match(&self) -> bool;
fn text_column(&self) -> i32;
fn insert_action_markup(&self, index_: i32, markup: &str);
fn insert_action_text(&self, index_: i32, text: &str);
fn insert_prefix(&self);
fn set_inline_completion(&self, inline_completion: bool);
fn set_inline_selection(&self, inline_selection: bool);
fn set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(
&self,
func: P
);
fn set_minimum_key_length(&self, length: i32);
fn set_model(&self, model: Option<&impl IsA<TreeModel>>);
fn set_popup_completion(&self, popup_completion: bool);
fn set_popup_set_width(&self, popup_set_width: bool);
fn set_popup_single_match(&self, popup_single_match: bool);
fn set_text_column(&self, column: i32);
fn cell_area(&self) -> Option<CellArea>;
fn connect_action_activated<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_cursor_on_match<F: Fn(&Self, &TreeModel, &TreeIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_insert_prefix<F: Fn(&Self, &str) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_match_selected<F: Fn(&Self, &TreeModel, &TreeIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_no_matches<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_inline_completion_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_inline_selection_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_minimum_key_length_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_model_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_popup_completion_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_popup_set_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_popup_single_match_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_text_column_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
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.
fn compute_prefix(&self, key: &str) -> Option<GString>
fn compute_prefix(&self, key: &str) -> Option<GString>
Computes the common prefix that is shared by all rows in self
that start with key
. If no row matches key
, None
will be returned.
Note that a text column must have been set for this function to work,
see set_text_column()
for details.
key
The text to complete for
Returns
The common prefix all rows starting with
key
or None
if no row matches key
.
fn delete_action(&self, index_: i32)
fn delete_action(&self, index_: i32)
Deletes the action at index_
from self
’s action list.
Note that index_
is a relative position and the position of an
action may have changed since it was inserted.
index_
the index of the item to delete
fn completion_prefix(&self) -> Option<GString>
fn completion_prefix(&self) -> Option<GString>
fn is_inline_completion(&self) -> bool
fn is_inline_completion(&self) -> bool
fn is_inline_selection(&self) -> bool
fn is_inline_selection(&self) -> bool
fn minimum_key_length(&self) -> i32
fn minimum_key_length(&self) -> i32
Returns the model the EntryCompletion
is using as data source.
Returns None
if the model is unset.
Returns
fn is_popup_completion(&self) -> bool
fn is_popup_completion(&self) -> bool
fn is_popup_set_width(&self) -> bool
fn is_popup_set_width(&self) -> bool
fn is_popup_single_match(&self) -> bool
fn is_popup_single_match(&self) -> bool
fn text_column(&self) -> i32
fn text_column(&self) -> i32
Returns the column in the model of self
to get strings from.
Returns
the column containing the strings
fn insert_action_markup(&self, index_: i32, markup: &str)
fn insert_action_markup(&self, index_: i32, markup: &str)
fn insert_action_text(&self, index_: i32, text: &str)
fn insert_action_text(&self, index_: i32, text: &str)
Inserts an action in self
’s action item list at position index_
with text text
. If you want the action item to have markup, use
insert_action_markup()
.
Note that index_
is a relative position in the list of actions and
the position of an action can change when deleting a different action.
index_
the index of the item to insert
text
text of the item to insert
fn insert_prefix(&self)
fn insert_prefix(&self)
Requests a prefix insertion.
fn set_inline_completion(&self, inline_completion: bool)
fn set_inline_completion(&self, inline_completion: bool)
Sets whether the common prefix of the possible completions should be automatically inserted in the entry.
inline_completion
true
to do inline completion
fn set_inline_selection(&self, inline_selection: bool)
fn set_inline_selection(&self, inline_selection: bool)
Sets whether it is possible to cycle through the possible completions inside the entry.
inline_selection
true
to do inline selection
fn set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(
&self,
func: P
)
fn set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(
&self,
func: P
)
Sets the match function for self
to be func
. The match function
is used to determine if a row should or should not be in the completion
list.
func
the GtkEntryCompletionMatchFunc
to use
func_data
user data for func
func_notify
destroy notify for func_data
.
fn set_minimum_key_length(&self, length: i32)
fn set_minimum_key_length(&self, length: i32)
Requires the length of the search key for self
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).
length
the minimum length of the key in order to start completing
Sets the model for a EntryCompletion
. If self
already has
a model set, it will remove it before setting the new model.
If model is None
, then it will unset the model.
model
the TreeModel
fn set_popup_completion(&self, popup_completion: bool)
fn set_popup_completion(&self, popup_completion: bool)
Sets whether the completions should be presented in a popup window.
popup_completion
true
to do popup completion
fn set_popup_set_width(&self, popup_set_width: bool)
fn set_popup_set_width(&self, popup_set_width: bool)
Sets whether the completion popup window will be resized to be the same width as the entry.
popup_set_width
true
to make the width of the popup the same as the entry
fn set_popup_single_match(&self, popup_single_match: bool)
fn set_popup_single_match(&self, popup_single_match: bool)
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 [inline completion][GtkEntryCompletion–inline-completion].
popup_single_match
true
if the popup should appear even for a single
match
fn set_text_column(&self, column: i32)
fn set_text_column(&self, column: i32)
Convenience function for setting up the most used case of this code: a
completion list with just strings. This function will set up self
to have a list displaying all (and just) strings in the completion list,
and to get those strings from column
in the model of self
.
This functions creates and adds a CellRendererText
for the selected
column. If you need to set the text column, but don’t want the cell
renderer, use [ObjectExtManual::set()
][crate::glib::prelude::ObjectExtManual::set()] to set the property::EntryCompletion::text-column
property directly.
column
the column in the model of self
to get strings from
The CellArea
used to layout cell renderers in the treeview column.
If no area is specified when creating the entry completion with
EntryCompletion::with_area()
a horizontally oriented
CellAreaBox
will be used.
fn connect_action_activated<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_action_activated<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_cursor_on_match<F: Fn(&Self, &TreeModel, &TreeIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_cursor_on_match<F: Fn(&Self, &TreeModel, &TreeIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
Gets 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
.
Note that model
is the model that was passed to
set_model()
.
model
the TreeModel
containing the matches
iter
a TreeIter
positioned at the selected match
Returns
true
if the signal has been handled
fn connect_insert_prefix<F: Fn(&Self, &str) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_insert_prefix<F: Fn(&Self, &str) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
Gets 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 FileChooser
inserts only the part of the prefix up to the
next ‘/’.
prefix
the common prefix of all possible completions
Returns
true
if the signal has been handled
fn connect_match_selected<F: Fn(&Self, &TreeModel, &TreeIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_match_selected<F: Fn(&Self, &TreeModel, &TreeIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
Gets 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
.
Note that model
is the model that was passed to
set_model()
.
model
the TreeModel
containing the matches
iter
a TreeIter
positioned at the selected match
Returns
true
if the signal has been handled
fn connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Gets emitted when the filter model has zero number of rows in completion_complete method. (In other words when GtkEntryCompletion is out of suggestions)