FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    StateTriggerBase

    struct · ferroui-controls · v0.5.0

    struct StateTriggerBase
    

    The base class of the triggers of a VisualState: while a trigger of a state is active, the state is a candidate to be the current state of its group (docs/porting/winui-calculator-gaps.md, section 5.7).

    The extension point of custom triggers. A trigger of an application derives from this class and calls set_active when its condition changes (WinUI's protected SetActive; it is public in Rust, which has no protected members, and is meant for the derived trigger only):

    #[repr(C)]
    pub struct ControlSizeTrigger { base: StateTriggerBase, /* ... */ }
    ferro_class!(ControlSizeTrigger: StateTriggerBase);
    // ... on a size change of the source:
    trigger.set_active(size.width >= trigger.min_width());
    

    Among the states of a group whose triggers are active, a StateTrigger or a custom trigger wins over an AdaptiveTrigger; among adaptive triggers the larger MinWindowWidth wins, then the larger MinWindowHeight; then the first in the order of the source.

    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<StateTriggerBase>
    

    Returns a strong reference to this object.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data of a derived trigger (WinUI's protected constructor); the trigger is not active.

    Source

    set_active

    fn set_active(self: &Self, value: bool)
    

    Sets whether the trigger is active (WinUI's protected SetActive). The group of the trigger selects its state again when the value changes.

    Source

    Trait implementations

    Availability

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