📄 mwtypes.h
字号:
#ifndef _MWTYPES_H#define _MWTYPES_H/* * Copyright (c) 1999, 2000, 2001, 2002, 2003 Greg Haerr <greg@censoft.com> * Portions Copyright (c) 2002 by Koninklijke Philips Electronics N.V. * * Exported Microwindows engine typedefs and defines */#define MWPACKED __attribute__ ((aligned(1), packed))/* builtin font std names*/#define MWFONT_SYSTEM_VAR "System" /* winFreeSansSerif 11x13 (ansi)*/#define MWFONT_SYSTEM_FIXED "SystemFixed" /* X6x13 (should be ansi)*/#define MWFONT_GUI_VAR "System" /* deprecated (was "Helvetica")*/#define MWFONT_OEM_FIXED "SystemFixed" /* deprecated (was "Terminal")*//* Text/GetTextSize encoding flags*/#define MWTF_ASCII 0x00000000L /* 8 bit packing, ascii*/#define MWTF_UTF8 0x00000001L /* 8 bit packing, utf8*/#define MWTF_UC16 0x00000002L /* 16 bit packing, unicode 16*/#define MWTF_UC32 0x00000004L /* 32 bit packing, unicode 32*/#define MWTF_XCHAR2B 0x00000008L /* 16 bit packing, X11 big endian PCF*/#define MWTF_PACKMASK 0x0000000FL /* packing bits mask*//* asian double-byte encodings*/#define MWTF_DBCS_BIG5 0x00000100L /* chinese big5*/#define MWTF_DBCS_EUCCN 0x00000200L /* chinese EUCCN (gb2312+0x80)*/#define MWTF_DBCS_EUCKR 0x00000300L /* korean EUCKR (ksc5601+0x80)*/#define MWTF_DBCS_EUCJP 0x00000400L /* japanese EUCJP*/#define MWTF_DBCS_JIS 0x00000500L /* japanese JISX0213*/#define MWTF_DBCSMASK 0x00000700L /* DBCS encodings bitmask*//* Text alignment flags*/#define MWTF_TOP 0x01000000L /* align on top*/#define MWTF_BASELINE 0x02000000L /* align on baseline*/#define MWTF_BOTTOM 0x04000000L /* align on bottom*//* SetFontAttr flags (no intersect with MWTF_ above)*/#define MWTF_KERNING 0x0001 /* font kerning*/#define MWTF_ANTIALIAS 0x0002 /* antialiased output*/#define MWTF_UNDERLINE 0x0004 /* draw underline*/#define MWTF_FREETYPE 0x1000 /* FIXME: remove*//* Drawing modes*/#define MWMODE_COPY 0 /* src*/#define MWMODE_XOR 1 /* src ^ dst*/#define MWMODE_OR 2 /* src | dst*/#define MWMODE_AND 3 /* src & dst*/#define MWMODE_CLEAR 4 /* 0*/#define MWMODE_SETTO1 5 /* 11111111*/ /* obsolete name, will be MWMODE_SET*/#define MWMODE_EQUIV 6 /* ~(src ^ dst)*/#define MWMODE_NOR 7 /* ~(src | dst)*/#define MWMODE_NAND 8 /* ~(src & dst)*/#define MWMODE_INVERT 9 /* ~dst*/#define MWMODE_COPYINVERTED 10 /* ~src*/#define MWMODE_ORINVERTED 11 /* ~src | dst*/#define MWMODE_ANDINVERTED 12 /* ~src & dst*/#define MWMODE_ORREVERSE 13 /* src | ~dst*/#define MWMODE_ANDREVERSE 14 /* src & ~dst*/#define MWMODE_NOOP 15 /* dst*/#define MWMODE_XOR_FGBG 16 /* src ^ background ^ dst (This is the Java XOR mode) */#define MWMODE_SIMPLE_MAX 16 /* Last "simple" (non-alpha) mode *//* * Porter-Duff rules for alpha compositing. * * Only SRC, CLEAR, and SRC_OVER are commonly used. * The rest are very uncommon, although a full Java implementation * would require them. (ATOP and XOR were introduced in JDK 1.4) * * Note that MWMODE_PORTERDUFF_XOR is *very* different from MWMODE_XOR. *//* #define MWMODE_CLEAR - already correctly defined */#define MWMODE_SRC MWMODE_COPY#define MWMODE_DST MWMODE_NOOP#define MWMODE_SRC_OVER 17#define MWMODE_DST_OVER 18#define MWMODE_SRC_IN 19#define MWMODE_DST_IN 20#define MWMODE_SRC_OUT 21#define MWMODE_DST_OUT 22#define MWMODE_SRC_ATOP 23#define MWMODE_DST_ATOP 24#define MWMODE_PORTERDUFF_XOR 25#define MWMODE_MAX 25/* Line modes */#define MWLINE_SOLID 0#define MWLINE_ONOFF_DASH 1/* FUTURE: MWLINE_DOUBLE_DASH *//* Fill mode */#define MWFILL_SOLID 0 #define MWFILL_STIPPLE 1 #define MWFILL_OPAQUE_STIPPLE 2 #define MWFILL_TILE 3/* Mouse button bits*/#define MWBUTTON_L 04#define MWBUTTON_M 02#define MWBUTTON_R 01/* Color defines*/#define MWARGB(a,r,g,b) ((MWCOLORVAL)(((unsigned char)(r)|\ (((unsigned)(unsigned char)(g))<<8))|\ (((unsigned long)(unsigned char)(b))<<16)|\ (((unsigned long)(unsigned char)(a))<<24)))#define MWRGB(r,g,b) MWARGB(255,(r),(g),(b)) /* rgb full alpha*/#define MW0RGB(r,g,b) MWARGB(0,(r),(g),(b)) /* rgb no alpha*//* convert an MWROP to drawing mode MWMODE value*/#define MWROP_TO_MODE(op) ((op) >> 24)/* convert an MWMODE to blitting mode MWROP value*/#define MWMODE_TO_ROP(op) (((long)(op)) << 24)/* * ROP blitter opcodes (extensions < 0x20000000 are reserved * for MWMODE_xxx blit ops, although currently some of these * are unused). */#define MWROP_EXTENSION 0xff000000L /* rop extension bits*//* copy src -> dst except for transparent color in src*/#define MWROP_SRCTRANSCOPY 0x21000000L/* alpha blend src -> dst with constant alpha, alpha value in low 8 bits*/#define MWROP_BLENDCONSTANT 0x22000000L/* alpha blend fg/bg color -> dst with src as alpha channel*/#define MWROP_BLENDFGBG 0x23000000L/* alpha blend src -> dst with separate per pixel alpha channel*/#define MWROP_BLENDCHANNEL 0x24000000L/* stretch src -> dst*/#define MWROP_STRETCH 0x25000000L/* Use the MWMODE value in the graphics context * to choose the appropriate MWROP value. * (This is only valid in calls to the Nano-X API, * it is not valid for the lower level blitters) */#define MWROP_USE_GC_MODE 0xff000000L/* blits rops based on src/dst binary operations*/#define MWROP_COPY MWMODE_TO_ROP(MWMODE_COPY)#define MWROP_XOR MWMODE_TO_ROP(MWMODE_XOR)#define MWROP_OR MWMODE_TO_ROP(MWMODE_OR)#define MWROP_AND MWMODE_TO_ROP(MWMODE_AND)#define MWROP_CLEAR MWMODE_TO_ROP(MWMODE_CLEAR)#define MWROP_SET MWMODE_TO_ROP(MWMODE_SETTO1)#define MWROP_EQUIV MWMODE_TO_ROP(MWMODE_EQUIV)#define MWROP_NOR MWMODE_TO_ROP(MWMODE_NOR)#define MWROP_NAND MWMODE_TO_ROP(MWMODE_NAND)#define MWROP_INVERT MWMODE_TO_ROP(MWMODE_INVERT)#define MWROP_COPYINVERTED MWMODE_TO_ROP(MWMODE_COPYINVERTED)#define MWROP_ORINVERTED MWMODE_TO_ROP(MWMODE_ORINVERTED)#define MWROP_ANDINVERTED MWMODE_TO_ROP(MWMODE_ANDINVERTED)#define MWROP_ORREVERSE MWMODE_TO_ROP(MWMODE_ORREVERSE)#define MWROP_ANDREVERSE MWMODE_TO_ROP(MWMODE_ANDREVERSE)#define MWROP_NOOP MWMODE_TO_ROP(MWMODE_NOOP)#define MWROP_XOR_FGBG MWMODE_TO_ROP(MWMODE_XOR_FGBG)/* * Porter-Duff rules for alpha compositing. * * Only SRC, CLEAR, and SRC_OVER are commonly used. * The rest are very uncommon, although a full Java implementation * would require them. * * Note that MWMODE_PORTERDUFF_XOR is very different from MWMODE_XOR. *//* #define MWMODE_CLEAR - already correctly defined */#define MWROP_SRC MWMODE_TO_ROP(MWMODE_SRC)#define MWROP_DST MWMODE_TO_ROP(MWMODE_DST)#define MWROP_SRC_OVER MWMODE_TO_ROP(MWMODE_SRC_OVER)#define MWROP_DST_OVER MWMODE_TO_ROP(MWMODE_DST_OVER)#define MWROP_SRC_IN MWMODE_TO_ROP(MWMODE_SRC_IN)#define MWROP_DST_IN MWMODE_TO_ROP(MWMODE_DST_IN)#define MWROP_SRC_OUT MWMODE_TO_ROP(MWMODE_SRC_OUT)#define MWROP_DST_OUT MWMODE_TO_ROP(MWMODE_DST_OUT)#define MWROP_SRC_ATOP MWMODE_TO_ROP(MWMODE_SRC_ATOP)#define MWROP_DST_ATOP MWMODE_TO_ROP(MWMODE_DST_ATOP)#define MWROP_PORTERDUFF_XOR MWMODE_TO_ROP(MWMODE_PORTERDUFF_XOR)#define MWROP_SRCCOPY MWROP_COPY /* obsolete*/#define MWROP_SRCAND MWROP_AND /* obsolete*/#define MWROP_SRCINVERT MWROP_XOR /* obsolete*/#define MWROP_BLACKNESS MWROP_CLEAR /* obsolete*//* * Pixel formats * Note the two pseudo pixel formats are never returned by display drivers, * but rather used as a data structure type in GrArea. The other * types are both returned by display drivers and used as pixel packing * specifiers. */#define MWPF_RGB 0 /* pseudo, convert from packed 32 bit RGB*/#define MWPF_PIXELVAL 1 /* pseudo, no convert from packed PIXELVAL*/#define MWPF_PALETTE 2 /* pixel is packed 8 bits 1, 4 or 8 pal index*/#define MWPF_TRUECOLOR0888 3 /* pixel is packed 32 bits 8/8/8 truecolor*/#define MWPF_TRUECOLOR888 4 /* pixel is packed 24 bits 8/8/8 truecolor*/#define MWPF_TRUECOLOR565 5 /* pixel is packed 16 bits 5/6/5 truecolor*/#define MWPF_TRUECOLOR555 6 /* pixel is packed 16 bits 5/5/5 truecolor*/#define MWPF_TRUECOLOR332 7 /* pixel is packed 8 bits 3/3/2 truecolor*/#define MWPF_TRUECOLOR8888 8 /* pixel is packed 32 bits 8/8/8/8 truecolor with alpha *//* * MWPIXELVAL definition: changes based on target system * Set using -DMWPIXEL_FORMAT=MWPF_XXX * * For the Nano-X server, it is important to use the correct MWPF_* value * for the MWPIXEL_FORMAT macro in order to match the hardware, * while the Nano-X clients that includes this file can get away with * a default pixel format of 24-bit color as the client will either: * 1) Use the MWPF_PIXELVAL native format when calling GrReadArea, in * which case we have to have enough spare room to hold 32-bit * pixlevalues (hence the default MWPF_TRUECOLOR0888 format), or * 2) Will use some other PF_* format, in which case the application * is well aware of which pixel-format it uses and can avoid the * device specific RGB2PIXEL and use RGB2PIXEL565 etc. instead, * and specifiy the pixel fomar as MWPF_TRUECOLOR565 etc. when * calling the GrArea function(s). */#ifndef MWPIXEL_FORMAT#define MWPIXEL_FORMAT MWPF_TRUECOLOR0888#endif#if defined(__AS386_16__)/* Force 8 bit palettized display for ELKS*/#undef MWPIXEL_FORMAT#define MWPIXEL_FORMAT MWPF_PALETTE#endif#if (MWPIXEL_FORMAT == MWPF_TRUECOLOR565) || (MWPIXEL_FORMAT == MWPF_TRUECOLOR555)typedef unsigned short MWPIXELVAL;#else #if MWPIXEL_FORMAT == MWPF_TRUECOLOR332 typedef unsigned char MWPIXELVAL; #else #if MWPIXEL_FORMAT == MWPF_PALETTE typedef unsigned char MWPIXELVAL; #else typedef unsigned long MWPIXELVAL; #endif #endif#endif/* portrait modes*/#define MWPORTRAIT_NONE 0x00 /* hw framebuffer, no rotation*/#define MWPORTRAIT_LEFT 0x01 /* rotate left*/#define MWPORTRAIT_RIGHT 0x02 /* rotate right*/#define MWPORTRAIT_DOWN 0x04 /* upside down*//* * Type definitions */typedef int MWCOORD; /* device coordinates*/typedef int MWBOOL; /* boolean value*/typedef unsigned char MWUCHAR; /* unsigned char*/typedef unsigned long MWCOLORVAL; /* device-independent color value*/typedef unsigned short MWIMAGEBITS; /* bitmap image unit size*/typedef unsigned long MWTIMEOUT; /* timeout value */typedef unsigned long MWTEXTFLAGS; /* MWTF_ text flag*/#define MWCOORD_MAX 0x7fff /* maximum coordinate value*/#define MWCOORD_MIN (-MWCOORD_MAX) /* minimum coordinate value*//* MWIMAGEBITS macros*/#define MWIMAGE_WORDS(x) (((x)+15)/16)#define MWIMAGE_BYTES(x) (MWIMAGE_WORDS(x)*sizeof(MWIMAGEBITS))/* size of image in words*/#define MWIMAGE_SIZE(width, height) \ ((height) * (((width) + MWIMAGE_BITSPERIMAGE - 1) / MWIMAGE_BITSPERIMAGE))#define MWIMAGE_BITSPERIMAGE (sizeof(MWIMAGEBITS) * 8)#define MWIMAGE_BITVALUE(n) ((MWIMAGEBITS) (((MWIMAGEBITS) 1) << (n)))#define MWIMAGE_FIRSTBIT (MWIMAGE_BITVALUE(MWIMAGE_BITSPERIMAGE - 1))#define MWIMAGE_NEXTBIT(m) ((MWIMAGEBITS) ((m) >> 1))#define MWIMAGE_TESTBIT(m) ((m) & MWIMAGE_FIRSTBIT) /* use with shiftbit*/#define MWIMAGE_SHIFTBIT(m) ((MWIMAGEBITS) ((m) << 1)) /* for testbit*//* dbl linked list data structure*/typedef struct _mwlist { /* LIST must be first decl in struct*/ struct _mwlist *next; /* next item*/ struct _mwlist *prev; /* previous item*/} MWLIST, *PMWLIST;/* dbl linked list head data structure*/typedef struct _mwlisthead { struct _mwlist *head; /* first item*/ struct _mwlist *tail; /* last item*/} MWLISTHEAD, *PMWLISTHEAD;/* Keyboard state modifiers*/typedef unsigned int MWKEYMOD;/* GetScreenInfo structure*/typedef struct { MWCOORD rows; /* number of rows on screen */ MWCOORD cols; /* number of columns on screen */ int xdpcm; /* dots/centimeter in x direction */ int ydpcm; /* dots/centimeter in y direction */ int planes; /* hw # planes*/ int bpp; /* hw bpp*/ long ncolors; /* hw number of colors supported*/ int fonts; /* number of built-in fonts */ int buttons; /* buttons which are implemented */ MWKEYMOD modifiers; /* modifiers which are implemented */ int pixtype; /* format of pixel value*/ int portrait; /* current portrait mode*/ MWBOOL fbdriver; /* true if running mwin fb screen driver*/ unsigned long rmask; /* red mask bits in pixel*/ unsigned long gmask; /* green mask bits in pixel*/ unsigned long bmask; /* blue mask bits in pixel*/ MWCOORD xpos; /* current x mouse position*/ MWCOORD ypos; /* current y mouse position*//* items below are get/set by the window manager and not used internally*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -