#ifndef MENU_H_
#define MENU_H_

#include "GraphBase.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "GlobalString.h"
#include "gvalue.h"
#include "CtlPanel1.h"
#include "ActionListCall.h"

#define MainItemCount   9
#define SubItemTextLen	36

#define SubItemCount_0  7
#define SubItemCount_1  7
#define SubItemCount_2  9
#define SubItemCount_3  10
#define SubItemCount_4  3
#define SubItemCount_5  8
#define SubItemCount_6  4
#define SubItemCount_7  6
#define SubItemCount_8  4	//interlink

#define SubItemCount_9  4	//passwd 

extern const unsigned char SubMenu_Count[12];

typedef struct{
	const char *fName;
	int Enable;
}TmenuItem;

class TMenu{
	public:
		int ItemsCount;
		unsigned int BorderColor;
		unsigned char BorderWidth;
	
		//TRect Bound;
		TRect MainBound;
		TRect SubBound;
		TRect MainContent;
		TRect SubContent;
		TBvStyle BevelOuter;
	
		char MainFontSize;
		char SubFontSize;
		
		unsigned char MainIndexOnTop;
		unsigned char ActiveLevel;
		unsigned char NeedRedraw;
		unsigned char NeedFullRedraw;
	
		unsigned int Permisson;
		TmenuItem MainItemList[12];
		TmenuItem SubItemList[12][10];
		
		unsigned char IsHasActive2;
		unsigned char SelectedMainIndex;
		unsigned char SelectedSubIndex;
		unsigned char LastMainIndex;
		unsigned char LastSubIndex;
		unsigned char IsBlockPermission;
		int NeedingPermission;
	
	
		int Active;
		int OnAction;
		class TImageList *IconList;
		class TCtlPanelLite *aPanel;
	public:
		TMenu(){};
		TMenu(int x1, int y1, int x2, int y2){
			Init(x1, y1, x2, y2);
		}
		
		void LoadText(void);
		void SelfDraw(void);
		void MainDraw(void);
		void SubDraw(void);
		void Show(void);
		void ReDraw(void);
		void FullRedraw();
		void FullRedrawFrm(int Prm);
		void RedrawFrmVoidArea(int x, int y, int x2, int y2);
		
		void Hide();
		
		void Init(int x1, int y1, int x2, int y2);
		
		TGuiMsgReturn KeyIn(unsigned char aKey);
		void Check4ReDraw(void);
		
		void ItemsLoadCaption(const char* pc, s16 Index);
		void SubItemsLoadCaption(const char* pc, s16 Index, s16 SubIndex);
		
		void LoadPermission(unsigned int aPms);
		
		void CheckPermission();
		void LoginBlock(int aPms);
		void GoAction();
		
		void CheckSystemPermissionII();
		void CheckSystemPermissionIII();
		
		void ExtReqExit();
		
		
};








#endif

