// Header for the definition of the class representing a Mechanical Card Type
//////////////////////////////////////////////////////////////////////////////
#ifndef _CPA_MECA_CARD_TYPE_HPP_
#define _CPA_MECA_CARD_TYPE_HPP_

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

#include <afxtempl.h>

#include "_MecCard.hpp"

//External Modules
#include "CTL.h"
//End of External Modules

class CPA_Editor_EnumDescriptor;
class CPA_Meca_MiniStrucView;

class CPA_Meca_CardType
{
public:
	CPA_Meca_CardType(CString csName, DNM_tdeMechanicsID tdeMotorID);
	~CPA_Meca_CardType();

//---------------------------------------
//Attributes
public:
	//The list of data
 	CTL_Editor_ControlList m_clControlList;
 
	//A rectangle specifying the zone where controls are drown
	CRect m_crControlZone;

	//A pointer on the Unallocation function
	void (*m_p_fn_vUnallocate) (CPA_Meca_Card *);

	//A pointer on the Filling function
	void (*m_p_fn_vFill) (CPA_Meca_Card *);

	//A pointer on the Saving function
	void (*m_p_fn_vSave) (SCR_tdst_File_Description *, CPA_Meca_Card *);

	//
	BOOL m_bAtLeastOneCardOfTheCardTypeHasBeenLoaded;

protected:

private:
	//The name of the mini-structure (in the Tree)
	CString m_csName;
	
	//The name of the File where this type of Cards are stored
	CString m_csFileName;

	//The name of the Action for this type of Cards
	CString m_csActionName;

	CRect m_crDisplayRect;
	CPA_Meca_MiniStrucView *m_pclParentView;
	
	//The currently edited Card
	CPA_Meca_Card *m_pclCurrentCard;

	//The list of Cards
	CPA_Meca_CardList m_clCardsList;

	//...
	BOOL m_bControlsAreHidden;

	//The ID of the type of Mechanics (image of Motor ID)
	DNM_tdeMechanicsID m_tdeMotorID;

//---------------------------------------
//Functions
public:
	CString m_fn_csGetCardTypeName();
	void m_fn_vSetCardTypeName(CString csNewName);
	
	CPA_Meca_Card *m_fn_pclGetEditedCard();
	void m_fn_vSetEditedCard(CPA_Meca_Card *);

	CPA_Meca_CardList *m_fn_pclGetCardsList();

	unsigned long m_fn_ulGetCardsNumber();

	BOOL m_fn_bControlsAreHidden();

	//Get : The ID of the type of Mechanics (image of Motor ID)
	DNM_tdeMechanicsID m_fn_tdeGetMotorID();

	//The name of the File where this type of Cards are stored
	CString m_fn_csGetFileName();
	void m_fn_vSetFileName(CString csNewName);

	//The name of the Action for this type of Cards
	CString m_fn_csGetActionName();
	void m_fn_vSetActionName(CString csNewName);

//	void m_fn_vAddIntegerControl(CString, long, long, char , BOOL, tdeDataLevel, BOOL, tdeControlSpacingType, BOOL);
	void m_fn_vAddDecimalControl(long double, long double, char, BOOL, CString _csControlName);
	void m_fn_vAddBooleanControl(BOOL, CString _csControlName);
//	void m_fn_vAddEnumControl(CString, CPA_Editor_EnumDescriptor *, tdeDataLevel, BOOL);
//	void m_fn_vAddListControl(CString, tdeDataLevel, BOOL);
//	void m_fn_vAddMatriceControl(CString, long, long, char, BOOL, tdeDataLevel, BOOL);
//	void m_fn_vAddTextControl(CString, tdeDataLevel, BOOL, tdeControlSpacingType, BOOL);
	
	//Creates all controls
	virtual long m_fn_lCreateMSControls(CWnd *, CRect);
	//Hides all controls
	virtual void m_fn_vHideAllControls();

	long m_fn_lOpen(CRect crRect);
	void m_fn_vOffsetZone(long lOffset);
	void m_fn_vClose();

	void m_fn_vGetMotorDatas();
	
protected:

private:
	void m_pri_fn_vAddOwnerDataToControl(CTL_Editor_Control *_pclControl);

};

//#####################################################################

// Definition of the class for the list of mini-structures
class CPA_Meca_CardTypeList : public CList<CPA_Meca_CardType *, CPA_Meca_CardType *>
{
public:
	CPA_Meca_CardTypeList();
	~CPA_Meca_CardTypeList();

	CPA_Meca_CardType* m_fn_pclAddElement(CString, DNM_tdeMechanicsID tdeMotorID);
	void m_fn_vEmptyList();

	//Gets a Type Card from its Motor ID
	CPA_Meca_CardType* m_fn_pclGetTypeCardFromID(DNM_tdeMechanicsID tdeMotorID);

};

#endif //_CPA_MECA_CARD_TYPE_HPP_

