FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Styles

    struct · ferroui-base · v0.5.0

    struct Styles
    

    A style that consists of a number of child styles.

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

    Returns a strong reference to this object.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see FerroObject::construct.

    Source

    new

    fn new() -> Ref<Self>
    

    Creates an empty styles collection.

    Source

    with_owner

    fn with_owner(owner: impl Into<ResourceHostRef>) -> Ref<Self>
    

    Creates an empty styles collection that belongs to owner.

    Source

    collection_changed

    fn collection_changed(self: &Self, handler: impl Fn(&NotifyCollectionChangedEventArgs<'a, Rc<dyn IStyle>>) -> () + 'static) -> Rc<dyn IDisposable>
    

    Raised when the collection changes. Disposing the returned handle unsubscribes.

    Source

    owner_changed

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

    Raised when the owner of the collection changes.

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of styles.

    Source

    owner

    fn owner(self: &Self) -> Option<ResourceHostRef>
    

    The owner of the collection.

    Source

    resources

    fn resources(self: &Self) -> Ref<ResourceDictionary>
    

    The dictionary of style resources.

    Source

    set_resources

    fn set_resources(self: &Self, value: Ref<ResourceDictionary>)
    

    Source

    has_resources

    fn has_resources(self: &Self) -> bool
    

    Whether the collection or any of its styles has resources.

    Source

    get

    fn get(self: &Self, index: usize) -> Rc<dyn IStyle>
    

    The style at index. Panics if out of range.

    Source

    set

    fn set(self: &Self, index: usize, value: impl Into<Rc<dyn IStyle>>)
    

    Replaces the style at index.

    The replacement is notified as a removal followed by an insertion.

    Source

    snapshot

    fn snapshot(self: &Self) -> Rc<Vec<Rc<dyn IStyle>>>
    

    A snapshot of the styles.

    Source

    try_get_resource

    fn try_get_resource(self: &Self, key: &ResourceKey, theme: Option<&ThemeVariant>) -> Option<ResourceValue>
    

    Tries to find a resource in the collection's resources and then in its styles, last style first.

    Source

    add_range

    fn add_range(self: &Self, items: impl IntoIterator<Item = Rc<dyn IStyle>>)
    

    Source

    insert_range

    fn insert_range(self: &Self, index: usize, items: impl IntoIterator<Item = Rc<dyn IStyle>>)
    

    Source

    move_item

    fn move_item(self: &Self, old_index: usize, new_index: usize)
    

    Source

    move_range

    fn move_range(self: &Self, old_index: usize, count: usize, new_index: usize)
    

    Source

    remove_all

    fn remove_all(self: &Self, items: impl IntoIterator<Item = Rc<dyn IStyle>>)
    

    Source

    remove_range

    fn remove_range(self: &Self, index: usize, count: usize)
    

    Source

    index_of

    fn index_of(self: &Self, item: impl Into<Rc<dyn IStyle>>) -> Option<usize>
    

    The index of a style, if it is in the collection.

    Source

    insert

    fn insert(self: &Self, index: usize, item: impl Into<Rc<dyn IStyle>>)
    

    Source

    remove_at

    fn remove_at(self: &Self, index: usize)
    

    Source

    add

    fn add(self: &Self, item: impl Into<Rc<dyn IStyle>>)
    

    Adds a style to the collection.

    Source

    clear

    fn clear(self: &Self)
    

    Removes all styles from the collection.

    Source

    contains

    fn contains(self: &Self, item: impl Into<Rc<dyn IStyle>>) -> bool
    

    Source

    remove

    fn remove(self: &Self, item: impl Into<Rc<dyn IStyle>>) -> bool
    

    Removes a style from the collection. Returns whether it was present.

    Source

    add_owner

    fn add_owner(self: &Self, owner: &ResourceHostRef)
    

    Adds an owner to the collection and the resource providers in it.

    Source

    remove_owner

    fn remove_owner(self: &Self, owner: &ResourceHostRef)
    

    Removes the owner of the collection and the resource providers in it.

    Source

    Trait implementations

    Availability

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