// Generated by gtkmmproc -- DO NOT MODIFY!


#include <cluttermm/shader.h>
#include <cluttermm/private/shader_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
{

void Shader::set_vertex_source(const std::string& source_code)
{
  clutter_shader_set_vertex_source(gobj(), source_code.c_str(), source_code.size());
}

void Shader::set_fragment_source(const std::string& source_code)
{
  clutter_shader_set_fragment_source(gobj(), source_code.c_str(), source_code.size());
}

} //namespace Clutter


namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Clutter::Shader> wrap(ClutterShader* object, bool take_copy)
{
  return Glib::RefPtr<Clutter::Shader>( dynamic_cast<Clutter::Shader*> (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& Shader_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_ = &Shader_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_shader_get_type());

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

  }

  return *this;
}


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


}


Glib::ObjectBase* Shader_Class::wrap_new(GObject* object)
{
  return new Shader((ClutterShader*)object);
}


/* The implementation: */

ClutterShader* Shader::gobj_copy()
{
  reference();
  return gobj();
}

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

}

Shader::Shader(ClutterShader* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Shader::~Shader()
{}


Shader::CppClassType Shader::shader_class_; // initialize static member

GType Shader::get_type()
{
  return shader_class_.init().get_type();
}


GType Shader::get_base_type()
{
  return clutter_shader_get_type();
}


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

}

Glib::RefPtr<Shader> Shader::create()
{
  return Glib::RefPtr<Shader>( new Shader() );
}
std::string Shader::get_vertex_source() const
{
  return Glib::convert_const_gchar_ptr_to_stdstring(clutter_shader_get_vertex_source(const_cast<ClutterShader*>(gobj())));
}

std::string Shader::get_fragment_source() const
{
  return Glib::convert_const_gchar_ptr_to_stdstring(clutter_shader_get_fragment_source(const_cast<ClutterShader*>(gobj())));
}

bool Shader::compile()
{
  GError* gerror = 0;
  bool retvalue = clutter_shader_compile(gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

bool Shader::is_compiled() const
{
  return clutter_shader_is_compiled(const_cast<ClutterShader*>(gobj()));
}

void Shader::release()
{
clutter_shader_release(gobj()); 
}

void Shader::set_is_enabled(bool enabled)
{
clutter_shader_set_is_enabled(gobj(), static_cast<int>(enabled)); 
}

bool Shader::get_is_enabled() const
{
  return clutter_shader_get_is_enabled(const_cast<ClutterShader*>(gobj()));
}

void Shader::set_uniform(const Glib::ustring& name, const Glib::ValueBase& value)
{
clutter_shader_set_uniform(gobj(), name.c_str(), (value).gobj()); 
}

CoglHandle Shader::get_cogl_program() const
{
  return clutter_shader_get_cogl_program(const_cast<ClutterShader*>(gobj()));
}

CoglHandle Shader::get_cogl_vertex_shader() const
{
  return clutter_shader_get_cogl_vertex_shader(const_cast<ClutterShader*>(gobj()));
}

CoglHandle Shader::get_cogl_fragment_shader() const
{
  return clutter_shader_get_cogl_fragment_shader(const_cast<ClutterShader*>(gobj()));
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Shader::property_compiled() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "compiled");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Shader::property_enabled() 
{
  return Glib::PropertyProxy<bool>(this, "enabled");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Shader::property_enabled() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "enabled");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<std::string> Shader::property_fragment_source() 
{
  return Glib::PropertyProxy<std::string>(this, "fragment-source");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<std::string> Shader::property_fragment_source() const
{
  return Glib::PropertyProxy_ReadOnly<std::string>(this, "fragment-source");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<std::string> Shader::property_vertex_source() 
{
  return Glib::PropertyProxy<std::string>(this, "vertex-source");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<std::string> Shader::property_vertex_source() const
{
  return Glib::PropertyProxy_ReadOnly<std::string>(this, "vertex-source");
}
#endif //GLIBMM_PROPERTIES_ENABLED


} // namespace Clutter


