// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::{ffi, GutterRendererAlignmentMode};
use glib::translate::*;

glib::wrapper! {
    #[doc(alias = "GtkSourceGutterLines")]
    pub struct GutterLines(Object<ffi::GtkSourceGutterLines, ffi::GtkSourceGutterLinesClass>);

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

impl GutterLines {
    #[doc(alias = "gtk_source_gutter_lines_add_class")]
    pub fn add_class(&self, line: u32, name: &str) {
        unsafe {
            ffi::gtk_source_gutter_lines_add_class(
                self.to_glib_none().0,
                line,
                name.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_add_qclass")]
    pub fn add_qclass(&self, line: u32, qname: glib::Quark) {
        unsafe {
            ffi::gtk_source_gutter_lines_add_qclass(self.to_glib_none().0, line, qname.into_glib());
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_get_buffer")]
    #[doc(alias = "get_buffer")]
    pub fn buffer(&self) -> gtk::TextBuffer {
        unsafe {
            from_glib_none(ffi::gtk_source_gutter_lines_get_buffer(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_get_first")]
    #[doc(alias = "get_first")]
    pub fn first(&self) -> u32 {
        unsafe { ffi::gtk_source_gutter_lines_get_first(self.to_glib_none().0) }
    }

    #[doc(alias = "gtk_source_gutter_lines_get_iter_at_line")]
    #[doc(alias = "get_iter_at_line")]
    pub fn iter_at_line(&self, line: u32) -> gtk::TextIter {
        unsafe {
            let mut iter = gtk::TextIter::uninitialized();
            ffi::gtk_source_gutter_lines_get_iter_at_line(
                self.to_glib_none().0,
                iter.to_glib_none_mut().0,
                line,
            );
            iter
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_get_last")]
    #[doc(alias = "get_last")]
    pub fn last(&self) -> u32 {
        unsafe { ffi::gtk_source_gutter_lines_get_last(self.to_glib_none().0) }
    }

    #[doc(alias = "gtk_source_gutter_lines_get_line_yrange")]
    #[doc(alias = "get_line_yrange")]
    pub fn line_yrange(&self, line: u32, mode: GutterRendererAlignmentMode) -> (i32, i32) {
        unsafe {
            let mut y = std::mem::MaybeUninit::uninit();
            let mut height = std::mem::MaybeUninit::uninit();
            ffi::gtk_source_gutter_lines_get_line_yrange(
                self.to_glib_none().0,
                line,
                mode.into_glib(),
                y.as_mut_ptr(),
                height.as_mut_ptr(),
            );
            (y.assume_init(), height.assume_init())
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_get_view")]
    #[doc(alias = "get_view")]
    pub fn view(&self) -> gtk::TextView {
        unsafe { from_glib_none(ffi::gtk_source_gutter_lines_get_view(self.to_glib_none().0)) }
    }

    #[cfg(feature = "v5_6")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))]
    #[doc(alias = "gtk_source_gutter_lines_has_any_class")]
    pub fn has_any_class(&self, line: u32) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_gutter_lines_has_any_class(
                self.to_glib_none().0,
                line,
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_has_class")]
    pub fn has_class(&self, line: u32, name: &str) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_gutter_lines_has_class(
                self.to_glib_none().0,
                line,
                name.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_has_qclass")]
    pub fn has_qclass(&self, line: u32, qname: glib::Quark) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_gutter_lines_has_qclass(
                self.to_glib_none().0,
                line,
                qname.into_glib(),
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_is_cursor")]
    pub fn is_cursor(&self, line: u32) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_gutter_lines_is_cursor(
                self.to_glib_none().0,
                line,
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_is_prelit")]
    pub fn is_prelit(&self, line: u32) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_gutter_lines_is_prelit(
                self.to_glib_none().0,
                line,
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_is_selected")]
    pub fn is_selected(&self, line: u32) -> bool {
        unsafe {
            from_glib(ffi::gtk_source_gutter_lines_is_selected(
                self.to_glib_none().0,
                line,
            ))
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_remove_class")]
    pub fn remove_class(&self, line: u32, name: &str) {
        unsafe {
            ffi::gtk_source_gutter_lines_remove_class(
                self.to_glib_none().0,
                line,
                name.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "gtk_source_gutter_lines_remove_qclass")]
    pub fn remove_qclass(&self, line: u32, qname: glib::Quark) {
        unsafe {
            ffi::gtk_source_gutter_lines_remove_qclass(
                self.to_glib_none().0,
                line,
                qname.into_glib(),
            );
        }
    }
}
