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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//! # `DBus` interface proxy for: `org.a11y.atspi.Text`
//!
//! This code was generated by `zbus-xmlgen` `2.0.1` from `DBus` introspection data.
//! Source: `Text.xml`.
//!
//! You may prefer to adapt it, instead of using it verbatim.
//!
//! More information can be found in the
//! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html)
//! section of the zbus documentation.
//!
#![allow(clippy::too_many_arguments)]
// this is to silence clippy due to zbus expanding parameter expressions

use crate::atspi_proxy;
use crate::common::{ClipType, CoordType, Granularity};

#[atspi_proxy(interface = "org.a11y.atspi.Text", assume_defaults = true)]
trait Text {
	/// AddSelection method
	fn add_selection(&self, start_offset: i32, end_offset: i32) -> zbus::Result<bool>;

	/// GetAttributeRun method
	fn get_attribute_run(
		&self,
		offset: i32,
		include_defaults: bool,
	) -> zbus::Result<(std::collections::HashMap<String, String>, i32, i32)>;

	/// GetAttributeValue method
	fn get_attribute_value(&self, offset: i32, attribute_name: &str) -> zbus::Result<String>;

	/// GetAttributes method
	fn get_attributes(
		&self,
		offset: i32,
	) -> zbus::Result<(std::collections::HashMap<String, String>, i32, i32)>;

	/// GetBoundedRanges method
	fn get_bounded_ranges(
		&self,
		x: i32,
		y: i32,
		width: i32,
		height: i32,
		coord_type: CoordType,
		x_clip_type: ClipType,
		y_clip_type: ClipType,
	) -> zbus::Result<Vec<(i32, i32, String, zbus::zvariant::OwnedValue)>>;

	/// GetCharacterAtOffset method
	fn get_character_at_offset(&self, offset: i32) -> zbus::Result<i32>;

	/// GetCharacterExtents method
	fn get_character_extents(
		&self,
		offset: i32,
		coord_type: CoordType,
	) -> zbus::Result<(i32, i32, i32, i32)>;

	/// GetDefaultAttributeSet method
	fn get_default_attribute_set(&self) -> zbus::Result<std::collections::HashMap<String, String>>;

	/// GetDefaultAttributes method
	fn get_default_attributes(&self) -> zbus::Result<std::collections::HashMap<String, String>>;

	/// GetNSelections method
	fn get_nselections(&self) -> zbus::Result<i32>;

	/// GetOffsetAtPoint method
	fn get_offset_at_point(&self, x: i32, y: i32, coord_type: CoordType) -> zbus::Result<i32>;

	/// GetRangeExtents method
	fn get_range_extents(
		&self,
		start_offset: i32,
		end_offset: i32,
		coord_type: CoordType,
	) -> zbus::Result<(i32, i32, i32, i32)>;

	/// GetSelection method
	fn get_selection(&self, selection_num: i32) -> zbus::Result<(i32, i32)>;

	/// GetStringAtOffset method
	fn get_string_at_offset(
		&self,
		offset: i32,
		granularity: Granularity,
	) -> zbus::Result<(String, i32, i32)>;

	/// GetText method
	fn get_text(&self, start_offset: i32, end_offset: i32) -> zbus::Result<String>;

	/// GetTextAfterOffset method
	fn get_text_after_offset(&self, offset: i32, type_: u32) -> zbus::Result<(String, i32, i32)>;

	/// GetTextAtOffset method
	fn get_text_at_offset(&self, offset: i32, type_: u32) -> zbus::Result<(String, i32, i32)>;

	/// GetTextBeforeOffset method
	fn get_text_before_offset(&self, offset: i32, type_: u32) -> zbus::Result<(String, i32, i32)>;

	/// RemoveSelection method
	fn remove_selection(&self, selection_num: i32) -> zbus::Result<bool>;

	/// ScrollSubstringTo method
	fn scroll_substring_to(
		&self,
		start_offset: i32,
		end_offset: i32,
		type_: u32,
	) -> zbus::Result<bool>;

	/// ScrollSubstringToPoint method
	fn scroll_substring_to_point(
		&self,
		start_offset: i32,
		end_offset: i32,
		type_: u32,
		x: i32,
		y: i32,
	) -> zbus::Result<bool>;

	/// SetCaretOffset method
	fn set_caret_offset(&self, offset: i32) -> zbus::Result<bool>;

	/// SetSelection method
	fn set_selection(
		&self,
		selection_num: i32,
		start_offset: i32,
		end_offset: i32,
	) -> zbus::Result<bool>;

	/// CaretOffset property
	#[dbus_proxy(property)]
	fn caret_offset(&self) -> zbus::Result<i32>;

	/// CharacterCount property
	#[dbus_proxy(property)]
	fn character_count(&self) -> zbus::Result<i32>;
}