// This file was generated by WTL Dialog wizard 
// ParameterDialog.cpp : Implementation of CParameterDialog

#include "stdafx.h"
#include "ParameterDialog.h"

// CParameterDialog
CParameterDialog::CParameterDialog()
{
}

CParameterDialog::~CParameterDialog()
{
}

LRESULT CParameterDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	DoDataExchange();
	
	m_wndSpinColor.SetRange(2, 256);
	m_wndSpinSpeed.SetRange(1, 10);
	
	m_wndSpinColor.SetPos(16);
	m_wndSpinSpeed.SetPos(3);

	return 1;  // Let the system set the focus
}

LRESULT CParameterDialog::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
//	DoDataExchange(TRUE);
//	EndDialog(wID);
	return 0;
}

LRESULT CParameterDialog::OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
//	EndDialog(wID);
	return 0;
}

void CParameterDialog::onChange()
{
	if (m_onParameterChangeDelegate) {
		m_onParameterChangeDelegate(GetParameter());
	}
}

LRESULT CParameterDialog::OnBnClickedButtonUpdate(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
	onChange();

	return 0;
}

Parameter CParameterDialog::GetParameter()
{
	Parameter param;
	param.nofs = IsDlgButtonChecked(IDC_CHECK_NOFS);
	param.speed = m_wndSpinSpeed.GetPos();
	param.color = m_wndSpinColor.GetPos();
	param.iebug = IsDlgButtonChecked(IDC_CHECK_IEBUG);
	return param;
}

