/* libgeglmm - a C++ wrapper for libgegl
 *
 * (c) 2009 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>

_DEFS(geglmm,gegl)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gegl
{

class PathItem
{
  _CLASS_GENERIC(PathItem, GeglPathItem)
public:

  GeglPathItem* gobj() { return &gobject_; }
  const GeglPathItem* gobj() const { return &gobject_; }

protected:
  GeglPathItem gobject_;
};


class Path
  : public Glib::Object
{
	_CLASS_GOBJECT(Path, GeglPath, GEGL_PATH, Glib::Object, GObject)
protected:
	_CTOR_DEFAULT()

public:
	_WRAP_CREATE()

public:
    _WRAP_METHOD(bool is_empty(), gegl_path_is_empty)
    _WRAP_METHOD(int get_n_nodes(), gegl_path_get_n_nodes)
    _WRAP_METHOD(double get_length(), gegl_path_get_length)
#m4 _CONVERSION(`GeglPathItem*',`PathItem&',`Glib::wrap($3)')
#m4 _CONVERSION(`PathItem&',`GeglPathItem*',__FCR2P)
    _WRAP_METHOD(bool get_node(int index, PathItem &), gegl_path_get_node)

    _WRAP_METHOD(Glib::ustring to_string(), gegl_path_to_string)
    _WRAP_METHOD(void get_matrix(GeglMatrix3 matrix), gegl_path_get_matrix)
    _WRAP_METHOD(void set_matrix(GeglMatrix3 matrix), gegl_path_set_matrix)
    _WRAP_METHOD(double closest_point(double x, double y, double &dx, double &dy, int & node_post_befor), gegl_path_closest_point)
    _WRAP_METHOD(void calc(double pos, double &dest_x, double &dest_y), gegl_path_calc)
    _WRAP_METHOD(void calc_values(guint num_samples, double & dest_xs, double & dest_ys), gegl_path_calc_values)
    _WRAP_METHOD(void get_bounds(double & min_x, double & max_x, double &min_y, double &max_y), gegl_path_get_bounds)

    //    _WRAP_METHOD(void foreach(void * each_item, gpointer data), gegl_path_foreach)
    //   gegl_path_foreach_flat

    _WRAP_METHOD(void clear(), gegl_path_clear)
    _WRAP_METHOD(void insert_node(int pos, const GeglPathItem *knot), gegl_path_insert_node)
    _WRAP_METHOD(void replace_node(int pos, const GeglPathItem *knot), gegl_path_replace_node)
    _WRAP_METHOD(void remove_node(int pos), gegl_path_remove_node)
    _WRAP_METHOD(void parse_string(const Glib::ustring & path_string), gegl_path_parse_string)
    _IGNORE(gegl_path_append)
    //    _WRAP_METHOD(Glib::RefPtr<Path> add_parameter_path(const Glib::ustring & parameter_name), gegl_path_add_parameter_path)
    //    _WRAP_METHOD(Glib::RefPtr<Path> get_parameter_path(const Glib::ustring & parameter_name), gegl_path_get_parameter_path)
#m4 _CONVERSION(`GSList*', `Glib::SListHandle<Glib::ustring>', `$2($3, Glib::OWNERSHIP_NONE)')
    _WRAP_METHOD(Glib::SListHandle<Glib::ustring> parameter_get_names(int *count), gegl_path_parameter_get_names)
    _WRAP_METHOD(double parameter_calc(const Glib::ustring & parameter_name, double pos), gegl_path_parameter_calc)
    _WRAP_METHOD(void parameter_get_bounds(const Glib::ustring & parameter_name, double & min, double & max), gegl_path_parameter_get_bounds)
    _WRAP_METHOD(void parameter_calc_values(const Glib::ustring & parameter_name, guint num_samples, double * samples), gegl_path_parameter_calc_values)

    _WRAP_METHOD(void freeze(), gegl_path_freeze)
    _WRAP_METHOD(void thaw(), gegl_path_thaw)

    _WRAP_SIGNAL(void changed(gpointer p0), "changed", no_default_handler)
};


}
