accesskit_atspi_common/
events.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
// Copyright 2022 The AccessKit Authors. All rights reserved.
// Licensed under the Apache License, Version 2.0 (found in
// the LICENSE-APACHE file) or the MIT license (found in
// the LICENSE-MIT file), at your option.

use accesskit::NodeId;
use atspi_common::{Live, Role, State};

use crate::{NodeIdOrRoot, Rect};

#[derive(Debug)]
pub enum Event {
    Object {
        target: NodeIdOrRoot,
        event: ObjectEvent,
    },
    Window {
        target: NodeId,
        name: String,
        event: WindowEvent,
    },
}

#[derive(Debug)]
pub enum Property {
    Name(String),
    Description(String),
    Parent(NodeIdOrRoot),
    Role(Role),
    Value(f64),
}

#[allow(clippy::enum_variant_names)]
#[derive(Debug)]
pub enum ObjectEvent {
    ActiveDescendantChanged(NodeId),
    Announcement(String, Live),
    BoundsChanged(Rect),
    CaretMoved(i32),
    ChildAdded(usize, NodeId),
    ChildRemoved(NodeId),
    PropertyChanged(Property),
    StateChanged(State, bool),
    TextInserted {
        start_index: i32,
        length: i32,
        content: String,
    },
    TextRemoved {
        start_index: i32,
        length: i32,
        content: String,
    },
    TextSelectionChanged,
}

#[derive(Debug)]
pub enum WindowEvent {
    Activated,
    Deactivated,
}