// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gtksourceviewmm/sourcegutter.h>
#include <gtksourceviewmm/private/sourcegutter_p.h>

/* sourcegutter.cc
 *
 * Copyright (C) 2009, 2010 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/gtksourcegutter.h>

static void SignalProxy_CellData_gtk_callback(GtkSourceGutter *gutter G_GNUC_UNUSED,
                                              GtkCellRenderer *cell,
                                              gint line_number,
                                              gboolean current_line,
                                              gpointer data)
{
  gtksourceview::SourceGutter::SlotData* the_slot = static_cast<gtksourceview::SourceGutter::SlotData*>(data);

  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  try
  {
  #endif //GLIBMM_EXCEPTIONS_ENABLED
    (*the_slot)(Glib::wrap(cell), line_number, current_line);
  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  #endif //GLIBMM_EXCEPTIONS_ENABLED
}

static void SignalProxy_CellData_gtk_callback_destroy(void* data)
{
  delete static_cast<gtksourceview::SourceGutter::SlotData*>(data);
}

static void SignalProxy_CellSize_gtk_callback(GtkSourceGutter *gutter G_GNUC_UNUSED,
                                              GtkCellRenderer *cell,
                                              gpointer data)
{
  gtksourceview::SourceGutter::SlotSize* the_slot = static_cast<gtksourceview::SourceGutter::SlotSize*>(data);

  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  try
  {
  #endif //GLIBMM_EXCEPTIONS_ENABLED
    (*the_slot)(Glib::wrap(cell));
  #ifdef GLIBMM_EXCEPTIONS_ENABLED
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
  #endif //GLIBMM_EXCEPTIONS_ENABLED
}

static void SignalProxy_CellSize_gtk_callback_destroy(void* data)
{
  delete static_cast<gtksourceview::SourceGutter::SlotSize*>(data);
}

namespace gtksourceview
{

void SourceGutter::set_cell_data_func(Gtk::CellRenderer* renderer, const SlotData& slot)
{
  SlotData* slot_copy = new SlotData(slot);

  gtk_source_gutter_set_cell_data_func(gobj(), Glib::unwrap(renderer),
      &SignalProxy_CellData_gtk_callback, slot_copy,
      &SignalProxy_CellData_gtk_callback_destroy);
}

void SourceGutter::set_cell_size_func(Gtk::CellRenderer* renderer, const SlotSize& slot)
{
  SlotSize* slot_copy = new SlotSize(slot);

  gtk_source_gutter_set_cell_size_func(gobj(), Glib::unwrap(renderer),
      &SignalProxy_CellSize_gtk_callback, slot_copy,
      &SignalProxy_CellSize_gtk_callback_destroy);
}

void
SourceGutter::reset_cell_data_func(Gtk::CellRenderer* renderer)
{
  gtk_source_gutter_set_cell_data_func(gobj(), Glib::unwrap(renderer), 0, 0, 0);
}

void
SourceGutter::reset_cell_size_func(Gtk::CellRenderer* renderer)
{
  gtk_source_gutter_set_cell_size_func(gobj(), Glib::unwrap(renderer), 0, 0, 0);
}

}//end namespace gtksourceview


namespace
{


static void SourceGutter_signal_cell_activated_callback(GtkSourceGutter* self, GtkCellRenderer* p0,GtkTextIter* p1,GdkEvent* p2,void* data)
{
  using namespace gtksourceview;
  typedef sigc::slot< void,Gtk::CellRenderer*,const Gtk::TextIter&,GdkEvent* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, Glib::wrap(p1)
, p2);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo SourceGutter_signal_cell_activated_info =
{
  "cell-activated",
  (GCallback) &SourceGutter_signal_cell_activated_callback,
  (GCallback) &SourceGutter_signal_cell_activated_callback
};


static gboolean SourceGutter_signal_query_tooltip_callback(GtkSourceGutter* self, GtkCellRenderer* p0,GtkTextIter* p1,GtkTooltip* p2,void* data)
{
  using namespace gtksourceview;
  typedef sigc::slot< bool,Gtk::CellRenderer*,const Gtk::TextIter&,const Glib::RefPtr<Gtk::Tooltip>& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        return static_cast<int>((*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, Glib::wrap(p1)
, Glib::wrap(p2, true)
));
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gboolean RType;
  return RType();
}

static gboolean SourceGutter_signal_query_tooltip_notify_callback(GtkSourceGutter* self, GtkCellRenderer* p0,GtkTextIter* p1,GtkTooltip* p2, void* data)
{
  using namespace gtksourceview;
  typedef sigc::slot< void,Gtk::CellRenderer*,const Gtk::TextIter&,const Glib::RefPtr<Gtk::Tooltip>& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
, Glib::wrap(p1)
, Glib::wrap(p2, true)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }

  typedef gboolean RType;
  return RType();
}

static const Glib::SignalProxyInfo SourceGutter_signal_query_tooltip_info =
{
  "query-tooltip",
  (GCallback) &SourceGutter_signal_query_tooltip_callback,
  (GCallback) &SourceGutter_signal_query_tooltip_notify_callback
};


} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace gtksourceview
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


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


  klass->cell_activated = &cell_activated_callback;
  klass->query_tooltip = &query_tooltip_callback;
}


void SourceGutter_Class::cell_activated_callback(GtkSourceGutter* self, GtkCellRenderer* p0, GtkTextIter* p1, GdkEvent* p2)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_cell_activated(Glib::wrap(p0)
, Glib::wrap(p1)
, p2);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const 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->cell_activated)
    (*base->cell_activated)(self, p0, p1, p2);
}
gboolean SourceGutter_Class::query_tooltip_callback(GtkSourceGutter* self, GtkCellRenderer* p0, GtkTextIter* p1, GtkTooltip* p2)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->on_query_tooltip(Glib::wrap(p0)
, Glib::wrap(p1)
, Glib::wrap(p2, true)
));
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const 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->query_tooltip)
    return (*base->query_tooltip)(self, p0, p1, p2);

  typedef gboolean RType;
  return RType();
}


Glib::ObjectBase* SourceGutter_Class::wrap_new(GObject* object)
{
  return new SourceGutter((GtkSourceGutter*)object);
}


/* The implementation: */

GtkSourceGutter* SourceGutter::gobj_copy()
{
  reference();
  return gobj();
}

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

}

SourceGutter::SourceGutter(GtkSourceGutter* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


SourceGutter::~SourceGutter()
{}


SourceGutter::CppClassType SourceGutter::sourcegutter_class_; // initialize static member

GType SourceGutter::get_type()
{
  return sourcegutter_class_.init().get_type();
}


GType SourceGutter::get_base_type()
{
  return gtk_source_gutter_get_type();
}


Glib::RefPtr<Gdk::Window> SourceGutter::get_window()
{

  Glib::RefPtr<Gdk::Window> retvalue = Glib::wrap((GdkWindowObject*)(gtk_source_gutter_get_window(gobj())));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const Gdk::Window> SourceGutter::get_window() const
{
  return const_cast<SourceGutter*>(this)->get_window();
}

void SourceGutter::insert(Gtk::CellRenderer* renderer, int position)
{
gtk_source_gutter_insert(gobj(), Glib::unwrap(renderer), position); 
}

void SourceGutter::reorder(Gtk::CellRenderer* renderer, int position)
{
gtk_source_gutter_reorder(gobj(), Glib::unwrap(renderer), position); 
}

void SourceGutter::remove(Gtk::CellRenderer* renderer)
{
gtk_source_gutter_remove(gobj(), Glib::unwrap(renderer)); 
}

void SourceGutter::queue_draw()
{
gtk_source_gutter_queue_draw(gobj()); 
}


Glib::SignalProxy3< void,Gtk::CellRenderer*,const Gtk::TextIter&,GdkEvent* > SourceGutter::signal_cell_activated()
{
  return Glib::SignalProxy3< void,Gtk::CellRenderer*,const Gtk::TextIter&,GdkEvent* >(this, &SourceGutter_signal_cell_activated_info);
}


Glib::SignalProxy3< bool,Gtk::CellRenderer*,const Gtk::TextIter&,const Glib::RefPtr<Gtk::Tooltip>& > SourceGutter::signal_query_tooltip()
{
  return Glib::SignalProxy3< bool,Gtk::CellRenderer*,const Gtk::TextIter&,const Glib::RefPtr<Gtk::Tooltip>& >(this, &SourceGutter_signal_query_tooltip_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<SourceView*> SourceGutter::property_view() const
{
  return Glib::PropertyProxy_ReadOnly<SourceView*>(this, "view");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Gtk::TextWindowType> SourceGutter::property_window_type() const
{
  return Glib::PropertyProxy_ReadOnly<Gtk::TextWindowType>(this, "window-type");
}
#endif //GLIBMM_PROPERTIES_ENABLED


void gtksourceview::SourceGutter::on_cell_activated(Gtk::CellRenderer* renderer, const Gtk::TextIter& iter, GdkEvent* event)
{
  BaseClassType *const 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->cell_activated)
    (*base->cell_activated)(gobj(),Glib::unwrap(renderer),const_cast<GtkTextIter*>((iter).gobj()),event);
}
bool gtksourceview::SourceGutter::on_query_tooltip(Gtk::CellRenderer* renderer, const Gtk::TextIter& iter, const Glib::RefPtr<Gtk::Tooltip>& tooltip)
{
  BaseClassType *const 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->query_tooltip)
    return (*base->query_tooltip)(gobj(),Glib::unwrap(renderer),const_cast<GtkTextIter*>((iter).gobj()),const_cast<GtkTooltip*>(Glib::unwrap(tooltip)));

  typedef bool RType;
  return RType();
}


} // namespace gtksourceview


