FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Effect

    struct · ferroui-base · v0.5.0

    struct Effect
    

    Base class of the mutable effects.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<Effect>
    

    Returns a strong reference to this object.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see FerroObject::construct.

    Source

    construct_custom

    fn construct_custom<T: CustomEffectClass>() -> Self
    

    Creates the class data of a custom effect class T (#455, not from upstream): its handle converts to Rc<dyn IEffect> as the built-in effects do, and what crosses to the render thread is its snapshot, CustomEffectClass::to_custom_effect. A property of T that affects the effect is declared with affects_render (or T calls raise_invalidated when a value changes), so that a new snapshot is taken.

    Source

    construct_interactive

    fn construct_interactive<T: CustomEffectClass + IEffectInputHandler>() -> Self
    

    Creates the class data of an interactive custom effect class T (#455, E7, not from upstream): a custom effect class (construct_custom) that receives the pointer input of the element it is the effect of, through IEffectInputHandler. When it is set as the Effect of an input element, the element routes its pointer events to it with an EffectHostContext; when it is replaced or cleared, the routing ends. The state the input changes lives in T, which raises invalidated so that the next snapshot carries it to the render thread.

    Source

    is_custom

    fn is_custom(self: &Self) -> bool
    

    Whether the effect is a custom effect class (construct_custom).

    Source

    is_interactive

    fn is_interactive(self: &Self) -> bool
    

    Whether the effect is an interactive custom effect class (construct_interactive).

    Source

    input_handler

    fn input_handler(self: &Self) -> Option<&dyn IEffectInputHandler>
    

    The input handler of an interactive custom effect class; None for the other effects.

    Source

    custom_snapshot

    fn custom_snapshot(self: &Self) -> Option<ImmutableCustomEffect>
    

    The snapshot of a custom effect class; None for the built-in effect classes.

    Source

    affects_render

    fn affects_render<T: ObjectType + Upcast<Effect>>(properties: &[&'static FerroProperty])
    

    Marks a property on a class deriving from Effect as affecting the effect's visual appearance: a change raises invalidated.

    Source

    raise_invalidated

    fn raise_invalidated(self: &Self)
    

    Raises the invalidated notification.

    Source

    invalidated

    fn invalidated(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
    

    Subscribes to invalidation of the effect: raised when a change requires the affected content to be redrawn. Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the effect.

    Source

    parse

    fn parse(s: &str) -> Result<Rc<dyn IEffect>, FormatError>
    

    Parses an effect: blur(<radius>), drop-shadow(<offset-x> <offset-y> [<blur-radius> [<color>]]), or a registered custom effect, <name>(<parameter>=<value>, ...) (CustomEffectRegistry::parse, #455).

    Source

    Trait implementations

    Availability

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