// PictureBar.cpp : implementation file
//

#include "stdafx.h"
#include "PictureBar.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPictureBar

CPictureBar::CPictureBar()
{
}

CPictureBar::~CPictureBar()
{
}


BEGIN_MESSAGE_MAP(CPictureBar, CSizingControlBarG)
	//{{AFX_MSG_MAP(CPictureBar)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPictureBar message handlers

int CPictureBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CSizingControlBarG::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rect;
	GetClientRect(rect);
	m_pView = (CPictureView*)(RUNTIME_CLASS(CPictureView)->CreateObject());
	m_pView->Create(NULL, NULL,AFX_WS_DEFAULT_VIEW|WS_CHILD,rect,this,WM_USER+2, NULL);
	m_pView->SendMessage(WM_INITIALUPDATE);
	
	return 0;
}

void CPictureBar::OnSize(UINT nType, int cx, int cy)
{
	CSizingControlBarG::OnSize(nType, cx, cy);

	if(m_pView)
	{
		if(::IsWindow(m_pView->m_hWnd))
		{
			m_pView->MoveWindow(0, 0, cx, cy);
		}
	}
}
