FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    FerroObject

    struct · ferroui-base · v0.5.0

    struct FerroObject
    

    An object with FerroProperty support: the root of the class hierarchy.

    View source

    Members

    TYPE

    const TYPE: &'static TypeInfo
    

    The runtime type of this class.

    Source

    construct

    fn construct() -> FerroObject
    

    Creates the class data. Use from the construct function of a derived class; the object becomes usable once passed to instantiate.

    Source

    dispatcher

    fn dispatcher(self: &Self) -> &Arc<Dispatcher>
    

    Returns the Dispatcher that this object is associated with: the dispatcher of the thread that owns the object.

    Source

    check_access

    fn check_access(self: &Self) -> bool
    

    Returns whether the calling thread is the thread that owns this object.

    Source

    verify_access

    fn verify_access(self: &Self)
    

    Checks that the calling thread is the thread that owns this object.

    Panics

    Panics when it is not.

    Source

    new

    fn new() -> Ref<FerroObject>
    

    Creates a plain object.

    Source

    to_ref

    fn to_ref(self: &Self) -> Ref<FerroObject>
    

    A strong reference to this object.

    Source

    to_weak

    fn to_weak(self: &Self) -> WeakRef<FerroObject>
    

    A weak reference to this object.

    Source

    get_type

    fn get_type(self: &Self) -> &'static TypeInfo
    

    The runtime type of the object.

    Source

    is

    fn is<T: ObjectType>(self: &Self) -> bool
    

    Whether the object is of class T or a class derived from it.

    Source

    downcast_ref

    fn downcast_ref<T: ObjectType>(self: &Self) -> Option<&T>
    

    Returns the object viewed as class T if it is one.

    Source

    on_property_changed

    fn on_property_changed(self: &Self, change: &FerroPropertyChangedEventArgs<'_>)
    

    Invokes the on_property_changed virtual member.

    Source

    inheritance_parent

    fn inheritance_parent(self: &Self) -> Option<Ref<FerroObject>>
    

    The parent object that inherited property values are inherited from.

    Source

    set_inheritance_parent

    fn set_inheritance_parent(self: &Self, value: impl Into<Nullable<FerroObject>>)
    

    Sets the parent object that inherited property values are inherited from.

    Source

    local_write_version

    fn local_write_version(self: &Self, property: &FerroProperty) -> u64
    

    Starts tracking explicit local/current writes to this property and returns its version. Equal-value writes count; style evaluation does not. Tracking lives with this object and is available only in development builds.

    Source

    local_assignment_version

    fn local_assignment_version(self: &Self, property: &FerroProperty) -> u64
    

    Tracks explicit local assignments and binding-slot changes. Unlike local_write_version, SetCurrentValue (for example two-way user input) does not transfer assignment ownership.

    Source

    clear_value

    fn clear_value<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>)
    

    Clears a property's local value.

    Source

    get_value

    fn get_value<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>) -> T
    

    Gets a property value.

    Source

    with_value

    fn with_value<T: PropertyValue, R>(self: &Self, property: &'static StyledProperty<T>, read: impl FnOnce(&T) -> R) -> R
    

    Reads a styled property's current value without cloning it. The callback may read other properties, but must not change this property's effective value while it is borrowed. Returning a reference to the value is not permitted by the callback's lifetime.

    Source

    get_base_value

    fn get_base_value<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>) -> Option<T>
    

    Gets a property's base value: the value excluding animated values. Returns None if the value comes from inheritance or the default.

    Source

    is_animating

    fn is_animating(self: &Self, property: &FerroProperty) -> bool
    

    Checks whether a property is animating.

    Source

    is_set

    fn is_set(self: &Self, property: &FerroProperty) -> bool
    

    Checks whether a styled property has a value assigned to it or a binding targeting it.

    Source

    has_local_value_binding

    fn has_local_value_binding(self: &Self, property: &FerroProperty) -> bool
    

    Whether a local-value binding targets this property, including direct properties and observable bindings. Unlike is_set, this does not rely on a styled property's effective-value entry. It does not inspect bindings at style/template priorities.

    Source

    set_value

    fn set_value<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>, value: T)
    

    Sets a property value with local value priority.

    Source

    set_value_with_priority

    fn set_value_with_priority<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>, value: T, priority: BindingPriority) -> Option<Rc<dyn IDisposable>>
    

    Sets a property value with the given priority. For priorities other than local value, disposing the returned handle removes the value.

    Source

    set_current_value

    fn set_current_value<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>, value: T)
    

    Sets the value of a property without changing its value source.

    This is used by a component that programmatically sets the value of one of its own properties without disabling an application's declared use of the property: the effective value changes, but existing bindings and styles continue to work. The new value has the property's current priority.

    Source

    bind_binding

    fn bind_binding(self: &Self, property: &'static FerroProperty, binding: &dyn BindingBase) -> Rc<dyn BindingExpressionBase>
    

    Binds a property to a binding. Returns the binding expression which represents the binding instance on this object.

    Source

    bind_binding_with_anchor

    fn bind_binding_with_anchor(self: &Self, property: &'static FerroProperty, binding: &dyn BindingBase, anchor: Option<&Ref<FerroObject>>) -> Rc<dyn BindingExpressionBase>
    

    Binds a property to a binding.

    Some bindings need context to locate their source: a data context, named elements or resources. If this object is not an element, or is not yet attached to the tree, anchor provides that context.

    Source

    bind_binding_with_priority

    fn bind_binding_with_priority(self: &Self, property: &'static FerroProperty, binding: &dyn BindingBase, priority: BindingPriority, anchor: Option<&Ref<FerroObject>>) -> Rc<dyn BindingExpressionBase>
    

    Binds a property to a binding at the given priority, whatever the default priority of the binding is. Disposing the returned expression removes the binding.

    An addition (no upstream counterpart): the values of WinUI's visual states are bound at BindingPriority::Animation.

    Source

    indexer

    fn indexer(self: &Self, binding: &crate::data::IndexerDescriptor) -> crate::data::IndexerBinding
    

    Gets a binding to a property of this object: the indexer taking an IndexerDescriptor (source[!Property] is source.indexer(&Property.bind())).

    Source

    bind_indexer

    fn bind_indexer(self: &Self, binding: &crate::data::IndexerDescriptor, value: &dyn BindingBase) -> Rc<dyn BindingExpressionBase>
    

    Binds the property of an IndexerDescriptor to a binding: the setter of the indexer (target[!Property] = binding is target.bind_indexer(&Property.bind(), &binding)).

    Source

    bind

    fn bind<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<T>>, priority: BindingPriority) -> Rc<dyn IDisposable>
    

    Binds a property to an observable.

    Source

    bind_value

    fn bind_value<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<BindingValue<T>>>, priority: BindingPriority) -> Rc<dyn IDisposable>
    

    Binds a property to an observable of binding values.

    Source

    bind_untyped

    fn bind_untyped<T: PropertyValue>(self: &Self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<BoxedValue>>, priority: BindingPriority) -> Rc<dyn IDisposable>
    

    Binds a property to an observable of untyped values.

    Source

    coerce_value

    fn coerce_value(self: &Self, property: &'static FerroProperty)
    

    Coerces the specified property.

    Source

    get_direct_value

    fn get_direct_value<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>) -> T
    

    Gets a direct property value.

    Source

    set_direct_value

    fn set_direct_value<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>, value: T)
    

    Sets a direct property value.

    Source

    clear_direct_value

    fn clear_direct_value<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>)
    

    Resets a direct property to its unset value.

    Source

    bind_direct

    fn bind_direct<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<T>>) -> Rc<dyn IDisposable>
    

    Binds a direct property to an observable.

    Source

    bind_direct_value

    fn bind_direct_value<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<BindingValue<T>>>) -> Rc<dyn IDisposable>
    

    Binds a direct property to an observable of binding values.

    Source

    bind_direct_untyped

    fn bind_direct_untyped<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<BoxedValue>>) -> Rc<dyn IDisposable>
    

    Binds a direct property to an observable of untyped values.

    Source

    set_and_raise

    fn set_and_raise<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>, field: &RefCell<T>, value: T) -> bool
    

    Sets the backing field of a direct property, raising a change notification if the value changed. Returns true if it changed.

    Source

    set_and_raise_cell

    fn set_and_raise_cell<T: PropertyValue + Copy>(self: &Self, property: &'static DirectPropertyBase<T>, field: &Cell<T>, value: T) -> bool
    

    set_and_raise for Copy values stored in a Cell.

    Source

    get_value_untyped

    fn get_value_untyped(self: &Self, property: &'static FerroProperty) -> BoxedValue
    

    Gets a property value as an untyped value.

    Source

    set_value_untyped

    fn set_value_untyped(self: &Self, property: &'static FerroProperty, value: &dyn Any, priority: BindingPriority) -> Option<Rc<dyn IDisposable>>
    

    Sets a property from an untyped value, which must hold exactly the property's value type or the unset marker.

    Source

    set_current_value_untyped

    fn set_current_value_untyped(self: &Self, property: &'static FerroProperty, value: &dyn Any)
    

    set_current_value with an untyped value.

    Source

    clear_value_untyped

    fn clear_value_untyped(self: &Self, property: &'static FerroProperty)
    

    Clears a property's local value.

    Source

    bind_property_untyped

    fn bind_property_untyped(self: &Self, property: &'static FerroProperty, source: Rc<dyn IObservable<BoxedValue>>, priority: BindingPriority) -> Rc<dyn IDisposable>
    

    Binds a property to an observable of untyped values.

    Source

    property_changed

    fn property_changed(self: &Self, handler: impl Fn(&FerroPropertyChangedEventArgs<'_>) -> () + 'static) -> Rc<dyn IDisposable>
    

    Subscribes to property changes on this object. Disposing the returned handle unsubscribes.

    Source

    add_property_changed_handler

    fn add_property_changed_handler(self: &Self, handler: Rc<dyn Fn(&FerroPropertyChangedEventArgs<'_>) -> ()>) -> u64
    

    Subscribes handler to property changes on this object and returns the token that remove_property_changed_handler takes: property_changed for a subscriber that keeps the object and the token itself, so that no handle is made.

    Source

    remove_property_changed_handler

    fn remove_property_changed_handler(self: &Self, token: u64) -> bool
    

    Ends a subscription of add_property_changed_handler.

    Source

    property_changed_subscriber_count

    fn property_changed_subscriber_count(self: &Self) -> usize
    

    The number of subscribers to property changes on this object (a diagnostics member, used by tests to verify that subscriptions are released).

    Source

    raise_property_changed

    fn raise_property_changed<T: PropertyValue>(self: &Self, property: &'static FerroProperty, old_value: Option<&T>, new_value: &T, priority: BindingPriority, is_effective_value: bool)
    

    Raises a property changed notification.

    Source

    raise_direct_property_changed

    fn raise_direct_property_changed<T: PropertyValue>(self: &Self, property: &'static DirectPropertyBase<T>, old_value: &T, new_value: &T)
    

    Raises a property changed notification for a direct property.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.