home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / CKTBL / SAMPLES / MFCDEMO / MAINFRM.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  2.5 KB  |  117 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mfcdemo.h"
  6.  
  7. #include "mainfrm.h"
  8.  
  9. #include "ctl3d.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMainFrame
  18.  
  19. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  20.  
  21. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  22.     //{{AFX_MSG_MAP(CMainFrame)
  23.     ON_WM_CREATE()
  24.     ON_WM_SYSCOLORCHANGE()
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // arrays of IDs used to initialize control bars
  30.  
  31. // toolbar buttons - IDs are command buttons
  32. static UINT BASED_CODE buttons[] =
  33. {
  34.     // same order as in the bitmap 'toolbar.bmp'
  35.     ID_FILE_NEW,
  36.     ID_FILE_OPEN,
  37.     ID_FILE_SAVE,
  38.         ID_SEPARATOR,
  39.     ID_EDIT_CUT,
  40.     ID_EDIT_COPY,
  41.     ID_EDIT_PASTE,
  42.         ID_SEPARATOR,
  43.     ID_FILE_PRINT,
  44.     ID_APP_ABOUT,
  45. };
  46.  
  47. static UINT BASED_CODE indicators[] =
  48. {
  49.     ID_SEPARATOR,           // status line indicator
  50.     ID_INDICATOR_CAPS,
  51.     ID_INDICATOR_NUM,
  52.     ID_INDICATOR_SCRL,
  53. };
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CMainFrame construction/destruction
  57.  
  58. CMainFrame::CMainFrame()
  59. {
  60.     // TODO: add member initialization code here
  61. }
  62.  
  63. CMainFrame::~CMainFrame()
  64. {
  65. }
  66.  
  67. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  68. {
  69.     if (CMDIFrameWnd::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.         TRACE("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.         TRACE("Failed to create status bar\n");
  86.         return -1;      // fail to create
  87.     }
  88.  
  89.     return 0;
  90. }
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CMainFrame diagnostics
  94.  
  95. #ifdef _DEBUG
  96. void CMainFrame::AssertValid() const
  97. {
  98.     CMDIFrameWnd::AssertValid();
  99. }
  100.  
  101. void CMainFrame::Dump(CDumpContext& dc) const
  102. {
  103.     CMDIFrameWnd::Dump(dc);
  104. }
  105.  
  106. #endif //_DEBUG
  107.  
  108. /////////////////////////////////////////////////////////////////////////////
  109. // CMainFrame message handlers
  110.  
  111. void CMainFrame::OnSysColorChange()
  112. {
  113.     // CMDIFrameWnd::OnSysColorChange();
  114.     // TODO: Add your message handler code here
  115.     Ctl3dColorChange();
  116. }
  117.