// childfrm.cpp : implementation of the CChildFrame class
//

#include "stdafx.h"
#include "sxbmem.h"

#include "childfrm.h"
#include "sxbmedoc.h"
#include "memview.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

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

IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)

BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
	//{{AFX_MSG_MAP(CChildFrame)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

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

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

CChildFrame::~CChildFrame()
{
}

BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT lpcs,
	CCreateContext* pContext)
{
	if (m_wndSplitter.CreateStatic( this, 2, 1, // TODO: adjust the number of rows, columns
			WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST )) {
		m_wndSplitter.CreateView( 0, 0, pContext->m_pNewViewClass	, CSize(180, 80), pContext );
		m_wndSplitter.CreateView( 1, 0, RUNTIME_CLASS(CMemView), CSize(180, 200), pContext );
		}

	CSize rc2 = ((CFormView *)m_wndSplitter.GetPane(0,0))->GetTotalSize();

	m_wndSplitter.SetRowInfo(0, rc2.cy, 50);
	m_wndSplitter.SetRowInfo(1, rc2.cy, 50);
	m_wndSplitter.SetColumnInfo(0, rc2.cx, 50); 

	int extra = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU) + 42;
	
	MoveWindow(lpcs->x, lpcs->y, rc2.cx + 15, 300 + rc2.cy + extra, FALSE);
	return TRUE;
}

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

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

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

#endif //_DEBUG

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

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) 
{
	// TODO: Add your specialized code here and/or call the base class
	return CMDIChildWnd::PreCreateWindow(cs);
}
