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


#include <glibmm.h>

#include <gtksourceviewmm/searchcontext.h>
#include <gtksourceviewmm/private/searchcontext_p.h>


/* searchsettings.cc
 *
 * Copyright (C) 2015 Christoph Brill
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtksourceview/gtksourcesearchcontext.h>
namespace
{
} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Gsv
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


void SearchContext_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* SearchContext_Class::wrap_new(GObject* object)
{
  return new SearchContext((GtkSourceSearchContext*)object);
}


/* The implementation: */

GtkSourceSearchContext* SearchContext::gobj_copy()
{
  reference();
  return gobj();
}

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

}

SearchContext::SearchContext(GtkSourceSearchContext* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


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

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


SearchContext::~SearchContext() noexcept
{}


SearchContext::CppClassType SearchContext::searchcontext_class_; // initialize static member

GType SearchContext::get_type()
{
  return searchcontext_class_.init().get_type();
}


GType SearchContext::get_base_type()
{
  return gtk_source_search_context_get_type();
}


SearchContext::SearchContext(const Glib::RefPtr<Buffer>& buffer, const Glib::RefPtr<SearchSettings>& settings)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Glib::Object(Glib::ConstructParams(searchcontext_class_.init(), "buffer", Glib::unwrap(buffer), "settings", Glib::unwrap(settings), nullptr))
{
  

}

Glib::RefPtr<SearchContext> SearchContext::create(const Glib::RefPtr<Buffer>& buffer, const Glib::RefPtr<SearchSettings>& settings)
{
  return Glib::RefPtr<SearchContext>( new SearchContext(buffer, settings) );
}

Glib::RefPtr<Buffer> SearchContext::get_buffer()
{
  Glib::RefPtr<Buffer> retvalue = Glib::wrap(gtk_source_search_context_get_buffer(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Buffer> SearchContext::get_buffer() const
{
  return const_cast<SearchContext*>(this)->get_buffer();
}

Glib::RefPtr<SearchSettings> SearchContext::get_settings()
{
  Glib::RefPtr<SearchSettings> retvalue = Glib::wrap(gtk_source_search_context_get_settings(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const SearchSettings> SearchContext::get_settings() const
{
  return const_cast<SearchContext*>(this)->get_settings();
}

bool SearchContext::get_highlight() const
{
  return gtk_source_search_context_get_highlight(const_cast<GtkSourceSearchContext*>(gobj()));
}

void SearchContext::set_highlight(bool highlight)
{
  gtk_source_search_context_set_highlight(gobj(), static_cast<int>(highlight));
}

Glib::RefPtr<Style> SearchContext::get_match_style()
{
  Glib::RefPtr<Style> retvalue = Glib::wrap(gtk_source_search_context_get_match_style(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Style> SearchContext::get_match_style() const
{
  return const_cast<SearchContext*>(this)->get_match_style();
}

void SearchContext::set_match_style(const Glib::RefPtr<Style>& match_style)
{
  gtk_source_search_context_set_match_style(gobj(), Glib::unwrap(match_style));
}

int SearchContext::get_occurrences_count() const
{
  return gtk_source_search_context_get_occurrences_count(const_cast<GtkSourceSearchContext*>(gobj()));
}

int SearchContext::get_occurrence_position(const TextBuffer::iterator& match_start, const TextBuffer::iterator& match_end) const
{
  return gtk_source_search_context_get_occurrence_position(const_cast<GtkSourceSearchContext*>(gobj()), (match_start).gobj(), (match_end).gobj());
}

bool SearchContext::forward(const TextBuffer::iterator& iter, TextBuffer::iterator& match_start, TextBuffer::iterator& match_end, bool& has_wrapped_around)
{
  return gtk_source_search_context_forward(gobj(), (iter).gobj(), (match_start).gobj(), (match_end).gobj(), ((gboolean*) &(has_wrapped_around)));
}

void SearchContext::forward_async(const TextBuffer::iterator& iter, const Glib::RefPtr<Gio::Cancellable>& cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
  gtk_source_search_context_forward_async(gobj(), (iter).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), callback, user_data);
}

bool SearchContext::backward(const TextBuffer::iterator& iter, TextBuffer::iterator& match_start, TextBuffer::iterator& match_end, bool& has_wrapped_around)
{
  return gtk_source_search_context_backward(gobj(), (iter).gobj(), (match_start).gobj(), (match_end).gobj(), ((gboolean*) &(has_wrapped_around)));
}

void SearchContext::backward_async(const TextBuffer::iterator& iter, const Glib::RefPtr<Gio::Cancellable>& cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
  gtk_source_search_context_backward_async(gobj(), (iter).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), callback, user_data);
}

unsigned int SearchContext::replace_all(const Glib::ustring& replace, int replace_length)
{
  GError* gerror = nullptr;
  unsigned int retvalue = gtk_source_search_context_replace_all(gobj(), replace.c_str(), replace_length, &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}


Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Buffer> > SearchContext::property_buffer() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Buffer> >(this, "buffer");
}

Glib::PropertyProxy< bool > SearchContext::property_highlight() 
{
  return Glib::PropertyProxy< bool >(this, "highlight");
}

Glib::PropertyProxy_ReadOnly< bool > SearchContext::property_highlight() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "highlight");
}

Glib::PropertyProxy< Glib::RefPtr<Style> > SearchContext::property_match_style() 
{
  return Glib::PropertyProxy< Glib::RefPtr<Style> >(this, "match-style");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Style> > SearchContext::property_match_style() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Style> >(this, "match-style");
}

Glib::PropertyProxy_ReadOnly< int > SearchContext::property_occurrences_count() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "occurrences-count");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SearchSettings> > SearchContext::property_settings() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SearchSettings> >(this, "settings");
}


} // namespace Gsv


