#ifndef NEWREGISTER_H_
#define NEWREGISTER_H_


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

#define nrCtl		0
#define nrShowDetails	1 

class TNewRegister{
	public:
		struct{
			u32 Color;
			u32 RibbonColor;
		}VScrollBar;
		struct{
			int TopIndex;
			int SelectedCol;
			unsigned short RowCount;
			unsigned short ColTop[12];
			unsigned short ColBottom[12];
			unsigned short ColHeight;
			unsigned short ColWidth[12];
			unsigned short ColLeft[12];
			unsigned short ColRight[12];
			unsigned short FixColTop;
			unsigned short FixColBottom;
		}ListView;
	public:
		TStaticText Caption;
		int ActiveLineNum;
		int LineCount;
		int LineHeight;
		float ScrollVertical;
	
		u32 FixColColor;
		u32 FixColTextColor;
		u32 Color;
		u32 TextColor;
		u32 SelectedColor;
		u32 SelectedTextColor;
	
		int TabOrder;
	
		TPoint OwnerLeftTop; //ParrentLeftTop;
		TRect Bound;	
		TRect VScrollBarBox;
		TRect Content;
	
		int SelectedIndex;
		
		TMyString Str;
		
		unsigned char State;
		unsigned char CtlIndex;
		unsigned char NewRegCompleted;
	private:
		void SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5,int w6, int w7, int w8);
	
		TGuiMsgReturn QueryKeyIn(unsigned char aKey);
		TGuiMsgReturn EditKeyIn(unsigned char aKey);
		
	public:
		TNewRegister(){};
		TNewRegister(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 DrawVertScrollBar(void);
		void DrawList(void);
		void Show(void);
		void ReDraw(void);
		void DrawCaption(void);
		void RenderContent(void);
		
		void DrawBtn(unsigned int x, unsigned int y, unsigned int x2, unsigned int y2,  unsigned int aClr);
		void DrawCtlItem(void);
		void ShowCtl(void);
		void DrawOverViewName(void);
		
		void DrawOverViewCountHost(void);
		void DrawOverViewAllHost(void);
		void DrawOverViewHost(void);
		
		void DrawOverViewReg(void);
		
		TGuiMsgReturn KeyIn(unsigned char aKey);
		
		void Read();
		void Clear();
		void Save(void);
		void Search(void);
		
		void ShowAllInf();
		
		void FullRePaint(void);
		void RePaint(void);
};









#endif


