// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gtkmm/celleditable.h>
#include <gtkmm/private/celleditable_p.h>

// -*- c++ -*-
/* $Id: celleditable.ccg,v 1.1.1.1 2003/01/21 13:38:44 murrayc Exp $ */

/* Copyright 1998-2002 The gtkmm Development Team
 *
 * 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.
 */

#include <gtk/gtkcelleditable.h>


namespace
{

static const Glib::SignalProxyInfo CellEditable_signal_editing_done_info =
{
  "editing_done",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static const Glib::SignalProxyInfo CellEditable_signal_remove_widget_info =
{
  "remove_widget",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};

} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gtk::CellEditable> wrap(GtkCellEditable* object, bool take_copy)
{
  return Glib::RefPtr<Gtk::CellEditable>( dynamic_cast<Gtk::CellEditable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} // namespace Glib


namespace Gtk
{


/* The *_Class implementation: */

const Glib::Interface_Class& CellEditable_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_ = &CellEditable_Class::iface_init_function;

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

  return *this;
}

void CellEditable_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); 

#ifdef GLIBMM_VFUNCS_ENABLED
  klass->start_editing = &start_editing_vfunc_callback;
#endif //GLIBMM_VFUNCS_ENABLED

  klass->editing_done = &editing_done_callback;
  klass->remove_widget = &remove_widget_callback;
}

#ifdef GLIBMM_VFUNCS_ENABLED
void CellEditable_Class::start_editing_vfunc_callback(GtkCellEditable* self, GdkEvent* event)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      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 && obj->is_derived_())
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      // Call the virtual member method, which derived classes might override.
      obj->start_editing_vfunc(event);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
  else
  {
    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->start_editing)
      (*base->start_editing)(self, event);
  }
}

#endif //GLIBMM_VFUNCS_ENABLED

void CellEditable_Class::editing_done_callback(GtkCellEditable* self)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      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 && obj->is_derived_())
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      // Call the virtual member method, which derived classes might override.
      obj->on_editing_done();
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
  else
  {
    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->editing_done)
      (*base->editing_done)(self);
  }
}

void CellEditable_Class::remove_widget_callback(GtkCellEditable* self)
{
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
      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 && obj->is_derived_())
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      // Call the virtual member method, which derived classes might override.
      obj->on_remove_widget();
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
  else
  {
    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->remove_widget)
      (*base->remove_widget)(self);
  }
}


Glib::ObjectBase* CellEditable_Class::wrap_new(GObject* object)
{
  return new CellEditable((GtkCellEditable*)(object));
}


/* The implementation: */

CellEditable::CellEditable()
:
  Glib::Interface(celleditable_class_.init())
{}

CellEditable::CellEditable(GtkCellEditable* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

CellEditable::~CellEditable()
{}

// static
void CellEditable::add_interface(GType gtype_implementer)
{
  celleditable_class_.init().add_interface(gtype_implementer);
}

CellEditable::CppClassType CellEditable::celleditable_class_; // initialize static member

GType CellEditable::get_type()
{
  return celleditable_class_.init().get_type();
}

GType CellEditable::get_base_type()
{
  return gtk_cell_editable_get_type();
}


void CellEditable::start_editing(GdkEvent* event)

{
  gtk_cell_editable_start_editing(gobj(), event);  
}


void CellEditable::editing_done()

{
  gtk_cell_editable_editing_done(gobj());  
}


void CellEditable::remove_widget()

{
  gtk_cell_editable_remove_widget(gobj());  
}


Glib::SignalProxy0< void > CellEditable::signal_editing_done()
{
  return Glib::SignalProxy0< void >(this, &CellEditable_signal_editing_done_info);
}

Glib::SignalProxy0< void > CellEditable::signal_remove_widget()
{
  return Glib::SignalProxy0< void >(this, &CellEditable_signal_remove_widget_info);
}


void Gtk::CellEditable::on_editing_done()
{
  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->editing_done)
    (*base->editing_done)(gobj());
}

void Gtk::CellEditable::on_remove_widget()
{
  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->remove_widget)
    (*base->remove_widget)(gobj());
}


#ifdef GLIBMM_VFUNCS_ENABLED
void Gtk::CellEditable::start_editing_vfunc(GdkEvent* event) 
{
  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->start_editing)
    (*base->start_editing)(gobj(),event);
}

#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gtk


