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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{ffi, Accessible, AccessibleTextContentChange};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    /// An interface for accessible objects containing formatted text.
    ///
    /// The [`AccessibleText`][crate::AccessibleText] interfaces is meant to be implemented by accessible
    /// objects that have text formatted with attributes, or non-trivial text contents.
    ///
    /// You should use the [enum@Gtk.AccessibleProperty.LABEL] or the
    /// [enum@Gtk.AccessibleProperty.DESCRIPTION] properties for accessible
    /// objects containing simple, unformatted text.
    ///
    /// # Implements
    ///
    /// [`AccessibleTextExt`][trait@crate::prelude::AccessibleTextExt], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
    #[doc(alias = "GtkAccessibleText")]
    pub struct AccessibleText(Interface<ffi::GtkAccessibleText, ffi::GtkAccessibleTextInterface>) @requires Accessible;

    match fn {
        type_ => || ffi::gtk_accessible_text_get_type(),
    }
}

impl AccessibleText {
    pub const NONE: Option<&'static AccessibleText> = None;
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::AccessibleText>> Sealed for T {}
}

/// Trait containing all [`struct@AccessibleText`] methods.
///
/// # Implementors
///
/// [`AccessibleText`][struct@crate::AccessibleText], [`Inscription`][struct@crate::Inscription], [`Label`][struct@crate::Label], [`TextView`][struct@crate::TextView], [`Text`][struct@crate::Text]
pub trait AccessibleTextExt: IsA<AccessibleText> + sealed::Sealed + 'static {
    /// Updates the position of the caret.
    ///
    /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
    /// function every time the caret has moved, in order to notify assistive
    /// technologies.
    #[doc(alias = "gtk_accessible_text_update_caret_position")]
    fn update_caret_position(&self) {
        unsafe {
            ffi::gtk_accessible_text_update_caret_position(self.as_ref().to_glib_none().0);
        }
    }

    /// Notifies assistive technologies of a change in contents.
    ///
    /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
    /// function every time their contents change as the result of an operation,
    /// like an insertion or a removal.
    ///
    /// Note: If the change is a deletion, this function must be called *before*
    /// removing the contents, if it is an insertion, it must be called *after*
    /// inserting the new contents.
    /// ## `change`
    /// the type of change in the contents
    /// ## `start`
    /// the starting offset of the change, in characters
    /// ## `end`
    /// the end offset of the change, in characters
    #[doc(alias = "gtk_accessible_text_update_contents")]
    fn update_contents(&self, change: AccessibleTextContentChange, start: u32, end: u32) {
        unsafe {
            ffi::gtk_accessible_text_update_contents(
                self.as_ref().to_glib_none().0,
                change.into_glib(),
                start,
                end,
            );
        }
    }

    /// Updates the boundary of the selection.
    ///
    /// Implementations of the [`AccessibleText`][crate::AccessibleText] interface should call this
    /// function every time the selection has moved, in order to notify assistive
    /// technologies.
    #[doc(alias = "gtk_accessible_text_update_selection_bound")]
    fn update_selection_bound(&self) {
        unsafe {
            ffi::gtk_accessible_text_update_selection_bound(self.as_ref().to_glib_none().0);
        }
    }
}

impl<O: IsA<AccessibleText>> AccessibleTextExt for O {}