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
33/// Trait containing all [`struct@AccessibleText`] methods.
34///
35/// # Implementors
36///
37/// [`AccessibleText`][struct@crate::AccessibleText], [`Inscription`][struct@crate::Inscription], [`Label`][struct@crate::Label], [`TextView`][struct@crate::TextView], [`Text`][struct@crate::Text]
38pub trait AccessibleTextExt: IsA<AccessibleText> + 'static {
39 /// Updates the position of the caret.
40 ///
41 /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
42 /// function every time the caret has moved, in order to notify assistive
43 /// technologies.
44 #[doc(alias = "gtk_accessible_text_update_caret_position")]
45 fn update_caret_position(&self) {
46 unsafe {
47 ffi::gtk_accessible_text_update_caret_position(self.as_ref().to_glib_none().0);
48 }
49 }
50
51 /// Notifies assistive technologies of a change in contents.
52 ///
53 /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
54 /// function every time their contents change as the result of an operation,
55 /// like an insertion or a removal.
56 ///
57 /// Note: If the change is a deletion, this function must be called *before*
58 /// removing the contents, if it is an insertion, it must be called *after*
59 /// inserting the new contents.
60 /// ## `change`
61 /// the type of change in the contents
62 /// ## `start`
63 /// the starting offset of the change, in characters
64 /// ## `end`
65 /// the end offset of the change, in characters
66 #[doc(alias = "gtk_accessible_text_update_contents")]
67 fn update_contents(&self, change: AccessibleTextContentChange, start: u32, end: u32) {
68 unsafe {
69 ffi::gtk_accessible_text_update_contents(
70 self.as_ref().to_glib_none().0,
71 change.into_glib(),
72 start,
73 end,
74 );
75 }
76 }
77
78 /// Updates the boundary of the selection.
79 ///
80 /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
81 /// function every time the selection has moved, in order to notify assistive
82 /// technologies.
83 #[doc(alias = "gtk_accessible_text_update_selection_bound")]
84 fn update_selection_bound(&self) {
85 unsafe {
86 ffi::gtk_accessible_text_update_selection_bound(self.as_ref().to_glib_none().0);
87 }
88 }
89}
90
91impl<O: IsA<AccessibleText>> AccessibleTextExt for O {}