/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkAbstractWidgetWrap.h"
#include "vtkHandleWidgetWrap.h"
#include "vtkObjectWrap.h"
#include "vtkHandleRepresentationWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkHandleWidgetWrap::ptpl;

VtkHandleWidgetWrap::VtkHandleWidgetWrap()
{ }

VtkHandleWidgetWrap::VtkHandleWidgetWrap(vtkSmartPointer<vtkHandleWidget> _native)
{ native = _native; }

VtkHandleWidgetWrap::~VtkHandleWidgetWrap()
{ }

void VtkHandleWidgetWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkHandleWidget").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("HandleWidget").ToLocalChecked(), ConstructorGetter);
}

void VtkHandleWidgetWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkHandleWidgetWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkAbstractWidgetWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkAbstractWidgetWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkHandleWidgetWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "AllowHandleResizeOff", AllowHandleResizeOff);
	Nan::SetPrototypeMethod(tpl, "allowHandleResizeOff", AllowHandleResizeOff);

	Nan::SetPrototypeMethod(tpl, "AllowHandleResizeOn", AllowHandleResizeOn);
	Nan::SetPrototypeMethod(tpl, "allowHandleResizeOn", AllowHandleResizeOn);

	Nan::SetPrototypeMethod(tpl, "CreateDefaultRepresentation", CreateDefaultRepresentation);
	Nan::SetPrototypeMethod(tpl, "createDefaultRepresentation", CreateDefaultRepresentation);

	Nan::SetPrototypeMethod(tpl, "EnableAxisConstraintOff", EnableAxisConstraintOff);
	Nan::SetPrototypeMethod(tpl, "enableAxisConstraintOff", EnableAxisConstraintOff);

	Nan::SetPrototypeMethod(tpl, "EnableAxisConstraintOn", EnableAxisConstraintOn);
	Nan::SetPrototypeMethod(tpl, "enableAxisConstraintOn", EnableAxisConstraintOn);

	Nan::SetPrototypeMethod(tpl, "GetAllowHandleResize", GetAllowHandleResize);
	Nan::SetPrototypeMethod(tpl, "getAllowHandleResize", GetAllowHandleResize);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetEnableAxisConstraint", GetEnableAxisConstraint);
	Nan::SetPrototypeMethod(tpl, "getEnableAxisConstraint", GetEnableAxisConstraint);

	Nan::SetPrototypeMethod(tpl, "GetHandleRepresentation", GetHandleRepresentation);
	Nan::SetPrototypeMethod(tpl, "getHandleRepresentation", GetHandleRepresentation);

	Nan::SetPrototypeMethod(tpl, "GetWidgetState", GetWidgetState);
	Nan::SetPrototypeMethod(tpl, "getWidgetState", GetWidgetState);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetAllowHandleResize", SetAllowHandleResize);
	Nan::SetPrototypeMethod(tpl, "setAllowHandleResize", SetAllowHandleResize);

	Nan::SetPrototypeMethod(tpl, "SetEnableAxisConstraint", SetEnableAxisConstraint);
	Nan::SetPrototypeMethod(tpl, "setEnableAxisConstraint", SetEnableAxisConstraint);

	Nan::SetPrototypeMethod(tpl, "SetRepresentation", SetRepresentation);
	Nan::SetPrototypeMethod(tpl, "setRepresentation", SetRepresentation);

#ifdef VTK_NODE_PLUS_VTKHANDLEWIDGETWRAP_INITPTPL
	VTK_NODE_PLUS_VTKHANDLEWIDGETWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkHandleWidgetWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkHandleWidget> native = vtkSmartPointer<vtkHandleWidget>::New();
		VtkHandleWidgetWrap* obj = new VtkHandleWidgetWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkHandleWidgetWrap::AllowHandleResizeOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->AllowHandleResizeOff();
}

void VtkHandleWidgetWrap::AllowHandleResizeOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->AllowHandleResizeOn();
}

void VtkHandleWidgetWrap::CreateDefaultRepresentation(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->CreateDefaultRepresentation();
}

void VtkHandleWidgetWrap::EnableAxisConstraintOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->EnableAxisConstraintOff();
}

void VtkHandleWidgetWrap::EnableAxisConstraintOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->EnableAxisConstraintOn();
}

void VtkHandleWidgetWrap::GetAllowHandleResize(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetAllowHandleResize();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkHandleWidgetWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkHandleWidgetWrap::GetEnableAxisConstraint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetEnableAxisConstraint();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkHandleWidgetWrap::GetHandleRepresentation(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	vtkHandleRepresentation * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetHandleRepresentation();
	VtkHandleRepresentationWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkHandleRepresentationWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkHandleRepresentationWrap *w = new VtkHandleRepresentationWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkHandleWidgetWrap::GetWidgetState(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetWidgetState();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkHandleWidgetWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkHandleWidgetWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	vtkHandleWidget * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkHandleWidgetWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkHandleWidgetWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkHandleWidgetWrap *w = new VtkHandleWidgetWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkHandleWidgetWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkHandleWidget * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkHandleWidgetWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkHandleWidgetWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkHandleWidgetWrap *w = new VtkHandleWidgetWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkHandleWidgetWrap::SetAllowHandleResize(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetAllowHandleResize(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkHandleWidgetWrap::SetEnableAxisConstraint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetEnableAxisConstraint(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkHandleWidgetWrap::SetRepresentation(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkHandleWidgetWrap *wrapper = ObjectWrap::Unwrap<VtkHandleWidgetWrap>(info.Holder());
	vtkHandleWidget *native = (vtkHandleWidget *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkHandleRepresentationWrap::ptpl))->HasInstance(info[0]))
	{
		VtkHandleRepresentationWrap *a0 = ObjectWrap::Unwrap<VtkHandleRepresentationWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetRepresentation(
			(vtkHandleRepresentation *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

