#include "pch.h"
#include "GenericBkMFC.h"
#include "DlgXPStyleButtonST.h"

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

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

	m_pIconsDLL = m_pIcons;
}

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

	DDX_Control(pDX, IDC_BUTTON4, m_btnXP[0]);
	DDX_Control(pDX, IDC_BUTTON5, m_btnXP[1]);
	DDX_Control(pDX, IDC_BUTTON6, m_btnXP[2]);
}

BEGIN_MESSAGE_MAP(CDlgXPStyleButtonST, CDialog)
	//{{AFX_MSG_MAP(CDlgXPStyleButtonST)
	//}}AFX_MSG_MAP

	ON_BN_CLICKED(IDC_CHKTOOLBAR, OnChkToolbar)
END_MESSAGE_MAP()

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

	m_btnXP[0].m_ptImageOrg.x += 4;
	m_btnXP[0].SetThemeHelper(&m_ThemeHelper);
	m_btnXP[0].SetIcon(m_pIconsDLL->LoadIcon(DLL_IDI_SET04_OK, 24, 24));
	m_btnXP[1].m_ptImageOrg.x += 4;
	m_btnXP[1].SetThemeHelper(&m_ThemeHelper);
	m_btnXP[1].SetIcon(m_pIconsDLL->LoadIcon(DLL_IDI_SET04_CANCEL, 24, 24));
	m_btnXP[2].m_ptImageOrg.x += 4;
	m_btnXP[2].SetThemeHelper(&m_ThemeHelper);
	m_btnXP[2].SetIcon(m_pIconsDLL->LoadIcon(DLL_IDI_SET04_INFO, 24, 24));

	// Enable checkbox only if running under XP
	if (m_ThemeHelper.IsAppThemed())	GetDlgItem(IDC_CHKTOOLBAR)->EnableWindow(TRUE);

	return TRUE;
} // End of OnInitDialog

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

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

void CDlgXPStyleButtonST::OnChkToolbar() 
{
	if (((CButton*)GetDlgItem(IDC_CHKTOOLBAR))->GetCheck())
	{
		m_btnXP[0].DrawAsToolbar(TRUE);
		m_btnXP[1].DrawAsToolbar(TRUE);
		m_btnXP[2].DrawAsToolbar(TRUE);
	} // if
	else
	{
		m_btnXP[0].DrawAsToolbar(FALSE);
		m_btnXP[1].DrawAsToolbar(FALSE);
		m_btnXP[2].DrawAsToolbar(FALSE);
	} // else
} // End of OnChkToolbar
