home *** CD-ROM | disk | FTP | other *** search
/ Using VRML (Special Edition) / Special_Edition_Using_VRML_CDROM_Que_1996.iso / webpages / software / win95 / browsers / ambersw / tutorial / lesson1 / mainfrm.cpp < prev    next >
C/C++ Source or Header  |  1995-09-17  |  3KB  |  120 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "lesson1.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_DYNCREATE(CMainFrame, CFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  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. END_MESSAGE_MAP()
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // arrays of IDs used to initialize control bars
  29.     
  30. // toolbar buttons - IDs are command buttons
  31. static UINT BASED_CODE buttons[] =
  32. {
  33.     // same order as in the bitmap 'toolbar.bmp'
  34.     ID_FILE_NEW,
  35.     ID_FILE_OPEN,
  36.     ID_FILE_SAVE,
  37.         ID_SEPARATOR,
  38.     ID_EDIT_CUT,
  39.     ID_EDIT_COPY,
  40.     ID_EDIT_PASTE,
  41.         ID_SEPARATOR,
  42.     ID_FILE_PRINT,
  43.     ID_APP_ABOUT,
  44. };
  45.  
  46. static UINT BASED_CODE indicators[] =
  47. {
  48.     ID_SEPARATOR,           // status line indicator
  49.     ID_INDICATOR_CAPS,
  50.     ID_INDICATOR_NUM,
  51.     ID_INDICATOR_SCRL,
  52. };
  53.  
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CMainFrame construction/destruction
  56.  
  57. CMainFrame::CMainFrame()
  58. {
  59.     // TODO: add member initialization code here
  60.     
  61. }
  62.  
  63. CMainFrame::~CMainFrame()
  64. {
  65. }
  66.  
  67. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  68. {
  69.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  70.         return -1;
  71.     
  72.     if (!m_wndToolBar.Create(this) ||
  73.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  74.         !m_wndToolBar.SetButtons(buttons,
  75.           sizeof(buttons)/sizeof(UINT)))
  76.     {
  77.         TRACE0("Failed to create toolbar\n");
  78.         return -1;      // fail to create
  79.     }
  80.  
  81.     if (!m_wndStatusBar.Create(this) ||
  82.         !m_wndStatusBar.SetIndicators(indicators,
  83.           sizeof(indicators)/sizeof(UINT)))
  84.     {
  85.         TRACE0("Failed to create status bar\n");
  86.         return -1;      // fail to create
  87.     }
  88.  
  89.     // TODO: Delete these three lines if you don't want the toolbar to
  90.     //  be dockable
  91.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  92.     EnableDocking(CBRS_ALIGN_ANY);
  93.     DockControlBar(&m_wndToolBar);
  94.  
  95.     // TODO: Remove this if you don't want tool tips
  96.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  97.         CBRS_TOOLTIPS | CBRS_FLYBY);
  98.  
  99.     return 0;
  100. }
  101.  
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CMainFrame diagnostics
  104.  
  105. #ifdef _DEBUG
  106. void CMainFrame::AssertValid() const
  107. {
  108.     CFrameWnd::AssertValid();
  109. }
  110.  
  111. void CMainFrame::Dump(CDumpContext& dc) const
  112. {
  113.     CFrameWnd::Dump(dc);
  114. }
  115.  
  116. #endif //_DEBUG
  117.  
  118. /////////////////////////////////////////////////////////////////////////////
  119. // CMainFrame message handlers
  120.