ui-automation 0.1.1

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

#[derive(Debug, Default, Clone)]
pub struct ClickRequest {
    position: ClickPosition,
    button: MouseButton,
}

impl ClickRequest {
    pub fn new(position: ClickPosition, button: MouseButton) -> Self {
        Self {
            position,
            button,
        }
    }

    #[must_use]
    pub const fn position(&self) -> ClickPosition {
        self.position
    }

    #[must_use]
    pub const fn button(&self) -> MouseButton {
        self.button
    }
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum ClickPosition {
    /// Click at the top-level position of the element.
    Origin,

    /// Click at the center of the element.
    #[default]
    Center,
}

#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum MouseButton {
    /// The left mouse button.
    #[default]
    Left,

    /// The middle mouse button, usually the scroll wheel button.
    Middle,

    /// The right mouse button.
    Right,
}