// ChildFrm.cpp : implementation of the CChildFrame class // #include "stdafx.h" #include "ImageGrinder.h" #include "ChildFrm.h" #include "ImageGrinderView.h" #include "FeatureLibView.h" ///////////////////////////////////////////////////////////////////////////// // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) //{{AFX_MSG_MAP(CChildFrame) ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CChildFrame construction/destruction CChildFrame::CChildFrame() { // TODO: add member initialization code here Initalized=false; } CChildFrame::~CChildFrame() { } BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs if( !CMDIChildWnd::PreCreateWindow(cs) ) return 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::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { // CG: The following block was added by the Splitter Bar component. /* { if (!m_wndSplitter.Create(this, 1, 2, // TODO: adjust the number of rows, columns CSize(10, 10), // TODO: adjust the minimum pane size pContext)) { TRACE0("Failed to create splitter bar "); return FALSE; // failed to create } return TRUE; } */ { if (!m_wndSplitter.CreateStatic(this,1,2) ) { TRACE0("Failed to create splitter bar "); return FALSE; // failed to create } m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CImageGrinderView),CSize(500,100), pContext); m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CFeatureLibView),CSize(100,100), pContext); AdjustSplitter(); Initalized=true; return TRUE; } } void CChildFrame::AdjustSplitter() { CFeatureLibView *view; if(Initalized) { CRect rct; GetClientRect(&rct); view=(CFeatureLibView *)m_wndSplitter.GetPane(0,1); m_wndSplitter.SetColumnInfo(1,view->GetMaxWidth(),10); m_wndSplitter.SetColumnInfo(0,rct.Width()-(GetSystemMetrics(SM_CYSIZEFRAME)*2+view->GetMaxWidth()),10); m_wndSplitter.RecalcLayout(); } } void CChildFrame::OnSize(UINT nType, int cx, int cy) { CMDIChildWnd::OnSize(nType, cx, cy); // TODO: Add your message handler code here AdjustSplitter(); }