/*******************************************************************

Copyright (c) 2004 Open Mobile Alliance, Ltd.  All Rights Reserved.

This software is made available under the usage and distribution terms 
covered by the Common Public License 1.0 and by using this software you
are bound by the terms and conditions of the same.

EXCEPT AS EXPRESSLY SET FORTH IN THE COMMON PUBLIC LICENSE,
THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
   
Each recipient is solely responsible for determining the 
appropriateness of using and distributing this program and assumes 
all risks associated with its exercise of rights under the Common 
Public License, including but not limited to the risks and 
costs of program errors, compliance with applicable laws, 
damage to or loss of data, programs or equipment, and 
unavailability or interruption of operations.

********************************************************************/

// WaitPane.cpp : implementation file
//

#include "stdafx.h"
#include "SCTS3DevMan.h"
#include "WaitPane.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CWaitPane dialog


CWaitPane::CWaitPane(CWnd* pParent /*=NULL*/)
	: CDialog(CWaitPane::IDD, pParent)
{
	//{{AFX_DATA_INIT(CWaitPane)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CWaitPane::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CWaitPane)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CWaitPane, CDialog)
	//{{AFX_MSG_MAP(CWaitPane)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWaitPane message handlers

BOOL CWaitPane::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	SetTimer(0,500,NULL);
	currentIcon=0;
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CWaitPane::OnTimer(UINT nIDEvent) 
{
	currentIcon=(currentIcon+1)%8;
	((CStatic *)GetDlgItem(IDC_WAITICON))->SetIcon(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WAIT1+currentIcon)));
	if (sctsTerminate())
	{
		EndDialog(IDOK);
	}
	CDialog::OnTimer(nIDEvent);
}

BOOL CWaitPane::PreTranslateMessage(MSG* pMsg) 
{
	/* Disable ESC  and Enter */
	if (pMsg->message==WM_KEYDOWN && (pMsg->wParam==VK_ESCAPE || pMsg->wParam==VK_RETURN)) return TRUE;
	return CDialog::PreTranslateMessage(pMsg);
}
