gtk4/
accessible_text_range.rs1use crate::ffi;
4use glib::translate::*;
5
6glib::wrapper! {
7 #[doc(alias = "GtkAccessibleTextRange")]
8 pub struct AccessibleTextRange(BoxedInline<ffi::GtkAccessibleTextRange>);
9}
10
11impl AccessibleTextRange {
12 pub fn new(start: usize, length: usize) -> Self {
13 skip_assert_initialized!();
14 unsafe { AccessibleTextRange::unsafe_from(ffi::GtkAccessibleTextRange { start, length }) }
15 }
16
17 pub fn start(&self) -> usize {
18 self.inner.start
19 }
20
21 pub fn set_start(&mut self, start: usize) {
22 self.inner.start = start;
23 }
24
25 pub fn length(&self) -> usize {
26 self.inner.length
27 }
28
29 pub fn set_length(&mut self, length: usize) {
30 self.inner.length = length
31 }
32}
33
34impl std::fmt::Debug for AccessibleTextRange {
35 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
36 f.debug_struct("AccessibleTextRange")
37 .field("start", &self.start())
38 .field("length", &self.length())
39 .finish()
40 }
41}