/* Header for the definition of a base control*/ /*/////////////////////////////////////////////////////////*/ #ifndef _CTL_CONTROL_ #define _CTL_CONTROL_ #if _MSC_VER >= 1000 #pragma once #endif /* _MSC_VER >= 1000*/ #include #include "CTL\Data\CTL_Dat.hpp" #include "CTL\Others\CTL_ODat.hpp" #include "CTL\Controls\CTL_BCL.hpp" #define CTL_C_SPACE_BETWEEN_CONTROLS 2 class CTL_Editor_Static; class CTL_Editor_CheckBox; class CTL_Editor_BaseControlList; class CTL_Editor_BaseControl; class CTL_Editor_ControlList; /*#########################################################*/ typedef enum CTL_eControlSpacingType { CTL_SPACING_TYPE__SINGLE_LINE = 0, CTL_SPACING_TYPE__MULTI_LINE, CTL_SPACING_TYPE__AUTO, CTL_SPACING_TYPE__FIXED_SIZE, } CTL_tdeControlSpacingType; /*#########################################################*/ class CPA_EXPORT CTL_Editor_Control { /*Constructor / Destructor*/ public: CTL_Editor_Control( CTL_tdeEditorDataType tdeType, BOOL bIsAlwaysReadOnly, CTL_tdeControlSpacingType tdeSpacingType, BOOL bUserCanChangeAspect, CTL_Editor_ControlList *_pclParentList, CString _csControlName, /*ANNECY BBB {*/ BOOL _bAcceptNameFromData = TRUE, /*ANNECY BBB }*/ /*Stefan Dumitrean 20-07-98 ( OAC buttons )*/ unsigned char ucInitialCurrentPair = 0 /*End Stefan Dumitrean 20-07-98 ( OAC buttons )*/ ); virtual ~CTL_Editor_Control(); /*Attributes*/ public: /*Stefan Dumitrean 20-07-98 ( OAC buttons )*/ unsigned char m_ucInitialCurrentPair; /*indicates whether the control is in a */ /*initial/current pair or not*/ /* 0 - no pair, 1 - initial, 2 - current*/ /*End Stefan Dumitrean 20-07-98 ( OAC buttons )*/ protected: /*The list of base controls*/ CTL_Editor_BaseControlList *m_pclListOfBaseControls; /*Type of spacing for the group of controls*/ CTL_tdeControlSpacingType m_tdeSpacingType; /*Indicates wether the User can modifiy control's aspect or not*/ BOOL m_bUserCanChangeAspect; /*Indicates wether the group of controls has already been created or not*/ BOOL m_bControlCreated; /*Indicates wether the group of controls is currently hidden or not*/ BOOL m_bHidden; /*ANNECY BBB {*/ /*Indicates if the control accepts to be renamed when its name does not match the current data's*/ BOOL m_bAcceptNameFromData; /*ANNECY BBB }*/ /*The whole rectangle occupied by the group of controls*/ CRect m_crZoneRect; /*The name of the Characteristic*/ CString m_pro_csControlName; CTL_Editor_Static *m_pclNameStatic; /*Indicates a control is always in Read Only mode, by construction*/ /* of the Editor*/ BOOL m_bIsAlwaysReadOnly; /*Indicates wether the control's current state is Read Only or not*/ /* (unused member if m_bAlwaysReadOnly is TRUE)*/ BOOL m_bIsReadOnly; /*The type of the Data edited by this group of controls*/ CTL_tdeEditorDataType m_tdeDataType; /*The current Data edited by this group of controls*/ CTL_Editor_Data *m_pclData; /*The Parent Wnd of all controls in the group*/ CWnd *m_pclParentWnd; private: /*List of OwnerData*/ CTL_ListOfOwnerData m_pri_clListOfOwnerData; /*The function to call to know if a Control can be displayed*/ /*The appliaction will use owner Data or something else to return the right value*/ CTL_td_p_fn_bControlCanBeDisplayed m_pri_p_fn_bControlCanBeDisplayedCallBack; /*The parent list of controls*/ CTL_Editor_ControlList *m_pri_pclParentList; /*Member functions*/ public: /*The list of base controls*/ CTL_Editor_BaseControlList *m_pub_fn_pclGetListOfBaseControls(); /*The parent list of controls*/ CTL_Editor_ControlList *m_pub_fn_pclGetParentList(); CString m_pub_fn_csGetControlName(); /*Returns the old name*/ CString m_pub_fn_csSetControlName(CString _csNewName); CTL_Editor_Static *m_pub_fn_pclGetNameStatic(); BOOL m_pub_fn_bHasBeenCreated(); BOOL m_fn_bCanUserChangeAspect(); BOOL m_fn_bIsAlwaysReadOnly(); BOOL m_fn_bIsReadOnly(); /*ANNECY BBB {*/ BOOL m_fn_bAcceptsToTakeNameFromData() { return m_bAcceptNameFromData; } /*ANNECY BBB }*/ CRect m_fn_crGetZoneRect(); CTL_Editor_Data *m_fn_pclGetEditedData(); virtual void m_fn_vSetEditedData(CTL_Editor_Data *); CTL_tdeEditorDataType m_pub_fn_tdeGetDataType(); CTL_tdeControlSpacingType m_fn_tdeGetSpacingType(); void m_fn_vAskForNewAspect(unsigned short uwAllowedTotalWidth); void m_pub_fn_vDisplayInZone( CRect &_r_crSameLineDestinationZone, CRect &_r_crNextLineDestinationZone); void m_pub_fn_vSetControlCanBeDisplayedCallBack(CTL_td_p_fn_bControlCanBeDisplayed _p_fn_CallBalck); /*Indicates whether this control must be displayed, according to CallBack*/ BOOL m_pub_fn_bMustBeDisplayed(); /*Owner Data*/ CTL_OwnerData *m_pub_fn_pclAddOwnerData(void *_pvDataPtr, CString _csName); CTL_OwnerData *m_pub_fn_pclAddOwnerData(long _lData, CString _csName); CTL_OwnerData *m_pub_fn_pclGetOwnerDataWithName(CString _csSearchedName); /* Virtual functions*/ /*///////////////////*/ /*Function called to create controls (must be called only once)*/ /*(This function is pure virtual)*/ virtual BOOL m_fn_bCreateControl(CWnd *) = 0; /*Function called to edit complex data (which can not be directly*/ /*edited)*/ /*(This function is virtual)*/ virtual void m_fn_vEditData(); /*Function called to develop complex data in tree*/ /*(This function is virtual)*/ virtual void m_fn_vDevelopData(); /*Function called to display the associated control of the char.*/ /*(This function is pure virtual)*/ virtual void m_fn_vDisplay() = 0; /*Function called to hide the associated control of the char.*/ virtual void m_fn_vHide(); /*Function called to update the associated control of the char.*/ /*(This function is pure virtual)*/ virtual void m_fn_vUpdate(CTL_tdeUpdateReason _eReason = CTL_UPDATE_REASON__NO_REASON_GIVEN, long _lUserDefinedReason = 0) = 0; /*Function called to update parent window in case of values changes.*/ virtual void m_fn_vUpdateParent(CTL_tdeUpdateReason eReason = CTL_UPDATE_REASON__NO_REASON_GIVEN, long _lUserDefinedReason = 0); /*Function called to make control Read Only*/ /*(This function is pure virtual)*/ virtual void m_fn_vMakeReadOnly() = 0; /*Function called to make control Read-Write*/ /*(This function is pure virtual)*/ virtual void m_fn_vMakeReadWrite() = 0; protected: BOOL m_pro_fn_bCreateBaseControls(unsigned char _ucNamePercentWidth, unsigned short _uwNameMinWidth, unsigned short _uwHeight, BOOL _bGoToNextLineAfterName = FALSE); void m_pro_fn_vDisplayBaseControls(); void m_pro_fn_vHideBaseControls(); private: BOOL m_pri_fn_bCanDisplayInWidth(unsigned short uwLeftWidth); /*Display of sub_controls in list*/ void m_pri_fn_vDisplaySubControlsInZone(BOOL _bUseNextLineZone, CRect &_r_crSameLineDestinationZone, CRect &_r_crNextLineDestinationZone); unsigned short m_pri_fn_uwComputeTotalWidth(unsigned short uwAllowedTotalWidth); unsigned char m_pri_fn_ucGetBaseControlNumber(); friend class EdActors_ControlDefinitionDialog; }; #endif /*_CTL_CONTROL_*/