// Generated by gmmproc 2.44.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gtksourceviewmm/undomanager.h>
#include <gtksourceviewmm/private/undomanager_p.h>


/* undomanager.cc
 *
 * Copyright (C) 2010, 2011 Krzesimir Nowak
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


namespace
{


static const Glib::SignalProxyInfo UndoManager_signal_can_undo_changed_info =
{
  "can-undo-changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static const Glib::SignalProxyInfo UndoManager_signal_can_redo_changed_info =
{
  "can-redo-changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gsv::UndoManager> wrap(GtkSourceUndoManager* object, bool take_copy)
{
  return Glib::RefPtr<Gsv::UndoManager>( dynamic_cast<Gsv::UndoManager*> (Glib::wrap_auto_interface<Gsv::UndoManager> ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} // namespace Glib


namespace Gsv
{


/* The *_Class implementation: */

const Glib::Interface_Class& UndoManager_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Interface_Class has to know the interface init function
    // in order to add interfaces to implementing types.
    class_init_func_ = &UndoManager_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = gtk_source_undo_manager_get_type();
  }

  return *this;
}

void UndoManager_Class::iface_init_function(void* g_iface, void*)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);

  //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
  //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
  g_assert(klass != 0); 

  klass->can_undo = &can_undo_vfunc_callback;
  klass->can_redo = &can_redo_vfunc_callback;
  klass->undo = &undo_vfunc_callback;
  klass->redo = &redo_vfunc_callback;
  klass->begin_not_undoable_action = &begin_not_undoable_action_vfunc_callback;
  klass->end_not_undoable_action = &end_not_undoable_action_vfunc_callback;

  klass->can_undo_changed = &can_undo_changed_callback;
  klass->can_redo_changed = &can_redo_changed_callback;
}

gboolean UndoManager_Class::can_undo_vfunc_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->can_undo_vfunc());
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->can_undo)
  {
    gboolean retval = (*base->can_undo)(self);
    return retval;
  }

  typedef gboolean RType;
  return RType();
}
gboolean UndoManager_Class::can_redo_vfunc_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->can_redo_vfunc());
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->can_redo)
  {
    gboolean retval = (*base->can_redo)(self);
    return retval;
  }

  typedef gboolean RType;
  return RType();
}
void UndoManager_Class::undo_vfunc_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->undo_vfunc();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->undo)
  {
    (*base->undo)(self);
  }

}
void UndoManager_Class::redo_vfunc_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->redo_vfunc();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->redo)
  {
    (*base->redo)(self);
  }

}
void UndoManager_Class::begin_not_undoable_action_vfunc_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->begin_not_undoable_action_vfunc();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->begin_not_undoable_action)
  {
    (*base->begin_not_undoable_action)(self);
  }

}
void UndoManager_Class::end_not_undoable_action_vfunc_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->end_not_undoable_action_vfunc();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->end_not_undoable_action)
  {
    (*base->end_not_undoable_action)(self);
  }

}

void UndoManager_Class::can_undo_changed_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->on_can_undo_changed();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)    );

  // Call the original underlying C function:
  if(base && base->can_undo_changed)
    (*base->can_undo_changed)(self);
}
void UndoManager_Class::can_redo_changed_callback(GtkSourceUndoManager* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->on_can_redo_changed();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)    );

  // Call the original underlying C function:
  if(base && base->can_redo_changed)
    (*base->can_redo_changed)(self);
}


Glib::ObjectBase* UndoManager_Class::wrap_new(GObject* object)
{
  return new UndoManager((GtkSourceUndoManager*)(object));
}


/* The implementation: */

UndoManager::UndoManager()
:
  Glib::Interface(undomanager_class_.init())
{}

UndoManager::UndoManager(GtkSourceUndoManager* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

UndoManager::UndoManager(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

UndoManager::~UndoManager()
{}

// static
void UndoManager::add_interface(GType gtype_implementer)
{
  undomanager_class_.init().add_interface(gtype_implementer);
}

UndoManager::CppClassType UndoManager::undomanager_class_; // initialize static member

GType UndoManager::get_type()
{
  return undomanager_class_.init().get_type();
}


GType UndoManager::get_base_type()
{
  return gtk_source_undo_manager_get_type();
}


bool UndoManager::can_undo() const
{
  return gtk_source_undo_manager_can_undo(const_cast<GtkSourceUndoManager*>(gobj()));
}

bool UndoManager::can_redo() const
{
  return gtk_source_undo_manager_can_redo(const_cast<GtkSourceUndoManager*>(gobj()));
}

void UndoManager::undo()
{
  gtk_source_undo_manager_undo(gobj());
}

void UndoManager::redo()
{
  gtk_source_undo_manager_redo(gobj());
}

void UndoManager::begin_not_undoable_action()
{
  gtk_source_undo_manager_begin_not_undoable_action(gobj());
}

void UndoManager::end_not_undoable_action()
{
  gtk_source_undo_manager_end_not_undoable_action(gobj());
}

void UndoManager::can_undo_changed()
{
  gtk_source_undo_manager_can_undo_changed(gobj());
}

void UndoManager::can_redo_changed()
{
  gtk_source_undo_manager_can_redo_changed(gobj());
}


Glib::SignalProxy0< void > UndoManager::signal_can_undo_changed()
{
  return Glib::SignalProxy0< void >(this, &UndoManager_signal_can_undo_changed_info);
}


Glib::SignalProxy0< void > UndoManager::signal_can_redo_changed()
{
  return Glib::SignalProxy0< void >(this, &UndoManager_signal_can_redo_changed_info);
}


void Gsv::UndoManager::on_can_undo_changed()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->can_undo_changed)
    (*base->can_undo_changed)(gobj());
}
void Gsv::UndoManager::on_can_redo_changed()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->can_redo_changed)
    (*base->can_redo_changed)(gobj());
}

bool Gsv::UndoManager::can_undo_vfunc() const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->can_undo)
  {
    bool retval((*base->can_undo)(const_cast<GtkSourceUndoManager*>(gobj())));
    return retval;
  }

  typedef bool RType;
  return RType();
}
bool Gsv::UndoManager::can_redo_vfunc() const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->can_redo)
  {
    bool retval((*base->can_redo)(const_cast<GtkSourceUndoManager*>(gobj())));
    return retval;
  }

  typedef bool RType;
  return RType();
}
void Gsv::UndoManager::undo_vfunc() 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->undo)
  {
    (*base->undo)(gobj());
  }
}
void Gsv::UndoManager::redo_vfunc() 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->redo)
  {
    (*base->redo)(gobj());
  }
}
void Gsv::UndoManager::begin_not_undoable_action_vfunc() 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->begin_not_undoable_action)
  {
    (*base->begin_not_undoable_action)(gobj());
  }
}
void Gsv::UndoManager::end_not_undoable_action_vfunc() 
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->end_not_undoable_action)
  {
    (*base->end_not_undoable_action)(gobj());
  }
}


} // namespace Gsv


