Effect
struct · ferroui-base · v0.5.0
struct Effect
Base class of the mutable effects.
Members
TYPEto_refconstructconstruct_customconstruct_interactiveis_customis_interactiveinput_handlercustom_snapshotaffects_renderraise_invalidatedinvalidatedparse
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<Effect>
Returns a strong reference to this object.
construct
fn construct() -> Self
Creates the class data; see FerroObject::construct.
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.
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.
is_custom
fn is_custom(self: &Self) -> bool
Whether the effect is a custom effect class
(construct_custom).
is_interactive
fn is_interactive(self: &Self) -> bool
Whether the effect is an interactive custom effect class
(construct_interactive).
input_handler
fn input_handler(self: &Self) -> Option<&dyn IEffectInputHandler>
The input handler of an interactive custom effect class; None for
the other effects.
custom_snapshot
fn custom_snapshot(self: &Self) -> Option<ImmutableCustomEffect>
The snapshot of a custom effect class; None for the built-in
effect classes.
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.
raise_invalidated
fn raise_invalidated(self: &Self)
Raises the invalidated notification.
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.
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).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<Effect>StaticTypeObjectTypeSubclassable<T>FerroObjectImplIAffectsRender
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.