// 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! {
    #[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 {}
}

pub trait AccessibleTextExt: IsA<AccessibleText> + sealed::Sealed + 'static {
    #[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);
        }
    }

    #[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,
            );
        }
    }

    #[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 {}
