home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n08 / sketchsc.exe / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1995-08-01  |  3KB  |  124 lines

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