#include "pch.h"
#include "GenericBkMFC.h"
#include "DlgListBoxST.h"

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

CDlgListBoxST::CDlgListBoxST(CWnd* pParent, CResourceServerST*	m_pIcons)
	: CDialog(CDlgListBoxST::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgListBoxST)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	m_pIconsDLL = m_pIcons;
}

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

	DDX_Control(pDX, IDC_LBXST, m_lbxListBox);
}

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

BOOL CDlgListBoxST::OnInitDialog() 
{
	CDialog::OnInitDialog();


	CreateImageList();

	// Associate image list to list box
	m_lbxListBox.SetImageList(&m_ImageList);

	m_lbxListBox.AddString(_T("Item 1"), 0);
	m_lbxListBox.AddString(_T("Item 2\nSecond line"), 1);
	m_lbxListBox.AddString(_T("Item 3\n(Disabled)"), 2);
	m_lbxListBox.AddString(_T("Item 4"), 3);
	m_lbxListBox.AddString(_T("Item 5"), 4);
	m_lbxListBox.AddString(_T("Item 6"), 5);
	m_lbxListBox.AddString(_T("Item 7\nLast line"), 6);

	m_lbxListBox.EnableItem(2, FALSE);
	m_lbxListBox.SetCurSel(0);

	return TRUE;
} // End of OnInitDialog

void CDlgListBoxST::OnOK()
{
} // End of OnOK

void CDlgListBoxST::OnCancel()
{
} // End of OnCancel

void CDlgListBoxST::CreateImageList()
{
	BOOL	bRetValue = FALSE;
	HICON	hIcon = NULL;

	// Create image list
	bRetValue = m_ImageList.Create(32, 32, ILC_COLOR32 | ILC_MASK, 5, 1);
	ASSERT(bRetValue == TRUE);

	// Add some icons
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_GENERAL_DRIVE02, 32, 32));
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_GENERAL_CAMERA01, 32, 32));
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_SET01_ADD, 32, 32));
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_GENERAL_TIME01, 32, 32));
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_GENERAL_USER04, 32, 32));
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_GENERAL_KEY08, 32, 32));
	m_ImageList.Add(m_pIconsDLL->LoadIcon(DLL_IDI_GENERAL_LOCK07, 32, 32));
} // End of CreateImageList
