[−][src]Trait gio::ListModelExt
Required methods
fn get_item_type(&self) -> Type
Gets the type of the items in self
. All items returned from
g_list_model_get_type
are of that type or a subtype, or are an
implementation of that interface.
The item type of a ListModel
can not change during the life of the
model.
Feature: v2_44
Returns
the glib::Type
of the items contained in self
.
fn get_n_items(&self) -> u32
Gets the number of items in self
.
Depending on the model implementation, calling this function may be
less efficient than iterating the list with increasing values for
position
until ListModel::get_item
returns None
.
Feature: v2_44
Returns
the number of items in self
.
fn get_object(&self, position: u32) -> Option<Object>
Get the item at position
. If position
is greater than the number of
items in self
, None
is returned.
None
is never returned for an index that is smaller than the length
of the list. See ListModel::get_n_items
.
Feature: v2_44
position
the position of the item to fetch
Returns
the object at position
.
fn items_changed(&self, position: u32, removed: u32, added: u32)
Emits the ListModel::items-changed
signal on self
.
This function should only be called by classes implementing
ListModel
. It has to be called after the internal representation
of self
has been updated, because handlers connected to this signal
might query the new state of the list.
Implementations must only make changes to the model (as visible to
its consumer) in places that will not cause problems for that
consumer. For models that are driven directly by a write API (such
as ListStore
), changes can be reported in response to uses of that
API. For models that represent remote data, changes should only be
made from a fresh mainloop dispatch. It is particularly not
permitted to make changes in response to a call to the ListModel
consumer API.
Stated another way: in general, it is assumed that code making a series of accesses to the model via the API, without returning to the mainloop, and without calling other code, will continue to view the same contents of the model.
Feature: v2_44
position
the position at which self
changed
removed
the number of items removed
added
the number of items added
fn connect_items_changed<F: Fn(&Self, u32, u32, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
This signal is emitted whenever items were added to or removed
from list
. At position
, removed
items were removed and added
items were added in their place.
Note: If removed
!= added
, the positions of all later items
in the model change.
Feature: v2_44
position
the position at which list
changed
removed
the number of items removed
added
the number of items added
Implementors
impl<O: IsA<ListModel>> ListModelExt for O
[src]
fn get_item_type(&self) -> Type
[src]
fn get_n_items(&self) -> u32
[src]
fn get_object(&self, position: u32) -> Option<Object>
[src]
fn items_changed(&self, position: u32, removed: u32, added: u32)
[src]
fn connect_items_changed<F: Fn(&Self, u32, u32, u32) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId