home *** CD-ROM | disk | FTP | other *** search
- // actiondi.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "mfcdemo.h"
- #include "actiondi.h"
- #include "demotbl.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CActionDialog dialog
-
-
- CActionDialog::CActionDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CActionDialog::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CActionDialog)
- m_EditCells = FALSE;
- m_ControlSelect = FALSE;
- m_EditColumnLabels = FALSE;
- m_EditRowLabels = FALSE;
- m_ExtendedSelect = FALSE;
- m_SelectAll = FALSE;
- m_SelectCells = FALSE;
- m_SelectColumns = FALSE;
- m_SelectRows = FALSE;
- m_ShiftSelect = FALSE;
- m_ResizeColumns = FALSE;
- m_ResizeRows = FALSE;
- //}}AFX_DATA_INIT
- }
-
- void CActionDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CActionDialog)
- DDX_Check(pDX, IDC_ACTION_EDITCELLS, m_EditCells);
- DDX_Check(pDX, IDC_ACTION_CONTROLSELECT, m_ControlSelect);
- DDX_Check(pDX, IDC_ACTION_EDITCOLUMNLABELS, m_EditColumnLabels);
- DDX_Check(pDX, IDC_ACTION_EDITROWLABELS, m_EditRowLabels);
- DDX_Check(pDX, IDC_ACTION_EXTENDEDSELECT, m_ExtendedSelect);
- DDX_Check(pDX, IDC_ACTION_SELECTALL, m_SelectAll);
- DDX_Check(pDX, IDC_ACTION_SELECTCELLS, m_SelectCells);
- DDX_Check(pDX, IDC_ACTION_SELECTCOLUMNS, m_SelectColumns);
- DDX_Check(pDX, IDC_ACTION_SELECTROWS, m_SelectRows);
- DDX_Check(pDX, IDC_ACTION_SHIFTSELECT, m_ShiftSelect);
- DDX_Check(pDX, IDC_ACTION_RESIZE_COLUMNS, m_ResizeColumns);
- DDX_Check(pDX, IDC_ACTION_RESIZE_ROWS, m_ResizeRows);
- //}}AFX_DATA_MAP
- }
-
- BEGIN_MESSAGE_MAP(CActionDialog, CDialog)
- //{{AFX_MSG_MAP(CActionDialog)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CActionDialog public protocol
-
- void CActionDialog::InitializeFrom( CDemoTableControl * aCKTBL )
- {
- DWORD flags = aCKTBL->GetFlags();
- cktbl = aCKTBL;
-
- m_EditCells = (flags&CKTBL_EDIT_CELLS)!=0;
- m_EditColumnLabels = (flags&CKTBL_EDIT_COLUMN_LABELS)!=0;
- m_EditRowLabels = (flags&CKTBL_EDIT_ROW_LABELS)!=0;
-
- m_ShiftSelect = (flags&CKTBL_SHIFT_SELECT)!=0;
- m_ControlSelect = (flags&CKTBL_CONTROL_SELECT)!=0;
- m_ExtendedSelect = (flags&CKTBL_EXTENDED_SELECT)!=0;
-
- m_SelectAll = (flags&CKTBL_SELECT_ALL)!=0;
- m_SelectCells = (flags&CKTBL_SELECT_CELLS)!=0;
- m_SelectColumns = (flags&CKTBL_SELECT_COLUMNS)!=0;
- m_SelectRows = (flags&CKTBL_SELECT_ROWS)!=0;
-
- m_ResizeColumns = (flags&CKTBL_RESIZE_COLUMNS)!=0;
- m_ResizeRows = (flags&CKTBL_RESIZE_ROWS)!=0;
- }
-
- void CActionDialog::ApplyData()
- {
- // TODO: Add your control notification handler code here
-
- cktbl->SetFlagsTo( CKTBL_EDIT_CELLS, m_EditCells );
- cktbl->SetFlagsTo( CKTBL_EDIT_COLUMN_LABELS, m_EditColumnLabels );
- cktbl->SetFlagsTo( CKTBL_EDIT_ROW_LABELS, m_EditRowLabels );
-
- cktbl->SetFlagsTo( CKTBL_SHIFT_SELECT, m_ShiftSelect );
- cktbl->SetFlagsTo( CKTBL_CONTROL_SELECT, m_ControlSelect );
- cktbl->SetFlagsTo( CKTBL_EXTENDED_SELECT, m_ExtendedSelect );
-
- cktbl->SetFlagsTo( CKTBL_SELECT_ALL, m_SelectAll );
- cktbl->SetFlagsTo( CKTBL_SELECT_CELLS, m_SelectCells );
- cktbl->SetFlagsTo( CKTBL_SELECT_COLUMNS, m_SelectColumns );
- cktbl->SetFlagsTo( CKTBL_SELECT_ROWS, m_SelectRows );
-
- cktbl->SetFlagsTo( CKTBL_RESIZE_COLUMNS, m_ResizeColumns );
- cktbl->SetFlagsTo( CKTBL_RESIZE_ROWS, m_ResizeRows );
-
- cktbl->Invalidate();
- }
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CActionDialog message handlers
-
- void CActionDialog::OnOK()
- {
- // TODO: Add extra validation here
-
- CDialog::OnOK();
- ApplyData();
- }
-