#ifndef _COBJLINK_H_
#define _COBJLINK_H_

#include "../x/Version.h"
#include "../x/scolplugin.h"
#include "CObjMessage.h"		//pour la classe CObjMessage

#define NBER_OF_LINKS 5
#define LINK_MOVE			(1<<0)
#define LINK_RESIZE			(1<<1)
#define LINK_SELECT			(1<<2)
#define LINK_STRING_SELECT	(1<<3)
#define LINK_HIDE_AND_SHOW	(1<<4)

class CObjLink;
class CObjMessage;				//pour la classe CObjMessage

typedef struct SLink
{
	CObjLink *object;
	struct SLink *next;
	int type;
} Link;

class CObjLink
{
private:
	Link *linkedObjectsList;
	static int activationID;
	int lastActivationID;
	//int (*flushObject)(CObjLink *);

	void broadcast(Link*, int, CObjMessage*);
	void broadcast_repaint( Link *, int * );
	void repaint_linked_object( int * );

public:
	//CObjLink( int (*flushObject)(CObjLink *obj) );
	CObjLink();
	virtual ~CObjLink( );

	int isLinkedTo( CObjLink *target );
	virtual int link( CObjLink *target, int type );
	virtual int unlink( CObjLink *target, int type );
	virtual int supports( int type );
	virtual int activate(int id, CObjMessage* msg);
	virtual int notify(CObjMessage* msg);
	virtual int handle(CObjMessage* msg);
	virtual void repaint( int nberOfLinkEventsToConsider );
	
	virtual void Redraw();
};

#endif

// proto des fonctions Scol associees
int _CRnodeLink(mmachine);
int _DSnodeLink(mmachine);