// FindDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ContentTrack.h"
#include "FindDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFindDlg dialog


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


void CFindDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFindDlg)
	DDX_Control(pDX, IDC_LIST_KEYTYPE, m_listCtrlKeyType);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CFindDlg message handlers

BOOL CFindDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	for (int x=0;x<MAX_KEYTYPE;x++)
	{
		int index = this->m_listCtrlKeyType.InsertString(x,NAME_KEYTYPE[x]);
		this->m_listCtrlKeyType.SetItemData(index,x);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CFindDlg::OnOK() 
{
	int count = this->m_listCtrlKeyType.GetSelCount();
	int *items = new int(count);
	this->m_listCtrlKeyType.GetSelItems(count,items);
	for (int x=0;x<count;x++)
	{
		int index = this->m_listCtrlKeyType.GetItemData(items[x]);
		m_listKeyType.AddTail((void *)index);
	}
	delete items;
	
	CDialog::OnOK();
}
