/*****************************************************************************
* Copyright (c) 2000 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/

// PropPgE1R2Ctry.cpp : implementation file
//

#include "stdafx.h"
#include "digidbp.h"
#include "PropPgE1R2Ctry.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPropPgE1R2Ctry property page

IMPLEMENT_DYNCREATE(CPropPgE1R2Ctry, CPropertyPage)

CPropPgE1R2Ctry::CPropPgE1R2Ctry() : CPropertyPage(CPropPgE1R2Ctry::IDD)
{
	//{{AFX_DATA_INIT(CPropPgE1R2Ctry)
	m_iE1R2Ctry = -1;
	//}}AFX_DATA_INIT

	try
	{
		m_E1R2CtryMap.Init(SValueMap::MAP_E1R2_R2SWITCHTYPE);		
	}

	catch (CAffirmException ae)
	{
	}

}

CPropPgE1R2Ctry::~CPropPgE1R2Ctry()
{
}

void CPropPgE1R2Ctry::SetE1R2Ctry(DWORD const dwE1R2Ctry)
{
   try
   {
      m_iE1R2Ctry = m_E1R2CtryMap.ToIndex(dwE1R2Ctry);
      if (m_hWnd != NULL) UpdateData(FALSE);
   }
   catch (CAffirmException ae)
   {
   }
}

DWORD CPropPgE1R2Ctry::GetE1R2Ctry(void)
{
   DWORD dwE1R2Ctry = 0;

   try
   {
      if (m_hWnd != NULL) UpdateData();
      dwE1R2Ctry = m_E1R2CtryMap.FromIndex(m_iE1R2Ctry);
   }
   catch (CAffirmException ae)
   {
   }

   return dwE1R2Ctry;
}



void CPropPgE1R2Ctry::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropPgE1R2Ctry)
	DDX_Control(pDX, IDC_E1R2Country, m_ctrlE1R2Ctry);
	DDX_CBIndex(pDX, IDC_E1R2Country, m_iE1R2Ctry);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropPgE1R2Ctry, CPropertyPage)
	//{{AFX_MSG_MAP(CPropPgE1R2Ctry)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropPgE1R2Ctry message handlers

BOOL CPropPgE1R2Ctry::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	for (int i = 0; i < m_E1R2CtryMap.astrDisplayNames.GetSize(); i++)
		m_ctrlE1R2Ctry.AddString(m_E1R2CtryMap.astrDisplayNames[i]);

	UpdateData(FALSE); // Send variable data to the controls
		
	return TRUE;
}