// Header for the definition of the class representing a mini-structure
// (Base class)	 (Controls)
//////////////////////////////////////////////////////////////////////
#ifndef _CPACMSTR_HPP_
#define _CPACMSTR_HPP_

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

#include <afxtempl.h>

#include "Help_Def.h"
#include "EDACCust.hpp"

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


class CPA_Editor_MiniStructureButton;
class EdActors_ActorMiniStructure;
class EdActors_MiniStrucView;

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

typedef enum eMiniStructureState
{
	MS_STATE_UNALLOCATED = 0,
	MS_STATE_CLOSED,
	MS_STATE_DEVELOPPED,

} tdeMiniStructureState;

typedef enum eMiniStructureManiability
{
	MS_MANIABILITY_NORMAL = 0,
	MS_MANIABILITY_ALWAYS_ALLOCATED,
	MS_MANIABILITY_ALLOCATED_ONLY_ONCE,

} tdeMiniStructureManiability;

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

class EdActors_MiniStructure
{
public:
	EdActors_MiniStructure(	CString csName,
													tdeMiniStructureManiability tdeManiability);

	~EdActors_MiniStructure();

//---------------------------------------
//Attributes
public:
	//The name of the mini-structure (in the Tree)
	CString m_csName;

	//The list of data
 	CTL_Editor_ControlList m_clControlList;

	//A rectangle specifying teh zone where control are drown
	CRect m_crControlZone;

	//Pointer on the actor MS object
	EdActors_ActorMiniStructure *m_pclActorMS;

protected:

private:
	CPA_Editor_MiniStructureButton *m_pclAllocButton;
	CPA_Editor_MiniStructureButton *m_pclOpenButton;
	CRect m_crDisplayRect;
	EdActors_MiniStrucView *m_pclParent;

	//Maniability	
	tdeMiniStructureManiability m_tdeManiability;
	BOOL m_bIsAlreadyAllocated;

//---------------------------------------
//Functions
public:
	CTL_Editor_Control *m_fn_pclAddIntegerControl(long,
																								long,
																								char,
																								BOOL,
																								OAC_tdeDataLevel,
																								BOOL,
																								CTL_tdeControlSpacingType,
																								OAC_tdeControlVisibility,
																								BOOL,
																								CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																								unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																								BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																								DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																								);
	CTL_Editor_Control *m_fn_pclAddDecimalControl(long double,
																								long double,
																								char,
																								OAC_tdeDataLevel,
																								BOOL,
																								CTL_tdeControlSpacingType,
																								OAC_tdeControlVisibility,
																								BOOL,
																								CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																								unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )

																								BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																								DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																								);

	CTL_Editor_Control *m_fn_pclAddBooleanControl(OAC_tdeDataLevel,
																								BOOL,
																								CTL_tdeControlSpacingType,
																								OAC_tdeControlVisibility,
																								BOOL,
																								CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																								unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )

																								BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																								DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																								);
	CTL_Editor_Control *m_fn_pclAddMaskedControl(	OAC_tdeDataLevel,
																								BOOL,
																								CTL_tdeControlSpacingType,
																								OAC_tdeControlVisibility,
																								BOOL,
																								CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																								unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																								BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																								DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																								);
	CTL_Editor_Control *m_fn_pclAddEnumControl(	OAC_tdeDataLevel,
																							OAC_tdeControlVisibility,
																							BOOL,
																							CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																							unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																								BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																							DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																							);
	CTL_Editor_Control *m_fn_pclAddStateControl(OAC_tdeDataLevel,
																							OAC_tdeControlVisibility,
																							BOOL,
																							CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																							unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																							BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																							DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																							);
	CTL_Editor_Control *m_fn_pclAddTextControl(	OAC_tdeDataLevel,
																							BOOL,
																							CTL_tdeControlSpacingType,
																							OAC_tdeControlVisibility,
																							BOOL,
																							CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																							unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																							BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																							DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																							);
	CTL_Editor_Control *m_fn_pclAddVectorControl(	long double,
																								long double,
																								char,
																								OAC_tdeDataLevel,
																								BOOL,
																								OAC_tdeControlVisibility,
																								CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																								unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																								BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																								DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																								);
	CTL_Editor_Control *m_fn_pclAddObjectListControl(	OAC_tdeDataLevel,
																										BOOL,
																										OAC_tdeControlVisibility,
																										BOOL,
																										BOOL,
																										BOOL,
																										CString _csControlName,
//Stefan Dumitrean 20-07-98 ( OAC buttons )
																										unsigned char ucInitialCurrentPair = 0,
//End Stefan Dumitrean 20-07-98 ( OAC buttons )
																										BOOL _bAcceptsToTakeNameOfData = TRUE, //ANNECY BBB
																										DWORD _ulHelpID = IDH_FIELD_UNKNOWN
																										);

	//Creates all controls
	virtual long m_fn_lCreateMSControls(CWnd *, CRect);
	//Hides all controls
	virtual void m_fn_vHideAllControls();
	//Shows all controls
	virtual void m_fn_vShowAllControls();

	//Reaction to buttons
	void m_fn_vOnButtonAlloc();
	void m_fn_vOnButtonOpen();

	long m_fn_lMove(CRect crRect);
	long m_fn_lOpen(CRect crRect);
	void m_fn_vClose();
	void m_fn_vOffsetZone(long lOffset);
	void m_fn_vGetMotorDatas();
	void m_fn_vUpdateMSButton();

	//Called when mode is Instance
	void m_fn_vUpdateControlsForInstance();
	//Called when mode is Model
	void m_fn_vUpdateControlsForModel();

	//Maniability
	tdeMiniStructureManiability m_fn_tdeGetManiability();
	BOOL m_fn_bCanBeUnallocated();
	BOOL m_fn_bCanBeAllocated();
	void m_fn_vHasBeenAllocated();
	void m_fn_vHasBeenUnallocated();
	BOOL m_fn_bIsAlreadyAllocated();

protected:

private:

};

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

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

	EdActors_MiniStructure* m_fn_pclAddElement(CString, tdeMiniStructureManiability);
	void m_fn_vEmptyList();

	void m_fn_vUpdateControlsForInstance();
	void m_fn_vUpdateControlsForModel();
	void m_fn_vHighliteData(CTL_Editor_Data *pclData);
};

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

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

	EdActors_MiniStructureList* m_fn_pclAddElement();

	EdActors_MiniStructureList *m_fn_pclGetListFromIndex(unsigned char ucIndex);

//	void m_fn_vEmptyList();
};

#endif //_CPACMSTR_HPP_

