65 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			65 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | #ifndef MYWIN_RECORD_H__
 | |||
|  | #define MYWIN_RECORD_H__
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | //定义最大消息条数
 | |||
|  | #define RECORD_MAX_MSG_NUM 100
 | |||
|  | //定义每条消息的最大长度
 | |||
|  | #define RECORD_MAX_MSG_LEN	100
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | typedef struct | |||
|  | { | |||
|  | 	int x_size; | |||
|  | 	int y_size; | |||
|  | 	char msg_type; | |||
|  | 	char msg[RECORD_MAX_MSG_LEN]; | |||
|  | }Record_MsgStruct; | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | typedef struct | |||
|  | { | |||
|  | 	WIN_WindowStruct win; | |||
|  | 	Record_MsgStruct msgs[RECORD_MAX_MSG_NUM]; | |||
|  | 	int msg_start;	//指向顶部
 | |||
|  | 	int msg_end;		//指向底部,新增的消息位于此
 | |||
|  | 	int msg_used;		//使用量
 | |||
|  | 	int press; | |||
|  | 	int y_off;			//y轴的偏移
 | |||
|  | 	int msg_x_size;	//文字显示x宽度
 | |||
|  | 	int font_size;	//文字尺寸
 | |||
|  | 	u32 color_light; | |||
|  | 	u32 color_dark; | |||
|  | }WIN_RecordStruct; | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | WIN_RecordStruct *WIN_CreatRecord (WIN_WindowStruct *base, | |||
|  | 			void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg), | |||
|  | 			int x,int y,int x_size,int y_size); | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | //添加消息,msg_type='s',发送的消息,msg_type='r',接收的消息
 | |||
|  | int RECORD_AddMsg(WIN_RecordStruct *box,char msg_type,char *msg); | |||
|  | 			 | |||
|  | 			 | |||
|  | 			 | |||
|  | 			 | |||
|  | void RECORD_DefaultMsgLoop (WIN_RecordStruct *box,WIN_MsgStruct *msg); | |||
|  | 
 | |||
|  | 
 | |||
|  | 			 | |||
|  | 			 | |||
|  | WIN_RecordStruct *RECORD_DrawRecord (WIN_WindowStruct *base,int x,int y,int x_size,int y_size); | |||
|  | 			 | |||
|  | 			 | |||
|  | 
 | |||
|  | 
 | |||
|  | #endif
 | |||
|  | 
 |