// StatusWnd.cpp
//

#include "stdafx.h"
#include "WEB_IO_TEST.h"
#include "StatusWnd.h"


// CStatusWnd

IMPLEMENT_DYNAMIC(CStatusWnd, CWnd)
CStatusWnd::CStatusWnd()
{
	m_eSatus = EOF_NOT;
}

CStatusWnd::~CStatusWnd()
{
}


BEGIN_MESSAGE_MAP(CStatusWnd, CWnd)
	ON_WM_PAINT()
END_MESSAGE_MAP()



void CStatusWnd::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	CBitmap bmp, *pOldbmp;
	CDC memDC;

	memDC.CreateCompatibleDC(&dc);

	switch(m_eSatus)
	{
	case EOF_ON:
		bmp.LoadBitmap(IDB_BITMAP_ON);
		break;
	case EOF_OFF:
		bmp.LoadBitmap(IDB_BITMAP_OFF);
		break;
	case EOF_NOT:
		bmp.LoadBitmap(IDB_BITMAP_NOT);
		break;
	case EOF_ON_DELAY:
		bmp.LoadBitmap(IDB_BITMAP_ONOFF);
		break;
	case EOF_OFF_DELAY:
		bmp.LoadBitmap(IDB_BITMAP_ONOFF);
		break;
	case EOF_ONOFF_MACRO:
		bmp.LoadBitmap(IDB_BITMAP_ONOFF);
		break;
	case EOF_ON_ADC_LEVEL:
		bmp.LoadBitmap(IDB_BITMAP_ON);
		break;
	}
	pOldbmp = memDC.SelectObject(&bmp);
	
	dc.StretchBlt(0, 0, 24, 24, &memDC, 0, 0, 24, 24, SRCCOPY);	

}


void CStatusWnd::SetStatus(EOnOffFlag eFlag)
{
	m_eSatus = eFlag;
	this->Invalidate();
}
