| 1 | // Copyright 2022 The AccessKit Authors. All rights reserved. |
| 2 | // Licensed under the Apache License, Version 2.0 (found in |
| 3 | // the LICENSE-APACHE file) or the MIT license (found in |
| 4 | // the LICENSE-MIT file), at your option. |
| 5 | |
| 6 | use accesskit::NodeId; |
| 7 | use atspi_common::{Live, Role, State}; |
| 8 | |
| 9 | use crate::{NodeIdOrRoot, Rect}; |
| 10 | |
| 11 | #[derive (Debug)] |
| 12 | pub enum Event { |
| 13 | Object { |
| 14 | target: NodeIdOrRoot, |
| 15 | event: ObjectEvent, |
| 16 | }, |
| 17 | Window { |
| 18 | target: NodeId, |
| 19 | name: String, |
| 20 | event: WindowEvent, |
| 21 | }, |
| 22 | } |
| 23 | |
| 24 | #[derive (Debug)] |
| 25 | pub enum Property { |
| 26 | Name(String), |
| 27 | Description(String), |
| 28 | Parent(NodeIdOrRoot), |
| 29 | Role(Role), |
| 30 | Value(f64), |
| 31 | } |
| 32 | |
| 33 | #[allow (clippy::enum_variant_names)] |
| 34 | #[derive (Debug)] |
| 35 | pub enum ObjectEvent { |
| 36 | ActiveDescendantChanged(NodeId), |
| 37 | Announcement(String, Live), |
| 38 | BoundsChanged(Rect), |
| 39 | CaretMoved(i32), |
| 40 | ChildAdded(usize, NodeId), |
| 41 | ChildRemoved(NodeId), |
| 42 | PropertyChanged(Property), |
| 43 | StateChanged(State, bool), |
| 44 | TextInserted { |
| 45 | start_index: i32, |
| 46 | length: i32, |
| 47 | content: String, |
| 48 | }, |
| 49 | TextRemoved { |
| 50 | start_index: i32, |
| 51 | length: i32, |
| 52 | content: String, |
| 53 | }, |
| 54 | TextSelectionChanged, |
| 55 | } |
| 56 | |
| 57 | #[derive (Debug)] |
| 58 | pub enum WindowEvent { |
| 59 | Activated, |
| 60 | Deactivated, |
| 61 | } |
| 62 | |