#ifndef IOPADDEFINE_H_
#define IOPADDEFINE_H_

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

class TIoPadDefine{
	public:
		struct{
			u32 Color;
			u32 RibbonColor;
		}VScrollBar;
		struct{
			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;
		TStaticText SText;
		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 Content0;
		TRect Content1;
		TRect Content2;
		TRect Content3;
		
		TMyString Str;
		
		unsigned char State;
		unsigned char CtlIndex;
		unsigned char NewRegCompleted;
		
		unsigned char ParentType;
		struct{
			unsigned char iType;
			unsigned char Path0;
			unsigned char Path1;
			unsigned char Path2;
		}Selected;
		
		struct{
			int TopIndex;
			int SelectedCol;
			int SelectedIndex;
			unsigned char CurrentType;
		}Level0, Level1, Level2;
		
		struct{
			unsigned char Count;
			unsigned char Type[40];
			unsigned char ItemsPath[40];
		}Loaded0;
		struct{
			unsigned char Count;
			unsigned char Type[256];
			unsigned char ItemsPath[256];
			unsigned char ChannelCount[256];
			unsigned char ChannelInCount[256];
		}Loaded1;
		struct{
			unsigned char Count;
			unsigned char Type[4];
			unsigned char IsOut[4];
			unsigned char ItemsPath[4];
		}Loaded2;
		
		
		struct{
			int TopIndex;
			int SelectedCol;
			int SelectedRow;
			int SelectedIndex;
			unsigned char CurrentType;
		}PrmEdit;
		struct {
			unsigned char eType;
			unsigned char Group0;
			unsigned char Group1;
			unsigned char Group2;
			unsigned char Group3;
		}ValueList[256][4];
		unsigned char IsEditing;
		unsigned char IsModifing;
		unsigned char IsWarningSave;
		unsigned char IsReqReturn;
		
		unsigned char CtlLevel;
	private:
		void SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5,int w6, int w7, int w8, int w9);
	public:
		TIoPadDefine(){};
		TIoPadDefine(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 SetAndShowCaption(unsigned char aType);
		
		void RenderContent(TRect aRect, unsigned int aClr, unsigned int Index); 
		void RenderContent0(unsigned int aClr);
		void RenderContent1(unsigned int aClr);
		void RenderContent2(unsigned int aClr);
		void RenderContent3(unsigned int aClr);
		
		void RenderBackGround(void);
		void RenderBackGround(unsigned int aClr);
		void DrawSelf(void);
		void DrawVertScrollBar0(void);
		void DrawVertScrollBar1(void);

		void Show(void);
		void ReDraw(void);
		void DrawCaption(void);
		void DrawCaption2(void);
		
		void RenderWarningSave(void);
		
		void FullRedraw(int Prm);
		//_________________________________________________
		void SetHandCtl(void);
		void LoadHandCtl(void);
		void LoadHandCtlChannel();
		void RenderHandCtl(void);
		void RenderHandCtlChannel(void);
		void RenderHandCtlChannelPrm(void);
		//_________________________________________________
		void SetDirectCtl(void);
		void LoadDirectCtl(void);
		void LoadDirectCtlChannel();
		void RenderDirectCtl(void);
		void RenderDirectCtlChannel(void);
		void RenderDirectCtlChannelPrm(void);
		//_________________________________________________
		void SetPort(void);
		void LoadPort(void);
		void LoadEp(void);
		void LoadEpChannel(void);
		void RenderPort(void);
		void RenderEp(void);	
		void RenderEpChannel(void);
		void RenderEpPrm(void);
		void RenderEpChannelPrm(void);
		//_________________________________________________
		void HandCtlList(void);
		
		TGuiMsgReturn HandCtlKeyIn(unsigned char aKey);
		TGuiMsgReturn DirectCtlKeyIn(unsigned char aKey);
		TGuiMsgReturn EpKeyIn(unsigned char aKey);
		TGuiMsgReturn KeyIn(unsigned char aKey);
		
		int ExtRequst(unsigned char Prm){return 0;}
};



#endif

