Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
2.7 KiB

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. #include "stdafx.h"
  13. #include "MDI.h"
  14. #include "MainFrm.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMainFrame
  22. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  23. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  24. //{{AFX_MSG_MAP(CMainFrame)
  25. ON_WM_CREATE()
  26. //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28. static UINT indicators[] =
  29. {
  30. ID_SEPARATOR, // status line indicator
  31. ID_INDICATOR_CAPS,
  32. ID_INDICATOR_NUM,
  33. ID_INDICATOR_SCRL,
  34. };
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CMainFrame construction/destruction
  37. CMainFrame::CMainFrame()
  38. {
  39. }
  40. CMainFrame::~CMainFrame()
  41. {
  42. }
  43. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  44. {
  45. if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  46. return -1;
  47. if (!m_wndToolBar.Create(this) ||
  48. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  49. {
  50. TRACE0("Failed to create toolbar\n");
  51. return -1; // fail to create
  52. }
  53. // set button styles for colors to TBBS_CHECKBOX
  54. m_wndToolBar.SetButtonStyle(6, TBBS_CHECKBOX);
  55. m_wndToolBar.SetButtonStyle(7, TBBS_CHECKBOX);
  56. m_wndToolBar.SetButtonStyle(10, TBBS_CHECKBOX);
  57. m_wndToolBar.SetButtonStyle(11, TBBS_CHECKBOX);
  58. m_wndToolBar.SetButtonStyle(12, TBBS_CHECKBOX);
  59. if (!m_wndStatusBar.Create(this) ||
  60. !m_wndStatusBar.SetIndicators(indicators,
  61. sizeof(indicators)/sizeof(UINT)))
  62. {
  63. TRACE0("Failed to create status bar\n");
  64. return -1; // fail to create
  65. }
  66. m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  67. CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  68. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  69. EnableDocking(CBRS_ALIGN_ANY);
  70. DockControlBar(&m_wndToolBar);
  71. // Add title for toolbar
  72. m_wndToolBar.SetWindowText(_T("Standard"));
  73. return 0;
  74. }
  75. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  76. {
  77. return CMDIFrameWnd::PreCreateWindow(cs);
  78. }
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CMainFrame diagnostics
  81. #ifdef _DEBUG
  82. void CMainFrame::AssertValid() const
  83. {
  84. CMDIFrameWnd::AssertValid();
  85. }
  86. void CMainFrame::Dump(CDumpContext& dc) const
  87. {
  88. CMDIFrameWnd::Dump(dc);
  89. }
  90. #endif //_DEBUG
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CMainFrame message handlers