// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "FaxApi.h" #include "MainFrm.h" #include "fcnselvw.h" #include "paramvw.h" #include "fcninfvw.h" #include "rvoutvw.h" #include "exelogvw.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CFaxApiApp * pFaxApiBrowserApp; ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CLOSE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { // TODO: add member initialization code here } CMainFrame::~CMainFrame() { } BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext) { BOOL fReturnValue; // Note: The main frame window for the FaxApi browser is overlaid with // a splitter window in which two additional splitter windows are // nested. The top level splitter window consists of one row and // three columns. The first column of the top level splitter window // contains the list of Fax API functions. The second column, in // which an additional splitter window is nested, is used to display // information about the Fax API function that is selected in the // function list. The third column of the top level splitter window // also contains a nested splitter window, and is used to display // "output" generated by the execution of the selected Fax API function. // Create the top level splitter window. fReturnValue = m_wndSplitterMainFrame.CreateStatic( this, 1, 3 ); if ( fReturnValue != (BOOL) FALSE ) { // Create the view that manages the list of Fax API functions. m_wndSplitterMainFrame.CreateView( 0, 0, RUNTIME_CLASS( CFaxApiFunctionSelectionFormView ), CSize( 205, 320 ), pContext ); // Add the second splitter window - which is a nested splitter - // in column 1 of m_wndSplitterMainFrame. This is the "info pane". if (!m_wndSplitterInfoPane.CreateStatic( &m_wndSplitterMainFrame, // our parent window is the first splitter 2, 1, // the new splitter is 2 rows, 1 column WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed m_wndSplitterMainFrame.IdFromRowCol(0, 1) ) ) { TRACE0("Failed to create nested splitter for Info pane.\n"); return FALSE; } // Set the initial width of the second column in m_wndSplitterMainFrame. // (determined experimentally) m_wndSplitterMainFrame.SetColumnInfo( 1, 320, 25 ); // Create the two views which display information about the // selected Fax API function inside the nested splitter // Create the Function Info view. if (!m_wndSplitterInfoPane.CreateView(0, 0, RUNTIME_CLASS(CFunctionInfoFormView), CSize(320, 195), pContext)) { TRACE0("Failed to create function prototype view in nested splitter\n"); return FALSE; } // Create the view that handles information pertaining to the parameter // list for the selected Fax API function. if (!m_wndSplitterInfoPane.CreateView(1, 0, RUNTIME_CLASS(CParameterInfoFormView), CSize(320, 300), pContext)) { TRACE0("Failed to create return value description view.\n"); return FALSE; } // Create the third splitter, nested in the third column of the top // level splitter. The third column of the top level splitter is the // "output pane". if (!m_wndSplitterOutputPane.CreateStatic( &m_wndSplitterMainFrame, // our parent window is the first splitter 2, 1, // the new splitter is 2 rows, 1 column WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed m_wndSplitterMainFrame.IdFromRowCol(0, 2) ) ) { TRACE0("Failed to create nested splitter for Output pane.\n"); return FALSE; } // Create the Return Value Output view in the "output pane". m_wndSplitterOutputPane.CreateView( 0, 0, RUNTIME_CLASS( CReturnValueOutputFormView ), CSize( 205, 90 ), pContext ); m_wndSplitterOutputPane.CreateView( 1, 0, RUNTIME_CLASS( CExecutionLogFormView ), CSize( 205, 40 ), pContext ); } return ( fReturnValue ); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CFrameWnd::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers void CMainFrame::OnClose() { pFaxApiBrowserApp->DeleteCFaxApiFunctionInfoObjects(); CFrameWnd::OnClose(); }