// Header for the definition of an ObjectList characteristic
///////////////////////////////////////////////////////////
#ifndef _CPACOTYP_HPP_
#define _CPACOTYP_HPP_

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

#include <afxtempl.h>

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

class CPA_tdoNameList;
class EdtList;
class CPA_ZonesActivatingList;

//#########################################################################################
class CPA_Editor_ObjectList : public CPA_BaseObject, public CPA_List<CPA_BaseObject *>
{
public:
	//args for the CPA_BaseObject constructor
	CPA_Editor_ObjectList(CPA_EditorBase *p_oDLL,
												CString csObjectType,
												CPA_BaseObject *p_oOwner
												)
							: CPA_BaseObject(p_oDLL,
																csObjectType,
																p_oOwner
																)
	{};

protected:

private:
	//Virtual functions
	virtual long GetDataType(void);
	virtual void *GetData(void);
};

//#########################################################################################
class CPA_Editor_ObjectListData : public CTL_Editor_Data
{
public:
	//Constructor
 CPA_Editor_ObjectListData(	CString,
														CTL_Editor_DataList *_pclParentList,
														CTL_Editor_Data *pclCurrentBaseData = NULL);

	// Destructor
 ~CPA_Editor_ObjectListData();

//Attributes
public:
 //for the instance: the current list of objects
 //CPA_Editor_ObjectList *m_p_oObjectList;
 //for the model: the current list of names, also used to fill the instance's objnamecombo
 CPA_tdoNameList *m_p_oNameList, *m_p_oOldNameList, *m_p_oNameListKeptForUndo;
 EdtList *m_p_oObjectList, *m_p_oOldObjectList, *m_p_oObjectListKeptForUndo;
 CPA_ZonesActivatingList *m_p_oZAList, *m_p_oOldZAList, *m_p_oZAListKeptForUndo;

protected:

private:

//Member functions
public:
	//Function called to get a string representing the value of the data
	CStringList *m_fn_pcslFormatDataValueString();
  //Function called to set the value of the data acoording to a string representing it
	void m_fn_vSetValueWithString(CStringList *);

	//Function called to Init the data
	void m_fn_vInitData();

	//Function called to read associated motor's data
	void m_fn_vGetMotorData();

	//Function called to update associated motor's data
	void m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason = CTL_UPDATE_REASON__NO_REASON_GIVEN,
														 long _lUserDefinedReason = 0);

	//Function called to update data with another one
	void m_fn_vUpdateData(CTL_Editor_Data *pclSourceData,
												CTL_tdeUpdateReason eReason = CTL_UPDATE_REASON__NO_REASON_GIVEN,
												long _lUserDefinedReason = 0);

	//Function called to look if data has been modified (by motor for example)
	void m_fn_vLookIfDataHasBeenModified();

	//sets the value and maintains coherence at the same time
	void m_vSetZAList(CPA_ZonesActivatingList *_p_oZAList);
	void m_vSetObjectList(EdtList *_p_oObjectList);

	// update engine value
	void m_vUpdateEngineZAList();
	void m_vUpdateEngineObjectList();

	//Undo
	//Function called to save the current Value (for Undo)
	void m_fn_vKeepCurrentValue();

	//Function called to validate Undo for the current change
	void m_fn_vRegisterUndoAction();

	//
	void m_fn_vDataHasBeenReallyModified();

protected:

private:

};

//##################################################################"
//this modification handler is used only when the user changes the current
//name list for a model or the current object list for an instance.
class CPA_ObjectListDataModif : public CPA_Modif
{
public:
	//Constructor
 CPA_ObjectListDataModif(
  CPA_Editor_ObjectListData *p_oData,
  void *pOldList,
  void *pNewList,
	void *_pOldAlternateList,
	void *_pNewAlternateList
 );

	//Destructor
 ~CPA_ObjectListDataModif();

	BOOL Do();
	BOOL Undo();

	//Members
private:
 CPA_Editor_ObjectListData *m_p_oData;
 void *m_pListBeforeDo;
 void *m_pListAfterDo;
 void *m_pAlternateListBeforeDo, *m_pAlternateListAfterDo;
};


//ROMTEAM correction (Nicu 06-02-98)
class OAC_FloatData : public  CTL_Editor_DecimalData
{
public:
    OAC_FloatData(char size, CString name, CTL_Editor_DataList *list, CTL_Editor_Data *data=NULL) : 
        CTL_Editor_DecimalData(size, name, list, data){};

    //Function called to read associated motor's data
    void m_fn_vGetMotorData();
    
    //Function called to update associated motor's data
    void m_fn_vUpdateMotorData(CTL_tdeUpdateReason eReason = CTL_UPDATE_REASON__NO_REASON_GIVEN,
                                                         long _lUserDefinedReason = 0);

//Function called to get a string representing the value of the data
    CStringList *m_fn_pcslFormatDataValueString();

//Function called to set the value of the data acoording to a string representing it
    void m_fn_vSetValueWithString(CStringList *pcslValueStringList);

};
//ENDROMTEAM correction (Nicu)

#endif //_CPACOTYP_HPP_
