// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgda-uimm/cloud.h>
#include <libgda-uimm/private/cloud_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-cloud.h>
#include <libgdamm/datamodel.h>

namespace
{

extern "C"
{

static gdouble Cloud_Weight_libgda_uimm_callback(GdaDataModel *model,
  gint row, gpointer data)
{
  Gnome::GdaUI::Cloud::SlotWeight* the_slot =
    static_cast<Gnome::GdaUI::Cloud::SlotWeight*>(data);

  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  try
  {
  #endif //GLIBMM_EXCEPTIONS_ENABLED
    return (*the_slot)(Glib::wrap(model, true), row);
  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  #endif //GLIBMM_EXCEPTIONS_ENABLED

  return 0;
}

} // extern "C"

} // anonymous namespace

namespace Gnome
{

namespace GdaUI
{

void Cloud::set_weight_slot(const SlotWeight& slot)
{
  // Create a copy of the slot.  A pointer to this copy will be passed through
  // the call back's data parameter.  It will be destroyed with the
  // std::auto_ptr<>.
  m_slot.reset(new SlotWeight(slot));

  gdaui_cloud_set_weight_func(gobj(), &Cloud_Weight_libgda_uimm_callback,
    m_slot.get());
}

void Cloud::unset_weight_slot()
{
  // The docs say to use NULL for the callback which will remove the weight
  // callback.
  gdaui_cloud_set_weight_func(gobj(), 0, 0);
}

} /* namespace GdaUI */

} /* namespace Gnome */

namespace
{


static void Cloud_signal_activate_callback(GdauiCloud* self, gint p0,void* data)
{
  using namespace Gnome::GdaUI;
  typedef sigc::slot< void,int > 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))(p0
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Cloud_signal_activate_info =
{
  "activate",
  (GCallback) &Cloud_signal_activate_callback,
  (GCallback) &Cloud_signal_activate_callback
};


} // anonymous namespace


namespace Glib
{

Gnome::GdaUI::Cloud* wrap(GdauiCloud* object, bool take_copy)
{
  return dynamic_cast<Gnome::GdaUI::Cloud *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gnome
{

namespace GdaUI
{


/* The *_Class implementation: */

const Glib::Class& Cloud_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Cloud_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gdaui_cloud_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  DataSelector::add_interface(get_type());

  }

  return *this;
}


void Cloud_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  klass->activate = &activate_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Cloud_Class::activate_callback(GdauiCloud* self, gint 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_activate(p0
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->activate)
    (*base->activate)(self, p0);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* Cloud_Class::wrap_new(GObject* o)
{
  return manage(new Cloud((GdauiCloud*)(o)));

}


/* The implementation: */

Cloud::Cloud(const Glib::ConstructParams& construct_params)
:
  Gtk::VBox(construct_params)
{
  }

Cloud::Cloud(GdauiCloud* castitem)
:
  Gtk::VBox((GtkVBox*)(castitem))
{
  }

Cloud::~Cloud()
{
  destroy_();
}

Cloud::CppClassType Cloud::cloud_class_; // initialize static member

GType Cloud::get_type()
{
  return cloud_class_.init().get_type();
}


GType Cloud::get_base_type()
{
  return gdaui_cloud_get_type();
}


Cloud::Cloud(const Glib::RefPtr<Gnome::Gda::DataModel>& model, int label_column, int weight_column)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Gtk::VBox(Glib::ConstructParams(cloud_class_.init(), "model", Glib::unwrap(model), "label_column", label_column, "weight_column", weight_column, static_cast<char*>(0)))
{
  

}

void Cloud::set_selection_mode(Gtk::SelectionMode mode)
{
gdaui_cloud_set_selection_mode(gobj(), ((GtkSelectionMode)(mode))); 
}

void Cloud::filter(const Glib::ustring& filter)
{
gdaui_cloud_filter(gobj(), filter.c_str()); 
}

Gtk::Widget* Cloud::create_filter_widget()
{
  return Glib::wrap(gdaui_cloud_create_filter_widget(gobj()));
}

const Gtk::Widget* Cloud::create_filter_widget() const
{
  return const_cast<Cloud*>(this)->create_filter_widget();
}


Glib::SignalProxy1< void,int > Cloud::signal_activate()
{
  return Glib::SignalProxy1< void,int >(this, &Cloud_signal_activate_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<int> Cloud::property_label_column() 
{
  return Glib::PropertyProxy<int>(this, "label-column");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<int> Cloud::property_label_column() const
{
  return Glib::PropertyProxy_ReadOnly<int>(this, "label-column");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<double> Cloud::property_max_scale() 
{
  return Glib::PropertyProxy<double>(this, "max-scale");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<double> Cloud::property_max_scale() const
{
  return Glib::PropertyProxy_ReadOnly<double>(this, "max-scale");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<double> Cloud::property_min_scale() 
{
  return Glib::PropertyProxy<double>(this, "min-scale");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<double> Cloud::property_min_scale() const
{
  return Glib::PropertyProxy_ReadOnly<double>(this, "min-scale");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Glib::RefPtr<Gnome::Gda::DataModel> > Cloud::property_model() 
{
  return Glib::PropertyProxy< Glib::RefPtr<Gnome::Gda::DataModel> >(this, "model");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gnome::Gda::DataModel> > Cloud::property_model() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gnome::Gda::DataModel> >(this, "model");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<int> Cloud::property_weight_column() 
{
  return Glib::PropertyProxy<int>(this, "weight-column");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<int> Cloud::property_weight_column() const
{
  return Glib::PropertyProxy_ReadOnly<int>(this, "weight-column");
}
#endif //GLIBMM_PROPERTIES_ENABLED


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gnome::GdaUI::Cloud::on_activate(int column)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->activate)
    (*base->activate)(gobj(),column);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace GdaUI

} // namespace Gnome


