home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / MFC / SAMPLES / CHKBOOK / CHECKDOC.H_ / CHECKDOC.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  2.8 KB  |  90 lines

  1. // checkdoc.h : interface of the CChkBookDoc class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. // This class implements all the details about the transaction-based,
  15. // fixed-length record document that are specific to the check book
  16. // document.  Generic transaction-based, fixed-length record document
  17. // behavior is implemented in its based class, CFixedLenRecDoc.
  18. /////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. class CChkBookDoc : public CFixedLenRecDoc
  22. {
  23. protected:  // create from dyunamic creation only
  24.     CChkBookDoc();
  25.     DECLARE_DYNCREATE(CChkBookDoc)
  26.  
  27. // Attributes
  28.     UINT m_nActiveRecord;
  29.  
  30.     // Extra header (in addition to that of CFixedLenRecDoc)
  31.     struct
  32.     {
  33.         DWORD dwFileSignature;
  34.         UINT nFirstCheckNo;
  35.     } m_extraHeader;
  36.  
  37.     // Each check is written in a fixed length record.
  38.     struct
  39.     {
  40.         DWORD   dwCents;
  41.         char    szPayTo[40];
  42.         char    szDate[10];
  43.         char    szMemo[40];
  44.     } m_record;
  45.  
  46. // Overrides of CFixedLenRecDoc and CDocument
  47.     BOOL OnOpenDocument(const char* pszPathName);
  48.     BOOL OnSaveDocument(const char* pszPathName);
  49.     BOOL SaveModified();
  50.     void* OnCreateNewRecord(int nNewRecordIndex);
  51.     BOOL OnReadExtraHeader();
  52.     void OnWriteExtraHeader(BOOL bNewHeader);
  53.     
  54. // Operations, called by book view and check view
  55.     void GetCheck(UINT nCheckNo, DWORD& dwCents, CString& strPayTo,
  56.             CString& strDate, CString& strMemo);
  57.     void UpdateCheck(CView* pSourceView, UINT nCheckNo, DWORD dwCents, 
  58.             const char* szPayTo, const char* szDate, 
  59.             const char* szMemo);
  60.     void ChangeSelectionNextCheckNo(BOOL bNext);
  61.     void ChangeSelectionToCheckNo(UINT nCheckNo);
  62.     UINT GetActiveCheckNo();
  63.     UINT GetFirstCheckNo();
  64.     UINT GetLastCheckNo();
  65.     
  66. // Implementation
  67.     void UpdateIniFileWithDocPath(const char* pszPathName);
  68.     BOOL MaybeCommitDirtyCheck();
  69.     void PackRecord(DWORD dwCents, const char* szPayTo, const char* szDate, 
  70.         const char* szMemo);
  71.     void ParseRecord(DWORD& dwCents, CString& strPayTo,
  72.             CString& strDate, CString& strMemo);
  73.     UINT CheckNoToRecordIndex(UINT nCheckNo);
  74.     UINT RecordIndexToCheckNo(UINT nRecordIndex);
  75.  
  76. public:
  77.     virtual ~CChkBookDoc();
  78.  
  79. // Generated message map functions
  80. protected:
  81.     //{{AFX_MSG(CChkBookDoc)
  82.     afx_msg void NewCheck();
  83.     afx_msg void OnNextCheck();
  84.     afx_msg void OnUpdateNextCheck(CCmdUI* pCmdUI);
  85.     afx_msg void OnPrevCheck();
  86.     afx_msg void OnUpdatePrevCheck(CCmdUI* pCmdUI);
  87.     //}}AFX_MSG
  88.     DECLARE_MESSAGE_MAP()
  89. };
  90.