// Generated by gmmproc 2.41.4 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gtkmm/cssprovider.h>
#include <gtkmm/private/cssprovider_p.h>


/* Copyright (C) 2010 The gtkmm 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtk/gtk.h>

namespace Gtk
{

bool CssProvider::load_from_data(const std::string& data)
{
  GError* gerror = 0;
  bool retvalue = gtk_css_provider_load_from_data(gobj(), data.c_str(), -1, &(gerror));
  if(gerror)
    Glib::Error::throw_exception(gerror);

  return retvalue;
}

} //namespace Gtk

namespace
{
} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Gtk
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


void CssProvider_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* CssProvider_Class::wrap_new(GObject* object)
{
  return new CssProvider((GtkCssProvider*)object);
}


/* The implementation: */

GtkCssProvider* CssProvider::gobj_copy()
{
  reference();
  return gobj();
}

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

}

CssProvider::CssProvider(GtkCssProvider* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


CssProvider::~CssProvider()
{}


CssProvider::CppClassType CssProvider::cssprovider_class_; // initialize static member

GType CssProvider::get_type()
{
  return cssprovider_class_.init().get_type();
}


GType CssProvider::get_base_type()
{
  return gtk_css_provider_get_type();
}


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

}

Glib::RefPtr<CssProvider> CssProvider::create()
{
  return Glib::RefPtr<CssProvider>( new CssProvider() );
}

Glib::ustring CssProvider::to_string() const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_css_provider_to_string(const_cast<GtkCssProvider*>(gobj())));
}

bool CssProvider::load_from_file(const Glib::RefPtr<const Gio::File>& file)
{
  GError* gerror = 0;
  bool retvalue = gtk_css_provider_load_from_file(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(file)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool CssProvider::load_from_path(const std::string& path)
{
  GError* gerror = 0;
  bool retvalue = gtk_css_provider_load_from_path(gobj(), path.c_str(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

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

  Glib::RefPtr<CssProvider> retvalue = Glib::wrap(gtk_css_provider_get_default());
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us
  return retvalue;
}


Glib::RefPtr<CssProvider> CssProvider::get_named(const Glib::ustring& name, const Glib::ustring& variant)
{

  Glib::RefPtr<CssProvider> retvalue = Glib::wrap(gtk_css_provider_get_named(name.c_str(), variant.c_str()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us
  return retvalue;
}


} // namespace Gtk


