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

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

glib::wrapper! {
    #[doc(alias = "PpsSearchResult")]
    pub struct SearchResult(Object<ffi::PpsSearchResult, ffi::PpsSearchResultClass>);

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

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

    #[doc(alias = "pps_search_result_new")]
    pub fn new(markup: &str, label: &str, page: u32, index: u32) -> SearchResult {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::pps_search_result_new(
                markup.to_glib_none().0,
                label.to_glib_none().0,
                page,
                index,
            ))
        }
    }
}

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

pub trait SearchResultExt: IsA<SearchResult> + sealed::Sealed + 'static {
    #[doc(alias = "pps_search_result_get_index")]
    #[doc(alias = "get_index")]
    fn index(&self) -> u32 {
        unsafe { ffi::pps_search_result_get_index(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "pps_search_result_get_label")]
    #[doc(alias = "get_label")]
    fn label(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::pps_search_result_get_label(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_search_result_get_markup")]
    #[doc(alias = "get_markup")]
    fn markup(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::pps_search_result_get_markup(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_search_result_get_page")]
    #[doc(alias = "get_page")]
    fn page(&self) -> u32 {
        unsafe { ffi::pps_search_result_get_page(self.as_ref().to_glib_none().0) }
    }
}

impl<O: IsA<SearchResult>> SearchResultExt for O {}
