/* libgeglmm - a C++ wrapper for libgegl
 *
 * (c) 2008-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 <geglmm/rectangle.h>

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

// gegl-plugin seems to include config.h. BAD.
#undef HAVE_CONFIG_H
#include <gegl-plugin.h>

namespace Gegl {

class Node;
class NodeContext;

//TODO: Document how these should be created (Add create() methods?) or obtained.

class Operation
	: public Glib::Object
{
	_CLASS_GOBJECT(Operation, GeglOperation, GEGL_OPERATION, Glib::Object, GObject)
public:
	_WRAP_METHOD(Rectangle get_invalidated_by_change(const Glib::ustring & input_pad, const Rectangle & input_region) const, gegl_operation_get_invalidated_by_change)
	_WRAP_METHOD(Rectangle get_bounding_box() const, gegl_operation_get_bounding_box)
	_WRAP_METHOD(Rectangle source_get_bounding_box(const Glib::ustring & pad_name) const, gegl_operation_source_get_bounding_box)
	_WRAP_METHOD(Rectangle get_cached_region(const Rectangle & roi) const, gegl_operation_get_cached_region)
	_WRAP_METHOD(Rectangle get_required_for_output(const Glib::ustring & input_pda, const Rectangle & roi) const, gegl_operation_get_required_for_output)
	_WRAP_METHOD(Glib::RefPtr<Node> detect(int x, int y), gegl_operation_detect, refreturn)
	_WRAP_METHOD(Glib::RefPtr<const Node> detect(int x, int y) const, gegl_operation_detect, refreturn, constversion)
	_WRAP_METHOD(void attach(const Glib::RefPtr<Node> & node), gegl_operation_attach)
	_WRAP_METHOD(void prepare(), gegl_operation_prepare)
	_WRAP_METHOD(bool process(GeglOperationContext * context, const Glib::ustring & output_pad, const Rectangle & result_rect), gegl_operation_process)
	_WRAP_METHOD(void create_pad(GParamSpec *param_spec), gegl_operation_create_pad)
	_WRAP_METHOD(void set_format(const Glib::ustring & pad_name, const Babl *format), gegl_operation_set_format)
	_WRAP_METHOD(const Babl* get_format(const Glib::ustring & pad_name), gegl_operation_get_format) //TODO: Wrap Babl.
	_WRAP_METHOD(Glib::RefPtr<Node> get_source_node(const Glib::ustring & pad_name), gegl_operation_get_source_node, refreturn)
	_WRAP_METHOD(Glib::RefPtr<const Node> get_source_node(const Glib::ustring & pad_name) const, gegl_operation_get_source_node, refreturn, constversion)

	// this one is implemented in OperationMeta
	_IGNORE(gegl_operation_meta_redirect)
};

class OperationSource 
	: public Operation
{
	_CLASS_GOBJECT(OperationSource, GeglOperationSource, GEGL_OPERATION_SOURCE, Operation, GeglOperation)
};

class OperationSink 
	: public Operation
{
	_CLASS_GOBJECT(OperationSink, GeglOperationSink, GEGL_OPERATION_SINK, Operation, GeglOperation)
public:
	//	_WRAP_METHOD(bool needs_full(), gegl_operation_sink_needs_full)
};

class OperationFilter 
	: public Operation
{
	_CLASS_GOBJECT(OperationFilter, GeglOperationFilter, GEGL_OPERATION_FILTER, Operation, GeglOperation)
};

class OperationComposer 
	: public Operation
{
	_CLASS_GOBJECT(OperationComposer, GeglOperationComposer, GEGL_OPERATION_COMPOSER, Operation, GeglOperation)
};

class OperationPointComposer 
	: public OperationComposer
{
	_CLASS_GOBJECT(OperationPointComposer, GeglOperationPointComposer, GEGL_OPERATION_POINT_COMPOSER, OperationComposer, GeglOperationComposer)
};


class OperationPointFilter 
	: public OperationFilter
{
	_CLASS_GOBJECT(OperationPointFilter, GeglOperationPointFilter, GEGL_OPERATION_POINT_FILTER, OperationFilter, GeglOperationFilter)
};


class OperationAreaFilter 
	: public OperationFilter
{
	_CLASS_GOBJECT(OperationAreaFilter, GeglOperationAreaFilter, GEGL_OPERATION_AREA_FILTER, OperationFilter, GeglOperationFilter)
};


class OperationMeta 
	: public Operation
{
	_CLASS_GOBJECT(OperationMeta, GeglOperationMeta, GEGL_OPERATION_META, Operation, GeglOperation)
public:
	//	_WRAP_METHOD(void redirect(const Glib::ustring & name, const Glib::RefPtr<Node> & internal, const Glib::ustring & internal_name), gegl_operation_meta_redirect)
	_WRAP_METHOD(void property_changed(GParamSpec * arg1, void *user_data), gegl_operation_meta_property_changed)
};


}

