// TitleWnd.cpp : implementation file
//

#include "stdafx.h"
#include "mw4gameed.h"
#include "TitleWnd.h"

/////////////////////////////////////////////////////////////////////////////
// CTitleWnd
extern CMW4GameEdApp theApp;

CTitleWnd::CTitleWnd()
{
	CreateEx(NULL,AfxRegisterWndClass(0),"Loading MW4 Editor...",WS_POPUP | WS_VISIBLE | WS_DLGFRAME,		// Localize
			 GetSystemMetrics(SM_CXSCREEN) / 2 - 160,GetSystemMetrics(SM_CYSCREEN) / 2 - 120,
			 320 + GetSystemMetrics(SM_CXBORDER) * 2,240 + GetSystemMetrics(SM_CXBORDER) * 2,NULL,NULL);

	bitmap.LoadBitmap(IDB_TITLEBMP);

	CRect r(110,180,210,195);
	m_VersionText.Create(LPCTSTR(theApp.m_VersionString),WS_CHILD | SS_CENTER | WS_VISIBLE,r,this,0);

	UpdateWindow();
}

CTitleWnd::~CTitleWnd()
{
//	delete dlg;
}

BEGIN_MESSAGE_MAP(CTitleWnd, CWnd)
	//{{AFX_MSG_MAP(CTitleWnd)
	ON_WM_CREATE()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTitleWnd message handlers

int CTitleWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	return 0;
}

void CTitleWnd::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CDC tmpDC;

	tmpDC.CreateCompatibleDC(&dc);

	CBitmap* oldBmp = tmpDC.SelectObject(&bitmap);
	BITMAP info;
	bitmap.GetObject(sizeof(info),&info);

	dc.BitBlt(0,0,info.bmWidth,info.bmHeight,&tmpDC,0,0,SRCCOPY);

	tmpDC.SelectObject(oldBmp);
	
	// Do not call CWnd::OnPaint() for painting messages
}
