⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asixwin.h

📁 嵌入式编程经常遇到的语言编程技巧和概念
💻 H
📖 第 1 页 / 共 2 页
字号:
#else/*here user must define their own OS related const*/#define ASIX_NONE			IRPT_NONE			/*  no activity */#define ASIX_PEN			IRPT_PEN			/*  pen message */#define ASIX_ICON			IRPT_ICON			/*  icon message  */#define ASIX_KEY			IRPT_KEY			/*  soft keyboard */#define ASIX_PAGER			IRPT_PAGER			/*  pager message, system doesn't use this, it can be used by users */#define ASIX_RTC			IRPT_RTC			/*  RTC message */#define ASIX_TIMER			IRPT_TIMER	        /*  timer message */#define ASIX_INPUT			IRPT_INPUT          /*  input pad message */#define ASIX_HWR			IRPT_HWR			/*  hand writing recognition */#define ASIX_INPUT_STATUS	IRPT_INPUT_STATUS   /*  input status message */#define ASIX_AUDIO			IRPT_AUDIO          /*  Audio status message */#define ASIX_CHINESE		SM_CHINESE			/*	chinese char	*/#define ASIX_UART			IRPT_UART			/*  UART data  */#define ASIX_SOFTKEY		SM_SOFTKEY			/*	softkey used in asix_kb	*/#define ASIX_MESSAGE		MESSAGE_IRPT#endif#define WM_TIMER		SM_TIMER#define WM_AT			SM_AT#define WM_SWITCH		SM_SWITCH#define WM_BEGINMSG		0x0070#define WM_ALARM		(0x0030 + WM_BEGINMSG)#define WM_BASE			(0x0040 + WM_BEGINMSG)#define WM_USER			(0x0300 + WM_BEGINMSG)#define WM_QUIT         (0x0041 + WM_BEGINMSG)#define WM_SLEEP		(0x0042 + WM_BEGINMSG)#define WM_WAKEUP		(0x0043 + WM_BEGINMSG)#define PS_POWER_LOW	0x0001	//wake up with power low condition/*We add foucus related message. by Lingming 2001/11/28*/#define WM_LOOSEFOCUS	(0x0046 + WM_BEGINMSG)#define WM_GETFOCUS		(0x0047 + WM_BEGINMSG)/*Notice the User repaint their client area*//*By Lingming 2002/03/22*/#define WM_REPAINT		(0x0048 + WM_BEGINMSG)#define WM_CLIENT		(0x0044 + WM_BEGINMSG)	//The window clinet area has been touched#define WM_TITLE		(0x0045 + WM_BEGINMSG)	//the title bar of the window has been touched/******Hard Key board message*************************************************/#define WM_KEYDOWN			(0x0100 + WM_BEGINMSG)#define WM_KEYUP			(0x0101 + WM_BEGINMSG)/******Pen input message******************************************************/#define WM_PENDOWN			(0x0201 + WM_BEGINMSG)#define WM_PENUP			(0x0202 + WM_BEGINMSG)#define WM_PENDRAG			(0x0203 + WM_BEGINMSG)#define WM_PENDRAGUP		(0x0204 + WM_BEGINMSG)#define WM_PENXY			(0x0205 + WM_BEGINMSG)/*******RTC message**********************************************************/#define WM_RTC				(0x0206 + WM_BEGINMSG)/******Softkey board message*************************************************/#define WM_CHAR				(0x0102 + WM_BEGINMSG)	#define WM_HANDWRITING		(0x0103 + WM_BEGINMSG)#define WM_PINYING			(0x0104 + WM_BEGINMSG)/* from where we get the input char*/#define KB_NODATA			0x0000#define KB_HWLINE1			0x0001#define KB_HWLINE2			0x0002#define KB_HWDEFAULT		0x0004#define KB_PYINPUT			0x0008#define KB_KBINPUT			0x0010#define KB_BHINPUT			0x0020	/* Menu and control command messages */#define WM_COMMAND          (0x0111 + WM_BEGINMSG)/* Select box message */#define WM_SELECTBOX		(0x0112 + WM_BEGINMSG)/****** Scroll bar support **************************************************/#define WM_HSCROLL          (0x0114 + WM_BEGINMSG)#define WM_VSCROLL          (0x0115 + WM_BEGINMSG)/****** Sourse of Mssage in Button **************************************/#define MS_ICON_TOUCH		PPSM_ICON_TOUCH#define MS_ICON_DRAG_UP		PPSM_ICON_DRAG_UP#define MS_ICON_PEN_UP		PPSM_ICON_PEN_UP#define MS_ICON_DRAG		PPSM_ICON_DRAG//#define WM_REFRESHSCROLL	0x0116#define PRESCROLLPOS		0#define CURSCROLLPOS		1/* WM_H/VSCROLL commands */#define SB_TOP              14#define SB_BOTTOM           1#define SB_LINEUP           2#define SB_LINEDOWN         3#define SB_PAGEUP           4#define SB_PAGEDOWN         5#define SB_LEFT             6#define SB_RIGHT            7#define SB_LINELEFT         8#define SB_LINERIGHT        9#define SB_PAGELEFT         10#define SB_PAGERIGHT        11#define SB_THUMBTRACK       12#define SB_ENDSCROLL        13/* Scroll bar selection constants *//*#define SB_HORZ             0#define SB_VERT             1#define SB_CTL              2#define SB_BOTH             3*//*******List Box Message**********************************/#define WM_LISTBOX			(0x0117 + WM_BEGINMSG)#define WM_CHINESE			(0x0119 + WM_BEGINMSG)#define WM_SOFTKEY			(0x0118 + WM_BEGINMSG)/*here we define the window status*/#define WST_DESTROYED		0x00000000L		/*For Destroy audit. By Lingming 2001/11/27*/#define WST_NORMAL			0xFACE0000L#define WST_ENABLE			0x00000001L		/*the window is enabled*/#define WST_HIDE			0x00000002L		/*the window is hide*/#define WST_KEYBOARD		0x00000004L		/* kb opened*/#define WST_HANDWRITE		0x00000008L		/* hand input pad opened*/#define WST_PUSHED			0x00000010L		/* the window is pushed */#define WST_FOCUS			0x00000020L		/* the window get the focus*/#define WST_CURSOR_ON		0x00000040L#define WST_CURSOR_REVERSED	0x00000080L#define WST_FORM_REPAINT	0x00000100L		/* when we destroy a form(Container), we donot need to											 * repaint during its children destroying*/											 /* By Lingming 2002/03/20*/	#define WST_EN_FOCUS		0x00000200L/* here we define users' message */#define WM_SHELL_CLOCK		(WM_USER + 1)/*------------------------------------------------------------------------------------------------------*/struct asix_window;typedef struct window_class{		unsigned char		wndclass_id;		// the function that CreateWindow() calls to do the object_based creation.*NOT NULL*	// I think here parent and menu are not needed.	unsigned int	(*create)(char *caption, U32 style, U16 x, U16 y,\					 U16 width, U16 hight, U32 wndid, U32 menu, void **ctrl_str, void *exdata);						 	// the function that DestroyWindow() calls to do the killing detail. *NOT NULL*	unsigned int	(*destroy)(void *ctrl_str);	// the function that DefWindowProc() calls to do the object msg handler.*NOT NULL*	unsigned int	(*msg_proc)( U32 win_id, U16 asix_msg, U32 lparam, void *data, U16 wparam, void *reserved);	//the function that GetMessage() calls to translate the PPSM message to ASIX message. *NOT NULL*	unsigned int	(*msg_trans)(void *ctrl_str, U16 msg_type, U32 areaId, P_U16 data, U32 size, void *trans_msg);		//the function that RePaintWindow() calls to repaint the window	unsigned int (*repaint)(void *ctrl_str, U32 lparam);	// the function that MoveWindow() calls to do the move method	unsigned int	(*move)(void *ctrl_str, U16 x, U16 y, U16 width, U16 hight, void *reserved);	// the function that EnableWindow() calls to do the enable or disable method	unsigned int	(*enable)(void *ctrl_str, U8 enable);	// the funtions that SetWindowText() calls to change the window's caption 	unsigned int	(*caption)(void *ctrl_str, char *caption, void *exdata);	// the function that WindowInformation() calls to fet the window's information	unsigned int 	(*information)(void *ctrl_str, struct asix_window *wndinfo);		} WNDCLASS;extern WNDCLASS 			WindowClass[];typedef struct asix_window{	struct asix_window	*prev;		//point to the previous sibling link	struct asix_window	*next;		//point to the next sibling link	struct asix_window	*child;		//point to the children link		WNDCLASS			*wndclass;	//point to the relevent class entry		unsigned int		task_id;	//the task id of this window 	unsigned int 		wnd_id;		//the window id which is assigned by Creatwindow()	unsigned int		parent_id;	//the winId of this windows's parent		unsigned int		status;				unsigned short		x;	unsigned short		y;	unsigned short		width;	unsigned short		hight;	char				*caption;	//the caption text string 	char				*tag;		//the help tag string 		unsigned int		style;	unsigned int		hmenu;	void				*ctrl_str;	//point to the control related struct 	void 				*exdata;		} ASIX_WINDOW;//////////////////////////////////////////////////////////////////////////////////// the following TCB is not the real TCB, here we just simulate one for the course// Lingming 2006/4/15 ///////////////////////////////////////////////////////////////////////////////////typedef struct systcb{	struct	systcb	*next;	U32				id;				/* task id : actually, it's SYSTCB's address *///	struct _gc 		*gc;	/* pointer to GC(Graphic Context) *///	struct _atvcb 	*atvcb;	/* pointer to Active Area Control Block *///	DWORD	devices;		/* devices used by this task //						 	 * descriped by one bit per device */	ASIX_WINDOW 	*wnd_ptr;		/* it will be used by Asixwin *///	DWORD	status;			/* when created, it is DORMANT;//							   when started, it is RUNNING; *///	DWORD	(*entryCallback)(DWORD);	/* pointer to function called before task begins *///	DWORD 	(*exitCallback)(DWORD);		/* pointer to function called after task exits */	/* Message Cache */	/* reserved *///	DWORD	*stack;			/* pointer to the stack of this task */ 	 } SYSTCB;extern ASIX_WINDOW			*CurWindow;	//point to current window entry	//extern ASIX_WINDOW			*FocusWindow;//point to the focused window/*The system level color theme, all controls color pallete are  *read from this struct global variable. *By Lingming 2001/11/28  */typedef struct asix_color_theme{	RGB form_title;			//The form's title color	RGB form_caption;		//the caption text	RGB form_disabletitle;	//modified by xh&zl 2002.3.12	RGB form_disablecaption;//modified by xh&zl 2002.3.12	RGB form_board;			//form's board	RGB form_client;		//form's client area	RGB form_text;	RGB form_backcolor;		//modified by xh&zl 2002.3.12	RGB form_frontcolor;	//modified by xh&zl 2002.3.12	RGB form_disablecolor;		RGB form_disabletext; 	RGB form_popclient;		//popup form's client area	RGB form_poptext;	RGB form_line;			//modified by xh&zl 2002.3.12	RGB menu; 	RGB obj3D;	RGB obj3D_text;			//obj's text	RGB obj3D_shadow;		//modified by xh&zl 2002.3.12	RGB obj3D_highlight;	//modified by xh&zl 2002.3.12	RGB obj3D_frontcolor;	//modified by longn_qi 2002.10.19	RGB obj3D_disablecolor;	//modified by longn_qi 2002.10.05	RGB obj3D_disabletext;	//modified by longn_qi 2002.10.05	RGB highlight;	RGB light_text;			//hight text} ASIX_COLOR_THEME;extern ASIX_COLOR_THEME		ColorTheme;/* The seconds left before we run into doze or sleep */extern S16		PowerSavingTimeOut;/* The flag that define whether our own UART irpt driver should be used*/extern U8		AsixOwnUartDriver;//extern STATUS ASIXInit(void); 		extern U32 CreateWindow(U8 ClassName, char *Caption, U32 Style, 					 U16 x, U16 y, U16 Width, U16 Height,					 U32 Parent, U32 hMenu, void *exdata);extern STATUS DestroyWindow(U32 Wndid);				 /*the power saving mode in ASIXGetMessage*/#define GETMSG_NOMAL	0x0000#define GETMSG_NO_ALARM	0x0001	/*no alarm pop up*/#define GETMSG_NO_DOZE	0x0002	/*no into doze mode*/#define GETMSG_NO_SLEEP	0x0004	/*no into sleep mode*///extern STATUS ASIXGetMessage(PMSG pMessage, U32 *pWnd_id, U16 mode, U16 Reserved2);	//extern STATUS DefWindowProc(U16 MsgCmd, U32 lparam, P_U16 data, U16 wparam);extern STATUS SetWindowText(U32 Wndid, char *Caption, void *exdata);extern STATUS EnableWindow(U32 Wndid, U8 Enable);extern U32    SetFocus(U32 Wndid);extern U32    GetFocus(void);extern STATUS EnableFocus( U32 wndid, U8 state );extern ASIX_WINDOW *FocusLookUp(ASIX_WINDOW *wndhead);extern STATUS RepaintWindow(U32 wndid, U32 lparam);extern STATUS PopUpWindow( U32 Wndid, U32 reserved );extern STATUS GetWindowStatus(U32 Wndid, P_U32 Status);extern U32 GetCurWindow( void );extern SYSTCB *GetCurTask( void ); extern STATUS IsMyWindow(U32 Wndid, U32 Head);//extern void AsixTransKeyMsg( MSG *asix_msg, KEYDATA *key );/*Scroll Bar support functions-defined in scroll.c*/extern	STATUS 	SetScrollRange(U32 windowid,U16 minpos, U16 maxpos);extern	STATUS 	GetScrollRange(U32 windowid, P_U16 minpos,P_U16 maxpos);extern	U16 	GetScrollPos(U32 windowid, U16 message, U16 wparam, U8 flag);extern	STATUS 	SetScrollPos(U32 windowid, U16 wparam, U32 menu, U16 message);//#ifdef ASIX_DEBUGextern STATUS tst_create(char *caption, U32 style, U16 x, U16 y, U16 width, U16 hight,						 U32 parent, U32 menu, void **ctrl_str, void *exdata);extern STATUS tst_destroy(void *ctrl_str);extern STATUS tst_msgproc( U32 win_id, U16 asix_msg, U32 lparam, void *data, U16 wparam, void *reserved);extern STATUS tst_msgtrans(void *ctrl_str, U16 msg_type, U32 areaId, P_U16 data, U32 size, void *trans_msg);//#endif	/****** Test Disp Support ***************************************************//* defined in disp.c and disp.h */#define	ASCII_5X7_FONT	SMALL_NORMAL_FONT#define	ASCII_8X16_FONT	LARGE_NORMAL_FONT#define	HZK_16X16_FONT	GB_NORMAL_FONT#define	T_ASCII_5X7_FONT	SMALL_ITALIC_FONT#define	T_ASCII_8X16_FONT	BIG5_VARIABLE_FONT#define	T_HZK_16X16_FONT	BIG5_NORMAL_FONT// 11/07//extern char 	*DrawText(U32 hDC, char *str, U16 xSrc, U16 ySrc, U16 xDes, U16 yDes, U16 font, U16 grey, U16 style);//extern STATUS	TextOut(U32 hDC, char *str, U16 x, U16 y, U16 font, U16 grey, U16 style); 	#define DisplayMsg(str, xSrc, ySrc, xDes, yDes, mode) \		DrawText(GetGC(), str, xSrc, ySrc, xDes, yDes, HZK_16X16_FONT, \		ColorTheme.form_text, mode)//pessia : test//#define DisplayMsg(str, xSrc, ySrc, xDes, yDes, mode) /****** Message Box support *************************************************/extern U16 MessageBox( U32 wndid, char *inforstr, char *caption, U16 type );#define MB_OK               0x0000#define MB_OKCANCEL         0x0001#define MB_ABORTRETRYIGNORE 0x0002#define MB_YESNOCANCEL      0x0003#define MB_YESNO            0x0004#define MB_RETRYCANCEL      0x0005#define MB_FLOAT			0x0006	/* display and then dissapia */#define MB_TYPEMASK         0x000F#define MB_ICONHAND         0x0010#define MB_ICONQUESTION     0x0020#define MB_ICONEXCLAMATION  0x0030#define MB_ICONASTERISK     0x0040#define MB_ICONERROR		0x0050#define MB_ICONMASK         0x00F0#define MB_ICONINFORMATION  MB_ICONASTERISK#define MB_ICONSTOP         MB_ICONHAND#define MB_DEFBUTTON1       0x0000#define MB_DEFBUTTON2       0x0100#define MB_DEFBUTTON3       0x0200#define MB_DEFMASK          0x0F00/* Standard dialog button IDs */#define IDOK                1#define IDCANCEL            2#define IDABORT             3#define IDRETRY             4#define IDIGNORE            5#define IDYES               6#define IDNO                7/* Dispstring ,defined in disp.c and disp.h */// 11/07 longn_qi//extern char 	*DrawText(U32 hDC, char *str, U16 xSrc, U16 ySrc, U16 xDes, U16 yDes, U16 font, U16 grey, U16 style);//extern STATUS	TextOut(U32 hDC, char *str, U16 xSrc, U16 ySrc, U16 font, U16 grey, U16 style);/****** SingleEditor Popwindow support *************************************************/extern STATUS OpenSingleEditor( char *caption, char *tips, char *extern_buffer, U16 size, U32 style );extern STATUS CreateMultiEditor( char *caption, char *extern_buffer, U16 size );//extern STATUS SetListDisplay( U32 windowid, P_VOID list_field, U8 count);extern STATUS SelectListBox( U32 windowid, U8 sel );//#define OPEN_SFTKB			1		// open soft keyboard#define ALARM_SYSTEM		0#define ALARM_PHONE			1#define ALARM_SMS			2#define ALARM_APPOINTMENT	3#endif	//#ifndef _ASIXWIN_H 	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -