ui-automation 0.1.1

Control the User Interface, cross-platform.
Documentation
// Copyright (C) 2024 Tristan Gerritsen <tristan@thewoosh.org>
// All Rights Reserved.

/// TODO implement [`Display`][std::fmt::Display] for this type.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Role {
    Unknown(String),

    /// The application doesn't specify further info.
    Generic,

    /// An application, containing zero or more [`Window`](Role::Window)s.
    Application,

    /// A clickable button.
    Button,

    /// A button which can be either on or off.
    Checkbox,

    /// A tree view with items from left to right.
    HierarchyHorizontal,

    /// A tree view with items from top to bottom.
    HierarchyVertical,

    /// An image or icon.
    Image,

    /// An input field with the `date` type.
    InputDate,

    /// An input field with the `time` type.
    InputTime,

    /// A textual input field with its contents masked.
    InputPassword,

    /// An input field where the user can select a point in a predefined range.
    InputSlider,

    /// Some static text.
    Label,

    /// A label when clicked performs an action.
    Link,

    /// A list of items.
    List,

    /// An item in a [`MenuBar`][Role::MenuBar], such as `File`, `Edit`, `Help`.
    Menu,

    /// A menu bar (usually horizontal) containing one or more [`Menu`][Role::Menu]s
    MenuBar,

    /// An item in a [`Menu`][Role::Menu], such as `Open` in the `File` menu.
    MenuItem,

    /// A (non) visual grouping of elements.
    Panel,

    /// A button as the option in a [`RadioGroup`](Role::RadioGroup).
    RadioButton,

    /// An input field with one or more exclusive options, in the form of
    /// [`RadioButton`](Role::RadioButton)s.
    RadioGroup,

    /// A scrollable panel.
    ScrollArea,

    /// The bar where the scroll depth is shown, usually on the right in a
    /// [`ScrollArea`](Role::ScrollArea).
    ScrollBar,

    /// A split up grouping of two subgroups, with the division of the total
    /// size changeable by a [`Splitter`](Role::Splitter).
    SplitGroup,

    /// A divisor of a [`SplitGroup`](Role::SplitGroup).
    Splitter,

    /// A grouping of tabs.
    TabGroup,

    /// The top-level container of a table.
    Table,

    /// An individual cell of a table row and column.
    TableCell,

    /// The horizontal part of a table.
    TableColumn,

    /// The vertical part of a table.
    TableRow,

    /// Text which the user can edit, with multiple lines allowed.
    TextEditMultiline,

    /// Text which the user can edit, without multiple lines.
    TextEditSingleline,

    /// A grouping of buttons with actions.
    Toolbar,

    /// A visual indicator of a certain value.
    ValueIndicator,

    /// A web page or other web content inside the window.
    WebView,

    /// A window.
    Window,
}

impl Default for Role {
    fn default() -> Self {
        Self::Unknown(String::new())
    }
}