Trait gtk::prelude::TreeSelectionExt [−][src]
pub trait TreeSelectionExt: 'static {}Show methods
fn count_selected_rows(&self) -> i32; fn mode(&self) -> SelectionMode; fn selected(&self) -> Option<(TreeModel, TreeIter)>; fn selected_rows(&self) -> (Vec<TreePath>, TreeModel); fn tree_view(&self) -> Option<TreeView>; fn iter_is_selected(&self, iter: &TreeIter) -> bool; fn path_is_selected(&self, path: &TreePath) -> bool; fn select_all(&self); fn select_iter(&self, iter: &TreeIter); fn select_path(&self, path: &TreePath); fn select_range(&self, start_path: &TreePath, end_path: &TreePath); fn selected_foreach<P: FnMut(&TreeModel, &TreePath, &TreeIter)>(
&self,
func: P
); fn set_mode(&self, type_: SelectionMode); fn set_select_function(
&self,
func: Option<Box_<dyn Fn(&TreeSelection, &TreeModel, &TreePath, bool) -> bool + 'static>>
); fn unselect_all(&self); fn unselect_iter(&self, iter: &TreeIter); fn unselect_path(&self, path: &TreePath); fn unselect_range(&self, start_path: &TreePath, end_path: &TreePath); fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
Expand description
Required methods
fn count_selected_rows(&self) -> i32
fn count_selected_rows(&self) -> i32
fn mode(&self) -> SelectionMode
fn mode(&self) -> SelectionMode
Sets iter
to the currently selected node if self
is set to
SelectionMode::Single
or SelectionMode::Browse
. iter
may be NULL if you
just want to test if self
has any selected nodes. model
is filled
with the current model as a convenience. This function will not work if you
use self
is SelectionMode::Multiple
.
Returns
TRUE, if there is a selected node.
model
A pointer to set to the TreeModel
, or NULL.
iter
The TreeIter
, or NULL.
Creates a list of path of all selected rows. Additionally, if you are
planning on modifying the model after calling this function, you may
want to convert the returned list into a list of GtkTreeRowReferences
.
To do this, you can use TreeRowReference::new()
.
To free the return value, use:
⚠️ The following code is in C ⚠️
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
Returns
A GList
containing a TreePath
for each selected row.
model
fn iter_is_selected(&self, iter: &TreeIter) -> bool
fn iter_is_selected(&self, iter: &TreeIter) -> bool
fn path_is_selected(&self, path: &TreePath) -> bool
fn path_is_selected(&self, path: &TreePath) -> bool
fn select_all(&self)
fn select_all(&self)
Selects all the nodes. self
must be set to SelectionMode::Multiple
mode.
fn select_iter(&self, iter: &TreeIter)
fn select_iter(&self, iter: &TreeIter)
fn select_path(&self, path: &TreePath)
fn select_path(&self, path: &TreePath)
fn select_range(&self, start_path: &TreePath, end_path: &TreePath)
fn select_range(&self, start_path: &TreePath, end_path: &TreePath)
Selects a range of nodes, determined by start_path
and end_path
inclusive.
self
must be set to SelectionMode::Multiple
mode.
start_path
The initial node of the range.
end_path
The final node of the range.
Calls a function for each selected node. Note that you cannot modify
the tree or selection from within this function. As a result,
selected_rows()
might be more useful.
func
The function to call for each selected node.
fn set_mode(&self, type_: SelectionMode)
fn set_mode(&self, type_: SelectionMode)
Sets the selection mode of the self
. If the previous type was
SelectionMode::Multiple
, then the anchor is kept selected, if it was
previously selected.
type_
The selection mode
fn set_select_function(
&self,
func: Option<Box_<dyn Fn(&TreeSelection, &TreeModel, &TreePath, bool) -> bool + 'static>>
)
fn set_select_function(
&self,
func: Option<Box_<dyn Fn(&TreeSelection, &TreeModel, &TreePath, bool) -> bool + 'static>>
)
Sets the selection function.
If set, this function is called before any node is selected or unselected,
giving some control over which nodes are selected. The select function
should return true
if the state of the node may be toggled, and false
if the state of the node should be left unchanged.
func
The selection function. May be None
fn unselect_all(&self)
fn unselect_all(&self)
Unselects all the nodes.
fn unselect_iter(&self, iter: &TreeIter)
fn unselect_iter(&self, iter: &TreeIter)
fn unselect_path(&self, path: &TreePath)
fn unselect_path(&self, path: &TreePath)
fn unselect_range(&self, start_path: &TreePath, end_path: &TreePath)
fn unselect_range(&self, start_path: &TreePath, end_path: &TreePath)
Unselects a range of nodes, determined by start_path
and end_path
inclusive.
start_path
The initial node of the range.
end_path
The initial node of the range.
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted whenever the selection has (possibly) changed. Please note that this signal is mostly a hint. It may only be emitted once when a range of rows are selected, and it may occasionally be emitted when nothing has happened.
fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId