use serde::{Deserialize, Serialize};
use zvariant::Type;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type, Hash)]
#[repr(u32)]
pub enum Role {
Invalid,
AcceleratorLabel,
Alert,
Animation,
Arrow,
Calendar,
Canvas,
CheckBox,
CheckMenuItem,
ColorChooser,
ColumnHeader,
ComboBox,
DateEditor,
DesktopIcon,
DesktopFrame,
Dial,
Dialog,
DirectoryPane,
DrawingArea,
FileChooser,
Filler,
FocusTraversable,
FontChooser,
Frame,
GlassPane,
HTMLContainer,
Icon,
Image,
InternalFrame,
Label,
LayeredPane,
List,
ListItem,
Menu,
MenuBar,
MenuItem,
OptionPane,
PageTab,
PageTabList,
Panel,
PasswordText,
PopupMenu,
ProgressBar,
PushButton,
RadioButton,
RadioMenuItem,
RootPane,
RowHeader,
ScrollBar,
ScrollPane,
Separator,
Slider,
SpinButton,
SplitPane,
StatusBar,
Table,
TableCell,
TableColumnHeader,
TableRowHeader,
TearoffMenuItem,
Terminal,
Text,
ToggleButton,
ToolBar,
ToolTip,
Tree,
TreeTable,
Unknown,
Viewport,
Window,
Extended,
Header,
Footer,
Paragraph,
Ruler,
Application,
Autocomplete,
Editbar,
Embedded,
Entry,
CHART,
Caption,
DocumentFrame,
Heading,
Page,
Section,
RedundantObject,
Form,
Link,
InputMethodWindow,
TableRow,
TreeItem,
DocumentSpreadsheet,
DocumentPresentation,
DocumentText,
DocumentWeb,
DocumentEmail,
Comment,
ListBox,
Grouping,
ImageMap,
Notification,
InfoBar,
LevelBar,
TitleBar,
BlockQuote,
Audio,
Video,
Definition,
Article,
Landmark,
Log,
Marquee,
Math,
Rating,
Timer,
Static,
MathFraction,
MathRoot,
Subscript,
Superscript,
DescriptionList,
DescriptionTerm,
DescriptionValue,
Footnote,
ContentDeletion,
ContentInsertion,
Mark,
Suggestion,
PushButtonMenu,
}
const ROLE_NAMES: &[&str] = &[
"invalid",
"accelerator label",
"alert",
"animation",
"arrow",
"calendar",
"canvas",
"check box",
"check menu item",
"color chooser",
"column header",
"combo box",
"date editor",
"desktop icon",
"desktop frame",
"dial",
"dialog",
"directory pane",
"drawing area",
"file chooser",
"filler",
"focus traversable",
"font chooser",
"frame",
"glass pane",
"html container",
"icon",
"image",
"internal frame",
"label",
"layered pane",
"list",
"list item",
"menu",
"menu bar",
"menu item",
"option pane",
"page tab",
"page tab list",
"panel",
"password text",
"popup menu",
"progress bar",
"push button",
"radio button",
"radio menu item",
"root pane",
"row header",
"scroll bar",
"scroll pane",
"separator",
"slider",
"spin button",
"split pane",
"status bar",
"table",
"table cell",
"table column header",
"table row header",
"tearoff menu item",
"terminal",
"text",
"toggle button",
"tool bar",
"tool tip",
"tree",
"tree table",
"unknown",
"viewport",
"window",
"extended",
"header",
"footer",
"paragraph",
"ruler",
"application",
"autocomplete",
"editbar",
"embedded",
"entry",
"chart",
"caption",
"document frame",
"heading",
"page",
"section",
"redundant object",
"form",
"link",
"input method window",
"table row",
"tree item",
"document spreadsheet",
"document presentation",
"document text",
"document web",
"document email",
"comment",
"list box",
"grouping",
"image map",
"notification",
"info bar",
"level bar",
"title bar",
"block quote",
"audio",
"video",
"definition",
"article",
"landmark",
"log",
"marquee",
"math",
"rating",
"timer",
"static",
"math fraction",
"math root",
"subscript",
"superscript",
"description list",
"description term",
"description value",
"footnote",
"content deletion",
"content insertion",
"mark",
"suggestion",
"push button menu",
];
impl Role {
#[must_use]
pub fn name(&self) -> &'static str {
ROLE_NAMES[*self as usize]
}
}
impl std::fmt::Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.name())
}
}