#ifndef __INFOPANEL_H
#define __INFOPANEL_H
#include "ultra64.h"
#include "bbreg.h"
#include "commondata.h"
#include "refimgdata.h"
#define CUR_NAME_LEN 		UR_NAME_LEN-1
#define CUR_DATE_LEN 		2*UR_DATE_LEN
#define CUR_ADDRESS_LEN  	UR_ADDRESS_LEN-1
#define CUR_EMAIL_LEN		UR_EMAIL_LEN-1
#define CUR_PHONE_LEN		UR_PHONE_LEN
#define CUR_CLUBID_LEN		UR_EMAIL_LEN+1
#define CUR_PINYIN_LEN		225

typedef struct {
	char birthdate[CUR_DATE_LEN];
	char name[CUR_NAME_LEN+3];
	char address[CUR_ADDRESS_LEN];
	char phone[CUR_PHONE_LEN];
	char pinyin[CUR_PINYIN_LEN];
	char gBbClubId[CUR_CLUBID_LEN];
	char sex;
	}CUserRegData;

typedef enum C_PosRef {
	CPOSREFNONE = 0,
	PRELEFT,
	PRERIGHT,
	PRETOP,
	PREBUTTON,
	PARENTLEFT,
	PARENTRIGHT,
	PARENTTOP,
	PARENTBUTTON,
	CPOSREFLAST,
	
	}CPosRef;
typedef enum CEditType {
	CEDITNONE = 1000,
	CHINESE ,
	ENGLISH,
	DIGITAL,
	MAIN,
	SHENMU,
	YUMU,
	CHECK,
	INPUT,
	INPUTREF,
	INPUTPY,
	TEXTL1,
	TEXTL2,
	TEXTU1,
	TEXTU2,
	TEXTDI,
	TEXTMI,
	TEXTCO,
	TEXT,
	BUTTON,
	ARROW,
	BIRTHDATE,
	ADDRESS,
	SEXTYPE,
	LABEL,
	WARNING,
	SWITCHENGLISH,
	NAME,
	CEDITLAST
	}CPanelType;
	
typedef enum {
	CUP,
	CDOWN,
	CFORWARD,
	CBACK,
	CLAST,
	}CMove;

typedef struct C_Edit {
	enum CEditType cet;
	int focusable;
	int editable;
	unsigned char *string;
	int cur;      /***      |   |   |   |  |   | |             */
	int curchar;  /*** 	charcursor 	cursor		   */
	int poscur;/*this may be cause confuse ,but in fact the cur is only for display,so it will 0<=cur<=numdisp*/
	int max;   /*and the poscur is for string ,and to the cur ,so the poscur will 0<=poscur<=poschar*/
	int poschar;/*the char  pos ,this is 0<=poschar <= max*/
	int numdisp;
	int ux;
	int uy;
	int width;
	int height;
	int strux;
	int struy;
	u32 img;
	}CEdit;
	
typedef struct C_Frame {
	CEdit** edit;
	int numedit;
	int focusedit;
	unsigned char *labelname;
	int ux;
	int uy;
	int width;
	int height;
	CPosRef uxref;
	CPosRef uyref;
	u32 img;
	u32 hiimg;
	u32 labelimg;	
	}CFrame;
	
	
typedef struct C_Message {
	int xdelay;
	int xdelaytime;
	
	int ydelay;
	int ydelaytime;
	
	int xoffset;
	int yoffset;
	
	int cursoroffset;
	int cursordelay;
	
	int CDIS_CURSOR:1;
	
	int CUP_CURSOR:1;
	int CDOWN_CURSOR:1;
	int CFORWARD_CURSOR:1;
	int CBACK_CURSOR:1;
	int CSTART_BUTTON:1; /*is the start button*/ 

	int CA_BUTTON:1; /*is the A Button */

	int CB_BUTTON:1; /*is the B Button*/ 

	int CU_CBUTTONS:1;/* is the C Button Up */

	int CD_CBUTTONS:1;/* is the C Button Down */

	int CL_CBUTTONS:1;/*is the C Button Left */

	int CR_CBUTTONS:1;/*is the C Button Right */

	int CU_JPAD:1; /* is the Control Stick Up */

	int CD_JPAD:1;/* is the Control Stick Down */

	int CL_JPAD:1;/* is the Control Stick Left */

	int CR_JPAD:1;/* is the Control Stick Right */

	int CZ_TRIG:1;/* is the Z Button */

	int CL_TRIG:1;/* is the L Button */

	int CR_TRIG:1;/* is the R Button  */
	int errorcode;/*0,none, 1:cannt read, 2:cannt write ,3:press to return main screen ,want display a chiose menu
	4:BB card is unpluged   5:BB card  mismatched with BB player
		       */
	int oldbut;
	int digitalstate; /*0:have freedom to move all , 1:constraint in one digital cell*/
	int digital;
	int digitalmax;
	int digitalmin;
	int enterdigital;/**/
	CEdit *edit;
	int bbcardstate;/*0 ok, -1 bb card is unpluged ,-2 bb card mismatched*/
	}CMessage;
	
typedef struct C_Panel {
	CPanelType paneltype;
	int numframe;
	int focusframe;
	CFrame** cframe;
	}CPanel;
		
typedef struct C_String {
	const unsigned char *s;
	int length;
	}CString;
	

typedef struct C_img {
	int *size;
	char *src_add;
	char **pdst_add;
	}CImg;
extern CImg decop[];
extern void decompresstex(void*,CImg*);
extern int localtobb();
extern int bbtolocal();
#endif /*__INFOPANEL_H*/
