MoonBit port of Rust accesskit (common + consumer).
///|
test "build and JSON-encode a TreeUpdate" {
let tree_id = TreeId::root()
let root = NodeId::new(1UL)
let node = Node::new(Role::Button)
node.set_label("OK")
let update = TreeUpdate::new(tree_id, root)
update.set_tree(Tree::new(root))
update.push_node(root, node)
let json = update.to_json().stringify(indent=2)
let roundtrip : TreeUpdate = @json.from_json(@json.parse(json))
assert_eq(roundtrip.focus().to_u64(), 1UL)
}pub(open) trait DeactivationHandler {
fn deactivate_accessibility(Self) -> Unit
}pub(all) enum Action {
Click
Focus
Blur
Collapse
Expand
CustomAction
Decrement
Increment
HideTooltip
ShowTooltip
ReplaceSelectedText
ScrollDown
ScrollLeft
ScrollRight
ScrollUp
ScrollIntoView
ScrollToPoint
SetScrollOffset
SetTextSelection
SetSequentialFocusNavigationStartingPoint
SetValue
ShowContextMenu
} derive(Eq, Debug)pub(all) enum ActionData {
CustomAction(Int)
Value(String)
NumericValue(Double)
ScrollUnit(ScrollUnit)
ScrollHint(ScrollHint)
ScrollToPoint(Point)
SetScrollOffset(Point)
SetTextSelection(TextSelection)
} derive(Eq, Debug)pub(all) struct ActionRequest {
// private fields
}
fn ActionRequest::ActionRequest(action : Action, target_tree : TreeId, target_node : NodeId) -> ActionRequestpub(all) struct CustomAction {
id : Int
description : String
} derive(Eq, Debug)
fn CustomAction::CustomAction(id : Int, description : String) -> CustomActionpub(all) struct NodeUpdate {
// private fields
}
fn NodeUpdate::NodeUpdate(id : NodeId, node : Node) -> NodeUpdatepub(all) enum Role {
Unknown
TextRun
Cell
Label
Image
Link
Row
ListItem
ListMarker
TreeItem
ListBoxOption
MenuItem
MenuListOption
Paragraph
GenericContainer
CheckBox
RadioButton
TextInput
Button
DefaultButton
Pane
RowHeader
ColumnHeader
RowGroup
List
Table
LayoutTableCell
LayoutTableRow
LayoutTable
Switch
Menu
MultilineTextInput
SearchInput
DateInput
DateTimeInput
WeekInput
MonthInput
TimeInput
EmailInput
NumberInput
PasswordInput
PhoneNumberInput
UrlInput
Abbr
Alert
AlertDialog
Application
Article
Audio
Banner
Blockquote
Canvas
Caption
Caret
Code
ColorWell
ComboBox
EditableComboBox
Complementary
Comment
ContentDeletion
ContentInsertion
ContentInfo
Definition
DescriptionList
Details
Dialog
DisclosureTriangle
Document
EmbeddedObject
Emphasis
Feed
FigureCaption
Figure
Footer
Form
Grid
GridCell
Group
Header
Heading
Iframe
IframePresentational
ImeCandidate
Keyboard
Legend
LineBreak
ListBox
Log
Main
Mark
Marquee
Math
MenuBar
MenuItemCheckBox
MenuItemRadio
MenuListPopup
Meter
Navigation
Note
PluginObject
ProgressIndicator
RadioGroup
Region
RootWebArea
Ruby
RubyAnnotation
ScrollBar
ScrollView
Search
Section
SectionFooter
SectionHeader
Slider
SpinButton
Splitter
Status
Strong
Suggestion
SvgRoot
Tab
TabList
TabPanel
Term
Time
Timer
TitleBar
Toolbar
Tooltip
Tree
TreeGrid
Video
WebView
Window
PdfActionableHighlight
PdfRoot
GraphicsDocument
GraphicsObject
GraphicsSymbol
DocAbstract
DocAcknowledgements
DocAfterword
DocAppendix
DocBackLink
DocBiblioEntry
DocBibliography
DocBiblioRef
DocChapter
DocColophon
DocConclusion
DocCover
DocCredit
DocCredits
DocDedication
DocEndnote
DocEndnotes
DocEpigraph
DocEpilogue
DocErrata
DocExample
DocFootnote
DocForeword
DocGlossary
DocGlossRef
DocIndex
DocIntroduction
DocNoteRef
DocNotice
DocPageBreak
DocPageFooter
DocPageHeader
DocPageList
DocPart
DocPreface
DocPrologue
DocPullquote
DocQna
DocSubtitle
DocTip
DocToc
ListGrid
Terminal
} derive(Eq, Debug)pub(all) struct TextDecoration {
style : TextDecorationStyle
color : Color
} derive(Eq, Debug)
fn TextDecoration::TextDecoration(style : TextDecorationStyle, color : Color) -> TextDecorationimpl Show for TextDecorationStyleimpl ToJson for TextDecorationStyleimpl FromJson for TextDecorationStylepub(all) struct TextPosition {
node : NodeId
character_index : Int
} derive(Eq, Debug)
fn TextPosition::TextPosition(node : NodeId, character_index : Int) -> TextPositionpub(all) struct TextSelection {
anchor : TextPosition
focus : TextPosition
} derive(Eq, Debug)
fn TextSelection::TextSelection(anchor : TextPosition, focus : TextPosition) -> TextSelectionpub(all) struct TreeUpdate {
// private fields
}
fn TreeUpdate::TreeUpdate(tree_id : TreeId, focus : NodeId) -> TreeUpdateMoonBit port of Rust accesskit (common + consumer).