// 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 glib::object::IsA;
use glib::translate::*;
use gtk_sys;
use std::fmt;
use Widget;

glib_wrapper! {
    pub struct TextChildAnchor(Object<gtk_sys::GtkTextChildAnchor, gtk_sys::GtkTextChildAnchorClass, TextChildAnchorClass>);

    match fn {
        get_type => || gtk_sys::gtk_text_child_anchor_get_type(),
    }
}

impl TextChildAnchor {
    pub fn new() -> TextChildAnchor {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(gtk_sys::gtk_text_child_anchor_new()) }
    }
}

impl Default for TextChildAnchor {
    fn default() -> Self {
        Self::new()
    }
}

pub const NONE_TEXT_CHILD_ANCHOR: Option<&TextChildAnchor> = None;

pub trait TextChildAnchorExt: 'static {
    fn get_deleted(&self) -> bool;

    fn get_widgets(&self) -> Vec<Widget>;
}

impl<O: IsA<TextChildAnchor>> TextChildAnchorExt for O {
    fn get_deleted(&self) -> bool {
        unsafe {
            from_glib(gtk_sys::gtk_text_child_anchor_get_deleted(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_widgets(&self) -> Vec<Widget> {
        unsafe {
            FromGlibPtrContainer::from_glib_container(gtk_sys::gtk_text_child_anchor_get_widgets(
                self.as_ref().to_glib_none().0,
            ))
        }
    }
}

impl fmt::Display for TextChildAnchor {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "TextChildAnchor")
    }
}
