home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c08 / recordvw / bibview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.8 KB  |  111 lines

  1. // BiblioView.cpp : implementation of the CBiblioView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Biblio.h"
  6.  
  7. #include "BibSet.h"
  8. #include "BibDoc.h"
  9. #include "BibView.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CBiblioView
  19.  
  20. IMPLEMENT_DYNCREATE(CBiblioView, CDaoRecordView)
  21.  
  22. BEGIN_MESSAGE_MAP(CBiblioView, CDaoRecordView)
  23.     //{{AFX_MSG_MAP(CBiblioView)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CBiblioView construction/destruction
  31.  
  32. CBiblioView::CBiblioView()
  33.     : CDaoRecordView(CBiblioView::IDD)
  34. {
  35.     //{{AFX_DATA_INIT(CBiblioView)
  36.     m_pSet = NULL;
  37.     //}}AFX_DATA_INIT
  38.     // TODO: add construction code here
  39.  
  40. }
  41.  
  42. CBiblioView::~CBiblioView()
  43. {
  44. }
  45.  
  46. void CBiblioView::DoDataExchange(CDataExchange* pDX)
  47. {
  48.     CDaoRecordView::DoDataExchange(pDX);
  49.     //{{AFX_DATA_MAP(CBiblioView)
  50.     DDX_FieldText(pDX, IDC_TITLE, m_pSet->m_Title, m_pSet);
  51.     DDX_FieldText(pDX, IDC_ISBN, m_pSet->m_ISBN, m_pSet);
  52.     DDX_FieldText(pDX, IDC_YEAR_PUBLISHED, m_pSet->m_Year_Published, m_pSet);
  53.     DDX_FieldText(pDX, IDC_SUBJECT, m_pSet->m_Subject, m_pSet);
  54.     DDX_FieldText(pDX, IDC_NOTES, m_pSet->m_Notes, m_pSet);
  55.     DDX_FieldText(pDX, IDC_COMMENTS, m_pSet->m_Comments, m_pSet);
  56.     DDX_FieldText(pDX, IDC_DESCRIPTION, m_pSet->m_Description, m_pSet);
  57.     DDX_FieldText(pDX, IDC_PUBID, m_pSet->m_PubID, m_pSet);
  58.     //}}AFX_DATA_MAP
  59. }
  60.  
  61. BOOL CBiblioView::PreCreateWindow(CREATESTRUCT& cs)
  62. {
  63.     // TODO: Modify the Window class or styles here by modifying
  64.     //  the CREATESTRUCT cs
  65.  
  66.     return CDaoRecordView::PreCreateWindow(cs);
  67. }
  68.  
  69. void CBiblioView::OnInitialUpdate()
  70. {
  71.     m_pSet = &GetDocument()->m_biblioSet;
  72.     m_pSet->m_strFilter = "[PubID] = 13";
  73.     m_pSet->m_strSort = "PubID";
  74.     CDaoRecordView::OnInitialUpdate();
  75.  
  76.     GetParentFrame()->RecalcLayout();
  77.     ResizeParentToFit();
  78. }
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CBiblioView diagnostics
  82.  
  83. #ifdef _DEBUG
  84. void CBiblioView::AssertValid() const
  85. {
  86.     CDaoRecordView::AssertValid();
  87. }
  88.  
  89. void CBiblioView::Dump(CDumpContext& dc) const
  90. {
  91.     CDaoRecordView::Dump(dc);
  92. }
  93.  
  94. CBiblioDoc* CBiblioView::GetDocument() // non-debug version is inline
  95. {
  96.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBiblioDoc)));
  97.     return (CBiblioDoc*)m_pDocument;
  98. }
  99. #endif //_DEBUG
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102. // CBiblioView database support
  103. CDaoRecordset* CBiblioView::OnGetRecordset()
  104. {
  105.     return m_pSet;
  106. }
  107.  
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CBiblioView message handlers
  111.