134 lines
3.7 KiB
C++
134 lines
3.7 KiB
C++
// CPACChkB.cpp : implementation file
|
|
/////////////////////////////////////////////////////
|
|
#include "StdAfx.h"
|
|
|
|
#include "WControls\CTL_WCkB.hpp"
|
|
|
|
#include "Controls\CTL_CtlB.hpp"
|
|
#include "Others\CTL_TTT.hpp"
|
|
#include "Others\CTL_Pub.hpp"
|
|
|
|
//External Modules
|
|
#include "CTL_ErO.hpp"
|
|
#include "IncTUT.h"
|
|
//End of External Modules
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CTL_Editor_CheckBox
|
|
|
|
BEGIN_MESSAGE_MAP(CTL_Editor_CheckBox, CButton)
|
|
//{{AFX_MSG_MAP(CTL_Editor_CheckBox)
|
|
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//**************************************************************************
|
|
CTL_Editor_CheckBox::CTL_Editor_CheckBox(CTL_tdeCarCheckBoxType _tdeType,
|
|
long _lAdditionnalStyles /*= 0*/,
|
|
CTL_Editor_Control *_pclControl,
|
|
CWnd *_pclParentWnd,
|
|
long _lUserDefinedType /*= 0*/,
|
|
long _lUserDefinedCode /*= 0*/,
|
|
CString _csFalseText /*= ""*/,
|
|
CString _csTrueText /*= ""*/)
|
|
|
|
: CTL_BaseWindowsControl(_pclControl,
|
|
_pclParentWnd,
|
|
_lUserDefinedType,
|
|
_lUserDefinedCode)
|
|
{
|
|
m_pri_tdeType = _tdeType;
|
|
|
|
//Creates control
|
|
DWORD lStyles;
|
|
CRect crBidonRect(0,0,0,0);
|
|
lStyles = WS_CHILD | BS_AUTOCHECKBOX;
|
|
|
|
m_pri_csFalseText = _csFalseText.IsEmpty() ? "False" : _csFalseText;
|
|
m_pri_csTrueText = _csTrueText.IsEmpty() ? "True" : _csTrueText;
|
|
|
|
switch ( m_pri_tdeType )
|
|
{
|
|
case CTL_CHECK_BOX_TYPE__NORMAL :
|
|
lStyles |= BS_PUSHLIKE;
|
|
break;
|
|
}
|
|
|
|
lStyles |= _lAdditionnalStyles;
|
|
|
|
if ( Create("",
|
|
lStyles,
|
|
crBidonRect,
|
|
_pclParentWnd,
|
|
CTL_fn_lGetNextAvailableIDForControl()) )
|
|
{
|
|
SetFont(_pclParentWnd->GetFont());
|
|
}
|
|
|
|
m_pri_td_p_fn_vHasBeenClicked_CallBack = NULL;
|
|
}
|
|
|
|
//**************************************************************************
|
|
CTL_Editor_CheckBox::~CTL_Editor_CheckBox()
|
|
{
|
|
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CTL_Editor_CheckBox message handlers
|
|
|
|
//**************************************************************************
|
|
void CTL_Editor_CheckBox::m_pub_fn_vSetHasBeenClicked_CallBack(CTL_tdp_fn_vCheckBoxHasBeenClicked _p_fn_vCallBack)
|
|
{
|
|
ERROR_ASSERT( m_pri_td_p_fn_vHasBeenClicked_CallBack == NULL );
|
|
|
|
m_pri_td_p_fn_vHasBeenClicked_CallBack = _p_fn_vCallBack;
|
|
}
|
|
|
|
//**************************************************************************
|
|
void CTL_Editor_CheckBox::OnClicked()
|
|
{
|
|
switch ( m_pri_tdeType )
|
|
{
|
|
case CTL_CHECK_BOX_TYPE__NORMAL :
|
|
SetCheck( GetCheck() );
|
|
break;
|
|
}
|
|
|
|
if ( m_pri_td_p_fn_vHasBeenClicked_CallBack != NULL )
|
|
m_pri_td_p_fn_vHasBeenClicked_CallBack(this,
|
|
m_pub_fn_pclGetParentControl(),
|
|
m_pri_tdeType,
|
|
m_pub_fn_lGetUserDefinedType(),
|
|
m_pub_fn_lGetUserDefinedCode());
|
|
}
|
|
|
|
//**************************************************************************
|
|
void CTL_Editor_CheckBox::SetCheck(BOOL bCheck)
|
|
{
|
|
switch ( m_pri_tdeType )
|
|
{
|
|
case CTL_CHECK_BOX_TYPE__NORMAL :
|
|
//Sets button's text
|
|
SetWindowText(bCheck ? m_pri_csTrueText : m_pri_csFalseText);
|
|
break;
|
|
}
|
|
|
|
CButton::SetCheck(bCheck);
|
|
}
|
|
|
|
//**********************************************************************************
|
|
//For TUT registration
|
|
void CTL_Editor_CheckBox::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
|
|
{
|
|
#ifndef CTL_WITH_NO_TUT
|
|
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Button, "Check Box", this);
|
|
#endif //CTL_WITH_NO_TUT
|
|
}
|