// Generated by gtkmmproc -- DO NOT MODIFY!


#include <cluttermm/backend.h>
#include <cluttermm/private/backend_p.h>

/* Copyright (C) 2009 The cluttermm 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 <clutter/clutter.h>

namespace Clutter
{

} //namespace Clutter


namespace
{


static const Glib::SignalProxyInfo Backend_signal_font_changed_info =
{
  "font-changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static const Glib::SignalProxyInfo Backend_signal_resolution_changed_info =
{
  "resolution-changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Clutter
{


/* The *_Class implementation: */

const Glib::Class& Backend_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_ = &Backend_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(clutter_backend_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


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


  klass->font_changed = &font_changed_callback;
  klass->resolution_changed = &resolution_changed_callback;
}


void Backend_Class::font_changed_callback(ClutterBackend* 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.
        obj->on_font_changed();
        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->font_changed)
    (*base->font_changed)(self);
}
void Backend_Class::resolution_changed_callback(ClutterBackend* 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.
        obj->on_resolution_changed();
        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->resolution_changed)
    (*base->resolution_changed)(self);
}


Glib::ObjectBase* Backend_Class::wrap_new(GObject* object)
{
  return new Backend((ClutterBackend*)object);
}


/* The implementation: */

ClutterBackend* Backend::gobj_copy()
{
  reference();
  return gobj();
}

Backend::Backend(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

Backend::Backend(ClutterBackend* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Backend::~Backend()
{}


Backend::CppClassType Backend::backend_class_; // initialize static member

GType Backend::get_type()
{
  return backend_class_.init().get_type();
}


GType Backend::get_base_type()
{
  return clutter_backend_get_type();
}


Backend::Backend()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(backend_class_.init()))
{
  

}

Glib::RefPtr<Backend> Backend::get_default()
{

  Glib::RefPtr<Backend> retvalue = Glib::wrap(clutter_get_default_backend());

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}


double Backend::get_resolution() const
{
  return clutter_backend_get_resolution(const_cast<ClutterBackend*>(gobj()));
}

void Backend::set_resolution(double dpi)
{
clutter_backend_set_resolution(gobj(), dpi); 
}

guint Backend::get_double_click_time() const
{
  return clutter_backend_get_double_click_time(const_cast<ClutterBackend*>(gobj()));
}

void Backend::set_double_click_time(guint msec)
{
clutter_backend_set_double_click_time(gobj(), msec); 
}

guint Backend::get_double_click_distance() const
{
  return clutter_backend_get_double_click_distance(const_cast<ClutterBackend*>(gobj()));
}

void Backend::set_double_click_distance(guint distance)
{
clutter_backend_set_double_click_distance(gobj(), distance); 
}

::Cairo::FontOptions Backend::get_font_options() const
{
  return ::Cairo::FontOptions(const_cast<cairo_font_options_t*>(clutter_backend_get_font_options(const_cast<ClutterBackend*>(gobj()))), true);
}

void Backend::set_font_options(const ::Cairo::FontOptions& options)
{
clutter_backend_set_font_options(gobj(), (options).cobj()); 
}

Glib::ustring Backend::get_font_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(clutter_backend_get_font_name(const_cast<ClutterBackend*>(gobj())));
}

void Backend::set_font_name(const Glib::ustring& font_name)
{
clutter_backend_set_font_name(gobj(), font_name.c_str()); 
}


Glib::SignalProxy0< void > Backend::signal_font_changed()
{
  return Glib::SignalProxy0< void >(this, &Backend_signal_font_changed_info);
}


Glib::SignalProxy0< void > Backend::signal_resolution_changed()
{
  return Glib::SignalProxy0< void >(this, &Backend_signal_resolution_changed_info);
}


void Clutter::Backend::on_font_changed()
{
  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->font_changed)
    (*base->font_changed)(gobj());
}
void Clutter::Backend::on_resolution_changed()
{
  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->resolution_changed)
    (*base->resolution_changed)(gobj());
}


} // namespace Clutter


