// Generated by gtkmmproc -- DO NOT MODIFY!


#include <geglmm/path.h>
#include <geglmm/private/path_p.h>

/* libgeglmm - a C++ wrapper for libgegl
 *
 * (c) 2008 Hubert Figuiere
 *
 * 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 3 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 GEGL; if not, see <http://www.gnu.org/licenses/>.
 */

#include <gegl.h>
#include <gegl-path.h>

#include <geglmm/path.h>


namespace
{


static void Path_signal_changed_callback(GeglPath* self, gpointer p0,void* data)
{
  using namespace Gegl;
  typedef sigc::slot< void,gpointer > 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))(p0);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Path_signal_changed_info =
{
  "changed",
  (GCallback) &Path_signal_changed_callback,
  (GCallback) &Path_signal_changed_callback
};


} // anonymous namespace


namespace Gegl
{


} // namespace Gegl


namespace Glib
{

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

} /* namespace Glib */


namespace Gegl
{


/* The *_Class implementation: */

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

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

  }

  return *this;
}


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


}


Glib::ObjectBase* Path_Class::wrap_new(GObject* object)
{
  return new Path((GeglPath*)object);
}


/* The implementation: */

GeglPath* Path::gobj_copy()
{
  reference();
  return gobj();
}

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

}

Path::Path(GeglPath* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Path::~Path()
{}


Path::CppClassType Path::path_class_; // initialize static member

GType Path::get_type()
{
  return path_class_.init().get_type();
}


GType Path::get_base_type()
{
  return gegl_path_get_type();
}

Path::Path()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(path_class_.init()))
{
  

}

Glib::RefPtr<Path> Path::create()
{
  return Glib::RefPtr<Path>( new Path() );
}

bool Path::is_empty()
{
  return gegl_path_is_empty(gobj());
}

int Path::get_n_nodes()
{
  return gegl_path_get_n_nodes(gobj());
}

double Path::get_length()
{
  return gegl_path_get_length(gobj());
}

bool Path::get_node(int index, PathItem & p2)
{
  return gegl_path_get_node(gobj(), index, const_cast<GeglPathItem*>((p2).gobj()));
}

Glib::ustring Path::to_string()
{
  return Glib::convert_return_gchar_ptr_to_ustring(gegl_path_to_string(gobj()));
}

void Path::get_matrix(GeglMatrix3 matrix)
{
gegl_path_get_matrix(gobj(), matrix); 
}

void Path::set_matrix(GeglMatrix3 matrix)
{
gegl_path_set_matrix(gobj(), matrix); 
}

double Path::closest_point(double x, double y, double & dx, double & dy, int & node_post_befor)
{
  return gegl_path_closest_point(gobj(), x, y, &(dx), &(dy), &(node_post_befor));
}

void Path::calc(double pos, double & dest_x, double & dest_y)
{
gegl_path_calc(gobj(), pos, &(dest_x), &(dest_y)); 
}

void Path::calc_values(guint num_samples, double & dest_xs, double & dest_ys)
{
gegl_path_calc_values(gobj(), num_samples, &(dest_xs), &(dest_ys)); 
}

void Path::get_bounds(double & min_x, double & max_x, double & min_y, double & max_y)
{
gegl_path_get_bounds(gobj(), &(min_x), &(max_x), &(min_y), &(max_y)); 
}

void Path::clear()
{
gegl_path_clear(gobj()); 
}

void Path::insert_node(int pos, const GeglPathItem * knot)
{
gegl_path_insert_node(gobj(), pos, knot); 
}

void Path::replace_node(int pos, const GeglPathItem * knot)
{
gegl_path_replace_node(gobj(), pos, knot); 
}

void Path::remove_node(int pos)
{
gegl_path_remove_node(gobj(), pos); 
}

void Path::parse_string(const Glib::ustring & path_string)
{
gegl_path_parse_string(gobj(), path_string.c_str()); 
}

void Path::freeze()
{
gegl_path_freeze(gobj()); 
}

void Path::thaw()
{
gegl_path_thaw(gobj()); 
}


Glib::SignalProxy1< void,gpointer > Path::signal_changed()
{
  return Glib::SignalProxy1< void,gpointer >(this, &Path_signal_changed_info);
}


} // namespace Gegl


