/* Header for the definition of a base control */
/*/////////////////////////////////////////////////////////*/
#ifndef _CTL_BASE_CONTROL_
#define _CTL_BASE_CONTROL_
 
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000*/
 
#include "ACP_Base.h"		/*For CPA_EXPORT*/
#include "CTL\Others\CTL_ClBk.hpp"
 
/*#########################################################*/
typedef enum CTL_eBaseControlDisplayType
{
	CTL_BASE_CONTROL_DISPLAY_TYPE__NORMAL = 0,
	CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_FIXED,
	CTL_BASE_CONTROL_DISPLAY_TYPE__ALWAYS_PERCENTAGED,
	CTL_BASE_CONTROL_DISPLAY_TYPE__USE_CALLBACK,
	/*CTL_BASE_CONTROL_DISPLAY_TYPE__*/
 
} CTL_tdeBaseControlDisplayType;
 
/*#########################################################*/
#define CTL_C_BASE_CONTROL_INVALID_PERCENTAGE		(-1)
 
class CTL_BaseWindowsControl;
class CTL_Editor_Control;
 
/*#########################################################*/
class CPA_EXPORT CTL_Editor_BaseControl
{
/*Constructor / Destructor*/
public:
	CTL_Editor_BaseControl(CTL_BaseWindowsControl *_pclBaseWindowsControl,
												 CWnd *_pclWnd,
												 CTL_Editor_Control *_pclParentControl,
												 CTL_tdeBaseControlDisplayType _eDisplayType,
												 unsigned char _ucPercentWidth,
												 unsigned short _uwFixedWidth,
												 unsigned short _uwHeight,
												 BOOL _bSamePlaceAsNext,
												 BOOL _bGoToNextLineAfterMe = FALSE);
		
	~CTL_Editor_BaseControl();
 
/*Attributes*/
public:
 
protected:
	
private:
	long m_pri_lComputedWidth;
	char m_pri_cComputedPercentage;
 
	CTL_BaseWindowsControl *m_pri_pclBaseWindowsControl;
	CWnd *m_pri_pclWnd;
 
	CRect m_crBaseZoneRect;
 
	CTL_td_p_fn_bBaseControlCanBeDisplayed m_pri_td_p_fn_vCanBeDisplayedCallBack;
	CTL_td_p_fn_bBaseControlCanBeDisplayed m_pri_td_p_fn_vMustBeEnabledCallBack;
	
	CTL_Editor_Control *m_pri_pclParentControl;
 
	CTL_tdp_fn_lGetSizeOfWindow m_pri_td_p_fn_lGetSize_CallBack;
 
	CTL_tdeBaseControlDisplayType m_pri_tdeDisplayType;
 
	unsigned char m_pri_ucPercentWidth;
	unsigned short m_pri_uwFixedWidth;
	unsigned short m_pri_uwHeight;
	
	BOOL m_pri_bSamePlaceAsNext;
 	BOOL m_pri_bBeginsOnNextLine;
 
/*Member functions*/
public:
	CRect &m_fn_rcrGetZoneRect();
	CWnd *m_fn_pclGetWnd();
	void m_fn_vHideBaseControl();
	void m_fn_vDisplayBaseControl();
	void m_fn_vMoveBaseControl();
 
	BOOL m_pub_fn_bCanBeDisplayed();
	BOOL m_pub_fn_bMustBeEnabled();
 
	void m_pub_fn_vMoveInZone(CRect &_r_crNextRectOnSameLine,
														CRect &_r_crNextRectOnNextLine);
 
	void m_pub_fn_vComputeBaseControlZone();
	
	void m_pub_fn_vSetCanBeDisplayedCallBack(CTL_td_p_fn_bBaseControlCanBeDisplayed _p_fn_vCallBack);
	void m_pub_fn_vSetMustBeEnabledCallBack(CTL_td_p_fn_bBaseControlCanBeDisplayed _p_fn_vCallBack);
	
	CTL_Editor_Control *m_pub_fn_pclGetParentControl();
 
	void m_pub_fn_vSetGetSize_CallBack(CTL_tdp_fn_lGetSizeOfWindow _p_fn_lCallBack);
 
	CTL_tdeBaseControlDisplayType m_pub_fn_tdeGetDisplayType();
 
 
protected:
 
private:
 
friend class CTL_Editor_Control;
friend class CTL_Editor_BaseControlList;
};											   
 
#endif /*_CTL_BASE_CONTROL_*/
