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.

174 lines
5.2 KiB

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "FaxApi.h"
  5. #include "MainFrm.h"
  6. #include "fcnselvw.h"
  7. #include "paramvw.h"
  8. #include "fcninfvw.h"
  9. #include "rvoutvw.h"
  10. #include "exelogvw.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. extern CFaxApiApp * pFaxApiBrowserApp;
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CMainFrame
  19. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  20. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  21. //{{AFX_MSG_MAP(CMainFrame)
  22. ON_WM_CLOSE()
  23. //}}AFX_MSG_MAP
  24. END_MESSAGE_MAP()
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CMainFrame construction/destruction
  27. CMainFrame::CMainFrame()
  28. {
  29. // TODO: add member initialization code here
  30. }
  31. CMainFrame::~CMainFrame()
  32. {
  33. }
  34. BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT lpcs,
  35. CCreateContext* pContext)
  36. {
  37. BOOL fReturnValue;
  38. // Note: The main frame window for the FaxApi browser is overlaid with
  39. // a splitter window in which two additional splitter windows are
  40. // nested. The top level splitter window consists of one row and
  41. // three columns. The first column of the top level splitter window
  42. // contains the list of Fax API functions. The second column, in
  43. // which an additional splitter window is nested, is used to display
  44. // information about the Fax API function that is selected in the
  45. // function list. The third column of the top level splitter window
  46. // also contains a nested splitter window, and is used to display
  47. // "output" generated by the execution of the selected Fax API function.
  48. // Create the top level splitter window.
  49. fReturnValue = m_wndSplitterMainFrame.CreateStatic( this, 1, 3 );
  50. if ( fReturnValue != (BOOL) FALSE )
  51. {
  52. // Create the view that manages the list of Fax API functions.
  53. m_wndSplitterMainFrame.CreateView( 0, 0, RUNTIME_CLASS( CFaxApiFunctionSelectionFormView ),
  54. CSize( 205, 320 ), pContext );
  55. // Add the second splitter window - which is a nested splitter -
  56. // in column 1 of m_wndSplitterMainFrame. This is the "info pane".
  57. if (!m_wndSplitterInfoPane.CreateStatic(
  58. &m_wndSplitterMainFrame, // our parent window is the first splitter
  59. 2, 1, // the new splitter is 2 rows, 1 column
  60. WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
  61. m_wndSplitterMainFrame.IdFromRowCol(0, 1) ) )
  62. {
  63. TRACE0("Failed to create nested splitter for Info pane.\n");
  64. return FALSE;
  65. }
  66. // Set the initial width of the second column in m_wndSplitterMainFrame.
  67. // (determined experimentally)
  68. m_wndSplitterMainFrame.SetColumnInfo( 1, 320, 25 );
  69. // Create the two views which display information about the
  70. // selected Fax API function inside the nested splitter
  71. // Create the Function Info view.
  72. if (!m_wndSplitterInfoPane.CreateView(0, 0,
  73. RUNTIME_CLASS(CFunctionInfoFormView), CSize(320, 195), pContext))
  74. {
  75. TRACE0("Failed to create function prototype view in nested splitter\n");
  76. return FALSE;
  77. }
  78. // Create the view that handles information pertaining to the parameter
  79. // list for the selected Fax API function.
  80. if (!m_wndSplitterInfoPane.CreateView(1, 0,
  81. RUNTIME_CLASS(CParameterInfoFormView), CSize(320, 300), pContext))
  82. {
  83. TRACE0("Failed to create return value description view.\n");
  84. return FALSE;
  85. }
  86. // Create the third splitter, nested in the third column of the top
  87. // level splitter. The third column of the top level splitter is the
  88. // "output pane".
  89. if (!m_wndSplitterOutputPane.CreateStatic(
  90. &m_wndSplitterMainFrame, // our parent window is the first splitter
  91. 2, 1, // the new splitter is 2 rows, 1 column
  92. WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
  93. m_wndSplitterMainFrame.IdFromRowCol(0, 2) ) )
  94. {
  95. TRACE0("Failed to create nested splitter for Output pane.\n");
  96. return FALSE;
  97. }
  98. // Create the Return Value Output view in the "output pane".
  99. m_wndSplitterOutputPane.CreateView( 0, 0,
  100. RUNTIME_CLASS( CReturnValueOutputFormView ), CSize( 205, 90 ), pContext );
  101. m_wndSplitterOutputPane.CreateView( 1, 0,
  102. RUNTIME_CLASS( CExecutionLogFormView ), CSize( 205, 40 ), pContext );
  103. }
  104. return ( fReturnValue );
  105. }
  106. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  107. {
  108. // TODO: Modify the Window class or styles here by modifying
  109. // the CREATESTRUCT cs
  110. return CFrameWnd::PreCreateWindow(cs);
  111. }
  112. /////////////////////////////////////////////////////////////////////////////
  113. // CMainFrame diagnostics
  114. #ifdef _DEBUG
  115. void CMainFrame::AssertValid() const
  116. {
  117. CFrameWnd::AssertValid();
  118. }
  119. void CMainFrame::Dump(CDumpContext& dc) const
  120. {
  121. CFrameWnd::Dump(dc);
  122. }
  123. #endif //_DEBUG
  124. /////////////////////////////////////////////////////////////////////////////
  125. // CMainFrame message handlers
  126. void CMainFrame::OnClose()
  127. {
  128. pFaxApiBrowserApp->DeleteCFaxApiFunctionInfoObjects();
  129. CFrameWnd::OnClose();
  130. }