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

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

glib::wrapper! {
    #[doc(alias = "PpsUndoContext")]
    pub struct UndoContext(Object<ffi::PpsUndoContext, ffi::PpsUndoContextClass>);

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

impl UndoContext {
    #[doc(alias = "pps_undo_context_new")]
    pub fn new(document_model: &DocumentModel) -> UndoContext {
        skip_assert_initialized!();
        unsafe { from_glib_full(ffi::pps_undo_context_new(document_model.to_glib_none().0)) }
    }

    //#[doc(alias = "pps_undo_context_add_action")]
    //pub fn add_action(&self, handler: /*Ignored*/&UndoHandler, data: /*Unimplemented*/Option<Basic: Pointer>) {
    //    unsafe { TODO: call ffi:pps_undo_context_add_action() }
    //}

    //#[doc(alias = "pps_undo_context_get_last_action")]
    //#[doc(alias = "get_last_action")]
    //pub fn last_action(&self) -> /*Unimplemented*/Option<Basic: Pointer> {
    //    unsafe { TODO: call ffi:pps_undo_context_get_last_action() }
    //}

    //#[doc(alias = "pps_undo_context_get_last_handler")]
    //#[doc(alias = "get_last_handler")]
    //pub fn last_handler(&self) -> /*Ignored*/Option<UndoHandler> {
    //    unsafe { TODO: call ffi:pps_undo_context_get_last_handler() }
    //}

    #[doc(alias = "pps_undo_context_redo")]
    pub fn redo(&self) {
        unsafe {
            ffi::pps_undo_context_redo(self.to_glib_none().0);
        }
    }

    #[doc(alias = "pps_undo_context_undo")]
    pub fn undo(&self) {
        unsafe {
            ffi::pps_undo_context_undo(self.to_glib_none().0);
        }
    }

    #[doc(alias = "document-model")]
    pub fn document_model(&self) -> Option<DocumentModel> {
        ObjectExt::property(self, "document-model")
    }
}
