// MailSplitterWnd.cpp: implementation of the CMailSplitterWnd class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "psm.h"
#include "MailSplitterWnd.h"
#include "MailListView.h"
#include "MailRTFView.h"
#include "PSMDoc.h"
#include "aplTopLevelItem.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CMailSplitterWnd, CSplitterWnd)

BEGIN_MESSAGE_MAP(CMailSplitterWnd, CSplitterWnd)
	//{{AFX_MSG_MAP(CMailSplitterWnd)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

#ifdef _DEBUG
void CMailSplitterWnd::AssertValid() const
{
	CSplitterWnd::AssertValid();
}

void CMailSplitterWnd::Dump(CDumpContext& dc) const
{
	CSplitterWnd::Dump(dc);
}
#endif //_DEBUG

CMailSplitterWnd::CMailSplitterWnd()
{
	
}

CMailSplitterWnd::~CMailSplitterWnd()
{
	
}

LRESULT CMailSplitterWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	if(message==((CPSMApp*)AfxGetApp())->m_view_update)
	{
		if(wParam==APL_UPDATE_TREE_ITEM)
		{
			CaplTreeItem* item = (CaplTreeItem*)lParam;
			CMailListView* view= (CMailListView*)((CFrameWnd*)GetPane(0, 0))->GetActiveView();
			
			if(view)
			{
				view->m_content_body= (CMailBodyFrame*)GetPane(1, 0);
				view->UpdateTreeItem(item);
			}
		}
	}
	return CSplitterWnd::WindowProc(message, wParam, lParam);
}
