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

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.

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

// AddServerDevicePane.cpp : implementation file
//

#include "stdafx.h"
#include "scts3devman.h"
#include "AddServerDevicePane.h"
#include "ServerDevicePane.h"
#include "ServerDevicePane2.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAddServerDevicePane dialog


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


void CAddServerDevicePane::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAddServerDevicePane)
	DDX_Control(pDX, IDC_SDEVTYPES, m_sdevs);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddServerDevicePane, CDialog)
	//{{AFX_MSG_MAP(CAddServerDevicePane)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddServerDevicePane message handlers

BOOL CAddServerDevicePane::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	/* Load image list */
	imgList.Create(16,16,ILC_MASK | ILC_COLOR8,2,0);
	imgList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_SDEVDISCOVER)));
	imgList.Add(LoadIcon(AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_SDEVMANUAL)));
	m_sdevs.SetImageList(&imgList,LVSIL_SMALL);

	m_sdevs.InsertItem(0,"Discover server device",0);
	m_sdevs.InsertItem(1,"Add server device manually",1);
	m_sdevs.SetItemState(0,LVIS_SELECTED,LVIS_SELECTED);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAddServerDevicePane::OnOK() 
{
	if (m_sdevs.GetItemState(0,LVIS_SELECTED))
	{
		mainPane->currentRightChildPane=new CServerDevicePane();
		mainPane->currentRightChildPane->Create(IDD_SERVERDEVICEPANE,mainPane->currentRightPane);
	}
	if (m_sdevs.GetItemState(1,LVIS_SELECTED))
	{
		mainPane->currentRightChildPane=new CServerDevicePane2(0);
		mainPane->currentRightChildPane->Create(IDD_SERVERDEVICEPANE2,mainPane->currentRightPane);
	}
	CDialog::OnOK();
}
