home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / WTJ9403.ZIP / CONTAIN / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1994-01-06  |  3KB  |  116 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "contain.h"
  6.  
  7. #include "mainfrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMainFrame
  16.  
  17. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  20.     //{{AFX_MSG_MAP(CMainFrame)
  21.         // NOTE - the ClassWizard will add and remove mapping macros here.
  22.         //    DO NOT EDIT what you see in these blocks of generated code !
  23.     ON_WM_CREATE()
  24.     //}}AFX_MSG_MAP
  25.     // Global help commands
  26.     ON_COMMAND(ID_HELP_INDEX, CMDIFrameWnd::OnHelpIndex)
  27.     ON_COMMAND(ID_HELP_USING, CMDIFrameWnd::OnHelpUsing)
  28.     ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
  29.     ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
  30.     ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpIndex)
  31. END_MESSAGE_MAP()
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // arrays of IDs used to initialize control bars
  35.  
  36. // toolbar buttons - IDs are command buttons
  37. static UINT BASED_CODE buttons[] =
  38. {
  39.     // same order as in the bitmap 'toolbar.bmp'
  40.     ID_FILE_NEW,
  41.     ID_FILE_OPEN,
  42.     ID_FILE_SAVE,
  43.         ID_SEPARATOR,
  44.     ID_EDIT_CUT,
  45.     ID_EDIT_COPY,
  46.     ID_EDIT_PASTE,
  47.         ID_SEPARATOR,
  48.     ID_FILE_PRINT,
  49.     ID_APP_ABOUT,
  50.     ID_CONTEXT_HELP,
  51. };
  52.  
  53. static UINT BASED_CODE indicators[] =
  54. {
  55.     ID_SEPARATOR,           // status line indicator
  56.     ID_INDICATOR_CAPS,
  57.     ID_INDICATOR_NUM,
  58.     ID_INDICATOR_SCRL,
  59. };
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // CMainFrame construction/destruction
  63.  
  64. CMainFrame::CMainFrame()
  65. {
  66.     // TODO: add member initialization code here
  67. }
  68.  
  69. CMainFrame::~CMainFrame()
  70. {
  71. }
  72.  
  73. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  74. {
  75.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  76.         return -1;
  77.  
  78.     if (!m_wndToolBar.Create(this) ||
  79.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  80.         !m_wndToolBar.SetButtons(buttons,
  81.           sizeof(buttons)/sizeof(UINT)))
  82.     {
  83.         TRACE("Failed to create toolbar\n");
  84.         return -1;      // fail to create
  85.     }
  86.  
  87.     if (!m_wndStatusBar.Create(this) ||
  88.         !m_wndStatusBar.SetIndicators(indicators,
  89.           sizeof(indicators)/sizeof(UINT)))
  90.     {
  91.         TRACE("Failed to create status bar\n");
  92.         return -1;      // fail to create
  93.     }
  94.  
  95.     return 0;
  96. }
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // CMainFrame diagnostics
  100.  
  101. #ifdef _DEBUG
  102. void CMainFrame::AssertValid() const
  103. {
  104.     CMDIFrameWnd::AssertValid();
  105. }
  106.  
  107. void CMainFrame::Dump(CDumpContext& dc) const
  108. {
  109.     CMDIFrameWnd::Dump(dc);
  110. }
  111.  
  112. #endif //_DEBUG
  113.  
  114. /////////////////////////////////////////////////////////////////////////////
  115. // CMainFrame message handlers
  116.