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.

128 lines
2.7 KiB

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "emshell.h"
  5. #include "ConnectionDlg.h"
  6. #include "emshellview.h"
  7. #include "MainFrm.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMainFrame
  15. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  16. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  17. //{{AFX_MSG_MAP(CMainFrame)
  18. ON_WM_CREATE()
  19. //}}AFX_MSG_MAP
  20. END_MESSAGE_MAP()
  21. static UINT indicators[] =
  22. {
  23. ID_SEPARATOR, // status line indicator
  24. ID_SEPARATOR,
  25. };
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CMainFrame construction/destruction
  28. CMainFrame::CMainFrame()
  29. {
  30. // TODO: add member initialization code here
  31. }
  32. CMainFrame::~CMainFrame()
  33. {
  34. }
  35. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  36. {
  37. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  38. return -1;
  39. if (!m_wndToolBar.CreateEx(this) ||
  40. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  41. {
  42. TRACE0("Failed to create toolbar\n");
  43. return -1; // fail to create
  44. }
  45. /* if (!m_wndDlgBar.Create(this, IDR_MAINFRAME,
  46. CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
  47. {
  48. TRACE0("Failed to create dialogbar\n");
  49. return -1; // fail to create
  50. }
  51. */
  52. if (!m_wndReBar.Create(this) ||
  53. !m_wndReBar.AddBar(&m_wndToolBar)
  54. /* || !m_wndReBar.AddBar(&m_wndDlgBar) */
  55. )
  56. {
  57. TRACE0("Failed to create rebar\n");
  58. return -1; // fail to create
  59. }
  60. if (!m_wndStatusBar.Create(this) ||
  61. !m_wndStatusBar.SetIndicators(indicators,
  62. sizeof(indicators)/sizeof(UINT)))
  63. {
  64. TRACE0("Failed to create status bar\n");
  65. return -1; // fail to create
  66. }
  67. m_wndStatusBar.SetPaneInfo( 1, ID_SEPARATOR, SBPS_NORMAL, 96 );
  68. // TODO: Remove this if you don't want tool tips
  69. m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  70. CBRS_TOOLTIPS | CBRS_FLYBY);
  71. return 0;
  72. }
  73. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  74. {
  75. //Modify the cs structure to remove the FWS_ADDTOTITLE style.
  76. //cs.style &= ~FWS_ADDTOTITLE;
  77. if( !CFrameWnd::PreCreateWindow(cs) )
  78. return FALSE;
  79. // TODO: Modify the Window class or styles here by modifying
  80. // the CREATESTRUCT cs
  81. return TRUE;
  82. }
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CMainFrame diagnostics
  85. #ifdef _DEBUG
  86. void CMainFrame::AssertValid() const
  87. {
  88. CFrameWnd::AssertValid();
  89. }
  90. void CMainFrame::Dump(CDumpContext& dc) const
  91. {
  92. CFrameWnd::Dump(dc);
  93. }
  94. #endif //_DEBUG
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CMainFrame message handlers
  97. CStatusBar* CMainFrame::GetStatusBar()
  98. {
  99. return &m_wndStatusBar;
  100. }