home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / DISPDECL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  9.3 KB  |  275 lines

  1. /*
  2.     dispdecl.h
  3.  
  4.     % Declarations for display manager
  5.  
  6.     5/16/88  by Ted.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      8/24/88 ted    merged driver and mode in to one stub function pointer.
  15.     11/22/88 ted    Added CheckMouse and ReadEvent functions
  16.     12/07/88 ted    Put init function into dControl structure.
  17.     12/12/88 ted    Merged CheckKey and CheckMouse into CheckEvent.
  18.      1/18/89 Ted    changed call to PlotText for simplified interface.
  19.      2/04/89 ted    Added pmap control dig element and codes.
  20.      2/07/89 Ted    added timeout wait arg to hCheckEvent function.
  21.      5/09/89 ted    Changed Alloc/Free terms to Open/Close.
  22.      6/17/89 ted    Added evcheck flag to dig.
  23.      6/28/89 ted    Removed display id info element.
  24.      6/28/89 ted    Added DC_GETCOLMAP, DC_CLAIMCOLOR, DC_RELEASECOLOR. Removed
  25.                      colmap from info structure to hide it in DIG.
  26.      6/28/89 ted    Changed mmwidth/height to x/ypixperm in info structure.
  27.      6/28/89 ted    Made dControl and pControl return int instead of void.
  28.      6/29/89 ted    Modified fontreq struct and added mouseshape struct.
  29.      7/12/89 ted    Converted '_func' prototypes from typedef to macro.
  30.      8/08/89 ted    Added bmap-to-pmap messages.
  31.      8/08/89 ted    Moved fontreq_struct out to ofontdesc_struct in oboxdecl.h.
  32.      8/30/89 ted    Added HC_CLEAREVENTS message.
  33. */
  34. /* -------------------------------------------------------------------------- */
  35. typedef enum {
  36.     DTYPE_MONOCHROME,
  37.     DTYPE_GREYSCALE,
  38.     DTYPE_MAPCOLOR,
  39.     DTYPE_TRUECOLOR
  40. } disptype;
  41. #ifdef LC        /* for lattice compiler enum bug */
  42. #    define disptype int
  43. #endif
  44.  
  45. /* DIG device/mode open function prototype */
  46. #define dmode_func(fname)            boolean fname(_arg1(struct dig__struct *digp))
  47. typedef dmode_func ((*dmode_fptr));
  48.  
  49. /* Curstype declarations */
  50.  
  51. typedef enum {
  52.     CURSOR_NONE,
  53.     CURSOR_BLOCK,
  54.     CURSOR_HALF,
  55.     CURSOR_THIN,
  56.     CURSOR_DASH,
  57.     CURSOR_NORMAL
  58. } cursortype;
  59. #ifdef LC        /* for lattice compiler enum bug */
  60. #    define cursortype int
  61. #endif
  62.  
  63. /*** Text attributes. ***/
  64.  
  65. #define ATTR_INVISIBLE        ((byte) 0x00)
  66. #define ATTR_NORMAL            ((byte) 0x07)
  67. #define ATTR_REVERSE        ((byte) 0x70)
  68. #define ATTR_UNDERLINE        ((byte) 0x01)
  69. #define ATTR_BLINKING        ((byte) 0x87)
  70. #define ATTR_BOLD            ((byte) 0x0F)
  71.  
  72. #define BO_LSBYTFIRST        ((byte) 0)
  73. #define BO_MSBYTFIRST        ((byte) 1)
  74. /* -------------------------------------------------------------------------- */
  75. /* The display device info structure */
  76.  
  77. #define DEVNAMELEN    22
  78.  
  79. typedef struct {
  80.     char     devname[DEVNAMELEN]; /* Text for device's name */
  81.     int     mode;                /* Device Display Mode */
  82.     unsigned xpixperm;            /* Pixels per meter on display device in x direction */
  83.     unsigned ypixperm;            /* Pixels per meter on display device in y direction */
  84.  
  85.     pmap_type dispmap;            /* Pixmap describing display memory */
  86.     unsigned dispaddr;            /* address of display buffer(if any) */
  87.     odim     bytewidth;            /* number of bytes in a line of display. */
  88.     unsigned ileave;            /* display memory interleave factor */
  89.     odim     ilsize;                /* interleave block size */
  90.     byte    nplanes;            /* number of bitplanes in image. */
  91.     byte    pixbits;            /* number of bits per pixel in a plane. */
  92.  
  93.     long     ncolors;            /* Number of possible pixel values */
  94.     disptype colortype;            /* type of display (e.g. Monochrome, Truecolor, etc.) */
  95.     ocolmap_type defcolmap;        /* Pointer to copy of device default color map */
  96.  
  97.     byte     hardcursor;            /* Flag for hardware cursor used by this driver */
  98.     byte    byteorder;            /* Code for the processor's byte order in a word */
  99.  
  100.     struct ofont_struct def_font; /* default system font */
  101. } dispinfo_struct;
  102.  
  103. /* dig_dControl Messages */
  104.  
  105. typedef enum {
  106.     DC_GETINFO,
  107.     DC_INITMODE,
  108.     DC_RESTOREMODE,
  109.     DC_SETATTRCOLS,
  110.     DC_GETATTRFG,
  111.     DC_GETATTRBG,
  112.     DC_SETCOLMAP,
  113.     DC_GETCOLMAP,
  114.     DC_CLAIMCOLOR,
  115.     DC_RELEASECOLOR,
  116.     DC_OPENFONT,
  117.     DC_CLOSEFONT,
  118.     DC_READCHARATTR,        /* only for cmwin isave */
  119.     DC_CACHE,                /* Hides mouse cursor also */
  120.     DC_FLUSH
  121. } dig_dcmsg;
  122. #ifdef LC        /* for lattice compiler enum bug */
  123. #    define dig_dcmsg int
  124. #endif
  125.  
  126. /* dig_pControl Messages */
  127.  
  128. typedef enum {
  129.     PC_OPENPMAP,
  130.     PC_CLOSEPMAP,
  131.     PC_CLEARPMAP,
  132.     PC_COPYPMAP,
  133.     PC_PMAPTOBMAP,
  134.     PC_BMAPTOPMAP,
  135.     PC_SAVEPMAP,
  136.     PC_LOADPMAP
  137. } dig_pcmsg;
  138. #ifdef LC        /* for lattice compiler enum bug */
  139. #    define dig_pcmsg int
  140. #endif
  141.  
  142. /* dig_hControl Messages */
  143.  
  144. typedef enum {
  145.     HC_OPEN,
  146.     HC_CLOSE,
  147.     HC_INITMOUSE,            /* Inits mouse box to dimensions of display */
  148.     HC_DEINITMOUSE,
  149.     HC_ISMOUSEON,
  150.     HC_SETMOUSEBOX,
  151.     HC_SETMOUSESHAPE,
  152.     HC_GETMOUSESHAPE,
  153.     HC_SETSOUNDON,
  154.     HC_SETSOUNDOFF,
  155.     HC_GETSOUNDON,
  156.     HC_CLEAREVENTS,
  157.     HC_PROTECT,
  158.     HC_UNPROTECT
  159. } dig_hcmsg;
  160. #ifdef LC        /* for lattice compiler enum bug */
  161. #    define dig_hcmsg int
  162. #endif
  163.  
  164. /* Window paint data structure */
  165.  
  166. typedef struct {
  167.     obj_type     win;
  168.     opbox       *relboxp;            /* box for tile relative to window */
  169.     VOID       *emsgdata;            /* message indata (needed for scrolling) */
  170. } ptd_struct;
  171.  
  172. /* -------------------------------------------------------------------------- */
  173. /* Hardware Dependent Code function types */
  174.  
  175. #define dig_CloseDIG_func(fname)    void    fname(_arg1(struct dig__struct *digp))
  176. #define dig_dControl_func(fname)    int        fname(_arg3(dig_dcmsg msg, VOID *indata, VOID *outdata))
  177.  
  178. #define dig_pPlotText_func(fname)    void    fname(_arg7(ptd_struct *ptd, opcoord x, opcoord y, char *charbuf, char rchar, byte rattr, int slen))
  179. #define dig_pDrawCursor_func(fname)    void    fname(_arg2(ptd_struct *ptd, cursortype ctype))
  180. #define dig_pClear_func(fname)        void    fname(_arg2(ptd_struct *ptd, opixval color))
  181. #define dig_pScrollBoxVt_func(fname) void    fname(_arg2(ptd_struct *ptd, opcoord n))
  182. #define dig_pScrollBoxHz_func(fname) void    fname(_arg2(ptd_struct *ptd, opcoord n))
  183.  
  184. #define dig_pDrawPixmap_func(fname)    void    fname(_arg3(ptd_struct *ptd, pmap_type pmap, opbox *pmboxp))
  185. #define dig_pReadPixmap_func(fname)    void    fname(_arg3(ptd_struct *ptd, pmap_type pmap, opbox *pmboxp))
  186. #define dig_pControl_func(fname)    int        fname(_arg3(dig_pcmsg msg, VOID *indata, VOID *outdata))
  187.  
  188. #define dig_hCheckEvent_func(fname) unsigned fname(_arg1(unsigned wait))
  189. #define dig_hReadEvent_func(fname)    unsigned fname(_arg1(moupos_struct *mouposp))
  190. #define dig_hGetShift_func(fname)    unsigned fname(_arg1(void))
  191. #define dig_hTimer_func(fname)        unsigned fname(_arg1(void))
  192. #define dig_hPause_func(fname)        void    fname(_arg1(unsigned duration))
  193. #define dig_hSound_func(fname)        void    fname(_arg2(unsigned pitch, unsigned duration))
  194. #define dig_hControl_func(fname)    int        fname(_arg3(dig_hcmsg msg, VOID *indata, VOID *outdata))
  195. /* -------------------------------------------------------------------------- */
  196. /* Device Interface Group function structure */
  197.  
  198. typedef struct dig__struct {
  199.     dig_CloseDIG_func        ((*CloseDIG));        /* Clean up device interface */
  200.     dig_dControl_func        ((*dControl));        /* miscellaneous display control */
  201.  
  202.     dig_pDrawCursor_func    ((*pDrawCursor));    /* set text cursor position */
  203.     dig_pPlotText_func        ((*pPlotText));        /* draw text */
  204.     dig_pClear_func            ((*pClear));        /* clear screen */
  205.     dig_pScrollBoxVt_func    ((*pScrollBoxVt));    /* scroll vertical */
  206.     dig_pScrollBoxHz_func    ((*pScrollBoxHz));    /* scroll horizontal */
  207.  
  208.     dig_pDrawPixmap_func    ((*pDrawPixmap));    /* draw a region */
  209.     dig_pReadPixmap_func    ((*pReadPixmap));    /* read a region */
  210.     dig_pControl_func        ((*pControl));        /* pixel map control */
  211.  
  212.     dig_hCheckEvent_func    ((*hCheckEvent));    /* check for keystroke ready */
  213.     dig_hReadEvent_func        ((*hReadEvent));    /* read key/mouse event */
  214.     dig_hGetShift_func        ((*hGetShift));     /* get keyboard shift state */
  215.     dig_hTimer_func            ((*hTimer));        /* system timer */
  216.     dig_hPause_func            ((*hPause));        /* system timer delay */
  217.     dig_hSound_func            ((*hSound));        /* sound generator */
  218.  
  219.     dig_hControl_func        ((*hControl));        /* miscellaneous hardware control */
  220.  
  221.     VOID *data;                            /* generic data pointer for dig data */
  222.     SIZE_T datasize;                    /* size of dig data block */
  223.  
  224.     unsigned vtscroll:1;     /* specifies whether vertical scrolling is supported */
  225.     unsigned hzscroll:1;     /* specifies whether horizontal scrolling is supported */
  226.     unsigned textfree:1;     /* specifies whether text position is restricted */
  227.     unsigned evcheck:1;         /* specifies whether hard_CheckEvent works or not */
  228.     int         type;             /* dig type : specifies supported features */
  229.     int     version;         /* implementation version for the given type */
  230. } dig_struct;
  231.  
  232. typedef struct disp_struct {
  233.     dispinfo_struct *info;
  234.     dig_struct          dig;            /* structure of device group function ptrs */
  235.  
  236.     unsigned          mouse_timeout;
  237.     opcoord          mouse_distout;
  238. } *disp_type;
  239.  
  240. typedef struct {
  241.     struct disp_struct disp;
  242.     struct wmgr_struct wmgr;
  243.     int id;                    /* id for which dmgr is the current one */
  244. } dmgr_struct;
  245.  
  246. /* -------------------------------------------------------------------------- */
  247. /* Message in and outdata structures */
  248.  
  249. typedef ofontdesc_struct fontreq_struct;
  250.  
  251. typedef struct {
  252.     ptd_struct *ptd;
  253.     opcoord     x;
  254.     opcoord     y;
  255.     char        *charbuf;
  256.     byte        *attrbuf;
  257.     int         slen;
  258. } ptarg_struct;            /* Used for ReadCharAttr dControl method */
  259.  
  260. typedef struct {
  261.     byte         attr;
  262.     opixval     bg;
  263.     opixval     fg;
  264. } setattr_struct;
  265.  
  266. typedef struct {
  267.     bmap_type    image;
  268.     bmap_type    mask;
  269.     opcoord     xhot;
  270.     opcoord     yhot;
  271.     unsigned short tsmask, tcmask;    /* Text mode char/attribute pairs */
  272. } mouseshape_struct;
  273. /* -------------------------------------------------------------------------- */
  274.  
  275.