// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/entityfield.h>
#include <libgdamm/private/entityfield_p.h>

/* $Id: entityfield.ccg,v 1.1 2006/11/08 00:07:37 murrayc Exp $ */
// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* entityfield.cc
 * 
 * Copyright 2006 libgdamm 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 <libgdamm/entity.h>
#include <libgda/gda-entity-field.h>
#include <libgda/gda-enum-types.h>

namespace Gnome
{

namespace Gda
{

} // namespace Gda

} // namespace Gnome


namespace
{
} // anonymous namespace


namespace Glib
{

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

} // namespace Glib


namespace Gnome
{

namespace Gda
{


/* The *_Class implementation: */

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

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

  return *this;
}

void EntityField_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->get_g_type = &get_g_type_vfunc_callback;
  klass->set_dict_type = &set_dict_type_vfunc_callback;
  klass->get_alias = &get_alias_vfunc_callback;
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
GType EntityField_Class::get_g_type_vfunc_callback(GdaEntityField* 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.
    {
      #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.
        return obj->get_g_type_vfunc();
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->get_g_type)
    return (*base->get_g_type)(self);


  typedef GType RType;
  return RType();
}
void EntityField_Class::set_dict_type_vfunc_callback(GdaEntityField* self, GdaDictType* type)
{
  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.
    {
      #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->set_dict_type_vfunc(Glib::wrap(type)
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->set_dict_type)
    (*base->set_dict_type)(self, type);

}
const gchar* EntityField_Class::get_alias_vfunc_callback(GdaEntityField* 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.
    {
      #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.
        return (obj->get_alias_vfunc()).c_str();
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->get_alias)
    return (*base->get_alias)(self);


  typedef const gchar* RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* EntityField_Class::wrap_new(GObject* object)
{
  return new EntityField((GdaEntityField*)(object));
}


/* The implementation: */

EntityField::EntityField()
:
  Glib::Interface(entityfield_class_.init())
{}

EntityField::EntityField(GdaEntityField* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

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

EntityField::~EntityField()
{}

// static
void EntityField::add_interface(GType gtype_implementer)
{
  entityfield_class_.init().add_interface(gtype_implementer);
}

EntityField::CppClassType EntityField::entityfield_class_; // initialize static member

GType EntityField::get_type()
{
  return entityfield_class_.init().get_type();
}

GType EntityField::get_base_type()
{
  return gda_entity_field_get_type();
}


Glib::RefPtr<Entity> EntityField::get_entity()
{

  Glib::RefPtr<Entity> retvalue = Glib::wrap(gda_entity_field_get_entity(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const Entity> EntityField::get_entity() const
{
  return const_cast<EntityField*>(this)->get_entity();
}

GType EntityField::get_g_type() const
{
  return gda_entity_field_get_g_type(const_cast<GdaEntityField*>(gobj()));
}

Glib::RefPtr<DictType> EntityField::get_dict_type()
{

  Glib::RefPtr<DictType> retvalue = Glib::wrap(gda_entity_field_get_dict_type(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const DictType> EntityField::get_dict_type() const
{
  return const_cast<EntityField*>(this)->get_dict_type();
}

void EntityField::set_dict_type(const Glib::RefPtr<DictType>& type)
{
gda_entity_field_set_dict_type(gobj(), Glib::unwrap(type)); 
}

Glib::ustring EntityField::get_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_entity_field_get_name(const_cast<GdaEntityField*>(gobj())));
}

Glib::ustring EntityField::get_description() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_entity_field_get_description(const_cast<GdaEntityField*>(gobj())));
}


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
GType Gnome::Gda::EntityField::get_g_type_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->get_g_type)
    return (*base->get_g_type)(gobj());

  typedef GType RType;
  return RType();
}
void Gnome::Gda::EntityField::set_dict_type_vfunc(const Glib::RefPtr<DictType>& type) 
{
  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->set_dict_type)
    (*base->set_dict_type)(gobj(),Glib::unwrap(type));
}
Glib::ustring Gnome::Gda::EntityField::get_alias_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->get_alias)
    return Glib::convert_const_gchar_ptr_to_ustring((*base->get_alias)(gobj()));

  typedef Glib::ustring RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gda

} // namespace Gnome


