SelectionModel
struct · ferroui-controls · v0.5.0
struct SelectionModel<T: PropertyValue>
A selection model: the selection of the items of a source collection of
items of type T. The untyped model is SelectionModel<BoxedValue>.
Members
newwith_sourceset_derivednodesourceset_sourcesingle_selectset_single_selectselected_indexset_selected_indexselected_indexesselected_itemset_selected_itemselected_itemsanchor_indexset_anchor_indexcountindexes_changedselection_changedlost_selectionsource_resetbatch_updatebegin_batch_updateend_batch_updateis_selectedselectdeselectselect_rangedeselect_rangeselect_allclearraise_property_changedbase_set_sourcebase_on_indexes_changedbase_on_source_collection_change_startedbase_on_source_resetbase_on_selection_removedbase_on_items_addedbase_on_items_removedbase_on_source_collection_changedbase_is_valid_collection_changebase_on_source_collection_change_finished
new
fn new() -> Rc<Self>
Creates a selection model without a source.
with_source
fn with_source(source: Option<ItemsSource>) -> Rc<Self>
Creates a selection model for a source.
set_derived
fn set_derived(self: &Self, derived: Weak<dyn SelectionModelImpl<T>>)
Registers the object deriving from this model, which receives the
virtual calls (see SelectionModelImpl).
node
fn node(self: &Self) -> &SelectionNodeBase<T>
The base state of the model.
source
fn source(self: &Self) -> Option<ItemsSource>
set_source
fn set_source(self: &Self, value: Option<ItemsSource>)
single_select
fn single_select(self: &Self) -> bool
set_single_select
fn set_single_select(self: &Self, value: bool)
selected_index
fn selected_index(self: &Self) -> i32
set_selected_index
fn set_selected_index(self: &Self, value: i32)
selected_indexes
fn selected_indexes(self: &Self) -> Rc<dyn IReadOnlySelectionList<i32>>
The selected indexes: a view of the selection, always the same list.
selected_item
fn selected_item(self: &Self) -> Option<T>
set_selected_item
fn set_selected_item(self: &Self, value: Option<T>)
selected_items
fn selected_items(self: &Self) -> Rc<dyn IReadOnlySelectionList<Option<T>>>
The selected items: a view of the selection. Before a source is assigned, the items selected by item.
anchor_index
fn anchor_index(self: &Self) -> i32
set_anchor_index
fn set_anchor_index(self: &Self, value: i32)
count
fn count(self: &Self) -> usize
The number of selected items.
indexes_changed
fn indexes_changed(self: &Self, handler: impl Fn(&SelectionModelIndexesChangedEventArgs) -> () + 'static) -> Subscription
Subscribes to the event raised when a change to the source shifts the indexes of selected items.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the model.
selection_changed
fn selection_changed(self: &Self, handler: impl Fn(&SelectionModelSelectionChangedEventArgsOf<T>) -> () + 'static) -> Subscription
Subscribes to the event raised when the selection changes.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the model.
lost_selection
fn lost_selection(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Subscribes to the event raised when the selection becomes empty.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the model.
source_reset
fn source_reset(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Subscribes to the event raised when the source is reset.
Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the model.
batch_update
fn batch_update(self: &Self) -> BatchUpdateOperation
Begins a batch update that ends when the returned operation is disposed or dropped.
begin_batch_update
fn begin_batch_update(self: &Self)
end_batch_update
fn end_batch_update(self: &Self)
is_selected
fn is_selected(self: &Self, index: i32) -> bool
select
fn select(self: &Self, index: i32)
deselect
fn deselect(self: &Self, index: i32)
select_range
fn select_range(self: &Self, start: i32, end: i32)
deselect_range
fn deselect_range(self: &Self, start: i32, end: i32)
select_all
fn select_all(self: &Self)
clear
fn clear(self: &Self)
raise_property_changed
fn raise_property_changed(self: &Self, property_name: &str)
Raises the property changed event.
base_set_source
fn base_set_source(self: &Self, value: Option<ItemsSource>)
The implementation of set_source of this type.
base_on_indexes_changed
fn base_on_indexes_changed(self: &Self, shift_index: i32, shift_delta: i32)
The implementation of on_indexes_changed of this type.
base_on_source_collection_change_started
fn base_on_source_collection_change_started(self: &Self)
The implementation of on_source_collection_change_started of this
type.
base_on_source_reset
fn base_on_source_reset(self: &Self)
The implementation of on_source_reset of this type.
base_on_selection_removed
fn base_on_selection_removed(self: &Self, _index: i32, _count: i32, deselected_items: Vec<Option<T>>)
The implementation of on_selection_removed of this type.
base_on_items_added
fn base_on_items_added(self: &Self, index: i32, items: ItemsView<'_>) -> CollectionChangeState<T>
The implementation of on_items_added of this type.
base_on_items_removed
fn base_on_items_removed(self: &Self, index: i32, items: ItemsView<'_>) -> CollectionChangeState<T>
The implementation of on_items_removed of this type.
base_on_source_collection_changed
fn base_on_source_collection_changed(self: &Self, e: &ItemsChangedEventArgs<'_>)
The implementation of on_source_collection_changed of this type.
base_is_valid_collection_change
fn base_is_valid_collection_change(self: &Self, e: &ItemsChangedEventArgs<'_>) -> bool
The implementation of is_valid_collection_change of this type.
base_on_source_collection_change_finished
fn base_on_source_collection_change_finished(self: &Self)
The implementation of on_source_collection_change_finished of this
type.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEitherSelectionNodeBaseImpl<T>INotifyPropertyChangedISelectionModel
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.