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


#include <glibmm.h>

#include <gtksourceviewmm/view.h>
#include <gtksourceviewmm/private/view_p.h>


/* view.cc
 *
 * Copyright (C) 2004-2005 Jae Jang
 * Copyright (C) 2005-2006 Rob Page
 * Copyright (C) 2006 Dodji Seketeli
 * Copyright (C) 2009, 2010, 2011 Krzesimir Nowak
 *
 * 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/gtksourceview.h>
#include <gtksourceview/gtksourceview-typebuiltins.h>

#include <gtksourceviewmm/view.h>
#include <gtksourceviewmm/markattributes.h>

namespace Gsv
{

View::View() :
    // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Gtk::TextView(Glib::ConstructParams(view_class_.init()))
{
    GtkSourceBuffer *buffer = gtk_source_buffer_new (0) ;
    gtk_text_view_set_buffer (GTK_TEXT_VIEW (gobject_), GTK_TEXT_BUFFER (buffer));
    g_object_unref(buffer);
}

View::View(const Glib::RefPtr<Buffer> &a_buffer) :
    // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Gtk::TextView(Glib::ConstructParams(view_class_.init()))
{
    if (a_buffer) {
        set_buffer (a_buffer) ;
    } else {
        GtkSourceBuffer *buffer = gtk_source_buffer_new (0) ;
        gtk_text_view_set_buffer (GTK_TEXT_VIEW (gobject_), GTK_TEXT_BUFFER (buffer)) ;
        g_object_unref(buffer);
    }
}

Glib::RefPtr<const Buffer>
View::get_source_buffer () const
{
    Glib::RefPtr<const Gtk::TextBuffer> buffer = get_buffer();
    return Glib::RefPtr<const Buffer>::cast_dynamic(buffer);
}

Glib::RefPtr<Buffer>
View::get_source_buffer ()
{
    Glib::RefPtr<Gtk::TextBuffer> buffer = get_buffer();
    return Glib::RefPtr<Buffer>::cast_dynamic(buffer);
}

void
View::set_source_buffer (const Glib::RefPtr<Buffer> &source_buffer)
{
    set_buffer (source_buffer) ;
}

}//end namespace Gsv


namespace
{


static const Glib::SignalProxyInfo View_signal_redo_info =
{
  "redo",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static const Glib::SignalProxyInfo View_signal_undo_info =
{
  "undo",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static void View_signal_line_mark_activated_callback(GtkSourceView* self, GtkTextIter* p0,GdkEvent* p1,void* data)
{
  using namespace Gsv;
  typedef sigc::slot< void,Gtk::TextIter&,GdkEvent* > SlotType;

  auto obj = dynamic_cast<View*>(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::wrap(p0)
, p1);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }
}

static const Glib::SignalProxyInfo View_signal_line_mark_activated_info =
{
  "line-mark-activated",
  (GCallback) &View_signal_line_mark_activated_callback,
  (GCallback) &View_signal_line_mark_activated_callback
};


static void View_signal_smart_home_end_callback(GtkSourceView* self, GtkTextIter* p0,gint p1,void* data)
{
  using namespace Gsv;
  typedef sigc::slot< void,Gtk::TextIter&,int > SlotType;

  auto obj = dynamic_cast<View*>(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::wrap(p0)
, p1
);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }
}

static const Glib::SignalProxyInfo View_signal_smart_home_end_info =
{
  "smart-home-end",
  (GCallback) &View_signal_smart_home_end_callback,
  (GCallback) &View_signal_smart_home_end_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gsv::SmartHomeEndType>::value_type()
{
  return gtk_source_smart_home_end_type_get_type();
}

// static
GType Glib::Value<Gsv::DrawSpacesFlags>::value_type()
{
  return gtk_source_draw_spaces_flags_get_type();
}


namespace Glib
{

Gsv::View* wrap(GtkSourceView* object, bool take_copy)
{
  return dynamic_cast<Gsv::View *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}

} /* namespace Glib */

namespace Gsv
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


void View_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->redo = &redo_callback;
  klass->undo = &undo_callback;
  klass->line_mark_activated = &line_mark_activated_callback;
}


void View_Class::redo_callback(GtkSourceView* self)
{
  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_redo();
        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->redo)
    (*base->redo)(self);
}
void View_Class::undo_callback(GtkSourceView* self)
{
  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_undo();
        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->undo)
    (*base->undo)(self);
}
void View_Class::line_mark_activated_callback(GtkSourceView* self, GtkTextIter* p0, GdkEvent* p1)
{
  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_line_mark_activated(Glib::wrap(p0)
, p1);
        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->line_mark_activated)
    (*base->line_mark_activated)(self, p0, p1);
}


Glib::ObjectBase* View_Class::wrap_new(GObject* o)
{
  return manage(new View((GtkSourceView*)(o)));

}


/* The implementation: */

View::View(const Glib::ConstructParams& construct_params)
:
  Gtk::TextView(construct_params)
{
  }

View::View(GtkSourceView* castitem)
:
  Gtk::TextView((GtkTextView*)(castitem))
{
  }

View::~View()
{
  destroy_();
}

View::CppClassType View::view_class_; // initialize static member

GType View::get_type()
{
  return view_class_.init().get_type();
}


GType View::get_base_type()
{
  return gtk_source_view_get_type();
}


void View::set_show_line_numbers(bool show)
{
  gtk_source_view_set_show_line_numbers(gobj(), static_cast<int>(show));
}

bool View::get_show_line_numbers() const
{
  return gtk_source_view_get_show_line_numbers(const_cast<GtkSourceView*>(gobj()));
}

void View::set_tab_width(guint width)
{
  gtk_source_view_set_tab_width(gobj(), width);
}

guint View::get_tab_width() const
{
  return gtk_source_view_get_tab_width(const_cast<GtkSourceView*>(gobj()));
}

void View::set_auto_indent(bool enable)
{
  gtk_source_view_set_auto_indent(gobj(), static_cast<int>(enable));
}

bool View::get_auto_indent() const
{
  return gtk_source_view_get_auto_indent(const_cast<GtkSourceView*>(gobj()));
}

void View::set_insert_spaces_instead_of_tabs(bool enable)
{
  gtk_source_view_set_insert_spaces_instead_of_tabs(gobj(), static_cast<int>(enable));
}

bool View::get_insert_spaces_instead_of_tabs() const
{
  return gtk_source_view_get_insert_spaces_instead_of_tabs(const_cast<GtkSourceView*>(gobj()));
}

void View::set_show_right_margin(bool show)
{
  gtk_source_view_set_show_right_margin(gobj(), static_cast<int>(show));
}

bool View::get_show_right_margin() const
{
  return gtk_source_view_get_show_right_margin(const_cast<GtkSourceView*>(gobj()));
}

void View::set_highlight_current_line(bool highlight)
{
  gtk_source_view_set_highlight_current_line(gobj(), static_cast<int>(highlight));
}

bool View::get_highlight_current_line() const
{
  return gtk_source_view_get_highlight_current_line(const_cast<GtkSourceView*>(gobj()));
}

void View::set_right_margin_position(guint margin)
{
  gtk_source_view_set_right_margin_position(gobj(), margin);
}

guint View::get_right_margin_position() const
{
  return gtk_source_view_get_right_margin_position(const_cast<GtkSourceView*>(gobj()));
}

void View::set_smart_home_end(SmartHomeEndType smart_he)
{
  gtk_source_view_set_smart_home_end(gobj(), ((GtkSourceSmartHomeEndType)(smart_he)));
}

SmartHomeEndType View::get_smart_home_end() const
{
  return ((SmartHomeEndType)(gtk_source_view_get_smart_home_end(const_cast<GtkSourceView*>(gobj()))));
}

void View::set_show_line_marks(bool show)
{
  gtk_source_view_set_show_line_marks(gobj(), static_cast<int>(show));
}

bool View::get_show_line_marks() const
{
  return gtk_source_view_get_show_line_marks(const_cast<GtkSourceView*>(gobj()));
}

void View::set_indent_on_tab(bool enable)
{
  gtk_source_view_set_indent_on_tab(gobj(), static_cast<int>(enable));
}

bool View::get_indent_on_tab() const
{
  return gtk_source_view_get_indent_on_tab(const_cast<GtkSourceView*>(gobj()));
}

void View::set_indent_width(gint width)
{
  gtk_source_view_set_indent_width(gobj(), width);
}

gint View::get_indent_width() const
{
  return gtk_source_view_get_indent_width(const_cast<GtkSourceView*>(gobj()));
}

void View::set_draw_spaces(DrawSpacesFlags flags)
{
  gtk_source_view_set_draw_spaces(gobj(), ((GtkSourceDrawSpacesFlags)(flags)));
}

DrawSpacesFlags View::get_draw_spaces() const
{
  return ((DrawSpacesFlags)(gtk_source_view_get_draw_spaces(const_cast<GtkSourceView*>(gobj()))));
}

guint View::get_visual_column(const Gtk::TextIter& iter) const
{
  return gtk_source_view_get_visual_column(const_cast<GtkSourceView*>(gobj()), (iter).gobj());
}

Glib::RefPtr<Gutter> View::get_gutter(Gtk::TextWindowType window_type)
{
  Glib::RefPtr<Gutter> retvalue = Glib::wrap(gtk_source_view_get_gutter(gobj(), ((GtkTextWindowType)(window_type))));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Gutter> View::get_gutter(Gtk::TextWindowType window_type) const
{
  return const_cast<View*>(this)->get_gutter(window_type);
}

Glib::RefPtr<Completion> View::get_completion()
{
  Glib::RefPtr<Completion> retvalue = Glib::wrap(gtk_source_view_get_completion(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Completion> View::get_completion() const
{
  return const_cast<View*>(this)->get_completion();
}

void View::set_mark_attributes(const Glib::ustring& category, const Glib::RefPtr<MarkAttributes>& attributes, int priority)
{
  gtk_source_view_set_mark_attributes(gobj(), category.c_str(), Glib::unwrap(attributes), priority);
}

Glib::RefPtr<MarkAttributes> View::get_mark_attributes(const Glib::ustring& category, int& priority)
{
  Glib::RefPtr<MarkAttributes> retvalue = Glib::wrap(gtk_source_view_get_mark_attributes(gobj(), category.c_str(), &(priority)));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const MarkAttributes> View::get_mark_attributes(const Glib::ustring& category, int& priority) const
{
  return const_cast<View*>(this)->get_mark_attributes(category, priority);
}


Glib::SignalProxy0< void > View::signal_redo()
{
  return Glib::SignalProxy0< void >(this, &View_signal_redo_info);
}


Glib::SignalProxy0< void > View::signal_undo()
{
  return Glib::SignalProxy0< void >(this, &View_signal_undo_info);
}


Glib::SignalProxy2< void,Gtk::TextIter&,GdkEvent* > View::signal_line_mark_activated()
{
  return Glib::SignalProxy2< void,Gtk::TextIter&,GdkEvent* >(this, &View_signal_line_mark_activated_info);
}


Glib::SignalProxy2< void,Gtk::TextIter&,int > View::signal_smart_home_end()
{
  return Glib::SignalProxy2< void,Gtk::TextIter&,int >(this, &View_signal_smart_home_end_info);
}


Glib::PropertyProxy< bool > View::property_show_line_numbers() 
{
  return Glib::PropertyProxy< bool >(this, "show-line-numbers");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_show_line_numbers() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "show-line-numbers");
}

Glib::PropertyProxy< bool > View::property_show_line_marks() 
{
  return Glib::PropertyProxy< bool >(this, "show-line-marks");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_show_line_marks() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "show-line-marks");
}

Glib::PropertyProxy< guint > View::property_tab_width() 
{
  return Glib::PropertyProxy< guint >(this, "tab-width");
}

Glib::PropertyProxy_ReadOnly< guint > View::property_tab_width() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "tab-width");
}

Glib::PropertyProxy< int > View::property_indent_width() 
{
  return Glib::PropertyProxy< int >(this, "indent-width");
}

Glib::PropertyProxy_ReadOnly< int > View::property_indent_width() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "indent-width");
}

Glib::PropertyProxy< bool > View::property_auto_indent() 
{
  return Glib::PropertyProxy< bool >(this, "auto-indent");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_auto_indent() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "auto-indent");
}

Glib::PropertyProxy< bool > View::property_insert_spaces_instead_of_tabs() 
{
  return Glib::PropertyProxy< bool >(this, "insert-spaces-instead-of-tabs");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_insert_spaces_instead_of_tabs() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "insert-spaces-instead-of-tabs");
}

Glib::PropertyProxy< bool > View::property_show_right_margin() 
{
  return Glib::PropertyProxy< bool >(this, "show-right-margin");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_show_right_margin() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "show-right-margin");
}

Glib::PropertyProxy< guint > View::property_right_margin_position() 
{
  return Glib::PropertyProxy< guint >(this, "right-margin-position");
}

Glib::PropertyProxy_ReadOnly< guint > View::property_right_margin_position() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "right-margin-position");
}

Glib::PropertyProxy< SmartHomeEndType > View::property_smart_home_end() 
{
  return Glib::PropertyProxy< SmartHomeEndType >(this, "smart-home-end");
}

Glib::PropertyProxy_ReadOnly< SmartHomeEndType > View::property_smart_home_end() const
{
  return Glib::PropertyProxy_ReadOnly< SmartHomeEndType >(this, "smart-home-end");
}

Glib::PropertyProxy< bool > View::property_highlight_current_line() 
{
  return Glib::PropertyProxy< bool >(this, "highlight-current-line");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_highlight_current_line() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "highlight-current-line");
}

Glib::PropertyProxy< bool > View::property_indent_on_tab() 
{
  return Glib::PropertyProxy< bool >(this, "indent-on-tab");
}

Glib::PropertyProxy_ReadOnly< bool > View::property_indent_on_tab() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "indent-on-tab");
}

Glib::PropertyProxy< DrawSpacesFlags > View::property_draw_spaces() 
{
  return Glib::PropertyProxy< DrawSpacesFlags >(this, "draw-spaces");
}

Glib::PropertyProxy_ReadOnly< DrawSpacesFlags > View::property_draw_spaces() const
{
  return Glib::PropertyProxy_ReadOnly< DrawSpacesFlags >(this, "draw-spaces");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Completion> > View::property_completion() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Completion> >(this, "completion");
}


void Gsv::View::on_redo()
{
  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->redo)
    (*base->redo)(gobj());
}
void Gsv::View::on_undo()
{
  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->undo)
    (*base->undo)(gobj());
}
void Gsv::View::on_line_mark_activated(Gtk::TextIter& mark, GdkEvent* event)
{
  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->line_mark_activated)
    (*base->line_mark_activated)(gobj(),(mark).gobj(),event);
}


} // namespace Gsv


