FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    MaterialPolicy

    struct · ferroui-base · v0.5.0

    struct MaterialPolicy
    

    The material policy (WinUI's MaterialHelper): materials are disabled, and acrylic draws its fallback colour, while the energy saver is on, the user turned transparency effects off, the effects are not fast enough, or a test simulates it.

    The settings come from the platform (IPlatformSettings::transparency_enabled and IPlatformSettings::energy_saver_enabled), read when the policy is first asked and whenever the platform reports a change of either (IPlatformSettings::accessibility_settings_changed, IPlatformSettings::energy_saver_changed). The policy is per thread, as the objects it serves.

    View source

    Members

    is_disabled_by_policy

    fn is_disabled_by_policy() -> bool
    

    Whether materials are disabled by the policy.

    Source

    policy_changed

    fn policy_changed(handler: impl Fn(bool) -> () + 'static) -> Subscription
    

    PolicyChanged: handler is called now with the current state, and whenever the state changes. Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the thread.

    Source

    update_policy_status

    fn update_policy_status()
    

    Reads the settings of the platform again and tells the listeners when the state changes.

    Source

    simulate_disabled_by_policy

    fn simulate_disabled_by_policy() -> bool
    

    SimulateDisabledByPolicy: whether a test makes the policy disable materials.

    Source

    set_simulate_disabled_by_policy

    fn set_simulate_disabled_by_policy(value: bool)
    

    Source

    ignore_are_effects_fast

    fn ignore_are_effects_fast() -> bool
    

    IgnoreAreEffectsFast: whether slow effects are ignored.

    Source

    set_ignore_are_effects_fast

    fn set_ignore_are_effects_fast(value: bool)
    

    Source

    are_effects_fast

    fn are_effects_fast() -> bool
    

    Whether the effects of the renderer are fast enough for materials (WinUI's CompositionCapabilities.AreEffectsFast); true unless a platform or the application says otherwise.

    Source

    set_are_effects_fast

    fn set_are_effects_fast(value: bool)
    

    Source

    transparency_enabled

    fn transparency_enabled() -> bool
    

    Whether the platform permits transparency effects, as the policy last read it (IPlatformSettings::transparency_enabled; true without platform settings).

    Source

    energy_saver_enabled

    fn energy_saver_enabled() -> bool
    

    Whether the energy saver is on, as the policy last read it (IPlatformSettings::energy_saver_enabled; false without platform settings).

    Source

    is_window_active

    fn is_window_active() -> bool
    

    Whether a window of the application is active: the acrylic of the host backdrop falls back to its colour while none is (WinUI's AcrylicBrush follows the activation of its window). true until a window says otherwise.

    Source

    set_window_active

    fn set_window_active(active: bool)
    

    Records whether a window of the application is active, and tells the listeners when it changed (the windows of ferroui-controls call it).

    Source

    window_activation_changed

    fn window_activation_changed(handler: impl Fn(bool) -> () + 'static) -> Subscription
    

    handler is called whenever is_window_active changes. Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the thread.

    Source

    noise_brush

    fn noise_brush(compositor: &Rc<Compositor>) -> CompositionSurfaceBrush
    

    The noise brush the materials share on compositor (WinUI's MaterialHelper.GetNoiseBrush): a surface brush of the noise texture that does not stretch and sits at the top left corner, which a border effect tiles.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ErasedDestructor
    • IntoEither

    Availability

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