// Generated by gmmproc 2.86.0 -- 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, see <https://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>

namespace
{
extern "C"
{
static void CssProvider_signal_parsing_error_callback(GtkCssProvider* self, GtkCssSection* p0,const GError* p1,void* data)
{
  using namespace Gtk;
  typedef sigc::slot<void(const Glib::RefPtr<const CssSection>&,const Glib::Error&)> SlotType;

  auto obj = dynamic_cast<CssProvider*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      Glib::Error::throw_exception(g_error_copy(p1));
    }
    catch (const Glib::Error& ex)
    {
      // ex can be (and usually is) an instance of a subclass of Glib::Error.
      try
      {
        if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
          (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true), ex);
      }
      catch (...)
      {
         Glib::exception_handlers_invoke();
      }
    }
  }
}
} // extern "C"
} // anonymous namespace

namespace Gtk
{
#ifndef GTKMM_DISABLE_DEPRECATED

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void CssProvider::load_from_data(const std::string& data)
{
  gtk_css_provider_load_from_data(gobj(), data.c_str(), -1);
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

} //namespace Gtk

namespace
{


static const Glib::SignalProxyInfo CssProvider_signal_parsing_error_info =
{
  "parsing-error",
  (GCallback) &CssProvider_signal_parsing_error_callback,
  (GCallback) &CssProvider_signal_parsing_error_callback
};


} // anonymous namespace


Gtk::CssParserError::CssParserError(Gtk::CssParserError::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (GTK_CSS_PARSER_ERROR, error_code, error_message)
{}

Gtk::CssParserError::CssParserError(GError* gobject)
:
  Glib::Error (gobject)
{}

Gtk::CssParserError::Code Gtk::CssParserError::code() const
{
  return static_cast<Code>(Glib::Error::code());
}

void Gtk::CssParserError::throw_func(GError* gobject)
{
  throw Gtk::CssParserError(gobject);
}

// static
GType Glib::Value<Gtk::CssParserError::Code>::value_type()
{
  return gtk_css_parser_error_get_type();
}


Gtk::CssParserWarning::CssParserWarning(Gtk::CssParserWarning::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (GTK_CSS_PARSER_WARNING, error_code, error_message)
{}

Gtk::CssParserWarning::CssParserWarning(GError* gobject)
:
  Glib::Error (gobject)
{}

Gtk::CssParserWarning::Code Gtk::CssParserWarning::code() const
{
  return static_cast<Code>(Glib::Error::code());
}

void Gtk::CssParserWarning::throw_func(GError* gobject)
{
  throw Gtk::CssParserWarning(gobject);
}

// static
GType Glib::Value<Gtk::CssParserWarning::Code>::value_type()
{
  return gtk_css_parser_warning_get_type();
}


namespace Glib
{

Glib::RefPtr<Gtk::CssProvider> wrap(GtkCssProvider* object, bool take_copy)
{
  return Glib::make_refptr_for_instance<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)
{
  const auto 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&& src) noexcept
: Glib::Object(std::move(src))
  , StyleProvider(std::move(src))
{}

CssProvider& CssProvider::operator=(CssProvider&& src) noexcept
{
  Glib::Object::operator=(std::move(src));
  StyleProvider::operator=(std::move(src));
  return *this;
}


CssProvider::~CssProvider() noexcept
{}


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(nullptr),
  Glib::Object(Glib::ConstructParams(cssprovider_class_.init()))
{
  

}

Glib::RefPtr<CssProvider> CssProvider::create()
{
  return Glib::make_refptr_for_instance<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())));
}

void CssProvider::load_from_string(const std::string& string)
{
  gtk_css_provider_load_from_string(gobj(), string.c_str());
}

void CssProvider::load_from_bytes(const Glib::RefPtr<const Glib::Bytes>& data)
{
  gtk_css_provider_load_from_bytes(gobj(), const_cast<GBytes*>(Glib::unwrap<Glib::Bytes>(data)));
}

void CssProvider::load_from_file(const Glib::RefPtr<const Gio::File>& file)
{
  gtk_css_provider_load_from_file(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(file)));
}

void CssProvider::load_from_path(const std::string& path)
{
  gtk_css_provider_load_from_path(gobj(), path.c_str());
}

void CssProvider::load_from_resource(const std::string& resource_path)
{
  gtk_css_provider_load_from_resource(gobj(), resource_path.c_str());
}

void CssProvider::load_named(const Glib::ustring& name, const Glib::ustring& variant)
{
  gtk_css_provider_load_named(gobj(), name.c_str(), variant.empty() ? nullptr : variant.c_str());
}


Glib::SignalProxy<void(const Glib::RefPtr<const CssSection>&, const Glib::Error&)> CssProvider::signal_parsing_error()
{
  return Glib::SignalProxy<void(const Glib::RefPtr<const CssSection>&, const Glib::Error&) >(this, &CssProvider_signal_parsing_error_info);
}


static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<InterfaceColorScheme>::value,
  "Type InterfaceColorScheme cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< InterfaceColorScheme > CssProvider::property_prefers_color_scheme() 
{
  return Glib::PropertyProxy< InterfaceColorScheme >(this, "prefers-color-scheme");
}

Glib::PropertyProxy_ReadOnly< InterfaceColorScheme > CssProvider::property_prefers_color_scheme() const
{
  return Glib::PropertyProxy_ReadOnly< InterfaceColorScheme >(this, "prefers-color-scheme");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<InterfaceContrast>::value,
  "Type InterfaceContrast cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< InterfaceContrast > CssProvider::property_prefers_contrast() 
{
  return Glib::PropertyProxy< InterfaceContrast >(this, "prefers-contrast");
}

Glib::PropertyProxy_ReadOnly< InterfaceContrast > CssProvider::property_prefers_contrast() const
{
  return Glib::PropertyProxy_ReadOnly< InterfaceContrast >(this, "prefers-contrast");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<ReducedMotion>::value,
  "Type ReducedMotion cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< ReducedMotion > CssProvider::property_prefers_reduced_motion() 
{
  return Glib::PropertyProxy< ReducedMotion >(this, "prefers-reduced-motion");
}

Glib::PropertyProxy_ReadOnly< ReducedMotion > CssProvider::property_prefers_reduced_motion() const
{
  return Glib::PropertyProxy_ReadOnly< ReducedMotion >(this, "prefers-reduced-motion");
}


} // namespace Gtk


