FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Classes

    struct · ferroui-base · v0.5.0

    struct Classes
    

    Holds a collection of style classes for a styled element.

    Similar to CSS, each control may have any number of styling classes applied. Classes whose name starts with : are pseudoclasses and may only be added or removed by the control itself, through IPseudoClasses.

    The value is a shared handle: clones refer to the same collection, and handles compare by identity.

    View source

    Members

    new

    fn new() -> Self
    

    Creates an empty collection.

    Source

    from_names

    fn from_names<S: Into<String>>(items: impl IntoIterator<Item = S>) -> Self
    

    Creates a collection from the given class names.

    Source

    ptr_eq

    fn ptr_eq(self: &Self, other: &Self) -> bool
    

    Whether two handles refer to the same collection.

    Source

    parse

    fn parse(s: &str) -> Classes
    

    Parses a space-separated list of class names.

    Source

    capacity

    fn capacity(self: &Self) -> usize
    

    The number of class names the collection can hold before its storage grows.

    Source

    set_capacity

    fn set_capacity(self: &Self, capacity: usize)
    

    Sets the number of class names the collection can hold before its storage grows.

    Panics

    Panics if capacity is less than the number of class names.

    Source

    count

    fn count(self: &Self) -> usize
    

    The number of classes.

    Source

    get

    fn get(self: &Self, index: usize) -> String
    

    The class at index.

    Source

    snapshot

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

    A snapshot of the classes.

    Source

    contains

    fn contains(self: &Self, name: &str) -> bool
    

    Returns whether a class is present in the collection.

    Source

    add_collection_changed

    fn add_collection_changed(self: &Self, handler: Rc<CollectionChangedHandler<String>>) -> u64
    

    Subscribes to collection changes; see FerroList::add_collection_changed.

    Source

    remove_collection_changed

    fn remove_collection_changed(self: &Self, token: u64) -> bool
    

    Source

    add

    fn add(self: &Self, name: &str)
    

    Adds a style class to the collection. Only standard classes may be added via this method.

    Source

    add_range

    fn add_range<S: AsRef<str>>(self: &Self, names: impl IntoIterator<Item = S>)
    

    Adds style classes to the collection.

    Source

    clear

    fn clear(self: &Self)
    

    Removes all non-pseudoclasses from the collection.

    Source

    insert

    fn insert(self: &Self, index: usize, name: &str)
    

    Inserts a style class into the collection.

    Source

    insert_range

    fn insert_range<S: AsRef<str>>(self: &Self, index: usize, names: impl IntoIterator<Item = S>)
    

    Inserts style classes into the collection.

    Source

    remove

    fn remove(self: &Self, name: &str) -> bool
    

    Removes a style class from the collection.

    Source

    remove_all

    fn remove_all<S: AsRef<str>>(self: &Self, names: impl IntoIterator<Item = S>)
    

    Removes style classes from the collection.

    Source

    remove_at

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

    Removes the style class at the specified index.

    Source

    remove_range

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

    Removes a range of style classes from the collection.

    Source

    replace

    fn replace<S: AsRef<str>>(self: &Self, source: &[S])
    

    Removes all non-pseudoclasses in the collection and adds a new set.

    Source

    set

    fn set(self: &Self, name: &str, value: bool)
    

    Adds or removes a style class.

    Source

    add_listener

    fn add_listener(self: &Self, listener: Rc<dyn Fn() -> ()>) -> u64
    

    Registers a listener invoked whenever the classes change. Returns a token for remove_listener.

    Source

    remove_listener

    fn remove_listener(self: &Self, token: u64) -> bool
    

    Source

    listener_count

    fn listener_count(self: &Self) -> usize
    

    The number of registered listeners.

    Source

    Trait implementations

    Availability

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