#pragma once
#include <afxmt.h>
#include <list>
using namespace std;
// CTrendResult

enum _TREND_RESULT_TYPE_
{
	RESULT_TYPE_HR = 1,
	RESULT_TYPE_ST,
	RESULT_TYPE_PVCs,
	RESULT_TYPE_SBP,
	RESULT_TYPE_DBP,
	RESULT_TYPE_RR,
	RESULT_TYPE_SPO2,
	RESULT_TYPE_PR,
	RESULT_TYPE_TEMP,
	RESULT_TYPE_AIROXY,
};

struct TREND_RESULT_TYPE
{
	INT16 i16Type;
	INT16 i16Flag;
	INT16 i16H, i16L;
	TCHAR cTypeName[8];
};


class CTrendResult : public CStatic
{
	DECLARE_DYNAMIC(CTrendResult)

public:
	CTrendResult(COLORREF color);
	virtual ~CTrendResult();

	void Erase();
	void draw_wave();
	void Add_TrendResultType(struct TREND_RESULT_TYPE *st);
	void Add_TrendResult(INT16 type,INT16 r);
	void Draw_Info();
	void Draw();
protected:
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	DECLARE_MESSAGE_MAP()

private:

	INT m_i32Show;
	CRect m_rectCtrl;			// 控件区域

	CDC dcMem; //用于缓冲作图的内存DC 
	CBitmap bmp; //内存中承载临时图象的位图
	CDC dcMemBK; //用于缓冲作图的内存DC 背景 
	CBitmap bmpBK; //内存中承载临时图象的位图 背景 

	CFont font;
	COLORREF m_color;

	INT m_i32DestroyFlag;
	//趋势图数据的类型
	INT m_i32Type;
	list<struct TREND_RESULT_TYPE> m_stResultType;
	INT16 m_i16Type;
	INT16 m_i16H, m_i16L;
	TCHAR m_cTypeName[8];
	//波形的保存的缓存区
	INT16 *m_i16Date[8];
	INT16 m_i16DateW[8], m_i16DateR[8], m_i16DateL[8];
	int  m_i16WaveDateLength;
	CCriticalSection m_CSWaveData;

	CPen *penLine;
	CPen *penBKLine;

public:
	static INT m_i32Width, m_i32Height;
};


