FerroProperty
struct · ferroui-base · v0.5.0
struct FerroProperty
Base class for properties: the untyped identity and description of a
property that can be set on a FerroObject.
Members
as_property_infobindhost_typenameproperty_typeproperty_type_nameowner_typeinheritsis_attachedis_directis_read_onlyassign_bindingset_assign_bindingidchangedget_metadataget_metadata_forunregisteris_valid_valueas_styledunset_valueregisterregister_withregister_attachedregister_attached_withregister_directregister_direct_with
as_property_info
fn as_property_info(self: &'static Self) -> std::rc::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.
bind
fn bind(self: &'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().
host_type
fn host_type(self: &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.
name
fn name(self: &Self) -> &str
The name of the property.
property_type
fn property_type(self: &Self) -> TypeId
The type of the property's value.
property_type_name
fn property_type_name(self: &Self) -> &'static str
The Rust type name of the property's value type.
owner_type
fn owner_type(self: &Self) -> &'static TypeInfo
The class that registered the property.
inherits
fn inherits(self: &Self) -> bool
Whether the property inherits its value.
is_attached
fn is_attached(self: &Self) -> bool
Whether this is an attached property.
is_direct
fn is_direct(self: &Self) -> bool
Whether this is a direct property.
is_read_only
fn is_read_only(self: &Self) -> bool
Whether this is a readonly property.
assign_binding
fn assign_binding(self: &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.
set_assign_binding
fn set_assign_binding(self: &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).
id
fn id(self: &Self) -> u32
An integer ID that uniquely identifies the property; shared by all
owners added with add_owner.
changed
fn changed(self: &'static Self) -> &'static PropertyChangedObservable
Notifications of changes to this property on any object.
The handlers are invoked after the object's own change handling.
get_metadata
fn get_metadata(self: &Self, type_: &'static TypeInfo) -> FerroPropertyMetadata
Gets the base metadata of the property on the specified type.
get_metadata_for
fn get_metadata_for(self: &Self, owner: &FerroObject) -> FerroPropertyMetadata
Gets the base metadata of the property on the type of owner.
unregister
fn unregister(self: &Self, type_: &'static TypeInfo)
Removes the metadata registered for the property on the specified type.
is_valid_value
fn is_valid_value(self: &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.
as_styled
fn as_styled<T: crate::PropertyValue>(self: &'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.
unset_value
fn unset_value() -> BoxedValue
The marker value that represents an unset property value.
register
fn register<TOwner: ObjectType, TValue: PropertyValue>(name: &str, default_value: TValue) -> &'static StyledProperty<TValue>
Registers a styled property with a default value.
register_with
fn register_with<TOwner: ObjectType, TValue: PropertyValue>(name: &str, options: StyledPropertyOptions<TValue>) -> &'static StyledProperty<TValue>
Registers a styled property.
register_attached
fn register_attached<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>(name: &str, default_value: TValue) -> &'static AttachedProperty<TValue>
Registers an attached property with a default value.
TOwner is the class that registers the property and THost the class
of objects the property can be set on.
register_attached_with
fn register_attached_with<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>(name: &str, options: StyledPropertyOptions<TValue>) -> &'static AttachedProperty<TValue>
Registers an attached property.
register_direct
fn register_direct<TOwner: ObjectType, TValue: PropertyValue>(name: &str, getter: fn(&TOwner) -> TValue, setter: Option<fn(&TOwner, TValue) -> ()>, unset_value: TValue) -> &'static DirectProperty<TOwner, TValue>
Registers a direct property: a property whose value is stored in a field of the owner and accessed through a getter and setter.
register_direct_with
fn register_direct_with<TOwner: ObjectType, TValue: PropertyValue>(name: &str, getter: fn(&TOwner) -> TValue, setter: Option<fn(&TOwner, TValue) -> ()>, metadata: DirectPropertyMetadata<TValue>) -> &'static DirectProperty<TOwner, TValue>
Registers a direct property with explicit metadata.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectAnyValueClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyToStringErasedDestructorIntoEitherIPropertyInfoPartialEqEqHashDebugDisplayMarkupTyped
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.