[][src]Trait gtk::TreeModelExt

pub trait TreeModelExt: 'static {
    fn foreach<P: FnMut(&TreeModel, &TreePath, &TreeIter) -> bool>(
        &self,
        func: P
    );
fn get_column_type(&self, index_: i32) -> Type;
fn get_flags(&self) -> TreeModelFlags;
fn get_iter(&self, path: &TreePath) -> Option<TreeIter>;
fn get_iter_first(&self) -> Option<TreeIter>;
fn get_iter_from_string(&self, path_string: &str) -> Option<TreeIter>;
fn get_n_columns(&self) -> i32;
fn get_path(&self, iter: &TreeIter) -> Option<TreePath>;
fn get_string_from_iter(&self, iter: &TreeIter) -> Option<GString>;
fn get_value(&self, iter: &TreeIter, column: i32) -> Value;
fn iter_children(&self, parent: Option<&TreeIter>) -> Option<TreeIter>;
fn iter_has_child(&self, iter: &TreeIter) -> bool;
fn iter_n_children(&self, iter: Option<&TreeIter>) -> i32;
fn iter_next(&self, iter: &TreeIter) -> bool;
fn iter_nth_child(
        &self,
        parent: Option<&TreeIter>,
        n: i32
    ) -> Option<TreeIter>;
fn iter_parent(&self, child: &TreeIter) -> Option<TreeIter>;
fn iter_previous(&self, iter: &TreeIter) -> bool;
fn row_changed(&self, path: &TreePath, iter: &TreeIter);
fn row_deleted(&self, path: &TreePath);
fn row_has_child_toggled(&self, path: &TreePath, iter: &TreeIter);
fn row_inserted(&self, path: &TreePath, iter: &TreeIter);
fn rows_reordered_with_length(
        &self,
        path: &TreePath,
        iter: Option<&TreeIter>,
        new_order: &[i32]
    );
fn connect_row_changed<F: Fn(&Self, &TreePath, &TreeIter) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_row_deleted<F: Fn(&Self, &TreePath) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_row_has_child_toggled<F: Fn(&Self, &TreePath, &TreeIter) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_row_inserted<F: Fn(&Self, &TreePath, &TreeIter) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all TreeModel methods.

Implementors

ListStore, TreeModelFilter, TreeModelSort, TreeModel, TreeSortable, TreeStore

Required methods

fn foreach<P: FnMut(&TreeModel, &TreePath, &TreeIter) -> bool>(&self, func: P)

Calls func on each node in model in a depth-first fashion.

If func returns true, then the tree ceases to be walked, and TreeModel::foreach returns.

func

a function to be called on each row

user_data

user data to passed to func

fn get_column_type(&self, index_: i32) -> Type

Returns the type of the column.

index_

the column index

Returns

the type of the column

fn get_flags(&self) -> TreeModelFlags

Returns a set of flags supported by this interface.

The flags are a bitwise combination of TreeModelFlags. The flags supported should not change during the lifetime of the self.

Returns

the flags supported by this interface

fn get_iter(&self, path: &TreePath) -> Option<TreeIter>

Sets iter to a valid iterator pointing to path. If path does not exist, iter is set to an invalid iterator and false is returned.

iter

the uninitialized TreeIter-struct

path

the TreePath-struct

Returns

true, if iter was set

fn get_iter_first(&self) -> Option<TreeIter>

Initializes iter with the first iterator in the tree (the one at the path "0") and returns true. Returns false if the tree is empty.

iter

the uninitialized TreeIter-struct

Returns

true, if iter was set

fn get_iter_from_string(&self, path_string: &str) -> Option<TreeIter>

Sets iter to a valid iterator pointing to path_string, if it exists. Otherwise, iter is left invalid and false is returned.

iter

an uninitialized TreeIter-struct

path_string

a string representation of a TreePath-struct

Returns

true, if iter was set

fn get_n_columns(&self) -> i32

Returns the number of columns supported by self.

Returns

the number of columns

fn get_path(&self, iter: &TreeIter) -> Option<TreePath>

Returns a newly-created TreePath-struct referenced by iter.

This path should be freed with TreePath::free.

iter

the TreeIter-struct

Returns

a newly-created TreePath-struct

fn get_string_from_iter(&self, iter: &TreeIter) -> Option<GString>

Generates a string representation of the iter.

This string is a “:” separated list of numbers. For example, “4:10:0:3” would be an acceptable return value for this string.

iter

a TreeIter-struct

Returns

a newly-allocated string. Must be freed with g_free.

fn get_value(&self, iter: &TreeIter, column: i32) -> Value

Initializes and sets value to that at column.

When done with value, gobject::Value::unset needs to be called to free any allocated memory.

iter

the TreeIter-struct

column

the column to lookup the value at

value

an empty gobject::Value to set

fn iter_children(&self, parent: Option<&TreeIter>) -> Option<TreeIter>

Sets iter to point to the first child of parent.

If parent has no children, false is returned and iter is set to be invalid. parent will remain a valid node after this function has been called.

If parent is None returns the first node, equivalent to gtk_tree_model_get_iter_first (tree_model, iter);

iter

the new TreeIter-struct to be set to the child

parent

the TreeIter-struct, or None

Returns

true, if iter has been set to the first child

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

Returns true if iter has children, false otherwise.

iter

the TreeIter-struct to test for children

Returns

true if iter has children

fn iter_n_children(&self, iter: Option<&TreeIter>) -> i32

Returns the number of children that iter has.

As a special case, if iter is None, then the number of toplevel nodes is returned.

iter

the TreeIter-struct, or None

Returns

the number of children of iter

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

Sets iter to point to the node following it at the current level.

If there is no next iter, false is returned and iter is set to be invalid.

iter

the TreeIter-struct

Returns

true if iter has been changed to the next node

fn iter_nth_child(&self, parent: Option<&TreeIter>, n: i32) -> Option<TreeIter>

Sets iter to be the child of parent, using the given index.

The first index is 0. If n is too big, or parent has no children, iter is set to an invalid iterator and false is returned. parent will remain a valid node after this function has been called. As a special case, if parent is None, then the n-th root node is set.

iter

the TreeIter-struct to set to the nth child

parent

the TreeIter-struct to get the child from, or None.

n

the index of the desired child

Returns

true, if parent has an n-th child

fn iter_parent(&self, child: &TreeIter) -> Option<TreeIter>

Sets iter to be the parent of child.

If child is at the toplevel, and doesn’t have a parent, then iter is set to an invalid iterator and false is returned. child will remain a valid node after this function has been called.

iter will be initialized before the lookup is performed, so child and iter cannot point to the same memory location.

iter

the new TreeIter-struct to set to the parent

child

the TreeIter-struct

Returns

true, if iter is set to the parent of child

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

Sets iter to point to the previous node at the current level.

If there is no previous iter, false is returned and iter is set to be invalid.

iter

the TreeIter-struct

Returns

true if iter has been changed to the previous node

fn row_changed(&self, path: &TreePath, iter: &TreeIter)

Emits the TreeModel::row-changed signal on self.

path

a TreePath-struct pointing to the changed row

iter

a valid TreeIter-struct pointing to the changed row

fn row_deleted(&self, path: &TreePath)

Emits the TreeModel::row-deleted signal on self.

This should be called by models after a row has been removed. The location pointed to by path should be the location that the row previously was at. It may not be a valid location anymore.

Nodes that are deleted are not unreffed, this means that any outstanding references on the deleted node should not be released.

path

a TreePath-struct pointing to the previous location of the deleted row

fn row_has_child_toggled(&self, path: &TreePath, iter: &TreeIter)

Emits the TreeModel::row-has-child-toggled signal on self. This should be called by models after the child state of a node changes.

path

a TreePath-struct pointing to the changed row

iter

a valid TreeIter-struct pointing to the changed row

fn row_inserted(&self, path: &TreePath, iter: &TreeIter)

Emits the TreeModel::row-inserted signal on self.

path

a TreePath-struct pointing to the inserted row

iter

a valid TreeIter-struct pointing to the inserted row

fn rows_reordered_with_length(
    &self,
    path: &TreePath,
    iter: Option<&TreeIter>,
    new_order: &[i32]
)

Emits the TreeModel::rows-reordered signal on self.

This should be called by models when their rows have been reordered.

path

a TreePath-struct pointing to the tree node whose children have been reordered

iter

a valid TreeIter-struct pointing to the node whose children have been reordered, or None if the depth of path is 0

new_order

an array of integers mapping the current position of each child to its old position before the re-ordering, i.e. new_order``[newpos] = oldpos

length

length of new_order array

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

This signal is emitted when a row in the model has changed.

path

a TreePath-struct identifying the changed row

iter

a valid TreeIter-struct pointing to the changed row

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

This signal is emitted when a row has been deleted.

Note that no iterator is passed to the signal handler, since the row is already deleted.

This should be called by models after a row has been removed. The location pointed to by path should be the location that the row previously was at. It may not be a valid location anymore.

path

a TreePath-struct identifying the row

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

This signal is emitted when a row has gotten the first child row or lost its last child row.

path

a TreePath-struct identifying the row

iter

a valid TreeIter-struct pointing to the row

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

This signal is emitted when a new row has been inserted in the model.

Note that the row may still be empty at this point, since it is a common pattern to first insert an empty row, and then fill it with the desired values.

path

a TreePath-struct identifying the new row

iter

a valid TreeIter-struct pointing to the new row

Loading content...

Implementors

impl<O: IsA<TreeModel>> TreeModelExt for O[src]

Loading content...