pub struct AttachedProperty<T: PropertyValue> { /* private fields */ }Expand description
An attached property: a styled property that is defined by one class and set on objects of another.
Implementations§
Source§impl<T: PropertyValue> AttachedProperty<T>
impl<T: PropertyValue> AttachedProperty<T>
Sourcepub fn add_owner<TOwner: ObjectType>(&'static self) -> &'static Self
pub fn add_owner<TOwner: ObjectType>(&'static self) -> &'static Self
Attaches the property as a non-attached property on class TOwner.
Sourcepub fn add_owner_with<TOwner: ObjectType>(
&'static self,
metadata: StyledPropertyMetadata<T>,
) -> &'static Self
pub fn add_owner_with<TOwner: ObjectType>( &'static self, metadata: StyledPropertyMetadata<T>, ) -> &'static Self
Attaches the property as a non-attached property on class TOwner,
with metadata for that class.
Methods from Deref<Target = StyledProperty<T>>§
Sourcepub fn as_property(&'static self) -> &'static FerroProperty
pub fn as_property(&'static self) -> &'static FerroProperty
The untyped base of the property.
Sourcepub fn validate_value(&self) -> Option<&dyn Fn(&T) -> bool>
pub fn validate_value(&self) -> Option<&dyn Fn(&T) -> bool>
The value validation callback for the property.
Sourcepub fn add_owner<TOwner: ObjectType>(&'static self) -> &'static Self
pub fn add_owner<TOwner: ObjectType>(&'static self) -> &'static Self
Registers the property on another class.
Sourcepub fn add_owner_with<TOwner: ObjectType>(
&'static self,
metadata: StyledPropertyMetadata<T>,
) -> &'static Self
pub fn add_owner_with<TOwner: ObjectType>( &'static self, metadata: StyledPropertyMetadata<T>, ) -> &'static Self
Registers the property on another class, with metadata for that class.
Sourcepub fn coerce_value(&self, instance: &FerroObject, base_value: T) -> T
pub fn coerce_value(&self, instance: &FerroObject, base_value: T) -> T
Coerces base_value with the coercion callback registered for the
type of instance, if any.
Sourcepub fn get_default_value(&self, type_: &'static TypeInfo) -> T
pub fn get_default_value(&self, type_: &'static TypeInfo) -> T
Gets the default value for the property on the specified type.
Sourcepub fn get_default_value_for(&self, owner: &FerroObject) -> T
pub fn get_default_value_for(&self, owner: &FerroObject) -> T
Gets the default value for the property on the type of owner.
Sourcepub fn get_metadata(
&self,
type_: &'static TypeInfo,
) -> Rc<StyledPropertyMetadata<T>>
pub fn get_metadata( &self, type_: &'static TypeInfo, ) -> Rc<StyledPropertyMetadata<T>>
Gets the property metadata for the specified type.
Sourcepub fn get_metadata_for(
&self,
owner: &FerroObject,
) -> Rc<StyledPropertyMetadata<T>>
pub fn get_metadata_for( &self, owner: &FerroObject, ) -> Rc<StyledPropertyMetadata<T>>
Gets the property metadata for the type of owner.
Sourcepub fn override_default_value<TOwner: ObjectType>(&self, default_value: T)
pub fn override_default_value<TOwner: ObjectType>(&self, default_value: T)
Overrides the default value for the property on class TOwner.
Sourcepub fn override_default_value_for(
&self,
type_: &'static TypeInfo,
default_value: T,
)
pub fn override_default_value_for( &self, type_: &'static TypeInfo, default_value: T, )
Overrides the default value for the property on the specified type.
Sourcepub fn override_metadata<TOwner: ObjectType>(
&self,
metadata: StyledPropertyMetadata<T>,
)
pub fn override_metadata<TOwner: ObjectType>( &self, metadata: StyledPropertyMetadata<T>, )
Overrides the metadata for the property on class TOwner.
Sourcepub fn override_metadata_for(
&self,
type_: &'static TypeInfo,
metadata: StyledPropertyMetadata<T>,
)
pub fn override_metadata_for( &self, type_: &'static TypeInfo, metadata: StyledPropertyMetadata<T>, )
Overrides the metadata for the property on the specified type.
Sourcepub fn unregister(&self, type_: &'static TypeInfo)
pub fn unregister(&self, type_: &'static TypeInfo)
Removes the metadata registered for the specified type.
Methods from Deref<Target = FerroProperty>§
Sourcepub fn as_property_info(&'static self) -> Rc<dyn IPropertyInfo>
pub fn as_property_info(&'static self) -> Rc<dyn IPropertyInfo>
The property as a shared property description
(Rc<dyn IPropertyInfo>), for the places that take a registered
property through the property description contract.
IPropertyInfo::as_ferro_property gives the property back.
Sourcepub fn bind(&'static self) -> IndexerDescriptor
pub fn bind(&'static self) -> IndexerDescriptor
Gets a description of a binding to the property, for the binding
indexer of FerroObject. This is the ! operator of a property:
!Border.BackgroundProperty is Border::background_property().bind(),
and the two-way forms !!Property and ~Property are
!Property.bind().
Sourcepub fn host_type(&self) -> Option<&'static TypeInfo>
pub fn host_type(&self) -> Option<&'static TypeInfo>
The class an attached property is declared for: the THost of its
registration, the type of the objects its accessors (GetX/SetX)
take. None for properties that are not attached.
Sourcepub fn property_type(&self) -> TypeId
pub fn property_type(&self) -> TypeId
The type of the property’s value.
Sourcepub fn property_type_name(&self) -> &'static str
pub fn property_type_name(&self) -> &'static str
The Rust type name of the property’s value type.
Sourcepub fn owner_type(&self) -> &'static TypeInfo
pub fn owner_type(&self) -> &'static TypeInfo
The class that registered the property.
Sourcepub fn is_attached(&self) -> bool
pub fn is_attached(&self) -> bool
Whether this is an attached property.
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Whether this is a readonly property.
Sourcepub fn assign_binding(&self) -> bool
pub fn assign_binding(&self) -> bool
Whether a binding given for this property in markup is assigned to the property as its value rather than bound to it (the “assign binding” attribute of the managed property). The property’s value type is then a binding type. A fact about the definition: it is the same for every owner and is not part of the metadata.
Sourcepub fn set_assign_binding(&self, value: bool)
pub fn set_assign_binding(&self, value: bool)
Marks the property as one that bindings are assigned to. Part of the
definition of the property: call it where the property is registered
(styled and attached properties state it through
StyledPropertyOptions::assign_binding).
Sourcepub fn id(&self) -> u32
pub fn id(&self) -> u32
An integer ID that uniquely identifies the property; shared by all
owners added with add_owner.
Sourcepub fn changed(&'static self) -> &'static PropertyChangedObservable
pub fn changed(&'static self) -> &'static PropertyChangedObservable
Notifications of changes to this property on any object.
The handlers are invoked after the object’s own change handling.
Sourcepub fn get_metadata(&self, type_: &'static TypeInfo) -> FerroPropertyMetadata
pub fn get_metadata(&self, type_: &'static TypeInfo) -> FerroPropertyMetadata
Gets the base metadata of the property on the specified type.
Sourcepub fn get_metadata_for(&self, owner: &FerroObject) -> FerroPropertyMetadata
pub fn get_metadata_for(&self, owner: &FerroObject) -> FerroPropertyMetadata
Gets the base metadata of the property on the type of owner.
Sourcepub fn unregister(&self, type_: &'static TypeInfo)
pub fn unregister(&self, type_: &'static TypeInfo)
Removes the metadata registered for the property on the specified type.
Sourcepub fn is_valid_value(&self, value: &dyn Any) -> bool
pub fn is_valid_value(&self, value: &dyn Any) -> bool
Checks whether value is valid for the property: of the property’s
value type and accepted by its validation callback.
Sourcepub fn as_styled<T: PropertyValue>(
&'static self,
) -> Option<&'static StyledProperty<T>>
pub fn as_styled<T: PropertyValue>( &'static self, ) -> Option<&'static StyledProperty<T>>
The property as a styled (or attached) property with value type T:
the typed view needed to read, set and bind it without boxing.
None for direct properties and when T is not the property’s value
type.
Trait Implementations§
Source§impl<T: PropertyValue> Deref for AttachedProperty<T>
impl<T: PropertyValue> Deref for AttachedProperty<T>
Source§type Target = StyledProperty<T>
type Target = StyledProperty<T>
Source§fn deref(&self) -> &StyledProperty<T>
fn deref(&self) -> &StyledProperty<T>
impl<T: PropertyValue> Registrable for AttachedProperty<T>
Source§impl<T: PropertyValue> TypedProperty for AttachedProperty<T>
impl<T: PropertyValue> TypedProperty for AttachedProperty<T>
Auto Trait Implementations§
impl<T> !Freeze for AttachedProperty<T>
impl<T> !RefUnwindSafe for AttachedProperty<T>
impl<T> !Send for AttachedProperty<T>
impl<T> !Sync for AttachedProperty<T>
impl<T> !UnwindSafe for AttachedProperty<T>
impl<T> Unpin for AttachedProperty<T>where
StyledProperty<T>: Unpin,
impl<T> UnsafeUnpin for AttachedProperty<T>where
StyledProperty<T>: UnsafeUnpin,
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more