home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / BATCH.PAK / MAINFRM.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  3.0 KB  |  123 lines

  1. /**************************************************************************
  2.  *
  3.  *  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4.  *  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5.  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6.  *  PURPOSE.
  7.  *
  8.  *  Copyright (c) 1994 - 1995    Microsoft Corporation.    All Rights Reserved.
  9.  *
  10.  **************************************************************************/
  11. // mainfrm.cpp : implementation of the CMainFrame class
  12. //
  13.  
  14. #define INC_OLE2
  15. #include "stdafx.h"
  16. #include "batch.h"
  17.  
  18. #include "mainfrm.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CMainFrame
  27.  
  28. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  29.  
  30. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  31.     //{{AFX_MSG_MAP(CMainFrame)
  32.     ON_WM_CREATE()
  33.     //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // arrays of IDs used to initialize control bars
  38.     
  39. // toolbar buttons - IDs are command buttons
  40. static UINT BASED_CODE buttons[] =
  41. {
  42.     // same order as in the bitmap 'toolbar.bmp'
  43.     ID_FILE_NEW,
  44.     ID_FILE_OPEN,
  45.     ID_FILE_SAVE,
  46.         ID_SEPARATOR,
  47.     ID_APP_ABOUT,
  48. };
  49.  
  50. static UINT BASED_CODE indicators[] =
  51. {
  52.     ID_SEPARATOR,           // status line indicator
  53. };
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CMainFrame construction/destruction
  57.  
  58. CMainFrame::CMainFrame()
  59. {
  60.     // TODO: add member initialization code here
  61.     
  62. }
  63.  
  64. CMainFrame::~CMainFrame()
  65. {
  66. }
  67.  
  68. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  69. {
  70.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  71.         return -1;
  72.     
  73.     if (!m_wndToolBar.Create(this,
  74.           WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY) ||
  75.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  76.         !m_wndToolBar.SetButtons(buttons,
  77.           sizeof(buttons)/sizeof(UINT)))
  78.     {
  79.         TRACE0("Failed to create toolbar\n");
  80.         return -1;      // fail to create
  81.     }
  82.  
  83.     if (!m_wndStatusBar.Create(this) ||
  84.         !m_wndStatusBar.SetIndicators(indicators,
  85.           sizeof(indicators)/sizeof(UINT)))
  86.     {
  87.         TRACE0("Failed to create status bar\n");
  88.         return -1;      // fail to create
  89.     }
  90.  
  91.     // TODO: Delete these three lines if you don't want the toolbar to
  92.     //  be dockable
  93.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  94.     EnableDocking(CBRS_ALIGN_ANY);
  95.     DockControlBar(&m_wndToolBar);
  96.  
  97.     return 0;
  98. }
  99.  
  100. void CMainFrame::SetStatusText(LPCSTR szText, BOOL fRepaint)
  101. {
  102.     m_wndStatusBar.SetPaneText(0, szText, fRepaint);
  103. }
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // CMainFrame diagnostics
  107.  
  108. #ifdef _DEBUG
  109. void CMainFrame::AssertValid() const
  110. {
  111.     CMDIFrameWnd::AssertValid();
  112. }
  113.  
  114. void CMainFrame::Dump(CDumpContext& dc) const
  115. {
  116.     CMDIFrameWnd::Dump(dc);
  117. }
  118.  
  119. #endif //_DEBUG
  120.  
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CMainFrame message handlers
  123.