// Generated by gtkmmproc -- DO NOT MODIFY!


#include <cluttermm/texture.h>
#include <cluttermm/private/texture_p.h>

/*
 * Copyright (c) 2007 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
{

Glib::RefPtr<Texture> Texture::create_from_file(const std::string& filename)
{
  const Glib::RefPtr<Texture> result (new Texture());
  result->set_from_file(filename);
  return result;
}

} // namespace Clutter

namespace
{


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

static const Glib::SignalProxyInfo Texture_signal_size_change_info =
{
  "size_change",
  (GCallback) &Texture_signal_size_change_callback,
  (GCallback) &Texture_signal_size_change_callback
};


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


} // anonymous namespace

// static
GType Glib::Value<Clutter::TextureFlags>::value_type()
{
  return clutter_texture_flags_get_type();
}

// static
GType Glib::Value<Clutter::TextureQuality>::value_type()
{
  return clutter_texture_quality_get_type();
}


Clutter::TextureError::TextureError(Clutter::TextureError::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (CLUTTER_TEXTURE_ERROR, error_code, error_message)
{}

Clutter::TextureError::TextureError(GError* gobject)
:
  Glib::Error (gobject)
{}

Clutter::TextureError::Code Clutter::TextureError::code() const
{
  return static_cast<Code>(Glib::Error::code());
}

void Clutter::TextureError::throw_func(GError* gobject)
{
  throw Clutter::TextureError(gobject);
}

// static
GType Glib::Value<Clutter::TextureError::Code>::value_type()
{
  return clutter_texture_error_get_type();
}


namespace Glib
{

Glib::RefPtr<Clutter::Texture> wrap(ClutterTexture* object, bool take_copy)
{
  return Glib::RefPtr<Clutter::Texture>( dynamic_cast<Clutter::Texture*> (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& Texture_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_ = &Texture_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_texture_get_type());

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

  }

  return *this;
}


void Texture_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->size_change = &size_change_callback;
  klass->pixbuf_change = &pixbuf_change_callback;
}


void Texture_Class::size_change_callback(ClutterTexture* self, gint p0, gint p1)
{
  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_size_change(p0
, p1
);
        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->size_change)
    (*base->size_change)(self, p0, p1);
}
void Texture_Class::pixbuf_change_callback(ClutterTexture* 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_pixbuf_change();
        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->pixbuf_change)
    (*base->pixbuf_change)(self);
}


Glib::ObjectBase* Texture_Class::wrap_new(GObject* object)
{
  return new Texture((ClutterTexture*)object);
}


/* The implementation: */

ClutterTexture* Texture::gobj_copy()
{
  reference();
  return gobj();
}

Texture::Texture(const Glib::ConstructParams& construct_params)
:
  Actor(construct_params)
{

}

Texture::Texture(ClutterTexture* castitem)
:
  Actor((ClutterActor*)(castitem))
{}


Texture::~Texture()
{}


Texture::CppClassType Texture::texture_class_; // initialize static member

GType Texture::get_type()
{
  return texture_class_.init().get_type();
}


GType Texture::get_base_type()
{
  return clutter_texture_get_type();
}


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

}

Glib::RefPtr<Texture> Texture::create()
{
  return Glib::RefPtr<Texture>( new Texture() );
}
bool Texture::set_from_file(const std::string& filename)
{
  GError* gerror = 0;
  bool retvalue = clutter_texture_set_from_file(gobj(), filename.c_str(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

bool Texture::set_from_rgb_data(const guchar* data, bool has_alpha, int width, int height, int rowstride, int bpp, TextureFlags flags)
{
  GError* gerror = 0;
  bool retvalue = clutter_texture_set_from_rgb_data(gobj(), data, static_cast<int>(has_alpha), width, height, rowstride, bpp, ((ClutterTextureFlags)(flags)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

bool Texture::set_from_yuv_data(const guchar* data, int width, int height, TextureFlags flags)
{
  GError* gerror = 0;
  bool retvalue = clutter_texture_set_from_yuv_data(gobj(), data, width, height, ((ClutterTextureFlags)(flags)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

bool Texture::set_area_from_rgb_data(const guchar* data, bool has_alpha, int x, int y, int width, int height, int rowstride, int bpp, TextureFlags flags)
{
  GError* gerror = 0;
  bool retvalue = clutter_texture_set_area_from_rgb_data(gobj(), data, static_cast<int>(has_alpha), x, y, width, height, rowstride, bpp, ((ClutterTextureFlags)(flags)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

void Texture::get_base_size(int& width, int& height) const
{
clutter_texture_get_base_size(const_cast<ClutterTexture*>(gobj()), &(width), &(height)); 
}

CoglPixelFormat Texture::get_pixel_format() const
{
  return clutter_texture_get_pixel_format(const_cast<ClutterTexture*>(gobj()));
}

TextureQuality Texture::get_filter_quality() const
{
  return ((TextureQuality)(clutter_texture_get_filter_quality(const_cast<ClutterTexture*>(gobj()))));
}

void Texture::set_filter_quality(TextureQuality filter_quality)
{
clutter_texture_set_filter_quality(gobj(), ((ClutterTextureQuality)(filter_quality))); 
}

int Texture::get_max_tile_waste() const
{
  return clutter_texture_get_max_tile_waste(const_cast<ClutterTexture*>(gobj()));
}

CoglHandle Texture::get_cogl_texture() const
{
  return clutter_texture_get_cogl_texture(const_cast<ClutterTexture*>(gobj()));
}

void Texture::set_cogl_texture(CoglHandle handle)
{
clutter_texture_set_cogl_texture(gobj(), handle); 
}

CoglHandle Texture::get_cogl_material() const
{
  return clutter_texture_get_cogl_material(const_cast<ClutterTexture*>(gobj()));
}

void Texture::set_cogl_material(CoglHandle handle)
{
clutter_texture_set_cogl_material(gobj(), handle); 
}

bool Texture::get_sync_size() const
{
  return clutter_texture_get_sync_size(const_cast<ClutterTexture*>(gobj()));
}

void Texture::set_sync_size(bool sync_size)
{
clutter_texture_set_sync_size(gobj(), static_cast<int>(sync_size)); 
}

void Texture::get_repeat(bool& repeat_x, bool& repeat_y) const
{
clutter_texture_get_repeat(const_cast<ClutterTexture*>(gobj()), reinterpret_cast<gboolean*>(&repeat_x), reinterpret_cast<gboolean*>(&repeat_y)); 
}

void Texture::set_repeat(bool repeat_x, bool repeat_y)
{
clutter_texture_set_repeat(gobj(), static_cast<int>(repeat_x), static_cast<int>(repeat_y)); 
}

bool Texture::get_keep_aspect_ratio() const
{
  return clutter_texture_get_keep_aspect_ratio(const_cast<ClutterTexture*>(gobj()));
}

void Texture::set_keep_aspect_ratio(bool keep_aspect)
{
clutter_texture_set_keep_aspect_ratio(gobj(), static_cast<int>(keep_aspect)); 
}

bool Texture::get_load_async() const
{
  return clutter_texture_get_load_async(const_cast<ClutterTexture*>(gobj()));
}

void Texture::set_load_async(bool load_async)
{
clutter_texture_set_load_async(gobj(), static_cast<int>(load_async)); 
}

bool Texture::get_load_data_async() const
{
  return clutter_texture_get_load_data_async(const_cast<ClutterTexture*>(gobj()));
}

void Texture::set_load_data_async(bool load_async)
{
clutter_texture_set_load_data_async(gobj(), static_cast<int>(load_async)); 
}

void Texture::set_pick_with_alpha(bool pick_with_alpha)
{
clutter_texture_set_pick_with_alpha(gobj(), static_cast<int>(pick_with_alpha)); 
}

bool Texture::get_pick_with_alpha() const
{
  return clutter_texture_get_pick_with_alpha(const_cast<ClutterTexture*>(gobj()));
}


Glib::SignalProxy2< void,int,int > Texture::signal_size_change()
{
  return Glib::SignalProxy2< void,int,int >(this, &Texture_signal_size_change_info);
}


Glib::SignalProxy0< void > Texture::signal_pixbuf_change()
{
  return Glib::SignalProxy0< void >(this, &Texture_signal_pixbuf_change_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<CoglHandle> Texture::property_cogl_texture() 
{
  return Glib::PropertyProxy<CoglHandle>(this, "cogl-texture");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<CoglHandle> Texture::property_cogl_texture() const
{
  return Glib::PropertyProxy_ReadOnly<CoglHandle>(this, "cogl-texture");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Texture::property_disable_slicing() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "disable-slicing");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_WriteOnly<std::string> Texture::property_filename() 
{
  return Glib::PropertyProxy_WriteOnly<std::string>(this, "filename");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<TextureQuality> Texture::property_filter_quality() 
{
  return Glib::PropertyProxy<TextureQuality>(this, "filter-quality");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<TextureQuality> Texture::property_filter_quality() const
{
  return Glib::PropertyProxy_ReadOnly<TextureQuality>(this, "filter-quality");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Texture::property_keep_aspect_ratio() 
{
  return Glib::PropertyProxy<bool>(this, "keep-aspect-ratio");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Texture::property_keep_aspect_ratio() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "keep-aspect-ratio");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_WriteOnly<bool> Texture::property_load_async() 
{
  return Glib::PropertyProxy_WriteOnly<bool>(this, "load-async");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_WriteOnly<bool> Texture::property_load_data_async() 
{
  return Glib::PropertyProxy_WriteOnly<bool>(this, "load-data-async");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<int> Texture::property_pixel_format() const
{
  return Glib::PropertyProxy_ReadOnly<int>(this, "pixel-format");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Texture::property_repeat_x() 
{
  return Glib::PropertyProxy<bool>(this, "repeat-x");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Texture::property_repeat_x() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "repeat-x");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Texture::property_repeat_y() 
{
  return Glib::PropertyProxy<bool>(this, "repeat-y");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Texture::property_repeat_y() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "repeat-y");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Texture::property_sync_size() 
{
  return Glib::PropertyProxy<bool>(this, "sync-size");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Texture::property_sync_size() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "sync-size");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<int> Texture::property_tile_waste() const
{
  return Glib::PropertyProxy_ReadOnly<int>(this, "tile-waste");
}
#endif //GLIBMM_PROPERTIES_ENABLED


void Clutter::Texture::on_size_change(int width, int height)
{
  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->size_change)
    (*base->size_change)(gobj(),width,height);
}
void Clutter::Texture::on_pixbuf_change()
{
  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->pixbuf_change)
    (*base->pixbuf_change)(gobj());
}


} // namespace Clutter


