// EdIRBeha.hpp : header file
//

#ifndef _EDIRBEHA_HPP_
#define _EDIRBEHA_HPP_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include <afxtempl.h>
#include "EdIRREd.hpp"
#include "EdIRICLs.hpp"

/////////////////////////////////////////////////////////////////////////////
// class CPA_EdIR_Behaviour
/////////////////////////////////////////////////////////////////////////////

class CPA_EdIR_View;
//class CPA_EdIR_LinkBehaviour;
class CPA_EdIR_MainBehaviour;
class CPA_BaseObject;
class CPA_EdIR_DebugInfoList;

class CPA_EdIR_Behaviour : public CButton
{
	// Classes, Enums ...
	private:
		enum MoveSizeType
		{
			MOVE_SIZE_NONE,
			MOVE_SIZE_LEFT,
			MOVE_SIZE_TOP,
			MOVE_SIZE_RIGHT,
			MOVE_SIZE_BOTTOM,
			MOVE_SIZE_LEFT_TOP,
			MOVE_SIZE_RIGHT_TOP,
			MOVE_SIZE_LEFT_BOTTOM,
			MOVE_SIZE_RIGHT_BOTTOM,
			MOVE_SIZE_MOVE
		};
//ANNECY CB
	public:
		BOOL	m_bFirstActivate;
		long	m_lErrorIndex;
//END ANNECY
	// Construction
	public:
		CPA_EdIR_Behaviour(CPA_EdIR_View *,BOOL);

		void										m_fn_vSetMainBehaviour(CPA_EdIR_MainBehaviour *);
		CPA_EdIR_MainBehaviour	*m_fn_pclGetMainBehaviour();

	// Attributes
	public:
		CList<CPA_EdIR_Behaviour *,CPA_EdIR_Behaviour *>					m_clListOfDependentBehaviours;
		BOOL																											m_bDeclaration;
		CPA_EdIR_IntermediateCodeList															m_clIntermediateCodeList;
		BOOL	m_bOldMacro;
		
	private:
		MoveSizeType																							m_eMoveSizeType;
		long																											m_lOffsetX;
		long																											m_lOffsetY;
		CPA_EdIR_View																							*m_pclIAViewRules;
		BOOL																											m_bIAmActive;
//		CList<CPA_EdIR_LinkBehaviour *,CPA_EdIR_LinkBehaviour *>	m_clListOfLinkBehaviours;
		CFont																											m_clFont;
		BOOL																											m_bHasBeenModified;
		CPA_EdIR_MainBehaviour																		*m_pclMainBehaviour;
		BOOL																											m_bIntermediateCodeListIsGood;

	// Operations
	private:
		BOOL	m_fn_bDependencyIsDrawable(CPA_BaseObject *);
		void	m_fn_vDrawDependency(CPA_EdIR_Behaviour *,CString,COLORREF);
		void	m_fn_vDrawDependencies(COLORREF);

		void	m_fn_vDisplayError(long);

	public:

		CPA_EdIR_EditCtrl																					m_clEditCtrl;
		void		m_fn_vDrawDependencies();

		void		m_fn_vRenameBehaviour();

		void		m_fn_vActivate(BOOL);
		void		m_fn_vSetRules(CString);
		CString	m_fn_csGetRules();
		CString	m_fn_csGetName();
		CRect		m_fn_crGetBoundingBox();
		void		m_fn_vUpdateButtonWidth();

		void		m_fn_vUpdateDependencies();

		BOOL		ShowWindow(int);

		BOOL		m_fn_bHasBeenModified();
		void		m_fn_vSetModified(BOOL);

		BOOL		m_fn_bIntermediateCodeListIsGood();
		void		m_fn_vSetIntermediateCodeList(BOOL);

		// BEGIN ROMTEAM Cristi Petrescu 98-08-
		void		m_fn_vSetCursorPosByLine(long);
		void		m_fn_vSetCursorPosByIndex(long);
		// END ROMTEAM Cristi Petrescu 98-08-

		BOOL		m_fn_bCheckIA(enum tdeTypeText_);
		BOOL		m_fn_bProcessIA(BOOL,BOOL,struct AI_tdstMind_ *,struct tdstComport_ *,struct tdstTreeInterpret_ *,enum tdeTypeText_,CPA_EdIR_DebugInfoList *);
		//BEGIN ROMTEAM Cristi Petrescu 98-04-
		BOOL		m_fn_bSaveIA(struct SCR_tdst_File_Description_ *,struct AI_tdstMind_ *,enum tdeTypeText_, CString csInfo);
		//END ROMTEAM Cristi Petrescu 98-04-

		//BEGIN ROMTEAM Cristi Petrescu 98-05-
		// for debugger
		void		m_fn_vHideNonExecutedLines (void);
		//END ROMTEAM Cristi Petrescu 98-05-

		long		m_fn_lGetLineNumberInPixel(long);
		long		m_fn_lGetStartLineIndex(long);

		void		m_fn_vRegisterInTUT();
//Stefan Dumitrean 8-07-98 ( macro color )
		BOOL		m_fn_bIsActive() { return m_bIAmActive; }
//End Stefan Dumitrean 8-07-98 ( macro color )

	protected:

	// Overrides
		// ClassWizard generated virtual function overrides
		//{{AFX_VIRTUAL(CPA_EdIR_Behaviour)
		public:
		virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
		virtual BOOL Create(LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
		protected:
		virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
		//}}AFX_VIRTUAL

	// Implementation
	public:
		virtual ~CPA_EdIR_Behaviour();

		// Generated message map functions
	protected:
		//{{AFX_MSG(CPA_EdIR_Behaviour)
			afx_msg void OnDestroy( );
			afx_msg void OnMouseMove(UINT nFlags, CPoint point);
			afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
			afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
			afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
			afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
		//}}AFX_MSG
		afx_msg void m_fn_vOnDeleteBehaviour();
		afx_msg void m_fn_vOnRenameBehaviour();

		DECLARE_MESSAGE_MAP()
};

#endif //_EDIRBEHA_HPP_
