// CombinePropPage.cpp : implementation file // #include "stdafx.h" #include "CombinePropPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCombinePropPage property page IMPLEMENT_DYNCREATE(CCombinePropPage, CPropertyPage) CCombinePropPage::CCombinePropPage() : CPropertyPage(CCombinePropPage::IDD) { //{{AFX_DATA_INIT(CCombinePropPage) m_nCombineType = -1; m_nCombineFactor = 2; m_nCombineFactorSlider = 0; //}}AFX_DATA_INIT } CCombinePropPage::~CCombinePropPage() { } void CCombinePropPage::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCombinePropPage) DDX_CBIndex(pDX, IDC_COMBO_COMBINETYPE, m_nCombineType); DDX_Text(pDX, IDC_EDIT_COMBINEFACTOR, m_nCombineFactor); DDV_MinMaxInt(pDX, m_nCombineFactor, 0, 100); DDX_Slider(pDX, IDC_SLIDER_COMBINEFACTOR, m_nCombineFactorSlider); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCombinePropPage, CPropertyPage) //{{AFX_MSG_MAP(CCombinePropPage) ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_COMBINEFACTOR, OnCustomdrawSliderCombinefactor) ON_EN_KILLFOCUS(IDC_EDIT_COMBINEFACTOR, OnKillfocusEditCombinefactor) ON_CBN_SELCHANGE(IDC_COMBO_COMBINETYPE, OnSelchangeComboCombinetype) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCombinePropPage message handlers BOOL CCombinePropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); // TODO: Add extra initialization here CDemo* pTheApp = (CDemo*) AfxGetApp(); m_nCombineFactor = pTheApp->Options.COMB_nCombineFactor; m_nCombineType = pTheApp->Options.COMB_nCombineType; UpdateData(FALSE); OnKillfocusEditCombinefactor(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CCombinePropPage::OnCustomdrawSliderCombinefactor(NMHDR* pNMHDR, LRESULT* pResult) { *pResult = 0; UpdateData(TRUE); if(m_nCombineFactor != m_nCombineFactorSlider) SetModified(TRUE); m_nCombineFactor = m_nCombineFactorSlider ; UpdateData(FALSE); } void CCombinePropPage::OnKillfocusEditCombinefactor() { SetModified(TRUE); UpdateData(TRUE); m_nCombineFactorSlider = m_nCombineFactor ; UpdateData(FALSE); } void CCombinePropPage::OnSelchangeComboCombinetype() { SetModified(TRUE); } BOOL CCombinePropPage::OnApply() { GetDlgItem(IDC_COMBO_COMBINETYPE)->SetFocus(); UpdateData(TRUE); CDemo* pTheApp = (CDemo*) AfxGetApp(); pTheApp->Options.COMB_nCombineFactor = m_nCombineFactor ; pTheApp->Options.COMB_nCombineType = m_nCombineType ; return TRUE; } void CCombinePropPage::OnOK() { CPropertyPage::OnOK(); }