/*
 =======================================================================================
  Name        : TPG_OGen.hpp
  Author      : David Reizer
  Description : implementation of class for ParticleGenerator editor object
 =======================================================================================
  Modification -> Author : Vincent Lhullier 
 =======================================================================================
 */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef _TPG_OGEN_HPP_
#define _TPG_OGEN_HPP_
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include "ACP_Base.h"
#include "ITF.h"
#include "PRT.h"
#include "CTL.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
class CPA_PartGen_MyDocument;
class CPA_PartGen_Source;
class CPA_PartGen_System;
class CPA_PartGen_Environment;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

///////////////////////////////////////////////////
// Particles Generator CLass

/*
 =======================================================================================
	Editor Particles Generator CLass
 =======================================================================================
 */
class CPA_PartGen_Generator : public CPA_SaveObject
{
  public:
	CPA_PartGen_Generator(CString, tdxHandleToParticleGenerator _hGenerator = NULL, BOOL _bIsLoaded = TRUE);
	~CPA_PartGen_Generator();

	//virtual functions
	virtual long		GetDataType(void);
	virtual void		*GetData(void);
	virtual CString		fn_csComputeReferencedSectionName(const CString _csNewName);
	virtual void		fn_vNotifySave(void);
	virtual void		fn_vNotifyUnSave(void);


	static void m_s_fn_vCallBackSaveGenerator
		( 
			SCR_tdst_File_Description *_p_stFile,
			char *_p_szSectionName,
			void *_p_vData,
			SCR_tde_Ntfy_Action _eAction 
		);

	BOOL m_pub_fn_vLoadIfUnloaded();

	// link to private Generator Motor Object
	tdxHandleToParticleGenerator m_pub_fn_hGetGenerator() {return m_pri_hGenerator;}
	void m_pub_fn_vSetGenerator( tdxHandleToParticleGenerator _hGenerator);

	// links to Source, System and Environment Editor Objects
	CPA_PartGen_Source			*m_pub_fn_p_clGetSource();
	CPA_PartGen_System			*m_pub_fn_p_clGetSystem();
	CPA_PartGen_Environment		*m_pub_fn_p_clGetEnv();
	CPA_PartGen_Generator		*m_pub_fn_p_oGetLinkedPrtGen();

	// source, system and environment controls
	void m_pub_fn_vSetSource( CPA_PartGen_Source* );
	void m_pub_fn_vSetSystem( CPA_PartGen_System* );
	void m_pub_fn_vSetEnv	( CPA_PartGen_Environment* );

	// Link to environment
	void m_pub_fn_vSetLinkToEnv( BOOL );
	BOOL m_pub_fn_bGetLinkToEnv();

	// Environment Mask
	void m_pub_fn_vSetEnvActiveWater( BOOL );
	void m_pub_fn_vSetEnvActiveAir( BOOL );
	long m_pub_fn_lGetEnvironmentMask();
	
	void	m_pub_fn_vUpdateGeneratorEnumDescriptors();
	void	m_pub_fn_vSetGenInEnv();

	CPA_PartGen_MyDocument * m_pub_fn_p_clGetDocument();

  private:
	void m_pri_fn_vSaveGenerator( SCR_tdst_File_Description* );

	void m_pri_fn_vFillDataList();
	void m_pri_fn_vFillGeneratorDataList();

  public:
	CTL_Editor_DataList m_pub_clGeneratorDataList;

  private:	
	tdxHandleToParticleGenerator	m_pri_hGenerator;

	friend class CPA_PartGen_Environment;
	friend void g_fn_vModificationWriteEnvBox( CTL_Editor_Data* );
	friend void g_fn_vModificationWriteEnvSphere( CTL_Editor_Data* );
};


#endif //_TPG_OGEN_HPP_
