[][src]Trait gio::ListStoreExt

pub trait ListStoreExt: 'static {
    fn append<P: IsA<Object>>(&self, item: &P);
fn find<P: IsA<Object>>(&self, item: &P) -> Option<u32>;
fn insert<P: IsA<Object>>(&self, position: u32, item: &P);
fn remove(&self, position: u32);
fn remove_all(&self);
fn splice(&self, position: u32, n_removals: u32, additions: &[Object]); }

Trait containing all ListStore methods.

Feature: v2_44

Implementors

ListStore

Required methods

fn append<P: IsA<Object>>(&self, item: &P)

Appends item to self. item must be of type ListStore:item-type.

This function takes a ref on item.

Use ListStoreExt::splice to append multiple items at the same time efficiently.

Feature: v2_44

item

the new item

fn find<P: IsA<Object>>(&self, item: &P) -> Option<u32>

Looks up the given item in the list store by looping over the items until the first occurrence of item. If item was not found, then position will not be set, and this method will return false.

If you need to compare the two items with a custom comparison function, use ListStoreExt::find_with_equal_func with a custom GEqualFunc instead.

Feature: v2_64

item

an item

position

the first position of item, if it was found.

Returns

Whether self contains item. If it was found, position will be set to the position where item occurred for the first time.

fn insert<P: IsA<Object>>(&self, position: u32, item: &P)

Inserts item into self at position. item must be of type ListStore:item-type or derived from it. position must be smaller than the length of the list, or equal to it to append.

This function takes a ref on item.

Use ListStoreExt::splice to insert multiple items at the same time efficiently.

Feature: v2_44

position

the position at which to insert the new item

item

the new item

fn remove(&self, position: u32)

Removes the item from self that is at position. position must be smaller than the current length of the list.

Use ListStoreExt::splice to remove multiple items at the same time efficiently.

Feature: v2_44

position

the position of the item that is to be removed

fn remove_all(&self)

Removes all items from self.

Feature: v2_44

fn splice(&self, position: u32, n_removals: u32, additions: &[Object])

Changes self by removing n_removals items and adding n_additions items to it. additions must contain n_additions items of type ListStore:item-type. None is not permitted.

This function is more efficient than ListStoreExt::insert and ListStoreExt::remove, because it only emits ListModel::items-changed once for the change.

This function takes a ref on each item in additions.

The parameters position and n_removals must be correct (ie: position + n_removals must be less than or equal to the length of the list at the time this function is called).

Feature: v2_44

position

the position at which to make the change

n_removals

the number of items to remove

additions

the items to add

n_additions

the number of items to add

Loading content...

Implementors

impl<O: IsA<ListStore>> ListStoreExt for O[src]

Loading content...