reman3/Rayman_X/cpa/tempgrp/TME/Src/EMECDgIf.cpp

110 lines
3.1 KiB
C++

// CPAMDgIf.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "EMECDgIf.hpp"
#include "_MInterf.hpp"
//External Modules
#include "IncTUT.h"
//End of External Modules
#define C_INFO_DIALOG_TIMER 70 //An Id for the timer
#define C_TEMPO_TIMER 100 //(ms)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPA_Meca_InformationDialog dialog
BEGIN_MESSAGE_MAP(CPA_Meca_InformationDialog, CDialog)
//{{AFX_MSG_MAP(CPA_Meca_InformationDialog)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//**************************************************************************
CPA_Meca_InformationDialog::CPA_Meca_InformationDialog(CWnd* pParent, CString csMessage)
: CDialog(CPA_Meca_InformationDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CPA_Meca_InformationDialog)
m_csMessage = csMessage;
//}}AFX_DATA_INIT
m_hOldInstance = AfxGetResourceHandle();
AfxSetResourceHandle(g_stMecaDLLIdentity.hModule);
}
//**************************************************************************
CPA_Meca_InformationDialog::~CPA_Meca_InformationDialog()
{
AfxSetResourceHandle(m_hOldInstance);
}
//***************************************************************************
void CPA_Meca_InformationDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPA_Meca_InformationDialog)
DDX_Text(pDX, IDC_STATIC_TEXT, m_csMessage);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CPA_Meca_InformationDialog message handlers
//***************************************************************************
BOOL CPA_Meca_InformationDialog::OnInitDialog()
{
CDialog::OnInitDialog();
//Init. timer
SetTimer(C_INFO_DIALOG_TIMER, C_TEMPO_TIMER, NULL);
//Loads Bitmaps
m_a_cbBitmaps[0].LoadBitmap(IDB_BITMAP_INFO1);
m_a_cbBitmaps[1].LoadBitmap(IDB_BITMAP_INFO2);
m_a_cbBitmaps[2].LoadBitmap(IDB_BITMAP_INFO3);
m_a_cbBitmaps[3].LoadBitmap(IDB_BITMAP_INFO4);
m_a_cbBitmaps[4].LoadBitmap(IDB_BITMAP_INFO5);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//***************************************************************************
void CPA_Meca_InformationDialog::OnOK()
{
KillTimer(C_INFO_DIALOG_TIMER);
EndDialog(IDOK);
}
//***************************************************************************
void CPA_Meca_InformationDialog::OnTimer(UINT nIDEvent)
{
static BOOL s_bFirstPass = TRUE;
static char s_cCurrentBitmapIndex = -1; //To begin with first bitmap
static char s_cIndexIncrement = 1;
s_cCurrentBitmapIndex += s_cIndexIncrement;
if ( ! s_bFirstPass )
{
if ( s_cCurrentBitmapIndex % (C_NUMBER_OF_BITMAPS-1) == 0 )
s_cIndexIncrement = -s_cIndexIncrement;
}
else
s_bFirstPass = FALSE;
((CStatic *)GetDlgItem(IDC_STATIC_IMAGE))->SetBitmap(HBITMAP(m_a_cbBitmaps[s_cCurrentBitmapIndex]));
CDialog::OnTimer(nIDEvent);
}