home *** CD-ROM | disk | FTP | other *** search
- // viewopti.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "mfcdemo.h"
- #include "viewopti.h"
- #include "demotbl.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CViewOptionsDialog dialog
-
-
- CViewOptionsDialog::CViewOptionsDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CViewOptionsDialog::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CViewOptionsDialog)
- m_ShowGrid = FALSE;
- m_ShowSelection = FALSE;
- //}}AFX_DATA_INIT
- }
-
- void CViewOptionsDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CViewOptionsDialog)
- DDX_Check(pDX, IDC_VIEW_SHOWGRID, m_ShowGrid);
- DDX_Check(pDX, IDC_VIEW_SHOWSELECTION, m_ShowSelection);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CViewOptionsDialog, CDialog)
- //{{AFX_MSG_MAP(CViewOptionsDialog)
- ON_BN_CLICKED(IDAPPLY, OnApply)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CViewOptionsDialog
-
-
- void CViewOptionsDialog::InitializeFrom( CDemoTableControl * aCKTBL )
- {
- DWORD flags = aCKTBL->GetFlags();
- cktbl = aCKTBL;
-
- m_ShowGrid = (flags&CKTBL_SHOW_GRID)!=0;
- m_ShowSelection = (flags&CKTBL_SHOW_SELECTION)!=0;
- }
-
- void CViewOptionsDialog::ApplyData()
- {
- // TODO: Add your control notification handler code here
-
- cktbl->SetFlagsTo( CKTBL_SHOW_GRID, m_ShowGrid );
- cktbl->SetFlagsTo( CKTBL_SHOW_SELECTION, m_ShowSelection );
- cktbl->Invalidate();
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CViewOptionsDialog message handlers
-
- void CViewOptionsDialog::OnApply()
- {
- // TODO: Add your control notification handler code here
- if(UpdateData()) {
- ApplyData();
- }
- }
-
- void CViewOptionsDialog::OnOK()
- {
- // TODO: Add extra validation here
-
- CDialog::OnOK();
- ApplyData();
- }
-