home *** CD-ROM | disk | FTP | other *** search
- // demoopt.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "mfcdemo.h"
- #include "demoopt.h"
- #include "demotbl.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoOptionsDialog dialog
-
-
- CDemoOptionsDialog::CDemoOptionsDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CDemoOptionsDialog::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDemoOptionsDialog)
- m_Columns = 0;
- m_GrowHorizontal = FALSE;
- m_GrowVertical = FALSE;
- m_Rows = 0;
- //}}AFX_DATA_INIT
- }
-
- void CDemoOptionsDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDemoOptionsDialog)
- DDX_Text(pDX, IDC_COLUMNS, m_Columns);
- DDV_MinMaxUInt(pDX, m_Columns, 1, 16380);
- DDX_Check(pDX, IDC_OPT_GROW_HORIZONTAL, m_GrowHorizontal);
- DDX_Check(pDX, IDC_OPT_GROW_VERTICAL, m_GrowVertical);
- DDX_Text(pDX, IDC_ROWS, m_Rows);
- DDV_MinMaxUInt(pDX, m_Rows, 1, 16380);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CDemoOptionsDialog, CDialog)
- //{{AFX_MSG_MAP(CDemoOptionsDialog)
- ON_BN_CLICKED(IDAPPLY, OnApply)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoOptionsDialog public protocol
-
- void CDemoOptionsDialog::InitializeFrom( CDemoTableControl * aCKTBL )
- {
- cktbl = aCKTBL;
-
- m_Columns = cktbl->GetColumns();
- m_Rows = cktbl->GetRows();
-
- //m_AdjustColWidth = (cktbl->GetFlags() & CKTBL_RESIZE_COLUMNS)!=0;
- //m_AdjustRowHeight = (cktbl->GetFlags() & CKTBL_RESIZE_ROWS)!=0;
- //m_ShowGridLines = (cktbl->GetFlags() & CKTBL_SHOW_GRID)!=0;
- m_GrowHorizontal = cktbl->m_GrowHorizontal;
- m_GrowVertical = cktbl->m_GrowVertical;
- }
-
- void CDemoOptionsDialog::ApplyData()
- {
- // TODO: Add your control notification handler code here
-
- cktbl->SetSize( m_Rows, m_Columns );
- //cktbl->SetFlagsTo( CKTBL_RESIZE_COLUMNS, m_AdjustColWidth );
- //cktbl->SetFlagsTo( CKTBL_RESIZE_ROWS, m_AdjustRowHeight );
- //cktbl->SetFlagsTo( CKTBL_SHOW_GRID, m_ShowGridLines );
- cktbl->m_GrowHorizontal = m_GrowHorizontal;
- cktbl->m_GrowVertical = m_GrowVertical;
- cktbl->Invalidate();
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CDemoOptionsDialog message handlers
-
- void CDemoOptionsDialog::OnApply()
- {
- // TODO: Add your control notification handler code here
-
- if(UpdateData()) {
- ApplyData();
- }
- }
-
- void CDemoOptionsDialog::OnOK()
- {
- // TODO: Add extra validation here
-
- CDialog::OnOK();
- ApplyData();
- }
-
-
-