// webbrowser.cpp : implementation of the CWebBrowser class
//
#include "stdafx.h"
#include "emule.h"
#include "emuleDlg.h"
#include "MuleStatusBarCtrl.h"
#include "WebBrowser.h"

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

IMPLEMENT_DYNCREATE(CWebBrowser, CHtmlView)
BEGIN_MESSAGE_MAP(CWebBrowser, CHtmlView)	
	ON_WM_SIZE()
	ON_WM_ERASEBKGND()
END_MESSAGE_MAP()

// CWebBrowser construction/destruction
CWebBrowser::CWebBrowser()
{
}

CWebBrowser::~CWebBrowser()
{
}

// CWebBrowser printing
CWebBrowser* CWebBrowser::GetHtmlView()
{
	CWebBrowser* pView = new CWebBrowser;
	return pView;
}

void CWebBrowser::OnSize(UINT nType, int cx, int cy)
{
	CHtmlView::OnSize(nType, cx, cy);

	// TODO: 여기에 메시지 처리기 코드를 추가합니다.
	//by tax99
	CRect rcClient;
	theApp.emuledlg->GetClientRect(&rcClient);
	CRect srect;
	theApp.emuledlg->statusbar->GetClientRect(&srect);
#define TB_HEIGHT			66 //height of the MAIN bitmaps
#define WEBTOOL_HEIGHT		40
#define PADDING		9
	SetWindowPos(NULL, rcClient.left+PADDING, rcClient.top+TB_HEIGHT+WEBTOOL_HEIGHT, rcClient.Width()-2*PADDING, rcClient.Height()-TB_HEIGHT-WEBTOOL_HEIGHT-srect.Height(), SWP_NOZORDER);
	Invalidate();
}

BOOL CWebBrowser::OnEraseBkgnd(CDC* pDC)
{
	// TODO: Add your message handler code here and/or call default
	CRect rc;
	GetClientRect(&rc);
	pDC->FillSolidRect(&rc, RGB(255, 255, 255));
//	return CHtmlView::OnEraseBkgnd(pDC);
	return TRUE;
}