ui_automation/role.rs
1// Copyright (C) 2024 Tristan Gerritsen <tristan@thewoosh.org>
2// All Rights Reserved.
3
4/// TODO implement [`Display`][std::fmt::Display] for this type.
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum Role {
7 Unknown(String),
8
9 /// The application doesn't specify further info.
10 Generic,
11
12 /// An application, containing zero or more [`Window`](Role::Window)s.
13 Application,
14
15 /// A clickable button.
16 Button,
17
18 /// A button which can be either on or off.
19 Checkbox,
20
21 /// A tree view with items from left to right.
22 HierarchyHorizontal,
23
24 /// A tree view with items from top to bottom.
25 HierarchyVertical,
26
27 /// An image or icon.
28 Image,
29
30 /// An input field with the `date` type.
31 InputDate,
32
33 /// An input field with the `time` type.
34 InputTime,
35
36 /// A textual input field with its contents masked.
37 InputPassword,
38
39 /// An input field where the user can select a point in a predefined range.
40 InputSlider,
41
42 /// Some static text.
43 Label,
44
45 /// A label when clicked performs an action.
46 Link,
47
48 /// A list of items.
49 List,
50
51 /// An item in a [`MenuBar`][Role::MenuBar], such as `File`, `Edit`, `Help`.
52 Menu,
53
54 /// A menu bar (usually horizontal) containing one or more [`Menu`][Role::Menu]s
55 MenuBar,
56
57 /// An item in a [`Menu`][Role::Menu], such as `Open` in the `File` menu.
58 MenuItem,
59
60 /// A (non) visual grouping of elements.
61 Panel,
62
63 /// A button as the option in a [`RadioGroup`](Role::RadioGroup).
64 RadioButton,
65
66 /// An input field with one or more exclusive options, in the form of
67 /// [`RadioButton`](Role::RadioButton)s.
68 RadioGroup,
69
70 /// A scrollable panel.
71 ScrollArea,
72
73 /// The bar where the scroll depth is shown, usually on the right in a
74 /// [`ScrollArea`](Role::ScrollArea).
75 ScrollBar,
76
77 /// A split up grouping of two subgroups, with the division of the total
78 /// size changeable by a [`Splitter`](Role::Splitter).
79 SplitGroup,
80
81 /// A divisor of a [`SplitGroup`](Role::SplitGroup).
82 Splitter,
83
84 /// A grouping of tabs.
85 TabGroup,
86
87 /// The top-level container of a table.
88 Table,
89
90 /// An individual cell of a table row and column.
91 TableCell,
92
93 /// The horizontal part of a table.
94 TableColumn,
95
96 /// The vertical part of a table.
97 TableRow,
98
99 /// Text which the user can edit, with multiple lines allowed.
100 TextEditMultiline,
101
102 /// Text which the user can edit, without multiple lines.
103 TextEditSingleline,
104
105 /// A grouping of buttons with actions.
106 Toolbar,
107
108 /// A visual indicator of a certain value.
109 ValueIndicator,
110
111 /// A web page or other web content inside the window.
112 WebView,
113
114 /// A window.
115 Window,
116}
117
118impl Default for Role {
119 fn default() -> Self {
120 Self::Unknown(String::new())
121 }
122}