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


#include <glibmm.h>

#include <gtkspellmm/gtkspell.h>
#include <gtkspellmm/private/gtkspell_p.h>

#include <gtkspell/gtkspell.h>

/* Copyright (c) 2013-2014  Sandro Mani <manisandro@gmail.com>
 *
 * This file is part of gtkspellmm.
 *
 * gtkspellmm is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * gtkspellmm 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace GtkSpell
{

} // namespace GtkSpell

namespace
{


static void Checker_signal_language_changed_callback(GtkSpellChecker* self, const gchar* p0,void* data)
{
  using namespace GtkSpell;
  typedef sigc::slot< void,const Glib::ustring& > SlotType;

  auto obj = dynamic_cast<Checker*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }
}

static const Glib::SignalProxyInfo Checker_signal_language_changed_info =
{
  "language-changed",
  (GCallback) &Checker_signal_language_changed_callback,
  (GCallback) &Checker_signal_language_changed_callback
};


} // anonymous namespace


GtkSpell::Error::Error(GtkSpell::Error::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (GTK_SPELL_ERROR, error_code, error_message)
{}

GtkSpell::Error::Error(GError* gobject)
:
  Glib::Error (gobject)
{}

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

void GtkSpell::Error::throw_func(GError* gobject)
{
  throw GtkSpell::Error(gobject);
}

// static
GType Glib::Value<GtkSpell::Error::Code>::value_type()
{
  return gtk_spell_error_get_type();
}


namespace Glib
{

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

} /* namespace Glib */


namespace GtkSpell
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


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


  klass->language_changed = &language_changed_callback;
}


void Checker_Class::language_changed_callback(GtkSpellChecker* self, const gchar* p0)
{
  const auto 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_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->on_language_changed(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  const auto 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->language_changed)
    (*base->language_changed)(self, p0);
}


Glib::ObjectBase* Checker_Class::wrap_new(GObject* object)
{
  return new Checker((GtkSpellChecker*)object);
}


/* The implementation: */

GtkSpellChecker* Checker::gobj_copy()
{
  reference();
  return gobj();
}

Checker::Checker(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{
   if(gobject_ && g_object_is_floating (gobject_))
     g_object_ref_sink(gobject_); //Stops it from being floating.

}

Checker::Checker(GtkSpellChecker* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Checker::Checker(Checker&& src) noexcept
: Glib::Object(std::move(src))
{}

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

Checker::~Checker() noexcept
{}


Checker::CppClassType Checker::checker_class_; // initialize static member

GType Checker::get_type()
{
  return checker_class_.init().get_type();
}


GType Checker::get_base_type()
{
  return gtk_spell_checker_get_type();
}


Checker::Checker()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(checker_class_.init()))
{
  
   if(gobject_ && g_object_is_floating (gobject_))
     g_object_ref_sink(gobject_); //Stops it from being floating.

}

bool Checker::attach(Gtk::TextView& view)
{
  return gtk_spell_checker_attach(gobj(), (view).gobj());
}

Glib::RefPtr<Checker> Checker::get_from_text_view(Gtk::TextView& view)
{

  Glib::RefPtr<Checker> retvalue = Glib::wrap(gtk_spell_checker_get_from_text_view((view).gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us
  return retvalue;
}

void Checker::detach()
{
  gtk_spell_checker_detach(gobj());
}

std::vector<Glib::ustring> Checker::get_suggestions(const Glib::ustring& word)
{
  return Glib::ListHandler<Glib::ustring>::list_to_vector(gtk_spell_checker_get_suggestions(gobj(), word.c_str()), Glib::OWNERSHIP_DEEP);
}

Gtk::Menu* Checker::get_suggestions_menu(Gtk::TextIter& iter)
{
  return (Gtk::Menu*)(Glib::wrap(gtk_spell_checker_get_suggestions_menu(gobj(), (iter).gobj())));
}

void Checker::set_language(const Glib::ustring& lang)
{
  GError* gerror = nullptr;
  gtk_spell_checker_set_language(gobj(), lang.c_str(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
}

Glib::ustring Checker::get_language()
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_spell_checker_get_language(gobj()));
}

std::vector<Glib::ustring> Checker::get_language_list()
{
  return Glib::ListHandler<Glib::ustring>::list_to_vector(gtk_spell_checker_get_language_list(), Glib::OWNERSHIP_DEEP);
}

Glib::ustring Checker::decode_language_code(const Glib::ustring& lang)
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_spell_checker_decode_language_code(lang.c_str()));
}

bool Checker::check_word(const Glib::ustring& word)
{
  return gtk_spell_checker_check_word(gobj(), word.c_str());
}

void Checker::recheck_all()
{
  gtk_spell_checker_recheck_all(gobj());
}

void Checker::add_to_dictionary(const Glib::ustring& word)
{
  gtk_spell_checker_add_to_dictionary(gobj(), word.c_str());
}

void Checker::ignore_word(const Glib::ustring& word)
{
  gtk_spell_checker_ignore_word(gobj(), word.c_str());
}


Glib::SignalProxy1< void,const Glib::ustring& > Checker::signal_language_changed()
{
  return Glib::SignalProxy1< void,const Glib::ustring& >(this, &Checker_signal_language_changed_info);
}


Glib::PropertyProxy< bool > Checker::property_decode_language_codes() 
{
  return Glib::PropertyProxy< bool >(this, "decode-language-codes");
}

Glib::PropertyProxy_ReadOnly< bool > Checker::property_decode_language_codes() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "decode-language-codes");
}


void GtkSpell::Checker::on_language_changed(const Glib::ustring& newlang)
{
  const auto 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->language_changed)
    (*base->language_changed)(gobj(),newlang.c_str());
}


} // namespace GtkSpell


