#pragma once
// CCommonObject
#ifndef __CCOMMONOBJECT__H
#define __CCOMMONOBJECT__H

//#include "GLinkedList.h"
//template <typename T>
//class GLinkedList;
class CCommonObject;
struct Connections{
	public:
		CCommonObject **m_pObjectIn;
		CCommonObject **m_pObjectOut;
		CStringList m_slObjectIn;
		CStringList m_slObjectOut;
		bool *m_pbInvIn;
		bool *m_pnInvOut;
		CRect *m_rectIns;
		CRect *m_rectOuts;
};

class CCommonObject
{
public:

	//enum ObjectType{
	//	Gate,
	//	Wire,
	//	Block
	//} m_eObjType;

public:
	CCommonObject(int nIn, int nOut, CString strName, CStringA strOrigin);
	CCommonObject(){};
	virtual ~CCommonObject();

	virtual void ResetGPath() {};
	virtual void TransformCObject(Matrix* pMat) {};
	virtual bool HitTest(CPoint point) {return false;}
	virtual void OutScreen(Graphics &g) {};
	virtual void OutXml(stringstream &ss) {};
	virtual void OutPs(stringstream &ss) {};
	virtual CCommonObject* ConnectHitTest(CPoint point, int &nNumber);
	virtual CCommonObject* Clone(CPoint TopLeftOrigin, CString strNewName, int nRotation){return NULL;}
	virtual void ExpandInsCount(){};
	virtual void ExpandOutsCount(){};
	virtual CString GetObjectName(){return m_strUniqueName;}
	virtual Rect* GetBounds(); // will SET the m_rectBounding !!!
	virtual void SetConnection(bool bIn, int nPos, CCommonObject* pConnectTo);
	virtual void DisconnectCObject(CCommonObject *pObject);
	virtual void Disconnect();
	int GetType() {return m_nObjType;}
	virtual void SetRotation(int nRotation);

private:

public:
	Connections m_Connection;
	GraphicsPath *m_gPath;
	GraphicsPath *m_gpText;
	Pen *m_pPen;
	Rect m_rectBounding;

	int m_nIn;
	int m_nOut;

	int m_nObjType; // 2-Block; 3-Gate; 4-Wire; 5-Tag; 6-Inv
	bool m_bIsSelected;

	CPoint m_pointTopLeft;
	Point m_pointTL;

	CString m_strUniqueName;
	CStringA m_strOrigin;

	int m_nRotation;

	bool m_bFileInProject;
protected:
};

#endif