Skip to content

Commit d3daa8a

Browse files
committed
gtk: Implementable implementation for AccessibleText
1 parent f0e1d9e commit d3daa8a

File tree

4 files changed

+555
-6
lines changed

4 files changed

+555
-6
lines changed

gtk4/src/accessible_text_range.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

3-
#[derive(Copy, Clone)]
4-
#[doc(alias = "GtkAccessibleTextRange")]
5-
#[repr(transparent)]
6-
pub struct AccessibleTextRange(crate::ffi::GtkAccessibleTextRange);
3+
use glib::translate::UnsafeFrom;
4+
use gtk4_sys::GtkAccessibleTextRange;
5+
6+
glib::wrapper! {
7+
#[doc(alias = "GtkAccessibleTextRange")]
8+
pub struct AccessibleTextRange(BoxedInline<crate::ffi::GtkAccessibleTextRange>);
9+
}
710

811
impl AccessibleTextRange {
12+
pub fn new(start: usize, length: usize) -> Self {
13+
unsafe { AccessibleTextRange::unsafe_from(GtkAccessibleTextRange { start, length }) }
14+
}
15+
916
pub fn start(&self) -> usize {
10-
self.0.start
17+
self.inner.start
1118
}
1219

1320
pub fn length(&self) -> usize {
14-
self.0.length
21+
self.inner.length
1522
}
1623
}
1724

gtk4/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ mod tree_view;
199199
mod tree_view_column;
200200
mod widget;
201201

202+
#[cfg(feature = "v4_14")]
203+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
204+
pub use accessible_text_range::AccessibleTextRange;
202205
pub use bitset_iter::BitsetIter;
203206
pub use border::Border;
204207
pub use builder_cscope::BuilderCScope;

0 commit comments

Comments
 (0)