// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgda-uimm/dataproxy.h>
#include <libgda-uimm/private/dataproxy_p.h>

/* libgda-uimm - a C++ wrapper for libgda-ui
 * 
 * Copyright (c) 2010 libgda-uimm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <libgda-ui/gdaui-enum-types.h>
#include <libgdamm/dataproxy.h>
#include <gtkmm/actiongroup.h>

namespace Gnome
{

namespace GdaUI
{

} /* namespace GdaUI */

} /* namespace Gnome */

namespace
{


static void DataProxy_signal_proxy_changed_callback(GdauiDataProxy* self, GdaDataProxy* p0,void* data)
{
  using namespace Gnome::GdaUI;
  typedef sigc::slot< void,const Glib::RefPtr<Gnome::Gda::DataProxy>& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo DataProxy_signal_proxy_changed_info =
{
  "proxy-changed",
  (GCallback) &DataProxy_signal_proxy_changed_callback,
  (GCallback) &DataProxy_signal_proxy_changed_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gnome::GdaUI::Action>::value_type()
{
  return gdaui_action_get_type();
}

// static
GType Glib::Value<Gnome::GdaUI::DataProxyWriteMode>::value_type()
{
  return gdaui_data_proxy_write_mode_get_type();
}


namespace Glib
{

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

} // namespace Glib


namespace Gnome
{

namespace GdaUI
{


/* The *_Class implementation: */

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

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

  return *this;
}

void DataProxy_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_proxy = &get_proxy_vfunc_callback;
  klass->set_column_editable = &set_column_editable_vfunc_callback;
  klass->show_column_actions = &show_column_actions_vfunc_callback;
  klass->get_actions_group = &get_actions_group_vfunc_callback;
  klass->set_write_mode = &set_write_mode_vfunc_callback;
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  klass->proxy_changed = &proxy_changed_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
GdaDataProxy* DataProxy_Class::get_proxy_vfunc_callback(GdauiDataProxy* 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 Glib::unwrap(obj->get_proxy_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_proxy)
    return (*base->get_proxy)(self);


  typedef GdaDataProxy* RType;
  return RType();
}
void DataProxy_Class::set_column_editable_vfunc_callback(GdauiDataProxy* self, gint column, gboolean editable)
{
  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_editable_vfunc(column
, editable
);
        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_column_editable)
    (*base->set_column_editable)(self, column, editable);

}
void DataProxy_Class::show_column_actions_vfunc_callback(GdauiDataProxy* self, gint column, gboolean show_actions)
{
  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->show_actions_vfunc(column
, show_actions
);
        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->show_column_actions)
    (*base->show_column_actions)(self, column, show_actions);

}
GtkActionGroup* DataProxy_Class::get_actions_group_vfunc_callback(GdauiDataProxy* 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 Glib::unwrap(obj->get_action_group_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_actions_group)
    return (*base->get_actions_group)(self);


  typedef GtkActionGroup* RType;
  return RType();
}
gboolean DataProxy_Class::set_write_mode_vfunc_callback(GdauiDataProxy* self, GdauiDataProxyWriteMode mode)
{
  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 static_cast<int>(obj->set_write_mode_vfunc(((DataProxyWriteMode)(mode))
));
      #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_write_mode)
    return (*base->set_write_mode)(self, mode);


  typedef gboolean RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void DataProxy_Class::proxy_changed_callback(GdauiDataProxy* self, GdaDataProxy* p0)
{
  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->on_proxy_changed(Glib::wrap(p0, true)
);
        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->proxy_changed)
    (*base->proxy_changed)(self, p0);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* DataProxy_Class::wrap_new(GObject* object)
{
  return new DataProxy((GdauiDataProxy*)(object));
}


/* The implementation: */

DataProxy::DataProxy()
:
  Glib::Interface(dataproxy_class_.init())
{}

DataProxy::DataProxy(GdauiDataProxy* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

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

DataProxy::~DataProxy()
{}

// static
void DataProxy::add_interface(GType gtype_implementer)
{
  dataproxy_class_.init().add_interface(gtype_implementer);
}

DataProxy::CppClassType DataProxy::dataproxy_class_; // initialize static member

GType DataProxy::get_type()
{
  return dataproxy_class_.init().get_type();
}


GType DataProxy::get_base_type()
{
  return gdaui_data_proxy_get_type();
}


Glib::RefPtr<Gnome::Gda::DataProxy> DataProxy::get_proxy()
{
  return Glib::wrap(gdaui_data_proxy_get_proxy(gobj()));
}

Glib::RefPtr<const Gnome::Gda::DataProxy> DataProxy::get_proxy() const
{
  return const_cast<DataProxy*>(this)->get_proxy();
}

Glib::RefPtr<Gtk::ActionGroup> DataProxy::get_actions_group()
{
  return Glib::wrap(gdaui_data_proxy_get_actions_group(gobj()));
}

Glib::RefPtr<const Gtk::ActionGroup> DataProxy::get_action_group() const
{
  return const_cast<DataProxy*>(this)->get_action_group();
}

void DataProxy::perform_action(Action action)
{
gdaui_data_proxy_perform_action(gobj(), ((GdauiAction)(action))); 
}

void DataProxy::set_editable(int column, bool editable)
{
gdaui_data_proxy_column_set_editable(gobj(), column, static_cast<int>(editable)); 
}

void DataProxy::show_actions(int column, bool show_actions)
{
gdaui_data_proxy_column_show_actions(gobj(), column, static_cast<int>(show_actions)); 
}

bool DataProxy::set_write_mode(DataProxyWriteMode mode)
{
  return gdaui_data_proxy_set_write_mode(gobj(), ((GdauiDataProxyWriteMode)(mode)));
}

DataProxyWriteMode DataProxy::get_write_mode() const
{
  return ((DataProxyWriteMode)(gdaui_data_proxy_get_write_mode(const_cast<GdauiDataProxy*>(gobj()))));
}


Glib::SignalProxy1< void,const Glib::RefPtr<Gnome::Gda::DataProxy>& > DataProxy::signal_proxy_changed()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Gnome::Gda::DataProxy>& >(this, &DataProxy_signal_proxy_changed_info);
}


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gnome::GdaUI::DataProxy::on_proxy_changed(const Glib::RefPtr<Gnome::Gda::DataProxy>& proxy)
{
  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->proxy_changed)
    (*base->proxy_changed)(gobj(),Glib::unwrap(proxy));
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
Glib::RefPtr<Gnome::Gda::DataProxy> Gnome::GdaUI::DataProxy::get_proxy_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->get_proxy)
    return Glib::wrap((*base->get_proxy)(const_cast<GdauiDataProxy*>(gobj())));

  typedef Glib::RefPtr<Gnome::Gda::DataProxy> RType;
  return RType();
}
void Gnome::GdaUI::DataProxy::set_editable_vfunc(int column, bool editable) 
{
  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_column_editable)
    (*base->set_column_editable)(gobj(),column,static_cast<int>(editable));
}
void Gnome::GdaUI::DataProxy::show_actions_vfunc(int column, bool show_actions) 
{
  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->show_column_actions)
    (*base->show_column_actions)(gobj(),column,static_cast<int>(show_actions));
}
Glib::RefPtr<Gtk::ActionGroup> Gnome::GdaUI::DataProxy::get_action_group_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->get_actions_group)
    return Glib::wrap((*base->get_actions_group)(const_cast<GdauiDataProxy*>(gobj())));

  typedef Glib::RefPtr<Gtk::ActionGroup> RType;
  return RType();
}
bool Gnome::GdaUI::DataProxy::set_write_mode_vfunc(DataProxyWriteMode mode) 
{
  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_write_mode)
    return (*base->set_write_mode)(gobj(),((GdauiDataProxyWriteMode)(mode)));

  typedef bool RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace GdaUI

} // namespace Gnome


