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

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Biblio.h"
  6.  
  7. #include "MainFrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMainFrame
  17.  
  18. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  21.     //{{AFX_MSG_MAP(CMainFrame)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code !
  24.     ON_WM_CREATE()
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. static UINT indicators[] =
  29. {
  30.     ID_SEPARATOR,           // status line indicator
  31.     ID_INDICATOR_CAPS,
  32.     ID_INDICATOR_TRANSACT,
  33. };
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CMainFrame construction/destruction
  37.  
  38. CMainFrame::CMainFrame()
  39. {
  40.     // TODO: add member initialization code here
  41.     
  42. }
  43.  
  44. CMainFrame::~CMainFrame()
  45. {
  46. }
  47.  
  48. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  49. {
  50.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  51.         return -1;
  52.     
  53.     if (!m_wndToolBar.Create(this) ||
  54.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  55.     {
  56.         TRACE0("Failed to create toolbar\n");
  57.         return -1;      // fail to create
  58.     }
  59.  
  60.     if (!m_wndStatusBar.Create(this) ||
  61.         !m_wndStatusBar.SetIndicators(indicators,
  62.           sizeof(indicators)/sizeof(UINT)))
  63.     {
  64.         TRACE0("Failed to create status bar\n");
  65.         return -1;      // fail to create
  66.     }
  67.  
  68.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  69.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  70.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  71.  
  72.     // TODO: Delete these three lines if you don't want the toolbar to
  73.     //  be dockable
  74.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  75.     EnableDocking(CBRS_ALIGN_ANY);
  76.     DockControlBar(&m_wndToolBar);
  77.  
  78.     return 0;
  79. }
  80.  
  81. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  82. {
  83.     // TODO: Modify the Window class or styles here by modifying
  84.     //  the CREATESTRUCT cs
  85.  
  86.     return CFrameWnd::PreCreateWindow(cs);
  87. }
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CMainFrame diagnostics
  91.  
  92. #ifdef _DEBUG
  93. void CMainFrame::AssertValid() const
  94. {
  95.     CFrameWnd::AssertValid();
  96. }
  97.  
  98. void CMainFrame::Dump(CDumpContext& dc) const
  99. {
  100.     CFrameWnd::Dump(dc);
  101. }
  102.  
  103. #endif //_DEBUG
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // CMainFrame message handlers
  107.