pub struct FixedSelection {
model: BoundObject<ListModel>,
pub(super) item_equivalence_fn: RefCell<Option<Box<dyn Fn(&Object, &Object) -> bool>>>,
selected: Cell<u32>,
selected_item: RefCell<Option<Object>>,
is_empty: PhantomData<bool>,
}Fields§
§model: BoundObject<ListModel>The underlying model.
item_equivalence_fn: RefCell<Option<Box<dyn Fn(&Object, &Object) -> bool>>>The function to use to test for equivalence of two items.
It is used when checking if an object still present when the underlying model changes. Which means that if there are two equivalent objects at the same time in the underlying model, the selected item might change unexpectedly between those two objects.
If this is not set, the Eq implementation is used, meaning that
they must be the same object.
selected: Cell<u32>The position of the selected item.
selected_item: RefCell<Option<Object>>The selected item.
is_empty: PhantomData<bool>Whether the model is empty.
Implementations§
Source§impl FixedSelection
impl FixedSelection
Sourcefn register_type()
fn register_type()
Registers the type only once.
Source§impl FixedSelection
impl FixedSelection
Sourcefn set_selected(&self, position: u32)
fn set_selected(&self, position: u32)
Set the selected item by its position.
Sourcefn set_selected_item(&self, item: Option<Object>)
fn set_selected_item(&self, item: Option<Object>)
Set the selected item.
Trait Implementations§
Source§impl Debug for FixedSelection
impl Debug for FixedSelection
Source§impl Default for FixedSelection
impl Default for FixedSelection
Source§impl DerivedObjectProperties for FixedSelection
impl DerivedObjectProperties for FixedSelection
Source§fn derived_properties() -> &'static [ParamSpec]
fn derived_properties() -> &'static [ParamSpec]
Properties installed for this type.
Source§fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
fn derived_property(&self, id: usize, pspec: &ParamSpec) -> Value
Similar to
ObjectImpl but auto-generated by the Properties macro
to allow handling more complex use-cases.Source§fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn derived_set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
Similar to
ObjectImpl but auto-generated by the Properties macro
to allow handling more complex use-cases.Source§impl ListModelImpl for FixedSelection
impl ListModelImpl for FixedSelection
Source§impl ObjectImpl for FixedSelection
impl ObjectImpl for FixedSelection
Source§fn properties() -> &'static [ParamSpec]
fn properties() -> &'static [ParamSpec]
Properties installed for this type.
Source§fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec)
Property setter. Read more
Source§fn constructed(&self)
fn constructed(&self)
Constructed. Read more
Source§fn notify(&self, pspec: &ParamSpec)
fn notify(&self, pspec: &ParamSpec)
Function to be called when property change is notified for with
self.notify("property").fn dispatch_properties_changed(&self, pspecs: &[ParamSpec])
Source§impl ObjectSubclass for FixedSelection
impl ObjectSubclass for FixedSelection
Source§type ParentType = Object
type ParentType = Object
Parent Rust type to inherit from.
Source§type Class = ClassStruct<FixedSelection>
type Class = ClassStruct<FixedSelection>
The C class struct. Read more
Source§type Instance = InstanceStruct<FixedSelection>
type Instance = InstanceStruct<FixedSelection>
The C instance struct. Read more
Source§type Type = FixedSelection
type Type = FixedSelection
Wrapper around this subclass defined with
wrapper!Source§type Interfaces = (ListModel, SelectionModel)
type Interfaces = (ListModel, SelectionModel)
List of interfaces implemented by this type.
Source§const ALLOW_NAME_CONFLICT: bool = false
const ALLOW_NAME_CONFLICT: bool = false
Allow name conflicts for this class. Read more
Source§fn type_init(_type_: &mut InitializingType<Self>)
fn type_init(_type_: &mut InitializingType<Self>)
Additional type initialization. Read more
Source§fn class_init(_klass: &mut Self::Class)
fn class_init(_klass: &mut Self::Class)
Class initialization. Read more
Source§fn with_class(_klass: &Self::Class) -> Self
fn with_class(_klass: &Self::Class) -> Self
Constructor. Read more
Source§fn instance_init(_obj: &InitializingObject<Self>)
fn instance_init(_obj: &InitializingObject<Self>)
Performs additional instance initialization. Read more
Source§impl ObjectSubclassType for FixedSelection
impl ObjectSubclassType for FixedSelection
Source§impl SelectionModelImpl for FixedSelection
impl SelectionModelImpl for FixedSelection
fn selection_in_range(&self, _position: u32, _n_items: u32) -> Bitset
fn is_selected(&self, position: u32) -> bool
fn select_all(&self) -> bool
fn select_item(&self, position: u32, unselect_rest: bool) -> bool
fn select_range(&self, position: u32, n_items: u32, unselect_rest: bool) -> bool
fn set_selection(&self, selected: &Bitset, mask: &Bitset) -> bool
fn unselect_all(&self) -> bool
fn unselect_item(&self, position: u32) -> bool
fn unselect_range(&self, position: u32, n_items: u32) -> bool
Auto Trait Implementations§
impl !Freeze for FixedSelection
impl !RefUnwindSafe for FixedSelection
impl !Send for FixedSelection
impl !Sync for FixedSelection
impl Unpin for FixedSelection
impl UnsafeUnpin for FixedSelection
impl !UnwindSafe for FixedSelection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ListModelImplExt for Twhere
T: ListModelImpl,
impl<T> ListModelImplExt for Twhere
T: ListModelImpl,
fn parent_item_type(&self) -> Type
fn parent_n_items(&self) -> u32
fn parent_item(&self, position: u32) -> Option<Object>
Source§impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
impl<T> ObjectImplExt for Twhere
T: ObjectImpl,
Source§fn parent_constructed(&self)
fn parent_constructed(&self)
Chain up to the parent class’ implementation of
glib::Object::constructed().Source§fn parent_notify(&self, pspec: &ParamSpec)
fn parent_notify(&self, pspec: &ParamSpec)
Chain up to the parent class’ implementation of
glib::Object::notify().Source§fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
fn parent_dispatch_properties_changed(&self, pspecs: &[ParamSpec])
Chain up to the parent class’ implementation of
glib::Object::dispatch_properties_changed().Source§fn signal_chain_from_overridden(
&self,
token: &SignalClassHandlerToken,
values: &[Value],
) -> Option<Value>
fn signal_chain_from_overridden( &self, token: &SignalClassHandlerToken, values: &[Value], ) -> Option<Value>
Chain up to parent class signal handler.
Source§impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
impl<T> ObjectSubclassExt for Twhere
T: ObjectSubclass,
Source§fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
fn obj(&self) -> BorrowedObject<'_, <T as ObjectSubclass>::Type>
Returns the corresponding object instance. Read more
Source§fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
fn from_obj(obj: &<T as ObjectSubclass>::Type) -> &T
Returns the implementation from an instance. Read more
Source§fn ref_counted(&self) -> ObjectImplRef<T>
fn ref_counted(&self) -> ObjectImplRef<T>
Returns a new reference-counted wrapper around
self.