pax_runtime_api/
cursor.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#[derive(Debug, Clone, PartialEq)]
pub enum CursorStyle {
    // General
    Auto,
    Default,
    None,

    // Links & Status
    ContextMenu,
    Help,
    Pointer,
    Progress,
    Wait,

    // Selection
    Cell,
    Crosshair,
    Text,
    VerticalText,

    // Drag & Drop
    Alias,
    Copy,
    Move,
    NoDrop,
    NotAllowed,

    // Resizing & Scrolling
    AllScroll,
    ColResize,
    RowResize,
    NResize,
    EResize,
    SResize,
    WResize,
    NeResize,
    NwResize,
    SeResize,
    SwResize,
    EwResize,
    NsResize,
    NeswResize,
    NwseResize,

    // Zooming
    ZoomIn,
    ZoomOut,

    // Grabbing
    Grab,
    Grabbing,

    // Custom
    Url(String, i32, i32),
}

impl std::fmt::Display for CursorStyle {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        // NOTE: These should match the valid css cursor names
        match self {
            CursorStyle::Auto => write!(f, "auto"),
            CursorStyle::Default => write!(f, "default"),
            CursorStyle::None => write!(f, "none"),
            CursorStyle::ContextMenu => write!(f, "context-menu"),
            CursorStyle::Help => write!(f, "help"),
            CursorStyle::Pointer => write!(f, "pointer"),
            CursorStyle::Progress => write!(f, "progress"),
            CursorStyle::Wait => write!(f, "wait"),
            CursorStyle::Cell => write!(f, "cell"),
            CursorStyle::Crosshair => write!(f, "crosshair"),
            CursorStyle::Text => write!(f, "text"),
            CursorStyle::VerticalText => write!(f, "vertical-text"),
            CursorStyle::Alias => write!(f, "alias"),
            CursorStyle::Copy => write!(f, "copy"),
            CursorStyle::Move => write!(f, "move"),
            CursorStyle::NoDrop => write!(f, "no-drop"),
            CursorStyle::NotAllowed => write!(f, "not-allowed"),
            CursorStyle::AllScroll => write!(f, "all-scroll"),
            CursorStyle::ColResize => write!(f, "col-resize"),
            CursorStyle::RowResize => write!(f, "row-resize"),
            CursorStyle::NResize => write!(f, "n-resize"),
            CursorStyle::EResize => write!(f, "e-resize"),
            CursorStyle::SResize => write!(f, "s-resize"),
            CursorStyle::WResize => write!(f, "w-resize"),
            CursorStyle::NeResize => write!(f, "ne-resize"),
            CursorStyle::NwResize => write!(f, "nw-resize"),
            CursorStyle::SeResize => write!(f, "se-resize"),
            CursorStyle::SwResize => write!(f, "sw-resize"),
            CursorStyle::EwResize => write!(f, "ew-resize"),
            CursorStyle::NsResize => write!(f, "ns-resize"),
            CursorStyle::NeswResize => write!(f, "nesw-resize"),
            CursorStyle::NwseResize => write!(f, "nwse-resize"),
            CursorStyle::ZoomIn => write!(f, "zoom-in"),
            CursorStyle::ZoomOut => write!(f, "zoom-out"),
            CursorStyle::Grab => write!(f, "grab"),
            CursorStyle::Grabbing => write!(f, "grabbing"),
            CursorStyle::Url(url, x, y) => write!(f, "url(\"{}\") {} {}, auto", url, x, y),
        }
    }
}