#ifndef REGISTERADDREMOVE_H_
#define REGISTERADDREMOVE_H_

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

class TRegisterAddRemove{
	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;
		TCtlPanel1 *aPanel;
	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;
		
		TMyString Str;
		
		unsigned char CtlIndex;
		
		unsigned char ParentType;
		struct{
			unsigned int Ava;
			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;
		
		unsigned char IsAdd;
		unsigned char IsSelecting;
		
		unsigned char CtlLevel;
		
		unsigned char AddTargetLevel;
		unsigned char AddTargetType;
	private:
		void SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5,int w6, int w7, int w8, int w9);
	public:
		TRegisterAddRemove(){};
		TRegisterAddRemove(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 RenderBackGround(void);
		void RenderBackGround(unsigned int aClr);
		void DrawSelf(void);
		void DrawVertScrollBar0(void);
		void DrawVertScrollBar1(void);

		void Show(void);
		void ReDraw(void);
		void DrawCaption2(void);
		
		void DrawBtn(unsigned int x, unsigned int y, unsigned int x2, unsigned int y2,  unsigned int aClr);
		void DrawCtlItemAdd();
		void DrawCtlItemRemove();
		void ShowItemDetailAdd();
		void ShowItemDetailRemove();
		void RenderWarningSave(void);
		
		void HandCtlList(void);
		
		TGuiMsgReturn KeyInAddStart(unsigned char aKey);
		TGuiMsgReturn KeyInRemoveStart(unsigned char aKey);
		TGuiMsgReturn KeyInAdd(unsigned char aKey);
		TGuiMsgReturn KeyInRemove(unsigned char aKey);
		TGuiMsgReturn KeyIn(unsigned char aKey);
		
		void InitPanel4Add(void);
		void Check4SelectedAdd(void);
		
		void InitPanel4RemoveViaUserCode(void);
		void InitPanel4Remove(void);
		void Check4SelectedRemove(void);
};



#endif

