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

📄 nano-x.h

📁 针对嵌入式micro window系统
💻 H
📖 第 1 页 / 共 2 页
字号:
  GR_WINDOW_ID otherid;		/* new/old focus id for focus events*/} GR_EVENT_GENERAL;/* Events for mouse motion or mouse position. */typedef struct {  GR_EVENT_TYPE type;		/* event type */  GR_WINDOW_ID wid;		/* window id event delivered to */  GR_WINDOW_ID subwid;		/* sub-window id (pointer was in) */  GR_COORD rootx;		/* root window x coordinate */  GR_COORD rooty;		/* root window y coordinate */  GR_COORD x;			/* window x coordinate of mouse */  GR_COORD y;			/* window y coordinate of mouse */  GR_BUTTON buttons;		/* current state of buttons */  GR_KEYMOD modifiers;		/* modifiers (MWKMOD_SHIFT, etc)*/} GR_EVENT_MOUSE;/* GrRegisterInput event*/typedef struct {  GR_EVENT_TYPE type;		/* event type */  int		fd;		/* input fd*/} GR_EVENT_FDINPUT;/* GR_EVENT_TYPE_UPDATE */typedef struct {  GR_EVENT_TYPE type;		/* event type */  GR_WINDOW_ID wid;		/* select window id*/  GR_WINDOW_ID subwid;		/* update window id (=wid for UPDATE event)*/  GR_COORD x;			/* new window x coordinate */  GR_COORD y;			/* new window y coordinate */  GR_SIZE width;		/* new width */  GR_SIZE height;		/* new height */  GR_UPDATE_TYPE utype;		/* update_type */} GR_EVENT_UPDATE;/* GR_EVENT_TYPE_SCREENSAVER */typedef struct {  GR_EVENT_TYPE type;		/* event type */  GR_BOOL activate;		/* true = activate, false = deactivate */} GR_EVENT_SCREENSAVER;/* GR_EVENT_TYPE_CLIENT_DATA_REQ */typedef struct {  GR_EVENT_TYPE type;		/* event type */  GR_WINDOW_ID wid;		/* ID of requested window */  GR_WINDOW_ID rid;		/* ID of window to send data to */  GR_SERIALNO serial;		/* Serial number of transaction */  GR_MIMETYPE mimetype;		/* Type to supply data as */} GR_EVENT_CLIENT_DATA_REQ;/* GR_EVENT_TYPE_CLIENT_DATA */typedef struct {  GR_EVENT_TYPE type;		/* event type */  GR_WINDOW_ID wid;		/* ID of window data is destined for */  GR_WINDOW_ID rid;		/* ID of window data is from */  GR_SERIALNO serial;		/* Serial number of transaction */  unsigned long len;		/* Total length of data */  unsigned long datalen;	/* Length of following data */  void *data;			/* Pointer to data (filled in on client side) */} GR_EVENT_CLIENT_DATA;/* GR_EVENT_TYPE_SELECTION_CHANGED */typedef struct {  GR_EVENT_TYPE type;		/* event type */  GR_WINDOW_ID new_owner;	/* ID of new selection owner */} GR_EVENT_SELECTION_CHANGED;/* * Union of all possible event structures. * This is the structure returned by the GrGetNextEvent and similar routines. */typedef union {  GR_EVENT_TYPE type;			/* event type */  GR_EVENT_ERROR error;			/* error event */  GR_EVENT_GENERAL general;		/* general window events */  GR_EVENT_BUTTON button;		/* button events */  GR_EVENT_KEYSTROKE keystroke;		/* keystroke events */  GR_EVENT_EXPOSURE exposure;		/* exposure events */  GR_EVENT_MOUSE mouse;			/* mouse motion events */  GR_EVENT_FDINPUT fdinput;		/* fd input events*/  GR_EVENT_UPDATE update;		/* window update events */  GR_EVENT_SCREENSAVER screensaver; 	/* Screen saver events */  GR_EVENT_CLIENT_DATA_REQ clientdatareq; /* Request for client data events */  GR_EVENT_CLIENT_DATA clientdata;	/* Client data events */  GR_EVENT_SELECTION_CHANGED selectionchanged; /* Selection owner changed */} GR_EVENT;typedef void (*GR_FNCALLBACKEVENT)(GR_EVENT *);/* Pixel packings within words. */#define	GR_BITMAPBITS	(sizeof(GR_BITMAP) * 8)#define	GR_ZEROBITS	((GR_BITMAP) 0x0000)#define	GR_ONEBITS	((GR_BITMAP) 0xffff)#define	GR_FIRSTBIT	((GR_BITMAP) 0x8000)#define	GR_LASTBIT	((GR_BITMAP) 0x0001)#define	GR_BITVALUE(n)	((GR_BITMAP) (((GR_BITMAP) 1) << (n)))#define	GR_SHIFTBIT(m)	((GR_BITMAP) ((m) << 1))#define	GR_NEXTBIT(m)	((GR_BITMAP) ((m) >> 1))#define	GR_TESTBIT(m)	(((m) & GR_FIRSTBIT) != 0)/* Size of bitmaps. */#define	GR_BITMAP_SIZE(width, height)	((height) * \  (((width) + sizeof(GR_BITMAP) * 8 - 1) / (sizeof(GR_BITMAP) * 8)))#define	GR_MAX_BITMAP_SIZE \  GR_BITMAP_SIZE(MAX_CURSOR_SIZE, MAX_CURSOR_SIZE)/* GrGetSysColor colors*//* desktop background*/#define GR_COLOR_DESKTOP           0/* caption colors*/#define GR_COLOR_ACTIVECAPTION     1#define GR_COLOR_ACTIVECAPTIONTEXT 2#define GR_COLOR_INACTIVECAPTION   3#define GR_COLOR_INACTIVECAPTIONTEXT 4/* 3d border shades*/#define GR_COLOR_WINDOWFRAME       5#define GR_COLOR_BTNSHADOW         6#define GR_COLOR_3DLIGHT           7#define GR_COLOR_BTNHIGHLIGHT      8/* top level application window backgrounds/text*/#define GR_COLOR_APPWINDOW         9#define GR_COLOR_APPTEXT           10/* button control backgrounds/text (usually same as app window colors)*/#define GR_COLOR_BTNFACE           11#define GR_COLOR_BTNTEXT           12/* edit/listbox control backgrounds/text, selected highlights*/#define GR_COLOR_WINDOW            13#define GR_COLOR_WINDOWTEXT        14#define GR_COLOR_HIGHLIGHT         15#define GR_COLOR_HIGHLIGHTTEXT     16#define GR_COLOR_GRAYTEXT          17/* menu backgrounds/text*/#define GR_COLOR_MENUTEXT          18#define GR_COLOR_MENU              19/* Error strings per error number*/#define GR_ERROR_STRINGS		\	"",				\	"Bad window id: %d\n",		\	"Bad graphics context: %d\n",	\	"Bad cursor size\n",		\	"Out of server memory\n",	\	"Bad window size: %d\n",	\	"Keyboard error\n",		\	"Mouse error\n",		\	"Input only window: %d\n",	\	"Illegal on root window: %d\n",	\	"Clipping overflow\n",		\	"Screen error\n",		\	"Unmapped focus window: %d\n",	\	"Bad drawing mode gc: %d\n"extern char *nxErrorStrings[];/* Public graphics routines. */void		GrFlush(void);int		GrOpen(void);void		GrClose(void);void		GrGetScreenInfo(GR_SCREEN_INFO *sip);GR_COLOR	GrGetSysColor(int index);GR_WINDOW_ID	GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,			GR_SIZE width, GR_SIZE height, GR_SIZE bordersize,			GR_COLOR background, GR_COLOR bordercolor);GR_WINDOW_ID    GrNewPixmap(GR_SIZE width, GR_SIZE height, void * addr);GR_WINDOW_ID	GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,				GR_SIZE width, GR_SIZE height);void		GrDestroyWindow(GR_WINDOW_ID wid);GR_GC_ID	GrNewGC(void);GR_GC_ID	GrCopyGC(GR_GC_ID gc);void		GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip);void		GrDestroyGC(GR_GC_ID gc);GR_REGION_ID	GrNewRegion(void);GR_REGION_ID	GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points);void		GrDestroyRegion(GR_REGION_ID region);void		GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect);void		GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,			GR_REGION_ID src_rgn2);void		GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,			GR_REGION_ID src_rgn2);void		GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,			GR_REGION_ID src_rgn2);void		GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,			GR_REGION_ID src_rgn2);void		GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region);GR_BOOL		GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y);int		GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y,			GR_COORD w, GR_COORD h);GR_BOOL		GrEmptyRegion(GR_REGION_ID region);GR_BOOL		GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2);void		GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy);int		GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect);void		GrMapWindow(GR_WINDOW_ID wid);void		GrUnmapWindow(GR_WINDOW_ID wid);void		GrRaiseWindow(GR_WINDOW_ID wid);void		GrLowerWindow(GR_WINDOW_ID wid);void		GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y);void		GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height);void		GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid,			GR_COORD x, GR_COORD y);void		GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr);void		GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props);void		GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props);GR_FONT_ID	GrCreateFont(GR_CHAR *name, GR_COORD height,			GR_LOGFONT *plogfont);void		GrSetFontSize(GR_FONT_ID fontid, GR_COORD size);void		GrSetFontRotation(GR_FONT_ID fontid, int tenthsdegrees);void		GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags);void		GrDestroyFont(GR_FONT_ID fontid);void		GrGetFontInfo(GR_FONT_ID font, GR_FONT_INFO *fip);GR_WINDOW_ID	GrGetFocus(void);void		GrSetFocus(GR_WINDOW_ID wid);void		GrSetBorderColor(GR_WINDOW_ID wid, GR_COLOR color);void		GrClearWindow(GR_WINDOW_ID wid, GR_BOOL exposeflag);void		GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask);void		GrGetNextEvent(GR_EVENT *ep);void		GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout);void		GrCheckNextEvent(GR_EVENT *ep);int		GrPeekEvent(GR_EVENT *ep);void		GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1,			GR_COORD x2, GR_COORD y2);void		GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y);void		GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,			GR_POINT *pointtable);void		GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE width, GR_SIZE height);void		GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE width, GR_SIZE height);void		GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,			GR_POINT *pointtable);void		GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,			GR_POINT *pointtable);void		GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE rx, GR_SIZE ry);void		GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x,			GR_COORD y, GR_SIZE rx, GR_SIZE ry);void		GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,			GR_COORD bx, GR_COORD by, int type);void		GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE rx, GR_SIZE ry, GR_COORD angle1,			GR_COORD angle2, int type); /* floating point required*/void		GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground);void		GrSetGCBackground(GR_GC_ID gc, GR_COLOR background);void		GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag);void		GrSetGCMode(GR_GC_ID gc, int mode);void		GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font);void		GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags,			GR_SIZE *retwidth, GR_SIZE *retheight,GR_SIZE *retbase);void		GrReadArea(GR_DRAW_ID id, GR_COORD x, GR_COORD y, GR_SIZE width,			GR_SIZE height, GR_PIXELVAL *pixels);void		GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE width,GR_SIZE height,void *pixels,int pixtype);void            GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid,			GR_COORD srcx, GR_COORD srcy, int op);void		GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			GR_SIZE width, GR_SIZE height, GR_BITMAP *imagebits);void		GrDrawImageBits(GR_DRAW_ID id,GR_GC_ID gc,GR_COORD x,GR_COORD y,			GR_IMAGE_HDR *pimage);void		GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x,			GR_COORD y, GR_SIZE width, GR_SIZE height,			char *path, int flags);GR_IMAGE_ID	GrLoadImageFromFile(char *path, int flags);void		GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x,			GR_COORD y, GR_SIZE width, GR_SIZE height,			GR_IMAGE_ID imageid);void		GrFreeImage(GR_IMAGE_ID id);void		GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip);void		GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,			void *str, GR_COUNT count, int flags);void		GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height,			GR_COORD hotx, GR_COORD hoty, GR_COLOR foreground,			GR_COLOR background, GR_BITMAP *fbbitmap,			GR_BITMAP *bgbitmap);void		GrMoveCursor(GR_COORD x, GR_COORD y);void		GrGetSystemPalette(GR_PALETTE *pal);void		GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal);void		GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel);void		GrReqShmCmds(long shmsize);void		GrInjectPointerEvent(MWCOORD x, MWCOORD y,			int button, int visible);void		GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue,			GR_KEYMOD modifiers, GR_SCANCODE scancode,			GR_BOOL pressed);void		GrCloseWindow(GR_WINDOW_ID wid);void		GrKillWindow(GR_WINDOW_ID wid);void		GrSetScreenSaverTimeout(GR_TIMEOUT timeout);void		GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist);GR_WINDOW_ID	GrGetSelectionOwner(GR_CHAR **typelist);void		GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid,			GR_SERIALNO serial, GR_MIMETYPE mimetype);void		GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did,			GR_SERIALNO serial, GR_LENGTH len, GR_LENGTH thislen,			void *data);void		GrBell(void);void		GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap,			int flags);void		GrRegisterInput(int fd);void		GrMainLoop(GR_FNCALLBACKEVENT fncb);GR_FNCALLBACKEVENT GrSetErrorHandler(GR_FNCALLBACKEVENT fncb);void		GrDefaultErrorHandler(GR_EVENT *ep);/* passive library entry points - available with client/server only*/void		GrPrepareSelect(int *maxfd,void *rfdset);void		GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb);/* nxutil.c - utility routines*/GR_WINDOW_ID	GrNewWindowEx(GR_WM_PROPS props, GR_CHAR *title,			GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,			GR_SIZE width, GR_SIZE height, GR_COLOR background);void		GrDrawLines(GR_DRAW_ID w, GR_GC_ID gc, GR_POINT *points,			GR_COUNT count);GR_WINDOW_ID    GrNewPixmapFromData(GR_SIZE width, GR_SIZE height, 			GR_COLOR foreground, GR_COLOR background, void * bits,			int flags);/* useful function macros*/#define GrSetWindowBackgroundColor(wid,color) \		{	GR_WM_PROPERTIES props;	\			props.flags = GR_WM_FLAGS_BACKGROUND; \			props.background = color; \			GrSetWMProperties(wid, &props); \		}#define GrSetWindowBorderSize(wid,width) \		{	GR_WM_PROPERTIES props;	\			props.flags = GR_WM_FLAGS_BORDERSIZE; \			props.bordersize = width; \			GrSetWMProperties(wid, &props); \		}#define GrSetWindowBorderColor(wid,color) \		{	GR_WM_PROPERTIES props;	\			props.flags = GR_WM_FLAGS_BORDERCOLOR; \			props.bordercolor = color; \			GrSetWMProperties(wid, &props); \		}#define GrSetWindowTitle(wid,name) \		{	GR_WM_PROPERTIES props;	\			props.flags = GR_WM_FLAGS_TITLE; \			props.title = (GR_CHAR *)name; \			GrSetWMProperties(wid, &props); \		}#ifdef __cplusplus}#endif/* RTEMS requires rtems_main()*/#if __rtems__#define main	rtems_main#endif#endif /* _NANO_X_H*/

⌨️ 快捷键说明

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