Add rayman2 source files
This commit is contained in:
154
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_BWC.cpp
Normal file
154
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_BWC.cpp
Normal file
@@ -0,0 +1,154 @@
|
||||
// Base Windows Control for CTL
|
||||
//
|
||||
// YB
|
||||
////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WControls\CTL_BWC.hpp"
|
||||
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
#include "Others\CTL_Pub.hpp"
|
||||
#include "Controls\CTL_Ctl.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
#include "IncTUT.h"
|
||||
//End of External Modules
|
||||
|
||||
//***************************************************************************
|
||||
CTL_BaseWindowsControl::CTL_BaseWindowsControl(CTL_Editor_Control *_pclParentControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
{
|
||||
m_pri_pclParentControl = _pclParentControl;
|
||||
m_pri_pclParentWnd = _pclParentWnd;
|
||||
m_pri_lUserDefinedType = _lUserDefinedType;
|
||||
m_pri_lUserDefinedCode = _lUserDefinedCode;
|
||||
|
||||
m_pri_pclWnd = NULL;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_BaseWindowsControl::~CTL_BaseWindowsControl()
|
||||
{
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
if ( CTL_p_fn_bUnregisterControl != NULL )
|
||||
{
|
||||
if ( m_pri_pclWnd != NULL )
|
||||
CTL_p_fn_bUnregisterControl(m_pri_pclWnd->m_hWnd);
|
||||
}
|
||||
/* else
|
||||
{
|
||||
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
|
||||
"Trying to unregister a control from TUT Module",
|
||||
"CTL_BaseWindowsControl::~CTL_BaseWindowsControl()",
|
||||
E_ERROR_GRAVITY_INSTABLE,
|
||||
"Function not found : the TUT DLL is probably not present in ""Edt_Data\\Tools"" directory");
|
||||
ERROR_ASSERT( FALSE );
|
||||
}*/
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
long CTL_BaseWindowsControl::m_pub_fn_lGetUserDefinedType()
|
||||
{
|
||||
return m_pri_lUserDefinedType;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
long CTL_BaseWindowsControl::m_pub_fn_lGetUserDefinedCode()
|
||||
{
|
||||
return m_pri_lUserDefinedCode;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Control *CTL_BaseWindowsControl::m_pub_fn_pclGetParentControl()
|
||||
{
|
||||
return m_pri_pclParentControl;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CWnd *CTL_BaseWindowsControl::m_pub_fn_pclGetParentWnd()
|
||||
{
|
||||
return m_pri_pclParentWnd;
|
||||
}
|
||||
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
//***************************************************************************
|
||||
//For TUT registration
|
||||
void CTL_BaseWindowsControl::m_pro_fn_vRegisterWindowsControl(CString _csAdditionnalInfo,
|
||||
enum TUT_eControlType_ _eType,
|
||||
CString _csControlString,
|
||||
CWnd *_pclWnd)
|
||||
{
|
||||
ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
|
||||
"Trying to register a control for TUT Module",
|
||||
"CTL_BaseWindowsControl::m_pub_fn_vRegisterWindowsControl(...)",
|
||||
E_ERROR_GRAVITY_INSTABLE,
|
||||
"An additonnal information should be stored in TUT's control name...");
|
||||
ERROR_ASSERT( !_csAdditionnalInfo.IsEmpty() );
|
||||
|
||||
m_pri_pclWnd = _pclWnd;
|
||||
m_pri_fn_vBuildNameForTUT(_csAdditionnalInfo, _eType, _csControlString, _pclWnd);
|
||||
}
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
||||
//***************************************************************************
|
||||
// Private Functions
|
||||
//***************************************************************************
|
||||
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
//***************************************************************************
|
||||
void CTL_BaseWindowsControl::m_pri_fn_vBuildNameForTUT(CString _csAdditionnalInfo,
|
||||
enum TUT_eControlType_ _eType,
|
||||
CString _csControlString,
|
||||
CWnd *_pclWnd)
|
||||
{
|
||||
/* ERROR_PREPARE_M(CTL_g_csModuleNameForErO,
|
||||
"Trying to register a control for TUT Module",
|
||||
"CTL_BaseWindowsControl::m_pri_fn_vBuildNameForTUT()",
|
||||
E_ERROR_GRAVITY_INSTABLE,
|
||||
"Function not found : the TUT DLL is probably not present in ""Edt_Data\\Tools"" directory");
|
||||
ERROR_CHECK( CTL_fn_bGetTUT_DLLFunctions() );*/
|
||||
|
||||
if ( CTL_p_fn_vRegisterControl == NULL )
|
||||
CTL_fn_bGetTUT_DLLFunctions();
|
||||
|
||||
if ( CTL_p_fn_vRegisterControl != NULL )
|
||||
{
|
||||
const CString c_csSeparator = " - ";
|
||||
|
||||
CString csTUTName;
|
||||
|
||||
//Adds TAG
|
||||
if ( CTL_g_csCurrentTAG.IsEmpty() )
|
||||
csTUTName = CString("CTL alone");
|
||||
else
|
||||
csTUTName = CString("CTL > ") + CTL_g_csCurrentTAG;
|
||||
|
||||
//Adds Secondary Info
|
||||
if ( !CTL_g_csCurrentSecondaryInfo.IsEmpty() )
|
||||
csTUTName += c_csSeparator + CTL_g_csCurrentSecondaryInfo;
|
||||
|
||||
//Adds additionnal Info
|
||||
if ( !_csAdditionnalInfo.IsEmpty() )
|
||||
csTUTName += c_csSeparator + _csAdditionnalInfo;
|
||||
|
||||
//Adds control type
|
||||
if ( !_csControlString.IsEmpty() )
|
||||
csTUTName += c_csSeparator + _csControlString;
|
||||
|
||||
//To ensure name's unicity : adds the ID
|
||||
//CString csID;
|
||||
//csID.Format("%i", CTL_fn_lGetCurrentIDForControl());
|
||||
//csTUTName += (c_csSeparator + csID);
|
||||
|
||||
//Registers in TUT
|
||||
CTL_p_fn_vRegisterControl(_pclWnd->m_hWnd,
|
||||
csTUTName,
|
||||
_eType);
|
||||
}
|
||||
}
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
|
330
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_VBas.cpp
Normal file
330
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_VBas.cpp
Normal file
@@ -0,0 +1,330 @@
|
||||
// Implementation of the CTL_Editor_BaseFormView class
|
||||
///////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WControls\CTL_VBas.hpp"
|
||||
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
#include "CTL_Res.h"
|
||||
|
||||
//For Init
|
||||
static BOOL s_g_pri_bBaseViewInitDone = FALSE;;
|
||||
|
||||
//Screen Height
|
||||
static unsigned short s_g_uwScreenHeight;
|
||||
|
||||
//#define _CTL_BASE_VIEW_ACCELERATION_
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_BaseFormView
|
||||
|
||||
IMPLEMENT_DYNCREATE(CTL_Editor_BaseFormView, CFormView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTL_Editor_BaseFormView, CFormView)
|
||||
//{{AFX_MSG_MAP(CTL_Editor_BaseFormView)
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_SIZE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_BaseFormView construction/destruction
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_BaseFormView::CTL_Editor_BaseFormView( UINT Id,
|
||||
BOOL bMustDisplayClosedHand )
|
||||
: CFormView( Id )
|
||||
{
|
||||
m_bMustDisplayClosedHand = bMustDisplayClosedHand;
|
||||
|
||||
m_bUserWantsToScroll = FALSE;
|
||||
|
||||
if ( !s_g_pri_bBaseViewInitDone )
|
||||
{
|
||||
//Gets screen's height
|
||||
HDC hdc;
|
||||
hdc = ::GetWindowDC(NULL);
|
||||
s_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
|
||||
::ReleaseDC(NULL,hdc);
|
||||
|
||||
//Loads Cursors
|
||||
HINSTANCE hOldInstance = AfxGetResourceHandle();
|
||||
AfxSetResourceHandle(CTL_g_hModule);
|
||||
|
||||
CTL_g_hcursor_CloseHand = AfxGetApp()->LoadCursor(IDC_CURSOR_CLOSED_HAND);
|
||||
CTL_g_hcursor_UpDownHand = AfxGetApp()->LoadCursor(IDC_CURSOR_UP_DOWN_HAND);
|
||||
|
||||
AfxSetResourceHandle(hOldInstance);
|
||||
|
||||
//Ints are now done
|
||||
s_g_pri_bBaseViewInitDone = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
// SHOULD NOT BE USED //
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
CTL_Editor_BaseFormView::CTL_Editor_BaseFormView()
|
||||
: CFormView(-1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_BaseFormView::~CTL_Editor_BaseFormView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_BaseFormView public functions
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_BaseFormView::m_fn_vSetViewHeight(unsigned short uwViewHeight)
|
||||
{
|
||||
m_uwViewHeight = uwViewHeight;
|
||||
unsigned short uwScrollBarHeight = GetSystemMetrics(SM_CYHSCROLL);
|
||||
|
||||
//Protection...
|
||||
//ANNECY CB
|
||||
// short wXSize = m_uwWindowWidth - 5;
|
||||
short wXSize = m_uwWindowWidth - 5 - GetSystemMetrics(SM_CXVSCROLL);
|
||||
//END ANNECY
|
||||
SetScrollSizes(MM_TEXT, CSize(max(0, wXSize), max(0, m_uwViewHeight /*- uwScrollBarHeight*/)));
|
||||
|
||||
if ( m_uwViewHeight > m_uwWindowHeight )
|
||||
m_bScrollIsPossible = TRUE;
|
||||
else
|
||||
m_bScrollIsPossible = FALSE;
|
||||
|
||||
//Supresses the scroll bar
|
||||
if ( m_bScrollIsPossible )
|
||||
{
|
||||
//ANNECY CB
|
||||
// EnableScrollBarCtrl(SB_VERT, FALSE);
|
||||
//END ANNECY
|
||||
EnableScrollBarCtrl(SB_HORZ, FALSE);
|
||||
|
||||
::SetClassLong(m_hWnd, GCL_HCURSOR, 0L);
|
||||
}
|
||||
else
|
||||
::SetClassLong(m_hWnd, GCL_HCURSOR, m_lInitialClassLong);
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_BaseFormView private functions
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_BaseFormView::OnInitialUpdate()
|
||||
{
|
||||
CFormView::OnInitialUpdate();
|
||||
|
||||
m_uwViewHeight = 0;
|
||||
CRect crWindowRect;
|
||||
GetClientRect(crWindowRect);
|
||||
m_uwWindowHeight = crWindowRect.Height();
|
||||
m_uwWindowWidth = crWindowRect.Width();
|
||||
|
||||
m_bScrollIsPossible = FALSE;
|
||||
|
||||
//To avoid cursor flashing
|
||||
m_lInitialClassLong = ::GetClassLong(m_hWnd, GCL_HCURSOR);
|
||||
}
|
||||
|
||||
//*******************************************************************************
|
||||
void CTL_Editor_BaseFormView::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
//Remove comments if acceleration is wanted...
|
||||
#ifdef _CTL_BASE_VIEW_ACCELERATION_
|
||||
static const short cs_wAcceleration = 1;
|
||||
static const short cs_wMaxCounterForAccel = 5;
|
||||
static const short cs_wInitialAddValue = 2;
|
||||
static short s_wCounterForAccel = 0;
|
||||
static short s_wCurrentAddValue = cs_wInitialAddValue;
|
||||
static BOOL s_bWasGoingUp = FALSE;
|
||||
|
||||
if ( m_bScrollIsPossible )
|
||||
{
|
||||
if ( nFlags & MK_LBUTTON )
|
||||
{
|
||||
CPoint cpScrollPos = GetScrollPosition();
|
||||
|
||||
if ( point.y - s_cpOldPoint.y < 0 )
|
||||
{
|
||||
if ( !s_bWasGoingUp )
|
||||
{
|
||||
s_wCounterForAccel = 0;
|
||||
s_wCurrentAddValue = cs_wInitialAddValue;
|
||||
}
|
||||
|
||||
SetCursor(g_hcursor_UpHand);
|
||||
cpScrollPos.y += s_wCurrentAddValue;
|
||||
s_bWasGoingUp = TRUE;
|
||||
}
|
||||
else if ( point.y - s_cpOldPoint.y > 0 )
|
||||
{
|
||||
if ( s_bWasGoingUp )
|
||||
{
|
||||
s_wCounterForAccel = 0;
|
||||
s_wCurrentAddValue = cs_wInitialAddValue;
|
||||
}
|
||||
|
||||
SetCursor(g_hcursor_DownHand);
|
||||
cpScrollPos.y -= s_wCurrentAddValue;
|
||||
s_bWasGoingUp = FALSE;
|
||||
}
|
||||
else
|
||||
SetCursor(g_hcursor_CloseHand);
|
||||
|
||||
s_wCounterForAccel++;
|
||||
|
||||
if ( s_wCounterForAccel >= cs_wMaxCounterForAccel )
|
||||
{
|
||||
s_wCounterForAccel = 0;
|
||||
s_wCurrentAddValue += cs_wAcceleration;
|
||||
}
|
||||
|
||||
ScrollToPosition(cpScrollPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursor(g_hcursor_CloseHand);
|
||||
s_wCounterForAccel = 0;
|
||||
s_wCurrentAddValue = cs_wInitialAddValue;
|
||||
}
|
||||
}
|
||||
#endif //_CTL_BASE_VIEW_ACCELERATION_
|
||||
|
||||
CPoint cpScreenPos = point;
|
||||
ClientToScreen(&cpScreenPos);
|
||||
|
||||
if ( m_bScrollIsPossible )
|
||||
{
|
||||
if ( nFlags & MK_LBUTTON )
|
||||
{
|
||||
//If window must scroll
|
||||
if ( m_bUserWantsToScroll )
|
||||
{
|
||||
//For Up and Down exits
|
||||
if ( cpScreenPos.y == 0 )
|
||||
{
|
||||
SetCursorPos(cpScreenPos.x, s_g_uwScreenHeight-2);
|
||||
cpScreenPos.y = m_uwOldPosition = s_g_uwScreenHeight-2;
|
||||
|
||||
}
|
||||
|
||||
if ( cpScreenPos.y == (s_g_uwScreenHeight-1) )
|
||||
{
|
||||
SetCursorPos(cpScreenPos.x, 1);
|
||||
cpScreenPos.y = m_uwOldPosition = 1;
|
||||
}
|
||||
|
||||
//Scrolls
|
||||
CPoint cpScrollPos = GetScrollPosition();
|
||||
|
||||
cpScrollPos.y -= (cpScreenPos.y - m_uwOldPosition);
|
||||
|
||||
ScrollToPosition(cpScrollPos);
|
||||
|
||||
//Forces Repaint
|
||||
MSG message;
|
||||
while ( ::PeekMessage(&message, NULL, WM_PAINT, WM_PAINT, PM_REMOVE) )
|
||||
::DispatchMessage(&message);
|
||||
}
|
||||
}
|
||||
//Displays the closed hand to see where you can scroll
|
||||
else if ( m_bMustDisplayClosedHand )
|
||||
SetCursor(CTL_g_hcursor_CloseHand);
|
||||
}
|
||||
else
|
||||
CFormView::OnMouseMove(nFlags, point);
|
||||
|
||||
m_uwOldPosition = (unsigned short)cpScreenPos.y ;
|
||||
}
|
||||
|
||||
//*******************************************************************************
|
||||
void CTL_Editor_BaseFormView::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
if ( m_bScrollIsPossible )
|
||||
{
|
||||
SetCapture();
|
||||
SetCursor(CTL_g_hcursor_UpDownHand);
|
||||
m_bUserWantsToScroll = TRUE;
|
||||
|
||||
ClientToScreen(&point);
|
||||
m_uwOldPosition = (unsigned short)point.y;
|
||||
}
|
||||
|
||||
CFormView::OnLButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
//*******************************************************************************
|
||||
void CTL_Editor_BaseFormView::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
ReleaseCapture();
|
||||
m_bUserWantsToScroll = FALSE;
|
||||
|
||||
CFormView::OnLButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
//*******************************************************************************
|
||||
void CTL_Editor_BaseFormView::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
m_uwWindowHeight = cy;
|
||||
|
||||
//Looks if scroll is possible
|
||||
if ( m_uwViewHeight > m_uwWindowHeight )
|
||||
m_bScrollIsPossible = TRUE;
|
||||
else
|
||||
m_bScrollIsPossible = FALSE;
|
||||
|
||||
//Supresses the scroll bar
|
||||
if ( m_bScrollIsPossible )
|
||||
{
|
||||
//ANNECY CB
|
||||
// EnableScrollBarCtrl(SB_VERT, FALSE);
|
||||
//END ANNECY
|
||||
EnableScrollBarCtrl(SB_HORZ, FALSE);
|
||||
|
||||
::SetClassLong(m_hWnd, GCL_HCURSOR, 0L);
|
||||
}
|
||||
else
|
||||
::SetClassLong(m_hWnd, GCL_HCURSOR, m_lInitialClassLong);
|
||||
|
||||
CFormView::OnSize(nType, cx, cy);
|
||||
}
|
||||
|
||||
|
||||
//*******************************************************************************
|
||||
//*******************************************************************************
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_BaseFormView diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CTL_Editor_BaseFormView::AssertValid() const
|
||||
{
|
||||
CFormView::AssertValid();
|
||||
}
|
||||
|
||||
void CTL_Editor_BaseFormView::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CFormView::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
|
||||
|
||||
|
107
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WBut.cpp
Normal file
107
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WBut.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
// CPACEdBu.cpp : implementation file
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WControls\CTL_WBut.hpp"
|
||||
|
||||
#include "Controls\CTL_Ctl.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_Button
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTL_Editor_Button, CButton)
|
||||
//{{AFX_MSG_MAP(CTL_Editor_Button)
|
||||
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
//**********************************************************************************
|
||||
CTL_Editor_Button::CTL_Editor_Button(CString _csName,
|
||||
CTL_tdeButtonType _tdeType,
|
||||
long _lAdditionnalStyles,
|
||||
CTL_Editor_Control *_pclParentControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclParentControl,
|
||||
_pclParentWnd,
|
||||
_lUserDefinedType,
|
||||
_lUserDefinedCode)
|
||||
{
|
||||
m_tdeType = _tdeType;
|
||||
|
||||
DWORD dwStyle = WS_CHILD;
|
||||
dwStyle |= _lAdditionnalStyles;
|
||||
|
||||
if ( Create(_csName,
|
||||
dwStyle,
|
||||
CRect(0,0,0,0),
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetFont(_pclParentWnd->GetFont());
|
||||
}
|
||||
|
||||
m_pri_td_p_fn_vButtonHasBeenClicked_CallBack = NULL;
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
CTL_Editor_Button::~CTL_Editor_Button()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_Button message handlers
|
||||
|
||||
//**********************************************************************************
|
||||
void CTL_Editor_Button::m_pub_fn_vSetButtonHasBeenClicked_CallBack(CTL_tdp_fn_vButtonHasBeenClicked _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_td_p_fn_vButtonHasBeenClicked_CallBack == NULL );
|
||||
|
||||
m_pri_td_p_fn_vButtonHasBeenClicked_CallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
void CTL_Editor_Button::OnClicked()
|
||||
{
|
||||
switch (m_tdeType)
|
||||
{
|
||||
case CTL_BUTTON_TYPE__EDIT:
|
||||
if ( m_pub_fn_pclGetParentControl() != NULL )
|
||||
m_pub_fn_pclGetParentControl()->m_fn_vEditData();
|
||||
break;
|
||||
}
|
||||
|
||||
//Calls CallBack
|
||||
if ( m_pri_td_p_fn_vButtonHasBeenClicked_CallBack != NULL )
|
||||
m_pri_td_p_fn_vButtonHasBeenClicked_CallBack(this,
|
||||
m_pub_fn_pclGetParentControl(),
|
||||
m_tdeType,
|
||||
m_pub_fn_lGetUserDefinedType(),
|
||||
m_pub_fn_lGetUserDefinedCode());
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
//For TUT registration
|
||||
void CTL_Editor_Button::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
|
||||
{
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Button, "Button", this);
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
}
|
||||
|
165
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WCBx.cpp
Normal file
165
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WCBx.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
// CPACLstB.cpp : implementation file
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WControls\CTL_WCBx.hpp"
|
||||
|
||||
#include "Controls\CTL_CtlE.hpp"
|
||||
#include "Others\CTL_Pub.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
#include "IncTUT.h"
|
||||
//End of External Modules
|
||||
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
#include "Others\CTL_EnLi.hpp"
|
||||
#include "Data\CTL_DatE.hpp"
|
||||
#include "Controls\CTL_CtlE.hpp"
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_ComboBox
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTL_Editor_ComboBox, CComboBox)
|
||||
//{{AFX_MSG_MAP(CTL_Editor_ComboBox)
|
||||
ON_CONTROL_REFLECT(CBN_SELCHANGE, OnSelchange)
|
||||
ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropdown)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_ComboBox::CTL_Editor_ComboBox(CTL_tdeComboBoxType _eType,
|
||||
long _lAdditionnalStyles,
|
||||
CTL_Editor_Control *_pclControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd,
|
||||
_lUserDefinedType,
|
||||
_lUserDefinedCode)
|
||||
{
|
||||
m_pri_eType = _eType;
|
||||
|
||||
//Creates control
|
||||
DWORD lStyles = WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL;
|
||||
lStyles |= _lAdditionnalStyles;
|
||||
|
||||
CRect crBidonRect(0,0,10,200);
|
||||
if ( Create(lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
//Sets the font
|
||||
SetFont(_pclParentWnd->GetFont());
|
||||
}
|
||||
|
||||
m_pri_p_td_fn_vSelChanged_CallBack = NULL;
|
||||
m_pri_p_td_fn_vDropDown_CallBack = NULL;
|
||||
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
m_iOldSelection = CB_ERR;
|
||||
m_pfCanISelectThisItem = NULL;
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_ComboBox::~CTL_Editor_ComboBox()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_ComboBox message handlers
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_ComboBox::m_pub_fn_vSetSelChanged_CallBack(CTL_tdp_fn_vComboBoxSelChanged _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_p_td_fn_vSelChanged_CallBack == NULL );
|
||||
|
||||
m_pri_p_td_fn_vSelChanged_CallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//****************************************************************************
|
||||
void CTL_Editor_ComboBox::m_pub_fn_vSetDropDown_CallBack(CTL_tdp_fn_vComboBoxSelChanged _p_fn_vCallBack)
|
||||
{
|
||||
ERROR_ASSERT( m_pri_p_td_fn_vDropDown_CallBack == NULL );
|
||||
|
||||
m_pri_p_td_fn_vDropDown_CallBack = _p_fn_vCallBack;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_ComboBox::OnSelchange()
|
||||
{
|
||||
short wIndex = GetCurSel();
|
||||
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
if (m_pfCanISelectThisItem)
|
||||
{
|
||||
//get the data
|
||||
CTL_Editor_EnumElement *pNewSelectedElement = (CTL_Editor_EnumElement *)GetItemDataPtr (wIndex);
|
||||
ASSERT (pNewSelectedElement);
|
||||
|
||||
CTL_Editor_EnumControl *pEnumCtrl = (CTL_Editor_EnumControl *)m_pub_fn_pclGetParentControl ();
|
||||
ASSERT (pEnumCtrl);
|
||||
CTL_Editor_EnumData *pEnumData = (CTL_Editor_EnumData *)pEnumCtrl->m_fn_pclGetEditedData ();
|
||||
ASSERT (pEnumData);
|
||||
if (!(*m_pfCanISelectThisItem)(pEnumData, pNewSelectedElement))
|
||||
{
|
||||
SetCurSel (m_iOldSelection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
||||
if ( wIndex != LB_ERR )
|
||||
if ( m_pri_p_td_fn_vSelChanged_CallBack != NULL )
|
||||
m_pri_p_td_fn_vSelChanged_CallBack(this,
|
||||
m_pub_fn_pclGetParentControl(),
|
||||
m_pri_eType,
|
||||
m_pub_fn_lGetUserDefinedType(),
|
||||
m_pub_fn_lGetUserDefinedCode());
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_ComboBox::OnDropdown()
|
||||
{
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
m_iOldSelection = GetCurSel ();
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
||||
int iSize, iMaxSize = 0;
|
||||
|
||||
for (int iIndex = 0; iIndex < GetCount(); iIndex++)
|
||||
{
|
||||
iSize = GetLBTextLen(iIndex);
|
||||
if (iSize > iMaxSize)
|
||||
iMaxSize = iSize;
|
||||
}
|
||||
|
||||
SetDroppedWidth(iMaxSize*7);
|
||||
|
||||
if ( m_pri_p_td_fn_vDropDown_CallBack != NULL )
|
||||
m_pri_p_td_fn_vDropDown_CallBack(this,
|
||||
m_pub_fn_pclGetParentControl(),
|
||||
m_pri_eType,
|
||||
m_pub_fn_lGetUserDefinedType(),
|
||||
m_pub_fn_lGetUserDefinedCode());
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
//For TUT registration
|
||||
void CTL_Editor_ComboBox::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
|
||||
{
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_ComboBox, "Combo Box", this);
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
}
|
133
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WCkB.cpp
Normal file
133
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WCkB.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
// 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
|
||||
}
|
353
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WEdt.cpp
Normal file
353
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WEdt.cpp
Normal file
@@ -0,0 +1,353 @@
|
||||
// CPACSpEd.cpp : implementation file
|
||||
///////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WControls\CTL_WEdt.hpp"
|
||||
|
||||
#include "Controls\CTL_CtlI.hpp"
|
||||
#include "Controls\CTL_CtlF.hpp"
|
||||
#include "Controls\CTL_CtlV.hpp"
|
||||
#include "Others\CTL_Pub.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "IncTUT.h"
|
||||
//End of External Modules
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_Edit
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTL_Editor_Edit, CEdit)
|
||||
//{{AFX_MSG_MAP(CTL_Editor_Edit)
|
||||
ON_WM_KEYUP()
|
||||
ON_WM_KILLFOCUS()
|
||||
ON_WM_RBUTTONUP()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_Edit::CTL_Editor_Edit(long _lMin,
|
||||
long _lMax,
|
||||
long _lAdditionnalStyles,
|
||||
CTL_Editor_IntegerControl *_pclControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd,
|
||||
_lUserDefinedType,
|
||||
_lUserDefinedCode)
|
||||
{
|
||||
m_pri_lMin = _lMin;
|
||||
m_pri_lMax = _lMax;
|
||||
m_pri_pclIntegerControl = _pclControl;
|
||||
m_pri_pclDecimalControl = NULL;
|
||||
m_pri_pclVectorControl = NULL;
|
||||
|
||||
m_pri_tdeType = CTL_EDIT_TYPE__INTEGER;
|
||||
|
||||
//Creates control
|
||||
CRect crBidonRect(0,0,0,0);
|
||||
DWORD lStyles = WS_CHILD | WS_BORDER | ES_CENTER | ES_MULTILINE | /*ES_NUMBER |*/ ES_WANTRETURN;
|
||||
lStyles |= _lAdditionnalStyles;
|
||||
|
||||
if ( Create(lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetFont(_pclParentWnd->GetFont());
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_Edit::CTL_Editor_Edit(long double _ldMin,
|
||||
long double _ldMax,
|
||||
long _lAdditionnalStyles,
|
||||
CTL_Editor_DecimalControl *_pclControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd,
|
||||
_lUserDefinedType,
|
||||
_lUserDefinedCode)
|
||||
{
|
||||
m_pri_ldMin = _ldMin;
|
||||
m_pri_ldMax = _ldMax;
|
||||
m_pri_pclDecimalControl = _pclControl;
|
||||
m_pri_pclIntegerControl = NULL;
|
||||
m_pri_pclVectorControl = NULL;
|
||||
|
||||
m_pri_tdeType = CTL_EDIT_TYPE__DECIMAL;
|
||||
|
||||
//Creates control
|
||||
CRect crBidonRect(0,0,0,0);
|
||||
DWORD lStyles = WS_CHILD | WS_BORDER | ES_CENTER | ES_MULTILINE | ES_WANTRETURN;
|
||||
lStyles |= _lAdditionnalStyles;
|
||||
|
||||
if ( Create(lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetFont(_pclParentWnd->GetFont());
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_Edit::CTL_Editor_Edit(long double _ldMin,
|
||||
long double _ldMax,
|
||||
long _lAdditionnalStyles,
|
||||
CTL_Editor_VectorControl *_pclControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd,
|
||||
_lUserDefinedType,
|
||||
_lUserDefinedCode)
|
||||
{
|
||||
m_pri_ldMin = _ldMin;
|
||||
m_pri_ldMax = _ldMax;
|
||||
m_pri_pclDecimalControl = NULL;
|
||||
m_pri_pclIntegerControl = NULL;
|
||||
m_pri_pclVectorControl = _pclControl;
|
||||
|
||||
m_pri_tdeType = CTL_EDIT_TYPE__VECTOR;
|
||||
|
||||
//Creates control
|
||||
CRect crBidonRect(0,0,0,0);
|
||||
DWORD lStyles = WS_CHILD | WS_BORDER | ES_CENTER | ES_MULTILINE | ES_WANTRETURN;
|
||||
lStyles |= _lAdditionnalStyles;
|
||||
|
||||
if ( Create(lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetFont(_pclParentWnd->GetFont());
|
||||
}
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
CTL_Editor_Edit::~CTL_Editor_Edit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_Edit message handlers
|
||||
|
||||
//************************************************************************************
|
||||
void CTL_Editor_Edit::m_fn_vSetCurrentValue(long lNewValue)
|
||||
{
|
||||
m_pri_lCurrent = lNewValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
void CTL_Editor_Edit::m_fn_vSetCurrentValue(long double ldNewValue)
|
||||
{
|
||||
m_pri_ldCurrent = ldNewValue;
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
void CTL_Editor_Edit::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
|
||||
{
|
||||
if ( nChar == 13 ) //'Enter' was pressed
|
||||
{
|
||||
//Gets the new value string
|
||||
CString csNewValue;
|
||||
GetWindowText(csNewValue);
|
||||
|
||||
switch ( m_pri_tdeType )
|
||||
{
|
||||
//-------------------------------------------------
|
||||
case CTL_EDIT_TYPE__INTEGER:
|
||||
{
|
||||
m_pri_lCurrent = atol(LPCTSTR(csNewValue));
|
||||
|
||||
if ( m_pri_lCurrent < m_pri_lMin )
|
||||
m_pri_lCurrent = m_pri_lMin;
|
||||
else if ( m_pri_lCurrent > m_pri_lMax )
|
||||
{
|
||||
if ((m_pri_lMax == ULONG_MAX) && (m_pri_lMin >=0))
|
||||
{
|
||||
if ((unsigned long)m_pri_lCurrent > (unsigned long) m_pri_lMax)
|
||||
m_pri_lCurrent = m_pri_lMax;
|
||||
}
|
||||
else
|
||||
m_pri_lCurrent = m_pri_lMax;
|
||||
}
|
||||
|
||||
csNewValue.Format("%ld", m_pri_lCurrent);
|
||||
SetWindowText(csNewValue);
|
||||
|
||||
//Updates parent's slider and tree view
|
||||
m_pri_pclIntegerControl->m_fn_vUpdateSpin(m_pri_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
//-------------------------------------------------
|
||||
case CTL_EDIT_TYPE__DECIMAL:
|
||||
{
|
||||
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
|
||||
|
||||
if ( m_pri_ldCurrent < m_pri_ldMin )
|
||||
m_pri_ldCurrent = m_pri_ldMin;
|
||||
else if ( m_pri_ldCurrent > m_pri_ldMax )
|
||||
m_pri_ldCurrent = m_pri_ldMax;
|
||||
|
||||
csNewValue.Format("%.3f", m_pri_ldCurrent);
|
||||
SetWindowText(csNewValue);
|
||||
|
||||
//Updates parent's slider and tree view
|
||||
m_pri_pclDecimalControl->m_fn_vUpdateSpin(m_pri_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
//-------------------------------------------------
|
||||
case CTL_EDIT_TYPE__VECTOR:
|
||||
{
|
||||
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
|
||||
|
||||
if ( m_pri_ldCurrent < m_pri_ldMin )
|
||||
m_pri_ldCurrent = m_pri_ldMin;
|
||||
else if ( m_pri_ldCurrent > m_pri_ldMax )
|
||||
m_pri_ldCurrent = m_pri_ldMax;
|
||||
|
||||
csNewValue.Format("%.3f", m_pri_ldCurrent);
|
||||
SetWindowText(csNewValue);
|
||||
|
||||
//Updates parent's slider and tree view
|
||||
m_pri_pclVectorControl->m_fn_vUpdateSpin(m_pri_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CEdit::OnKeyUp(nChar, nRepCnt, nFlags);
|
||||
}
|
||||
|
||||
//************************************************************************************
|
||||
//To avoid default 'right clic' result in an Edit field
|
||||
void CTL_Editor_Edit::OnRButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
//CEdit::OnRButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
// To update contents when the edit loses focus
|
||||
void CTL_Editor_Edit::OnKillFocus( CWnd* pNewWnd )
|
||||
{
|
||||
OnKeyUp(13,1,0);
|
||||
CEdit::OnKillFocus(pNewWnd);
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
mfn_vRefreshMotorData ();
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
//For TUT registration
|
||||
void CTL_Editor_Edit::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
|
||||
{
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_TextEdit, "Edit", this);
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
}
|
||||
|
||||
//ROMTEAM Selection (Cristian Stegaru 24/03/98)
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Method : mfn_vRefreshMotorData
|
||||
// Date : 98-03
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Description : I put here all the stuff from OnKeyUp, excepting the key check
|
||||
// Author : Stegaru Cristian - CPA2
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Modification :
|
||||
// Date :
|
||||
// By :
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CTL_Editor_Edit::mfn_vRefreshMotorData ()
|
||||
{
|
||||
//Gets the new value string
|
||||
CString csNewValue;
|
||||
GetWindowText(csNewValue);
|
||||
|
||||
switch ( m_pri_tdeType )
|
||||
{
|
||||
//-------------------------------------------------
|
||||
case CTL_EDIT_TYPE__INTEGER:
|
||||
{
|
||||
m_pri_lCurrent = atol(LPCTSTR(csNewValue));
|
||||
|
||||
if ( m_pri_lCurrent < m_pri_lMin )
|
||||
m_pri_lCurrent = m_pri_lMin;
|
||||
else if ( m_pri_lCurrent > m_pri_lMax )
|
||||
{
|
||||
if ((m_pri_lMax == ULONG_MAX) && (m_pri_lMin >=0))
|
||||
{
|
||||
if ((unsigned long)m_pri_lCurrent > (unsigned long) m_pri_lMax)
|
||||
m_pri_lCurrent = m_pri_lMax;
|
||||
}
|
||||
else
|
||||
m_pri_lCurrent = m_pri_lMax;
|
||||
}
|
||||
|
||||
csNewValue.Format("%ld", m_pri_lCurrent);
|
||||
SetWindowText(csNewValue);
|
||||
|
||||
//Updates parent's slider and tree view
|
||||
m_pri_pclIntegerControl->m_fn_vUpdateSpin(m_pri_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
//-------------------------------------------------
|
||||
case CTL_EDIT_TYPE__DECIMAL:
|
||||
{
|
||||
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
|
||||
|
||||
if ( m_pri_ldCurrent < m_pri_ldMin )
|
||||
m_pri_ldCurrent = m_pri_ldMin;
|
||||
else if ( m_pri_ldCurrent > m_pri_ldMax )
|
||||
m_pri_ldCurrent = m_pri_ldMax;
|
||||
|
||||
csNewValue.Format("%.3f", m_pri_ldCurrent);
|
||||
SetWindowText(csNewValue);
|
||||
|
||||
//Updates parent's slider and tree view
|
||||
m_pri_pclDecimalControl->m_fn_vUpdateSpin(m_pri_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
//-------------------------------------------------
|
||||
case CTL_EDIT_TYPE__VECTOR:
|
||||
{
|
||||
m_pri_ldCurrent = atof(LPCTSTR(csNewValue));
|
||||
|
||||
if ( m_pri_ldCurrent < m_pri_ldMin )
|
||||
m_pri_ldCurrent = m_pri_ldMin;
|
||||
else if ( m_pri_ldCurrent > m_pri_ldMax )
|
||||
m_pri_ldCurrent = m_pri_ldMax;
|
||||
|
||||
csNewValue.Format("%.3f", m_pri_ldCurrent);
|
||||
SetWindowText(csNewValue);
|
||||
|
||||
//Updates parent's slider and tree view
|
||||
m_pri_pclVectorControl->m_fn_vUpdateSpin(m_pri_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
//ENDROMTEAM Selection (Cristian Stegaru)
|
367
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WSpn.cpp
Normal file
367
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WSpn.cpp
Normal file
@@ -0,0 +1,367 @@
|
||||
// CPACSpin.cpp : implementation file
|
||||
////////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
//ANNECY CB
|
||||
#if 0
|
||||
#include "WControls\CTL_WSpn.hpp"
|
||||
|
||||
#include "Controls\CTL_CtlI.hpp"
|
||||
#include "Controls\CTL_CtlF.hpp"
|
||||
#include "Controls\CTL_CtlV.hpp"
|
||||
#include "Controls\CTL_Cnst.hpp"
|
||||
#include "Others\CTL_Pub.hpp"
|
||||
|
||||
//External Modules
|
||||
#include "CTL_ErO.hpp"
|
||||
#include "IncTUT.h"
|
||||
//End of External Modules
|
||||
|
||||
short CTL_g_uwScreenHeight = 0;
|
||||
|
||||
UDACCEL g_a_struc_Accel[C_ACCEL_NB] =
|
||||
{
|
||||
{ 1, 1 },
|
||||
{ 1, 2 },
|
||||
{ 1, 3 },
|
||||
{ 1, 4 },
|
||||
{ 1, 5 },
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_SpinButton
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTL_Editor_SpinButton, CSpinButtonCtrl)
|
||||
//{{AFX_MSG_MAP(CTL_Editor_SpinButton)
|
||||
ON_NOTIFY_REFLECT(UDN_DELTAPOS, OnDeltapos)
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_MOUSEMOVE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_SpinButton::CTL_Editor_SpinButton(CTL_Editor_IntegerControl *_pclControl,
|
||||
long _lLower,
|
||||
long _lUpper,
|
||||
CWnd *_pclParentWnd)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd)
|
||||
{
|
||||
m_pclIntegerControl = _pclControl;
|
||||
m_pclDecimalControl = NULL;
|
||||
m_pclVectorControl = NULL;
|
||||
|
||||
ERROR_ASSERT(_lLower < _lUpper);
|
||||
m_lLower = _lLower;
|
||||
m_lUpper = _lUpper;
|
||||
|
||||
m_tdeType = EDCAR_SPIN_TYPE_INTEGER;
|
||||
|
||||
//Creates control
|
||||
CRect crBidonRect(0,0,10,10);
|
||||
DWORD lStyles = WS_CHILD | UDS_ARROWKEYS | UDS_AUTOBUDDY;
|
||||
if ( Create(lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetAccel(C_ACCEL_NB, g_a_struc_Accel);
|
||||
SetRange(0, 100);
|
||||
}
|
||||
|
||||
m_uwManualIntegerDelta = 1;
|
||||
m_bManualPosIsOn = FALSE;
|
||||
|
||||
if ( CTL_g_uwScreenHeight == 0 )
|
||||
{
|
||||
//Gets screen's height
|
||||
HDC hdc;
|
||||
hdc = ::GetWindowDC(NULL);
|
||||
CTL_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
|
||||
::ReleaseDC(NULL,hdc);
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_SpinButton::CTL_Editor_SpinButton(CTL_Editor_DecimalControl *_pclControl,
|
||||
long double _ldLower,
|
||||
long double _ldUpper,
|
||||
CWnd *_pclParentWnd)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd)
|
||||
{
|
||||
m_pclIntegerControl = NULL;
|
||||
m_pclDecimalControl = _pclControl;
|
||||
m_pclVectorControl = NULL;
|
||||
m_ldLower = _ldLower;
|
||||
m_ldUpper = _ldUpper;
|
||||
|
||||
m_tdeType = EDCAR_SPIN_TYPE_DECIMAL;
|
||||
|
||||
//Creates control
|
||||
CRect crBidonRect(0,0,10,10);
|
||||
DWORD lStyles = WS_CHILD | UDS_ARROWKEYS | UDS_AUTOBUDDY;
|
||||
if ( Create(lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetAccel(C_ACCEL_NB, g_a_struc_Accel);
|
||||
SetRange(0, 100);
|
||||
}
|
||||
//Computes divisor value
|
||||
char cCounter = C_SPIN_PRECISION;
|
||||
m_ldDivisor = 1.0;
|
||||
while ( cCounter != 0 )
|
||||
{
|
||||
m_ldDivisor *= 10.0;
|
||||
cCounter --;
|
||||
}
|
||||
|
||||
m_fManualDecimalDelta = (float)0.1;
|
||||
m_bManualPosIsOn = FALSE;
|
||||
|
||||
if ( CTL_g_uwScreenHeight == 0 )
|
||||
{
|
||||
//Gets screen's height
|
||||
HDC hdc;
|
||||
hdc = ::GetWindowDC(NULL);
|
||||
CTL_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
|
||||
::ReleaseDC(NULL,hdc);
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_SpinButton::CTL_Editor_SpinButton(CTL_Editor_VectorControl *_pclControl,
|
||||
long double _ldLower,
|
||||
long double _ldUpper,
|
||||
CWnd *_pclParentWnd)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclControl,
|
||||
_pclParentWnd)
|
||||
{
|
||||
m_pclIntegerControl = NULL;
|
||||
m_pclDecimalControl = NULL;
|
||||
m_pclVectorControl = _pclControl;
|
||||
|
||||
m_ldLower = _ldLower;
|
||||
m_ldUpper = _ldUpper;
|
||||
|
||||
m_tdeType = EDCAR_SPIN_TYPE_VECTOR;
|
||||
|
||||
//Creates control
|
||||
CRect crBidonRect(0,0,10,10);
|
||||
DWORD lStyles = WS_CHILD | UDS_ARROWKEYS | UDS_AUTOBUDDY;
|
||||
if ( Create( lStyles,
|
||||
crBidonRect,
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl())
|
||||
)
|
||||
{
|
||||
SetAccel(C_ACCEL_NB, g_a_struc_Accel);
|
||||
SetRange(0, 100);
|
||||
}
|
||||
|
||||
//Computes divisor value
|
||||
char cCounter = C_SPIN_PRECISION;
|
||||
m_ldDivisor = 1.0;
|
||||
while ( cCounter != 0 )
|
||||
{
|
||||
m_ldDivisor *= 10.0;
|
||||
cCounter --;
|
||||
}
|
||||
|
||||
m_fManualDecimalDelta = (float)0.1;
|
||||
m_bManualPosIsOn = FALSE;
|
||||
|
||||
if ( CTL_g_uwScreenHeight == 0 )
|
||||
{
|
||||
//Gets screen's height
|
||||
HDC hdc;
|
||||
hdc = ::GetWindowDC(NULL);
|
||||
CTL_g_uwScreenHeight = GetDeviceCaps(hdc, VERTRES);
|
||||
::ReleaseDC(NULL,hdc);
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_SpinButton::~CTL_Editor_SpinButton()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_SpinButton message handlers
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_SpinButton::OnDeltapos(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
|
||||
|
||||
switch ( m_tdeType )
|
||||
{
|
||||
//---------------------------------------------------------
|
||||
case EDCAR_SPIN_TYPE_INTEGER:
|
||||
{
|
||||
m_lCurrent += pNMUpDown->iDelta;
|
||||
|
||||
if ( m_lCurrent > m_lUpper )
|
||||
m_lCurrent = m_lUpper;
|
||||
else if ( m_lCurrent < m_lLower )
|
||||
m_lCurrent = m_lLower;
|
||||
|
||||
m_pclIntegerControl->m_fn_vUpdateEdit(m_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
//---------------------------------------------------------
|
||||
case EDCAR_SPIN_TYPE_DECIMAL:
|
||||
{
|
||||
m_ldCurrent += ((long double)(pNMUpDown->iDelta) / m_ldDivisor);
|
||||
|
||||
if ( m_ldCurrent > m_ldUpper )
|
||||
m_ldCurrent = m_ldUpper;
|
||||
else if ( m_ldCurrent < m_ldLower )
|
||||
m_ldCurrent = m_ldLower;
|
||||
|
||||
m_pclDecimalControl->m_fn_vUpdateEdit(m_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
//---------------------------------------------------------
|
||||
case EDCAR_SPIN_TYPE_VECTOR:
|
||||
{
|
||||
m_ldCurrent += ((long double)(pNMUpDown->iDelta) / m_ldDivisor);
|
||||
|
||||
if ( m_ldCurrent > m_ldUpper )
|
||||
m_ldCurrent = m_ldUpper;
|
||||
else if ( m_ldCurrent < m_ldLower )
|
||||
m_ldCurrent = m_ldLower;
|
||||
|
||||
m_pclVectorControl->m_fn_vUpdateEdit(m_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_SpinButton::m_fn_vSetCurrentPos(long lNewValue)
|
||||
{
|
||||
m_lCurrent = lNewValue;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_SpinButton::m_fn_vSetCurrentPos(long double ldNewValue)
|
||||
{
|
||||
m_ldCurrent = ldNewValue;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_SpinButton::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
SetCapture();
|
||||
m_bManualPosIsOn = TRUE;
|
||||
|
||||
ClientToScreen(&point);
|
||||
m_uwOldPosition = (unsigned short)point.y;
|
||||
|
||||
CSpinButtonCtrl::OnRButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_SpinButton::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
if ( m_bManualPosIsOn )
|
||||
{
|
||||
CPoint cpScreenPos = point;
|
||||
ClientToScreen(&cpScreenPos);
|
||||
|
||||
if ( cpScreenPos.y == 0 )
|
||||
{
|
||||
SetCursorPos(cpScreenPos.x, CTL_g_uwScreenHeight-2);
|
||||
cpScreenPos.y = m_uwOldPosition = CTL_g_uwScreenHeight-2;
|
||||
|
||||
}
|
||||
|
||||
if ( cpScreenPos.y == (CTL_g_uwScreenHeight-1) )
|
||||
{
|
||||
SetCursorPos(cpScreenPos.x, 1);
|
||||
cpScreenPos.y = m_uwOldPosition = 1;
|
||||
}
|
||||
|
||||
switch ( m_tdeType )
|
||||
{
|
||||
case EDCAR_SPIN_TYPE_INTEGER:
|
||||
{
|
||||
long lNewValue = (long)(m_lCurrent + (m_uwOldPosition - cpScreenPos.y) * m_uwManualIntegerDelta);
|
||||
if ( lNewValue > m_lUpper )
|
||||
lNewValue = m_lUpper;
|
||||
else if ( lNewValue < m_lLower )
|
||||
lNewValue = m_lLower;
|
||||
m_fn_vSetCurrentPos(lNewValue);
|
||||
m_pclIntegerControl->m_fn_vUpdateEdit(m_lCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
case EDCAR_SPIN_TYPE_DECIMAL:
|
||||
{
|
||||
long double ldNewValue = (long double)(m_ldCurrent + (m_uwOldPosition - cpScreenPos.y) * m_fManualDecimalDelta);
|
||||
if ( ldNewValue > m_ldUpper )
|
||||
ldNewValue = m_ldUpper;
|
||||
else if ( ldNewValue < m_ldLower )
|
||||
ldNewValue = m_ldLower;
|
||||
m_fn_vSetCurrentPos(ldNewValue);
|
||||
m_pclDecimalControl->m_fn_vUpdateEdit(m_ldCurrent, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
|
||||
case EDCAR_SPIN_TYPE_VECTOR:
|
||||
{
|
||||
long double ldNewValue = (long double)(m_ldCurrent + (m_uwOldPosition - cpScreenPos.y) * m_fManualDecimalDelta);
|
||||
if ( ldNewValue > m_ldUpper )
|
||||
ldNewValue = m_ldUpper;
|
||||
else if ( ldNewValue < m_ldLower )
|
||||
ldNewValue = m_ldLower;
|
||||
m_fn_vSetCurrentPos(ldNewValue);
|
||||
m_pclVectorControl->m_fn_vUpdateEdit(m_ldCurrent, this, CTL_UPDATE_REASON__DATA_MODIFIED_BY_USER);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
m_uwOldPosition = (unsigned short)cpScreenPos.y ;
|
||||
}
|
||||
|
||||
CSpinButtonCtrl::OnMouseMove(nFlags, point);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_SpinButton::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
ReleaseCapture();
|
||||
m_bManualPosIsOn = FALSE;
|
||||
|
||||
CSpinButtonCtrl::OnRButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
//For TUT registration
|
||||
void CTL_Editor_SpinButton::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
|
||||
{
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Spin, "Spin Control", this);
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
}
|
||||
|
||||
#endif
|
||||
//ENDANNECY CB
|
279
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WSta.cpp
Normal file
279
Rayman_X/cpa/tempgrp/Ctl/Src/WControls/CTL_WSta.cpp
Normal file
@@ -0,0 +1,279 @@
|
||||
// CPACStat.cpp : implementation file
|
||||
//////////////////////////////////////////
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WControls\CTL_WSta.hpp"
|
||||
|
||||
#include "Others\CTL_Pub.hpp"
|
||||
#include "Others\CTL_Pri.hpp"
|
||||
|
||||
//ANNECY CB
|
||||
#include "WControls\CTL_VBas.hpp"
|
||||
//END ANNECY
|
||||
|
||||
//External Modules
|
||||
#include "IncTUT.h"
|
||||
//End of External Modules
|
||||
|
||||
extern CBrush g_clWhiteBrush;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
//Colors for a value (not changeable in Setup)
|
||||
COLORREF CTL_g_colref_ValueTextColor = RGB(0,0,0);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_Static
|
||||
IMPLEMENT_DYNAMIC(CTL_Editor_Static, CStatic)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTL_Editor_Static, CStatic)
|
||||
//{{AFX_MSG_MAP(CTL_Editor_Static)
|
||||
ON_WM_RBUTTONUP()
|
||||
ON_WM_LBUTTONDBLCLK()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
//ANNECY CB
|
||||
ON_WM_MOUSEMOVE()
|
||||
//END ANNECY
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Static::CTL_Editor_Static(CString _csName,
|
||||
CTL_tdeStaticType _tdeType,
|
||||
long _lAdditionnalStyles,
|
||||
CTL_Editor_Control *_pclParentControl,
|
||||
CWnd *_pclParentWnd,
|
||||
long _lUserDefinedType /*= 0*/,
|
||||
long _lUserDefinedCode /*= 0*/)
|
||||
|
||||
: CTL_BaseWindowsControl(_pclParentControl,
|
||||
_pclParentWnd,
|
||||
_lUserDefinedType,
|
||||
_lUserDefinedCode)
|
||||
{
|
||||
m_csTextToDisplay = _csName;
|
||||
|
||||
m_pri_tdeType = _tdeType;
|
||||
|
||||
m_pri_p_fnStaticHasBeenClicked_CallBack = CTL_g_p_fnDefaultCallBack_StaticHasBeenClicked;
|
||||
m_pri_td_p_fn_vGetColor = CTL_g_p_fnDefaultCallBack_GetColor;
|
||||
|
||||
//Creates the control
|
||||
DWORD lStyles = WS_CHILD | SS_NOTIFY | WS_BORDER;
|
||||
switch ( m_pri_tdeType )
|
||||
{
|
||||
case CTL_STATIC_TYPE__FIELD_VALUE:
|
||||
case CTL_STATIC_TYPE__NEUTRAL_FIELD:
|
||||
lStyles |= (SS_CENTER);
|
||||
break;
|
||||
}
|
||||
lStyles |= _lAdditionnalStyles;
|
||||
|
||||
m_pri_colBackGroundColor = RGB(132,132,132);
|
||||
m_pri_colTextColor = RGB(0,0,0);
|
||||
|
||||
if ( Create(_csName,
|
||||
lStyles,
|
||||
CRect(0,0,0,0),
|
||||
_pclParentWnd,
|
||||
CTL_fn_lGetNextAvailableIDForControl()) )
|
||||
{
|
||||
SetFont(_pclParentWnd->GetFont());
|
||||
}
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_Editor_Static::~CTL_Editor_Static()
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTL_Editor_Static message handlers
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::m_fn_vSetTextToDisplay(CString csNewText,
|
||||
BOOL _bMustRefresDisplay /*= FALSE*/)
|
||||
{
|
||||
m_csTextToDisplay = csNewText;
|
||||
|
||||
if ( _bMustRefresDisplay )
|
||||
InvalidateRect(NULL);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CTL_tdeStaticType CTL_Editor_Static::m_pub_fn_tdeGetType()
|
||||
{
|
||||
return m_pri_tdeType;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
CString CTL_Editor_Static::m_pub_fn_csGetDisplayedString()
|
||||
{
|
||||
return m_csTextToDisplay;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
COLORREF CTL_Editor_Static::m_pub_fn_colGetBackGroundColor()
|
||||
{
|
||||
return m_pri_colBackGroundColor;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::m_pub_fn_vSetBackGroundColor(COLORREF _colNewColor,
|
||||
BOOL _bMustRefresDisplay /*= FALSE*/)
|
||||
{
|
||||
m_pri_colBackGroundColor = _colNewColor;
|
||||
|
||||
if ( _bMustRefresDisplay )
|
||||
InvalidateRect(NULL);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
COLORREF CTL_Editor_Static::m_pub_fn_colGetTextColor()
|
||||
{
|
||||
return m_pri_colTextColor;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::m_pub_fn_vSetTextColor(COLORREF _colNewColor,
|
||||
BOOL _bMustRefresDisplay /*= FALSE*/)
|
||||
{
|
||||
m_pri_colTextColor = _colNewColor;
|
||||
|
||||
if ( _bMustRefresDisplay )
|
||||
InvalidateRect(NULL);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::m_pub_fn_vSetStaticHasBeenClicked_CallBack(
|
||||
CTL_td_p_fn_vStaticHasBeenClicked _p_fnStaticHasBeenClicked_CallBack)
|
||||
|
||||
{
|
||||
m_pri_p_fnStaticHasBeenClicked_CallBack = _p_fnStaticHasBeenClicked_CallBack;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::m_pub_fn_v_SetColRefGetColor_CallBack(CTL_tdp_fn_vGetColor _p_fn_CallBack)
|
||||
{
|
||||
m_pri_td_p_fn_vGetColor = _p_fn_CallBack;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::OnRButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
//CPA2 Stegaru Cristian 98/06/19
|
||||
CTL_tdeClickType clickType = CTL_CLICK_TYPE__RIGHT_CLICK;
|
||||
if (MK_SHIFT == (MK_SHIFT & nFlags))
|
||||
clickType = CTL_CLICK_TYPE__SHIFT_RIGHT_CLICK;
|
||||
|
||||
if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
|
||||
m_pri_p_fnStaticHasBeenClicked_CallBack(this, clickType);
|
||||
//End CPA2 Stegaru Cristian 98/06/19
|
||||
|
||||
CStatic::OnRButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||
{
|
||||
if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
|
||||
m_pri_p_fnStaticHasBeenClicked_CallBack(this, CTL_CLICK_TYPE__LEFT_DOUBLE_CLICK);
|
||||
CStatic::OnMButtonDblClk(nFlags, point);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
|
||||
m_pri_p_fnStaticHasBeenClicked_CallBack(this, CTL_CLICK_TYPE__LEFT_CLICK);
|
||||
|
||||
CStatic::OnLButtonUp(nFlags, point);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
//ANNECY CB
|
||||
void CTL_Editor_Static::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
CTL_Editor_BaseFormView *pView = (CTL_Editor_BaseFormView *) GetParent();
|
||||
ClientToScreen(&point);
|
||||
pView->ScreenToClient(&point);
|
||||
LPARAM lParam = point.x + (point.y << 16);
|
||||
pView->SendMessage(WM_MOUSEMOVE, (WPARAM) nFlags, lParam);
|
||||
}
|
||||
//END ANNECY
|
||||
|
||||
void CTL_Editor_Static::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
//ANNECY CB
|
||||
// if ( m_pri_p_fnStaticHasBeenClicked_CallBack != NULL )
|
||||
// m_pri_p_fnStaticHasBeenClicked_CallBack(this, CTL_CLICK_TYPE__LEFT_BUTTON_DOWN);
|
||||
// else
|
||||
{
|
||||
CTL_Editor_BaseFormView *pView = (CTL_Editor_BaseFormView *) GetParent();
|
||||
ClientToScreen(&point);
|
||||
pView->ScreenToClient(&point);
|
||||
LPARAM lParam = point.x + (point.y << 16);
|
||||
pView->SendMessage(WM_LBUTTONDOWN, (WPARAM) nFlags, lParam);
|
||||
}
|
||||
//END ANNECY
|
||||
CStatic::OnLButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CTL_Editor_Static::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
CRect crClientRect;
|
||||
GetClientRect(crClientRect);
|
||||
|
||||
if ( m_pri_td_p_fn_vGetColor != NULL )
|
||||
m_pri_td_p_fn_vGetColor(this, m_pri_colBackGroundColor, m_pri_colTextColor);
|
||||
|
||||
//Fills the window's rect
|
||||
dc.FillSolidRect(crClientRect, m_pri_colBackGroundColor);
|
||||
|
||||
//Displays the string
|
||||
dc.SelectObject(GetFont());
|
||||
dc.SetTextColor(m_pri_colTextColor);
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
|
||||
UINT nFormat = DT_SINGLELINE | DT_VCENTER;
|
||||
if ( (GetStyle() & SS_CENTER) != 0 )
|
||||
nFormat |= DT_CENTER;
|
||||
else
|
||||
nFormat |= DT_LEFT;
|
||||
|
||||
crClientRect.left ++;
|
||||
dc.DrawText(m_csTextToDisplay, crClientRect, nFormat);
|
||||
|
||||
// Do not call CStatic::OnPaint() for painting messages
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
long CTL_Editor_Static::m_fn_lGetMinLength()
|
||||
{
|
||||
CClientDC dc(this);
|
||||
CString csWindowText;
|
||||
GetWindowText(csWindowText);
|
||||
dc.SelectObject(GetFont());
|
||||
|
||||
return (dc.GetTextExtent(csWindowText).cx);
|
||||
}
|
||||
|
||||
//**********************************************************************************
|
||||
//For TUT registration
|
||||
void CTL_Editor_Static::m_pub_fn_vRegisterWindowsControl(CString _csAdditionnalInfo)
|
||||
{
|
||||
#ifndef CTL_WITH_NO_TUT
|
||||
m_pro_fn_vRegisterWindowsControl(_csAdditionnalInfo, TUT_e_Window, "Static", this);
|
||||
#endif //CTL_WITH_NO_TUT
|
||||
}
|
||||
|
Reference in New Issue
Block a user