/*
*******************************************************************************
* Copyright (c) 1996-97 Digi International Inc., All Rights Reserved          *
*                                                                             *
* This  software  contains  proprietary  and  confidential   information   of *
* Digi International  Inc.   By  accepting  transfer  of this copy, Recipient *
* agrees to retain this software in  confidence,  to  prevent  disclosure  to *
* others,  and  to make no  use of this software other than that for which it *
* was delivered.  This is an unpublished copyright work  Digi   International *
* Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is *
* strictly prohibited.                                                        *
*                                                                             *
* Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc. *
* Confidential  when   combined   with   the   aggregated  modules  for  this *
* product) OBJECT CODE ONLY SOURCE MATERIALS                                  *
*                                                                             *
* (C) COPYRIGHT Digi International Inc. 1996-97                               *
*                                                                             *
* All Rights Reserved                                                         *
*                                                                             *
* US   Government   Users   Restricted   Rights   -   Use,   duplication   or *
* disclosure  restricted by GSA ADP Schedule Contract with Digi International *
* Inc.                                                                        *
*                                                                             *
*******************************************************************************
*/
// ChildFrm.cpp : implementation of the CChildFrame class
//
/*
		This is the frame window for all statistics windows. The panes that are added to this
		frame are from the CStatDoc derived class, The code for the panes themselves are all in 
		StatView.cpp. 

Revision History:

   $History: ChildFrm.cpp $
 * 
 * *****************  Version 20  *****************
 * User: Mikez        Date: 7/11/97    Time: 5:01p
 * Branched in $/Components/Windows/NT/Sync/Build/Diag
 * 
 * *****************  Version 19  *****************
 * User: Rodgerb      Date: 1/27/97    Time: 1:18p
 * Updated in $/Components/Windows/NT/Sync/rev2diag
 * 1) documentation
 * 2) added some new params to Physical layer stats
 * 
 * *****************  Version 18  *****************
 * User: Rodgerb      Date: 1/08/97    Time: 5:43p
 * Updated in $/Components/Windows/NT/Sync/rev2diag
 * documentation
*/


#include "stdafx.h"
#include "Diagnostic.h"

#include "ChildFrm.h"
#include "StatDoc.h"
#include "StatView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChildFrame

IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)

BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
	//{{AFX_MSG_MAP(CChildFrame)
	ON_WM_RBUTTONUP()
	ON_UPDATE_COMMAND_UI(IDW_DataSource, OnUpdateDataSourceBox)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction

CChildFrame::CChildFrame()
{
	// TODO: add member initialization code here
}

CChildFrame::~CChildFrame()
{
}

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	return CMDIChildWnd::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics

#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
	CMDIChildWnd::AssertValid();
}

void CChildFrame::Dump(CDumpContext& dc) const
{
	CMDIChildWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers

void CChildFrame::OnUpdateDataSourceBox(CCmdUI* pCmdUI)
{
	pCmdUI->Enable();
}

BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
	CStatDoc *pDoc = dynamic_cast<CStatDoc *>(pContext->m_pCurrentDoc);
	
// the get the simple statistics pane CDataSource::GetStatPane() is used
	pContext->m_pNewViewClass = pDoc->GetStatPane();
	CMDIChildWnd::OnCreateClient(lpcs, pContext);

	return TRUE;
}

void CChildFrame::OnRButtonUp(UINT, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CMenu menu;
	CMenu *submenu;
	// Load the menu.
	menu.LoadMenu(IDR_STATTYPE);
	// Get the pop-up menu.
	submenu = menu.GetSubMenu(1);
	// Post the menu.
	submenu->TrackPopupMenu(
					TPM_LEFTALIGN | TPM_RIGHTBUTTON,
					point.x, point.y,
					AfxGetApp()->m_pMainWnd);
}
