#ifndef CHECKNORMAL_H_
#define CHECKNORMAL_H_

#include "gType.h" 
#include "GraphBase.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "my_string.h"
#include "MainCtl.h"
#include "Device.h"
#include "EpDevice.h"
#include "DevProperty.h"


//For Idle View or Edit
class TCheckNormal{
	public:
		TStaticText Caption;
		class TDesignPrmSet *pDesignPrmSet;
	
		struct{
			short RowCount;
			short ColTop[12];
			short ColBottom[12];
			short ColHeight;
			short ColWidth[6];
			short ColLeft[6];
			short ColRight[6];
			short FixColTop;
			short FixColBottom;
		}Lv;
	
		//TMyString Str[10];
		u32 FixColColor;
		u32 FixColTextColor;
		u32 Color;
		u32 TextColor;
		u32 SelectedColor;
		u32 SelectedTextColor;
	
		int TabOrder;
		int IsShowing;
	
		TPoint OwnerLeftTop; //ParrentLeftTop;
		TRect Bound;	
		TRect VScrollBarBox;
		TRect Content;
	
		char Text[64];
		struct{
			int DevAll;
			int DevRoot;
			int DevEp;
			int Linkage;
			int LinkageActive;
			int EventFire;
			int EventFault;
			int EventSuperSv;
			int EventStart;
			int EventFeedback;
		}Count;
		
		unsigned char LoadCtlNum;
		unsigned char SlaveCheckInx;
		unsigned char IsSlaveDone;
		unsigned char AskInx;
		unsigned char AskNum;
		union{
			unsigned int D32[120];
			struct{
				struct{
					unsigned int Smoke;
					unsigned int Tempe;
					unsigned int HandReport;
					unsigned int HydKp;
					unsigned int ModuleInput;
					unsigned int ModuleInOut;
					unsigned int ModuleOutput;
					unsigned int Va;
					unsigned int FDisplay;
					unsigned int LnkPs;
					unsigned int cOther;
				}Designed;
				struct{
					unsigned int Smoke;
					unsigned int Tempe;
					unsigned int HandReport;
					unsigned int HydKp;
					unsigned int ModuleInput;
					unsigned int ModuleInOut;
					unsigned int ModuleOutput;
					unsigned int Va;
					unsigned int FDisplay;
					unsigned int LnkPs;
					unsigned int cOther;
				}Normal;
				struct{
					unsigned int Smoke;
					unsigned int Tempe;
					unsigned int HandReport;
					unsigned int HydKp;
					unsigned int ModuleInput;
					unsigned int ModuleInOut;
					unsigned int ModuleOutput;
					unsigned int Va;
					unsigned int FDisplay;
					unsigned int LnkPs;
					unsigned int cOther;
				}Fault;
				struct{
					unsigned int Smoke;
					unsigned int Tempe;
					unsigned int HandReport;
					unsigned int HydKp;
					unsigned int ModuleInput;
					unsigned int ModuleInOut;
					unsigned int ModuleOutput;
					unsigned int Va;
					unsigned int FDisplay;
					unsigned int LnkPs;
					unsigned int cOther;
				}Mask;
			}All;
		}CheckNormalDataAll;
		unsigned char HasDrawData[68];
		unsigned int AutoReturnTick;
	private:
		void SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5);
		
	public:
		TCheckNormal(){};
		TCheckNormal(int x1, int y1, int aW, int aH, int OwnerX, int OwnerY, u32 aColor){
			Init(x1, y1, aW, aH, OwnerX, OwnerY, aColor);
		}
		void Init(int x1, int y1, int aW, int aH, int OwnerX, int OwnerY, u32 aColor);	
		
		void RenderBackGround(void);
		void RenderBackGround(unsigned int aClr);
		void DrawSelf(void);
		void Show(void);
		void ShowCtlNum();
		void ReDraw(void);
		void DrawCaption(void);
		void RenderContent(void);
		
		void DrawGridAndText();
		void CheckNwAllCount();
		
		void ClearAndDrawData();
		void LoadAndDrawData(void);
		void LoadAndDrawDataSlave(unsigned char aCtlNum);
		void LoadAndDrawDataAll();
		void ShowData(unsigned int Force);
		void CheckDoneClear();
		void CheckSlaveDone();
		
		TGuiMsgReturn KeyIn(unsigned char aKey);
		
		int Task500Ms();
		void Hide();
		
		int ExtRequst(unsigned char Prm);
};



#endif





