#include "c4d_nodeplugin.h"
#include "c4d_memory.h"
#include "c4d_general.h"
#include "operatingsystem.h"

Bool NodeData::Init(GeListNode *node) 
{ 
	return TRUE; 
}

void NodeData::Free(GeListNode *node) 
{ 
}

Bool NodeData::CopyTo(NodeData *dest, GeListNode *snode, GeListNode *dnode, LONG flags, AliasTrans *trn) 
{ 
	return TRUE; 
}

Bool NodeData::Read(GeListNode *node, HyperFile *hf, LONG level) 
{ 
	return TRUE; 
}

Bool NodeData::Write(GeListNode *node, HyperFile *hf) 
{ 
	return TRUE; 
}

Bool NodeData::Message(GeListNode *node, LONG type, void *data) 
{ 
	return TRUE; 
}

void NodeData::GetBubbleHelp(GeListNode *node, String &str)
{
}

BaseDocument* NodeData::GetDocument(GeListNode *node) 
{ 
	return NULL; 
}

LONG NodeData::GetBranchInfo(GeListNode *node, BranchInfo *info, LONG max) 
{ 
	return 0; 
}

Bool NodeData::GetDDescription(GeListNode *node, Description *description,LONG &flags)
{
	return FALSE;
}

Bool NodeData::GetDEnabling(GeListNode *node, const DescID &id,GeData &t_data,LONG flags,const BaseContainer *itemdesc)
{
	return TRUE;
}

Bool NodeData::GetDParameter(GeListNode *node, const DescID &id,GeData &t_data,LONG &flags)
{
	return TRUE;
}

Bool NodeData::SetDParameter(GeListNode *node, const DescID &id,const GeData &t_data,LONG &flags)
{
	return TRUE;
}

void FillNodePlugin(NODEPLUGIN *np, LONG info, DataAllocator *g, BaseBitmap *icon, LONG disklevel, void *emulation)
{
	np->Allocator				= g;
	np->Destructor			= &NodeData::Destructor;
	np->Init						= &NodeData::Init;
	np->Free						= &NodeData::Free;
	np->Read						= &NodeData::Read;
	np->Write						= &NodeData::Write;
	np->CopyTo					= &NodeData::CopyTo;
	np->Message					= &NodeData::Message;
	np->GetDocument			= &NodeData::GetDocument;
	np->GetBranchInfo		= &NodeData::GetBranchInfo;
	np->GetDDescription	= &NodeData::GetDDescription;
	np->GetDParameter		= &NodeData::GetDParameter;	
	np->SetDParameter		= &NodeData::SetDParameter;	
	np->GetDEnabling		= &NodeData::GetDEnabling;
	np->GetBubbleHelp   = &NodeData::GetBubbleHelp;

	np->disklevel		= disklevel;
	np->info				= info;
	np->icon				= icon;
	np->emulation		= emulation;
	np->fallback    = NULL;
}

Bool RegisterNodePlugin(LONG id, const String &str, LONG info, DataAllocator *g, BaseBitmap *icon, LONG disklevel, LONG *fallback)
{
	NODEPLUGIN np;
	ClearMem(&np,sizeof(np));
	FillNodePlugin(&np,info,g,icon,disklevel);
	np.fallback=fallback;
	return GeRegisterPlugin(C4DPL_NODE,id,str,&np,sizeof(np));
}
