// TitleStripBmp.cpp: implementation of the CTitleStripBmp class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "TitleStripBmp.h"
#include "DrawUtils.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTitleStripBmp::CTitleStripBmp():
	bmpBody_(0),
	bmpTail_(0)
{

}

CTitleStripBmp::~CTitleStripBmp()
{

}

void CTitleStripBmp::SetBitmaps(UINT bmpBody, UINT bmpTail)
{
	bmpBody_ = bmpBody;
	bmpTail_ = bmpTail;
}

void CTitleStripBmp::SetDrawArea(const CRect& drawArea)
{
	drawArea_ = drawArea;
}

void CTitleStripBmp::Draw(CDC* pDC)
{
	CSize size;
	CPoint topLeft;
	CRect tailRect;

	topLeft = drawArea_.TopLeft();
	DrawUtils::DrawBitmap(pDC, bmpBody_, topLeft, DrawUtils::enBmp_AlignLeft | DrawUtils::enBmp_AlignTop);

	size = DrawUtils::GetBitmapSize(bmpBody_);
	
	tailRect = drawArea_;
	tailRect.DeflateRect(size.cx, 0,0,0);
	DrawUtils::DrawBitmap(pDC, bmpTail_, tailRect, DrawUtils::enBmp_Tile);
}

CRect CTitleStripBmp::GetDrawArea() const
{
	return drawArea_;
}