home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / Cell Control / DATA1.CAB / VCDEMO_Files / UndoDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-11  |  1.9 KB  |  83 lines

  1. // UndoDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vcdemo.h"
  6. #include "UndoDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CUndoDlg dialog
  16.  
  17.  
  18. CUndoDlg::CUndoDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CUndoDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CUndoDlg)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. void CUndoDlg::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(CUndoDlg)
  31.     DDX_Control(pDX, IDC_SGCTRL1, m_ctrl);
  32.     //}}AFX_DATA_MAP
  33. }
  34.  
  35.  
  36. BEGIN_MESSAGE_MAP(CUndoDlg, CDialog)
  37.     //{{AFX_MSG_MAP(CUndoDlg)
  38.     ON_BN_CLICKED(IDC_BUTTON_DISCARD, OnButtonDiscard)
  39.     ON_BN_CLICKED(IDC_BUTTON_REDO, OnButtonRedo)
  40.     ON_BN_CLICKED(IDC_BUTTON_UNDO, OnButtonUndo)
  41.     //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CUndoDlg message handlers
  46.  
  47. void CUndoDlg::OnButtonDiscard() 
  48. {
  49.     // TODO: Add your control notification handler code here
  50.     m_ctrl.DoDiscardUndo();
  51. }
  52.  
  53. void CUndoDlg::OnButtonRedo() 
  54. {
  55.     // TODO: Add your control notification handler code here
  56.     if( m_ctrl.DoGetRedoState() )
  57.         m_ctrl.DoRedo();
  58.     else
  59.         AfxMessageBox( "Can't redo now" );
  60. }
  61.  
  62. void CUndoDlg::OnButtonUndo() 
  63. {
  64.     // TODO: Add your control notification handler code here
  65.     if( m_ctrl.DoGetUndoState() )
  66.         m_ctrl.DoUndo();
  67.     else
  68.         AfxMessageBox( "Can't undo now" );
  69. }
  70.  
  71. BOOL CUndoDlg::OnInitDialog() 
  72. {
  73.     CDialog::OnInitDialog();
  74.     
  75.     // TODO: Add extra initialization here
  76.     m_ctrl.SetPageLabelVisible( FALSE );    
  77.     COleVariant var( "VCDEMO" );
  78.     m_ctrl.DoSetMessageTitle( var );
  79.  
  80.     return TRUE;  // return TRUE unless you set the focus to a control
  81.                   // EXCEPTION: OCX Property Pages should return FALSE
  82. }
  83.