pub struct FerroProperty { /* private fields */ }Expand description
Base class for properties: the untyped identity and description of a
property that can be set on a FerroObject.
Implementations§
Source§impl FerroProperty
impl 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.
Source§impl FerroProperty
impl FerroProperty
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().
Source§impl FerroProperty
impl FerroProperty
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.
Sourcepub fn unset_value() -> BoxedValue
pub fn unset_value() -> BoxedValue
The marker value that represents an unset property value.
Sourcepub fn register<TOwner: ObjectType, TValue: PropertyValue>(
name: &str,
default_value: TValue,
) -> &'static StyledProperty<TValue>
pub fn register<TOwner: ObjectType, TValue: PropertyValue>( name: &str, default_value: TValue, ) -> &'static StyledProperty<TValue>
Registers a styled property with a default value.
Sourcepub fn register_with<TOwner: ObjectType, TValue: PropertyValue>(
name: &str,
options: StyledPropertyOptions<TValue>,
) -> &'static StyledProperty<TValue>
pub fn register_with<TOwner: ObjectType, TValue: PropertyValue>( name: &str, options: StyledPropertyOptions<TValue>, ) -> &'static StyledProperty<TValue>
Registers a styled property.
Sourcepub fn register_attached<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>(
name: &str,
default_value: TValue,
) -> &'static AttachedProperty<TValue>
pub 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.
Sourcepub fn register_attached_with<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>(
name: &str,
options: StyledPropertyOptions<TValue>,
) -> &'static AttachedProperty<TValue>
pub fn register_attached_with<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>( name: &str, options: StyledPropertyOptions<TValue>, ) -> &'static AttachedProperty<TValue>
Registers an attached property.
Sourcepub 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>
pub 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.
Sourcepub 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>
pub 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§
Source§impl Debug for FerroProperty
impl Debug for FerroProperty
Source§impl Display for FerroProperty
impl Display for FerroProperty
impl Eq for FerroProperty
Source§impl Hash for FerroProperty
impl Hash for FerroProperty
Source§impl IPropertyInfo for FerroProperty
A registered property is a property info: the untyped accessors read and
write the property on an object of the class hierarchy.
impl IPropertyInfo for FerroProperty
A registered property is a property info: the untyped accessors read and write the property on an object of the class hierarchy.
Source§fn get(&self, target: &dyn AnyValue) -> Option<BoxedValue>
fn get(&self, target: &dyn AnyValue) -> Option<BoxedValue>
Panics if target is not an object of the class hierarchy.
Source§fn as_any(&self) -> Option<&dyn Any>
fn as_any(&self) -> Option<&dyn Any>
as_any()?.downcast_ref::<T>()): the equivalent of is/as on the
contract. None for an implementation that does not expose itself.Source§fn try_get(
&self,
target: &dyn AnyValue,
) -> Result<Option<BoxedValue>, BindingError>
fn try_get( &self, target: &dyn AnyValue, ) -> Result<Option<BoxedValue>, BindingError>
target. An Err is the equivalent of the
getter throwing, for example because target is not of the type that
declares the property.Source§fn set(
&self,
target: &dyn AnyValue,
value: Option<&BoxedValue>,
) -> Result<(), BindingError>
fn set( &self, target: &dyn AnyValue, value: Option<&BoxedValue>, ) -> Result<(), BindingError>
target. An Err is the equivalent of the
setter throwing.fn can_set(&self) -> bool
fn can_get(&self) -> bool
Source§fn property_type(&self) -> ValueType
fn property_type(&self) -> ValueType
Source§fn as_ferro_property(&self) -> Option<&'static FerroProperty>
fn as_ferro_property(&self) -> Option<&'static FerroProperty>
Source§fn get_boxed(&self, target: &BoxedValue) -> Option<BoxedValue>
fn get_boxed(&self, target: &BoxedValue) -> Option<BoxedValue>
get for an owner known as an untyped handle. The
accessors of binding paths read through the boxed forms, so that a
property description whose accessors need the handle of the owner
(not only a view of it) can override them; the defaults forward to
the forms taking a view. Override the three boxed forms together.Source§fn try_get_boxed(
&self,
target: &BoxedValue,
) -> Result<Option<BoxedValue>, BindingError>
fn try_get_boxed( &self, target: &BoxedValue, ) -> Result<Option<BoxedValue>, BindingError>
try_get for an owner known as an untyped handle.Source§fn set_boxed(
&self,
target: &BoxedValue,
value: Option<&BoxedValue>,
) -> Result<(), BindingError>
fn set_boxed( &self, target: &BoxedValue, value: Option<&BoxedValue>, ) -> Result<(), BindingError>
set for an owner known as an untyped handle.Source§impl MarkupTyped for FerroProperty
impl MarkupTyped for FerroProperty
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !Freeze for FerroProperty
impl !RefUnwindSafe for FerroProperty
impl !Send for FerroProperty
impl !Sync for FerroProperty
impl !UnwindSafe for FerroProperty
impl Unpin for FerroProperty
impl UnsafeUnpin for FerroProperty
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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