// 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, Viewport};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "ShumateLayer")]
    pub struct Layer(Object<ffi::ShumateLayer, ffi::ShumateLayerClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;

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

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

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

pub trait LayerExt: IsA<Layer> + sealed::Sealed + 'static {
    #[doc(alias = "shumate_layer_get_viewport")]
    #[doc(alias = "get_viewport")]
    fn viewport(&self) -> Option<Viewport> {
        unsafe {
            from_glib_none(ffi::shumate_layer_get_viewport(
                self.as_ref().to_glib_none().0,
            ))
        }
    }
}

impl<O: IsA<Layer>> LayerExt for O {}
