gtk4/auto/accessible_text.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{ffi, Accessible, AccessibleTextContentChange};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// An interface for accessible objects containing formatted text.
10 ///
11 /// The [`AccessibleText`][crate::AccessibleText] interfaces is meant to be implemented by accessible
12 /// objects that have text formatted with attributes, or non-trivial text contents.
13 ///
14 /// You should use the [enum@Gtk.AccessibleProperty.LABEL] or the
15 /// [enum@Gtk.AccessibleProperty.DESCRIPTION] properties for accessible
16 /// objects containing simple, unformatted text.
17 ///
18 /// # Implements
19 ///
20 /// [`AccessibleTextExt`][trait@crate::prelude::AccessibleTextExt], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
21 #[doc(alias = "GtkAccessibleText")]
22 pub struct AccessibleText(Interface<ffi::GtkAccessibleText, ffi::GtkAccessibleTextInterface>) @requires Accessible;
23
24 match fn {
25 type_ => || ffi::gtk_accessible_text_get_type(),
26 }
27}
28
29impl AccessibleText {
30 pub const NONE: Option<&'static AccessibleText> = None;
31}
32
33mod sealed {
34 pub trait Sealed {}
35 impl<T: super::IsA<super::AccessibleText>> Sealed for T {}
36}
37
38/// Trait containing all [`struct@AccessibleText`] methods.
39///
40/// # Implementors
41///
42/// [`AccessibleText`][struct@crate::AccessibleText], [`Inscription`][struct@crate::Inscription], [`Label`][struct@crate::Label], [`TextView`][struct@crate::TextView], [`Text`][struct@crate::Text]
43pub trait AccessibleTextExt: IsA<AccessibleText> + sealed::Sealed + 'static {
44 /// Updates the position of the caret.
45 ///
46 /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
47 /// function every time the caret has moved, in order to notify assistive
48 /// technologies.
49 #[doc(alias = "gtk_accessible_text_update_caret_position")]
50 fn update_caret_position(&self) {
51 unsafe {
52 ffi::gtk_accessible_text_update_caret_position(self.as_ref().to_glib_none().0);
53 }
54 }
55
56 /// Notifies assistive technologies of a change in contents.
57 ///
58 /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
59 /// function every time their contents change as the result of an operation,
60 /// like an insertion or a removal.
61 ///
62 /// Note: If the change is a deletion, this function must be called *before*
63 /// removing the contents, if it is an insertion, it must be called *after*
64 /// inserting the new contents.
65 /// ## `change`
66 /// the type of change in the contents
67 /// ## `start`
68 /// the starting offset of the change, in characters
69 /// ## `end`
70 /// the end offset of the change, in characters
71 #[doc(alias = "gtk_accessible_text_update_contents")]
72 fn update_contents(&self, change: AccessibleTextContentChange, start: u32, end: u32) {
73 unsafe {
74 ffi::gtk_accessible_text_update_contents(
75 self.as_ref().to_glib_none().0,
76 change.into_glib(),
77 start,
78 end,
79 );
80 }
81 }
82
83 /// Updates the boundary of the selection.
84 ///
85 /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
86 /// function every time the selection has moved, in order to notify assistive
87 /// technologies.
88 #[doc(alias = "gtk_accessible_text_update_selection_bound")]
89 fn update_selection_bound(&self) {
90 unsafe {
91 ffi::gtk_accessible_text_update_selection_bound(self.as_ref().to_glib_none().0);
92 }
93 }
94}
95
96impl<O: IsA<AccessibleText>> AccessibleTextExt for O {}