Skip to main content

TreeSelectionExt

Trait TreeSelectionExt 

Source
pub trait TreeSelectionExt:
    IsA<TreeSelection>
    + Sealed
    + 'static {
Show 20 methods // Provided 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

Trait containing all TreeSelection methods.

§Implementors

TreeSelection

Provided Methods§

Source

fn count_selected_rows(&self) -> i32

Returns the number of rows that have been selected in tree.

§Returns

The number of rows selected.

Source

fn mode(&self) -> SelectionMode

Gets the selection mode for self. See set_mode().

§Returns

the current selection mode

Source

fn selected(&self) -> Option<(TreeModel, TreeIter)>

Sets iter to the currently selected node, if self is set to SelectionMode::Single or SelectionMode::Browse.

The iter argument may be None if you just want to test if self has any selected nodes.

The model argument is filled with the current model as a convenience.

This function will not work with SelectionMode::Multiple. See selected_rows() instead.

§Returns

true, if there is a selected node.

§model

the model

§iter

the iterator for the selected row

Source

fn selected_rows(&self) -> (Vec<TreePath>, TreeModel)

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

the selected paths

§model

A pointer to set to the TreeModel, or None.

Source

fn tree_view(&self) -> Option<TreeView>

Returns the tree view associated with self.

§Returns

A TreeView

Source

fn iter_is_selected(&self, iter: &TreeIter) -> bool

Returns true if the row at iter is currently selected.

§iter

A valid TreeIter

§Returns

true, if iter is selected

Source

fn path_is_selected(&self, path: &TreePath) -> bool

Returns true if the row pointed to by path is currently selected. If path does not point to a valid location, false is returned

§path

A TreePath to check selection on.

§Returns

true if path is selected.

Source

fn select_all(&self)

Selects all the nodes. self must be set to SelectionMode::Multiple mode.

Source

fn select_iter(&self, iter: &TreeIter)

Selects the specified iterator.

§iter

The TreeIter to be selected.

Source

fn select_path(&self, path: &TreePath)

Select the row at path.

§path

The TreePath to be selected.

Source

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.

Source

fn selected_foreach<P: FnMut(&TreeModel, &TreePath, &TreeIter)>(&self, func: P)

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.

Source

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

Source

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

Source

fn unselect_all(&self)

Unselects all the nodes.

Source

fn unselect_iter(&self, iter: &TreeIter)

Unselects the specified iterator.

§iter

The TreeIter to be unselected.

Source

fn unselect_path(&self, path: &TreePath)

Unselects the row at path.

§path

The TreePath to be unselected.

Source

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.

Source

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.

Source

fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§