home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / shaw / vbits32 / mainfrm.cpp next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  3.1 KB  |  129 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "vbits32.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.         ID_SEPARATOR,
  52.     ID_VIEW_NEWDIALOG,
  53. };
  54.  
  55. static UINT BASED_CODE indicators[] =
  56. {
  57.     ID_SEPARATOR,           // status line indicator
  58.     ID_INDICATOR_CAPS,
  59.     ID_INDICATOR_NUM,
  60.     ID_INDICATOR_SCRL,
  61. };
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CMainFrame construction/destruction
  65.  
  66. CMainFrame::CMainFrame()
  67. {
  68.     // TODO: add member initialization code here
  69.     
  70. }
  71.  
  72. CMainFrame::~CMainFrame()
  73. {
  74. }
  75.  
  76. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  77. {
  78.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  79.         return -1;
  80.     
  81.     if (!m_wndToolBar.Create(this) ||
  82.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  83.         !m_wndToolBar.SetButtons(buttons,
  84.           sizeof(buttons)/sizeof(UINT)))
  85.     {
  86.         TRACE0("Failed to create toolbar\n");
  87.         return -1;      // fail to create
  88.     }
  89.  
  90.     if (!m_wndStatusBar.Create(this) ||
  91.         !m_wndStatusBar.SetIndicators(indicators,
  92.           sizeof(indicators)/sizeof(UINT)))
  93.     {
  94.         TRACE0("Failed to create status bar\n");
  95.         return -1;      // fail to create
  96.     }
  97.  
  98.     // TODO: Delete these three lines if you don't want the toolbar to
  99.     //  be dockable
  100.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  101.     EnableDocking(CBRS_ALIGN_ANY);
  102.     DockControlBar(&m_wndToolBar);
  103.  
  104.     // TODO: Remove this if you don't want tool tips
  105.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  106.         CBRS_TOOLTIPS | CBRS_FLYBY);
  107.  
  108.     return 0;
  109. }
  110.  
  111. /////////////////////////////////////////////////////////////////////////////
  112. // CMainFrame diagnostics
  113.  
  114. #ifdef _DEBUG
  115. void CMainFrame::AssertValid() const
  116. {
  117.     CMDIFrameWnd::AssertValid();
  118. }
  119.  
  120. void CMainFrame::Dump(CDumpContext& dc) const
  121. {
  122.     CMDIFrameWnd::Dump(dc);
  123. }
  124.  
  125. #endif //_DEBUG
  126.  
  127. /////////////////////////////////////////////////////////////////////////////
  128. // CMainFrame message handlers
  129.