home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v1.zip / DDKX86 / H / PMAVIOP.H < prev    next >
C/C++ Source or Header  |  1995-04-14  |  39KB  |  1,096 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT (C) Microsoft Corporation, 1989                                 */
  4. /* COPYRIGHT (C) Microsoft Corporation, 1989                                 */
  5. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  6. /*                                                                           */
  7. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  8. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  9. /*    drivers. You may use this code in accordance with the IBM License      */
  10. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  11. /*    Copyright statement may not be removed.                                */
  12. /*                                                                           */
  13. /*****************************************************************************/
  14. /****************************** Module Header ******************************\
  15. *
  16. * Module Name: PMAVIOP.H
  17. *
  18. * OS/2 Presentation Manager AVIO PRIVATE function declarations
  19. *
  20. *
  21. *
  22. * ===========================================================================
  23. *
  24. * Comments at the end of each typedef line give the name tags used in
  25. * the assembler include version of this file.
  26. *
  27. * The assembler include version of this file excludes lines between NOINC
  28. * and INC comments.
  29. *
  30. #ifndef __IBMC__
  31.    * The 32-bit version of this file (as placed into the IBMH directory)
  32.    * excludes all non 32-bit material marked in this file as well
  33.    * as any areas specifically marked with __IBMC__ conditional
  34.    * sections - including this paragraph. The H2IBMH rexx command file
  35.    * removes these sections.
  36. #endif
  37. * ===========================================================================
  38. *
  39. */
  40. /* NOINC */
  41. #ifdef __IBMC__
  42.    #pragma checkout( suspend )
  43.       #ifndef __CHKHDR__
  44.          #pragma checkout( suspend )
  45.       #endif
  46.    #pragma checkout( resume )
  47. #endif
  48. /* INC */
  49.  
  50. #define PMAVIOP_INCLUDED
  51.  
  52. #ifndef INCL_32         /* If neither INCL_32 or INCL_16 set already */
  53.    #ifndef INCL_16      /* find out from compiler if 32-bit or not.  */
  54.      #ifdef M_I386
  55.         #define INCL_32 /* Compiling for 32-bit */
  56.      #else
  57.         #define INCL_16 /* Compiling for 16-bit */
  58.      #endif
  59.   #endif
  60. #endif
  61.  
  62. /* NOINC */
  63. #ifndef INCL_32
  64.    #ifndef APIENTRY16
  65.       #define APIENTRY16 APIENTRY
  66.    #endif
  67. #endif
  68. /* INC */
  69.  
  70. /*************************** Shield Section ****************************
  71. *
  72. * Abstract: Data structures and constants used by the Shield Layer.
  73. *           Interfaces provided by the Shield Layer.
  74. *
  75. * Created:  07-May-87
  76. * Author:   Ron Murray  [ronm]
  77. *
  78. *
  79. * This include file defines the data structures used by the Shield
  80. * Layer module and documents their usage conventions.
  81. *
  82. */
  83.  
  84. /************************ Conventions **********************************\
  85. *
  86. * Instances of VioPresentationSpace correspond to console windows.  Vio and
  87. * Shield Layer modules cooperatively use them to maintain the state of the
  88. * console's window.  That cooperation is mediated by a ram semaphore
  89. * (fsemVioPSLock) which must be acquired before any drawing actions or
  90. * presentation space modifications are attempted on behalf of the console.
  91. *
  92. * When the sempahore is acquired, the VioPS will be in a consistent state.
  93. * It may become temporarily inconsistent while the semaphore is held,
  94. * but it must again be consistent when the semaphore lock is released.  The
  95. * WinSyncWithPS (defined below) is relevant here.
  96. *
  97. * When a new console is created, the Vio module allocates a shared global
  98. * segment containing the VioPresentationSpace instance for that console.
  99. *
  100. * The initialization process is completed by the WinCreateConsole function
  101. * (defined below) which defines pShieldGreData to reference a private data
  102. * structure within the global segment.  That is done by reallocating the
  103. * global segment to provide room for the private data.
  104. *
  105. * All drawing actions by Vio and the Shield Layer are accomplished by means
  106. * of the CharRect, CharStr, ScrollRect, and UpdateCursor interfaces provided
  107. * by the Graphics Engine API.
  108. *
  109. \***********************************************************************/
  110.  
  111.  
  112. /*********************** Field Definitions *****************************\
  113. *
  114. * fsemVioPSLock -- A fast, safe ram semaphore used to control
  115. * access to the presentation space by the Vio module and the Shield
  116. * Layer thread.  This semaphore records the process/thread numbers
  117. * for the owning thread.  That makes crash-recovery cleanups possible.
  118. *
  119. * selLVB -- A segment selector for the Logical Video Buffer.
  120. * The LVB is assumed to begin at offset zero within that segment.  It is a
  121. * two dimensional array of character cells laid out in memory in row-major
  122. * order.
  123. *
  124. * selBVSCB -- A segment selector field filled in by BvsCalls.
  125. * That segment contains per-session control information used by the
  126. * BvsCalls module.
  127. *
  128. * rgfAVio -- A word of bit flags reserved for use by the AVio subsystem.
  129. * Currently it's used to denote whether the PS is associated with a
  130. * device context.
  131. *
  132. * CellByteSize -- The size in bytes of a logical video buffer cell.  For VIO
  133. * presentation spaces this values must be 2.  This field is included for upward
  134. * compatibility with AVIO presentation spaces where CellSize == 4.
  135. *
  136. * BufferRowCount -- The number of cell rows in the logical video buffer.
  137. *
  138. * BufferColumnCount -- The number of cell columns in the logical video buffer.
  139. *
  140. * WindowOriginRow -- A row index for the logical video buffer. This field
  141. * together with the WindowOriginColumn field contain the indices of the LVB
  142. * cell which is drawn in the bottom left corner of the console window's
  143. * client area.  The origin for these coordinates is the bottom left corner
  144. * of the LVB.  These fields are maintained by the Shield Layer thread as
  145. * the console window is scrolled and resized.
  146. *
  147. * WindowOriginColumn -- A column index for the logical video buffer. See the
  148. * description of WindowOriginRow.
  149. *
  150. * TextCursorRow -- The row coordinate for the flashing text cursor associated
  151. * with this Vio console.  This coordinate defines the vertical position of the
  152. * cursor relative to the logical video buffer.
  153. *
  154. * TextCursorColumn -- The column coordinate for the flashing text cursor.  This
  155. * coordinate defines the position of the cursor relative to the logical video
  156. * buffer.
  157. *
  158. * TextCursorStartLine -- The first scan line of a character cell image overlaid
  159. * by the text cursor. Lines in the cell image are number from top to bottom
  160. * starting at zero.
  161. *
  162. * TextCursorEndLine -- The last scan line of a character cell image overlaid by
  163. * the text cursor.
  164. *
  165. * If the TextCursorStartLine and TextCursorEndLine fields are initially zero,
  166. * WinCreateConsole function will set them to values which will place a line at
  167. * the bottom the character cell.  The thickness of that line will match the
  168. * system metric SM_CYBORDER.
  169. *
  170. * Non-zero values will be coerced into the half open interval
  171. * [0.. CellImageHeight).
  172. *
  173. *
  174. * TextCursorWidth -- The width of the text cursor in pixels.  If this field is
  175. * initially zero WinCreateConsole will set it to match the width of a character
  176. * cell. Non-zero values for CWidth will be coerced into the half open interval
  177. * [ 0..CellWidth).
  178. *
  179. * TextCursorVisible -- The VIO module uses this field to define whether it
  180. * wishes the cursor to be visible (non zero values) or invisible (zero).  Note
  181. * that the cursor may not be visible even when this field is non-zero.  For
  182. * example the window for this console may not have the input focus.
  183. *
  184. * After setting this field, Vio calls UpdateCursor (part of the Graphics
  185. * Engine Interface) to bring the text cursor image into correspondence.
  186. *
  187. *
  188. * CellImageHeight -- The height in pixels of a character cell image.  This
  189. * field together with the CellImageWidth field define the DeviceCellSize.
  190. *
  191. * CellImageWidth -- The width in pixels of a character cell image.
  192. *
  193. * CodepageID -- A number identifying the code page from which character
  194. *               images are to be copied.
  195. *
  196. * WindowHeight -- The height of the console window client rectangle in
  197. *                 units of LVB cell images.
  198. *
  199. * WindowWidth -- The width of the console window client rectangle in units
  200. *                of LVB cell images.
  201. *
  202. * The WindowHeight and WindowWidth fields are maintained by the Shield Layer
  203. * thread for Vio presentation spaces and by WinDefAvioWindowProc for AVio
  204. * presentation spaces.
  205. *
  206. * hConsoleDisplayContext -- A handle to the Own Display Context corresponding
  207. * to this presentation space.
  208. *
  209. \***********************************************************************/
  210.  
  211.  
  212. /******************* Public Data Type **********************************\
  213.  *
  214.  * VioPresentationSpace  -- Shared with the Vio module
  215.  *
  216. \***********************************************************************/
  217. /*ifdef D1348*/
  218. #define DBCSEvBufSiz 10
  219. typedef struct _DBCSENVINFO { /* dbcsenvinfo */
  220.     UCHAR  DBCSVector[DBCSEvBufSiz];    /* DBCS Vectors */
  221.     USHORT cc;                          /* Country Code */
  222.     USHORT cp;                          /* Code Page    */
  223. } DBCSENVINFO;
  224.  
  225.  
  226.  
  227. typedef struct _VIOPSNLSEXT { /* viopsnlsext */
  228.     DBCSENVINFO DBCSEvInfo[4];  /* For lcid 0 to 3 */
  229.     ULONG       grid_color;     /* For Display.dll */
  230.     ULONG       scrnattrflag;   /* lsb = 0 : screen intensity low */
  231.                                 /*       1 : screen intensity high */
  232. } VIOPSNLSEXT;
  233. typedef VIOPSNLSEXT FAR  *PVIOPSNLSEXT;
  234. /*endif D1348*/
  235.  
  236. #ifdef INCL_32
  237.  
  238. typedef struct _VioPresentationSpace32 {  /* viops */
  239.  
  240.     FSRSEM  fsemVioPSLock;
  241. /****************************************/
  242. /*      what to do with these?          */
  243. /****************************************/
  244. /*  SEL     selLVB;                     */
  245. /*  SEL     selBVSCB;                   */
  246.     PVOID   pLVB;
  247.     PVOID   pBVSCB;
  248.     BOOL    rgfAVio;
  249.     USHORT  CellByteSize;
  250.     USHORT  BufferRowCount;
  251.     USHORT  BufferColumnCount;
  252.  
  253. /* Window Origin coordinates can be negative for AVio presentation spaces.
  254.  * For Vio presentation spaces the Shield Layer always coerces them to
  255.  * non-negative values such that the client rectangle always lies completely
  256.  * within the image of the logical video buffer.
  257.  */
  258.     short   WindowOriginRow;
  259.     short   WindowOriginColumn;
  260.     USHORT  TextCursorRow;
  261.     USHORT  TextCursorColumn;
  262.     USHORT  TextCursorStartLine;
  263.     USHORT  TextCursorEndLine;
  264.     USHORT  TextCursorWidth;
  265.     BOOL    TextCursorVisible;
  266.     USHORT  CellImageHeight;
  267.     USHORT  CellImageWidth;
  268.     USHORT  CodepageID;
  269.     USHORT  WindowHeight;
  270.     USHORT  WindowWidth;
  271.     USHORT  Pad;
  272.     HDC     hConsoleDisplayContext;
  273.  
  274. /* The following fields are used for private communication between
  275.  * the shield thread and the display driver.
  276.  *
  277.  * NB: The order and positions of the fields RowOrgLatch..CursorWidth
  278.  *     must parallel that of the fields WindowOriginRow..TextCursorWidth
  279.  *     in the Vio presentation space.  The UpdateCursor code in the device
  280.  *     driver depends on this being so.  See the AVioPS.inc file used
  281.  *     by the driver.
  282.  */
  283.     HWND    hVioWindow;         /* Window handle for this Vio PS  */
  284.     short   RowOrgLatch;        /* Window origin coordinates from */
  285.     short   ColOrgLatch;        /* the last call to UpdateCursor  */
  286.     short   CursorRow;          /* Cursor state as of the last    */
  287.     short   CursorCol;          /* call to UpdateCursor           */
  288.     short   CursorStartLine;
  289.     short   CursorEndLine;
  290.     BYTE    CursorWidth;
  291.     char    PartialCellAdjust;  /* Adjustment for partial cells   */
  292.     short   XLatch;             /* Pel coordinates of the cursor  */
  293.     short   YLatch;             /* rectangle relative to the Vio  */
  294.     short   WidthLatch;         /* window                         */
  295.     short   HeightLatch;
  296.     USHORT  CellHeightLatch;    /* To detect cell height changes. */
  297.     BOOL    rgfShieldStates;    /* Shield States shared with the  */
  298.                                 /* device driver code.            */
  299.  
  300.     PVOID   pFontsLoaded[3];    /* define 32 bits of storage    */
  301.     PVOID   pMapFontsLoaded[3]; /* for a FLAT pointer           */
  302.  
  303.     USHORT  FormatID;
  304.     USHORT  Reserved;           /*
  305.                                  * Japan needs to know FormatID and *
  306.                                  * Reserved for the Display Device  *
  307.                                  * Driver.                          */
  308.  
  309.     /*ifdef D1348*/
  310.     PVIOPSNLSEXT lpNLSExt;
  311.     /*endif D1348*/
  312.  
  313. } VioPresentationSpace32;
  314. typedef VioPresentationSpace32 VIOPS32;
  315. typedef VIOPS32 *PVIOPS32;
  316.  
  317. #else
  318.  
  319. typedef struct _VioPresentationSpace {  /* viops */
  320.  
  321.     FSRSEM  fsemVioPSLock;
  322.  
  323.     SEL     selLVB;
  324.     SEL     selBVSCB;
  325.     BOOL    rgfAVio;
  326.  
  327.     USHORT  CellByteSize;
  328.  
  329.     USHORT  BufferRowCount;
  330.     USHORT  BufferColumnCount;
  331.  
  332. /* Window Origin coordinates can be negative for AVio presentation spaces.
  333.  * For Vio presentation spaces the Shield Layer always coerces them to
  334.  * non-negative values such that the client rectangle always lies completely
  335.  * within the image of the logical video buffer.
  336.  */
  337.     SHORT   WindowOriginRow;
  338.     SHORT   WindowOriginColumn;
  339.  
  340.     USHORT  TextCursorRow;
  341.     USHORT  TextCursorColumn;
  342.     USHORT  TextCursorStartLine;
  343.     USHORT  TextCursorEndLine;
  344.     USHORT  TextCursorWidth;
  345.     BOOL    TextCursorVisible;
  346.  
  347.     USHORT  CellImageHeight;
  348.     USHORT  CellImageWidth;
  349.  
  350.     USHORT  CodepageID;
  351.  
  352.     USHORT  WindowHeight;
  353.     USHORT  WindowWidth;
  354.  
  355.     HDC     hConsoleDisplayContext;
  356.  
  357. /* The following fields are used for private communication between
  358.  * the shield thread and the display driver.
  359.  *
  360.  * NB: The order and positions of the fields RowOrgLatch..CursorWidth
  361.  *     must parallel that of the fields WindowOriginRow..TextCursorWidth
  362.  *     in the Vio presentation space.  The UpdateCursor code in the device
  363.  *     driver depends on this being so.  See the AVioPS.inc file used
  364.  *     by the driver.
  365.  */
  366.     HWND    hVioWindow;         /* Window handle for this Vio PS  */
  367.  
  368.     SHORT   RowOrgLatch;        /* Window origin coordinates from */
  369.     SHORT   ColOrgLatch;        /* the last call to UpdateCursor  */
  370.  
  371.     SHORT   CursorRow;          /* Cursor state as of the last    */
  372.     SHORT   CursorCol;          /* call to UpdateCursor           */
  373.     SHORT   CursorStartLine;
  374.     SHORT   CursorEndLine;
  375.     BYTE    CursorWidth;
  376.  
  377.     CHAR    PartialCellAdjust;  /* Adjustment for partial cells   */
  378.                                 /* on the bottom of the window.   */
  379.     SHORT   XLatch;             /* Pel coordinates of the cursor  */
  380.     SHORT   YLatch;             /* rectangle relative to the Vio  */
  381.     SHORT   WidthLatch;         /* window                         */
  382.     SHORT   HeightLatch;
  383.  
  384.     USHORT  CellHeightLatch;    /* To detect cell height changes. */
  385.  
  386.     BOOL    rgfShieldStates;    /* Shield States shared with the  */
  387.                                 /* device driver code.            */
  388.  
  389.     SEL     selFontsLoaded[3];  /* Selectors for fonts loaded into */
  390.                                 /* LCID 1..3.                      */
  391.  
  392.     USHORT NEAR *npMapFontsLoaded[3];
  393.                                 /* Offsets within the display driver's   */
  394.                                 /* global data segment of the code page  */
  395.                                 /* maps for fonts loaded into LCID 1..3. */
  396.     USHORT  FormatID;
  397.     USHORT  Reserved;           /*
  398.                                  * Japan needs to know FormatID and *
  399.                                  * Reserved for the Display Device  *
  400.                                  * Driver.                          */
  401.     /*ifdef D1348*/
  402.     PVIOPSNLSEXT lpNLSExt;
  403.     /*endif D1348*/
  404.  
  405. } VioPresentationSpace;
  406.  
  407.  
  408. /* Standard typedefs
  409.  */
  410. typedef VioPresentationSpace VIOPS;
  411. typedef VIOPS FAR *PVIOPS;
  412. typedef VIOPS NEAR *NPVIOPS;
  413. typedef PVIOPS FAR *PPVIOPS;
  414.  
  415. #endif
  416.  
  417.  
  418. /* Compatible typedefs
  419.  */
  420. /* NOINC */
  421. #define Sel_LogicalVideoBuffer  selLVB
  422. #define Sel_BVSControlBlock     selBVSCB
  423. #define selfontsloaded          selFontsLoaded
  424. #define npmapfontsloaded        npMapFontsLoaded
  425. #define PresentationSpaceLock   fsemVioPSLock
  426. /* INC */
  427. /* ASM
  428. viops_PresentationSpaceLock     equ <viops_fsemVioPSLock>
  429. viops_Sel_LogicalVideoBuffer    equ <viops_selLVB>
  430. viops_Sel_BVSControlBlock       equ <viops_selBVSCB>
  431. ifndef viops_selfontsloaded
  432. viops_selfontsloaded            equ <viops_selFontsLoaded>
  433. viops_npmapfontsloaded          equ <viops_npMapFontsLoaded>
  434. endif
  435. */
  436.  
  437.  
  438. /* Flag definitions for rgfAVio:
  439.  */
  440. #define fAssociated         0x0001
  441.  
  442.  
  443. /* Flag definitions for rgfShieldStates.  These flags coordinate the
  444.  * appearance of the text cursor between the shield thread and the display
  445.  * driver.
  446.  */
  447. #define fCursorShowing      0x0001  /* Cursor is visible on the screen */
  448. #define fHasTheFocus        0x0002  /* This window has the input focus */
  449. #define fCursorIsOn         0x0004  /* 1 => On part of blink cycle     */
  450.  
  451.  
  452. /* The flags below are used to implement WinSyncWithPS and the system
  453.  * commands "Mark" and "Copy".
  454.  *
  455.  * Whenever the shield thread makes a call to the device driver via
  456.  * GreCharRect, GreCharStr, GreScrollRect, or GreUpdateCursor, it
  457.  * will turn on the fShieldCalling flag.
  458.  *
  459.  * When we want to restrict display changes to those initiated by the
  460.  * shield thread, we turn on the fServeShieldOnly flag.  When we want
  461.  * to defer all display changes, we turn on the fServeNobody flag.
  462.  *
  463.  * The routines which turn off the fServeShieldOnly and fServeNobody
  464.  * flags must also repaint the client rect and update the text cursor.
  465.  */
  466. #define fShieldCalling      0x8000
  467. #define fServeShieldOnly    0x4000
  468. #define fServeNobody        0x2000
  469.  
  470.  
  471. #define MaxVIORows  255         /* Limit value for BufferRowCount    */
  472. #define MaxVIOCols  255         /* Limit value for BufferColumnCount */
  473.  
  474.  
  475. /* WM_AbortShield is a private message used between the shield thread,
  476.  * VioStub.exe, and the task manager.  It indicates that the Vio window
  477.  * should be removed immediately when the child processes terminate.
  478.  */
  479. #define WM_AbortShield          (0x352)    /* WM_User+52 */
  480.  
  481. /* NOINC */
  482. #define BufferCell      USHORT
  483.  
  484. #define RamSemaphore    ULONG
  485. /* INC */
  486.  
  487. typedef RamSemaphore FAR *LPRamSemaphore;
  488.  
  489.  
  490.  
  491. /***********************************************************************\
  492.  *
  493.  *                   Structures and Interfaces
  494.  *                              for
  495.  *                     Drawing (A)Vio Images
  496.  *
  497.  * The Graphics Engine provides a set of interfaces for drawing Vio and
  498.  * AVio images on the display screen.  [#define'd in PMDDIP.H]
  499.  *
  500.  * Four functions are provided:
  501.  *
  502.  *     ErrValue GreCharRect(hps, lpVioPS)
  503.  *     HPS                       hps;        -- A micro PS for the console
  504.  *     VioPresentationSpace FAR *lpVioPS;    -- The  VioPS for the console
  505.  *     GridRectRef          FAR *lpRectDesc; -- The rectangle to draw
  506.  *
  507.  * GreCharRect draws a rectangle of characters taken from the logical video
  508.  * buffer associated with the (A)Vio presentation space.
  509.  *
  510.  *     ErrValue GreCharStr(hps, lpVioPS, lpStrDesc)
  511.  *     HPS                       hps;          -- A micro PS for the console
  512.  *     VioPresentationSpace FAR *lpVioPS;      -- The  VioPS for the console
  513.  *     GridStringRef        FAR *lpStringDesc; -- The string to draw
  514.  *
  515.  * GreCharStr draws a string of characters taken from the logical video
  516.  * buffer.  The string is defined by a set of starting coordinates within
  517.  * the LVB and an length.  The string may cross row boundaries.
  518.  *
  519.  *     ErrValue GreScrollRect(hps, lpVioPS, lpScrollDesc)
  520.  *     HPS                       hps;          -- A micro ps for the console.
  521.  *     VioPresentationSpace FAR *lpVioPS;      -- The (A)Vio PS for the console.
  522.  *     ScrollRectRef        FAR *lpScrollDesc; -- The rectangle being scrolled.
  523.  *
  524.  * GreScrollRect scrolls a subrectangle of the LVB image.  Note that it does
  525.  * not scroll the content of the logical video buffer.  That must be done
  526.  * prior to calling GreScrollRect.
  527.  *
  528.  *     ErrValue GreUpdateCursor(hps, lpVioPS)
  529.  *     HPS                       hps;        -- A micro ps for the console.
  530.  *     VioPresentationSpace FAR *lpVioPS;    -- The (A)Vio PS for the console.
  531.  *
  532.  * GreUpdateCursor adjusts the position and characteristic of the text cursor
  533.  * to match the control fields within the (A)Vio presentation space.
  534.  *
  535. \***********************************************************************/
  536.  
  537.  
  538. /******************* Public Data Type **********************************\
  539.  *
  540.  * GridRectRef -- Defines an LVB rectangle for GreCharRect.
  541.  *
  542. \***********************************************************************/
  543.  
  544. typedef struct _GridRectRef { /* cellrect */
  545.  
  546.                     ULONG   StartRow;
  547.                     ULONG   StartColumn;
  548.                     ULONG   RectWidth;
  549.                     ULONG   RectDepth;
  550.                } GridRectRef;
  551.  
  552. typedef GridRectRef FAR * LPGridRectRef;
  553.  
  554.  
  555. /******************* Public Data Type **********************************\
  556.  *
  557.  * GridStringRef -- Defines an LVB string for GreCharStr.
  558.  *
  559. \***********************************************************************/
  560.  
  561. typedef struct _GridStringRef { /* cellstr */
  562.  
  563.                     ULONG   StartRow;
  564.                     ULONG   StartColumn;
  565.                     ULONG   StringLength;
  566.                 } GridStringRef;
  567.  
  568. typedef GridStringRef FAR * LPGridStringRef;
  569.  
  570.  
  571. /******************* Public Data Type **********************************\
  572.  *
  573.  * ScrollRectRef -- Defines a scrolling action for GreScrollRect.
  574.  *
  575. \***********************************************************************/
  576.  
  577. typedef struct _ScrollRectRef { /* cellscroll */
  578.  
  579.                     ULONG   StartRow;
  580.                     ULONG   StartColumn;
  581.                     ULONG   RectWidth;
  582.                     ULONG   RectDepth;
  583.                     LONG    HorzMovement;
  584.                     LONG    VertMovement;
  585.  
  586.                     USHORT FAR *lpFillCell;
  587.                 } ScrollRectRef;
  588.  
  589. typedef ScrollRectRef FAR * LPScrollRectRef;
  590.  
  591.  
  592.  
  593. /******************* Public Data Type **********************************\
  594.  *
  595.  * KbdMouParameters -- Used to create a console
  596.  *
  597. \***********************************************************************/
  598.  
  599. typedef struct _KbdMouParameters {   /* kmparms */
  600.  
  601.             USHORT  KeyBuffSize;
  602.             USHORT  MouBuffSize;
  603.             USHORT  MouFilterMask;
  604.         } KbdMouParameters;
  605.  
  606.  
  607. /************************ Conventions **********************************\
  608.  *
  609.  * This structure is passed to WinCreateConsole (see below).  It defines the
  610.  * sizes of the keyboard and mouse event queues to allocate for the console
  611.  * and it supplies the initial cursor image and event filter to use with
  612.  * the mouse.
  613.  *
  614. \***********************************************************************/
  615.  
  616. /*********************** Field Definitions *****************************\
  617.  *
  618.  * KeyBuffSize -- Maximum number of events to be retained in the keyboard
  619.  * buffer.  Zero signifies that the default value (30) should be used.
  620.  *
  621.  * MouBuffSize -- Maximum number of events to be retained in the mouse buffer.
  622.  * Zero signifies that the default value (30) should be used.
  623.  *
  624.  * MouFilterMask -- An initial value for the filter mask used to record or
  625.  * discard mouse events
  626.  *
  627. \***********************************************************************/
  628.  
  629.  
  630. /******************* Public Data Type **********************************\
  631.  *
  632.  * HCONSOLE -- Handle used to reference a Vio console.
  633.  *
  634. \***********************************************************************/
  635.  
  636. /* NOINC */
  637. #define HCONSOLE SHANDLE
  638. /* INC */
  639.  
  640.  
  641.  
  642. /******************* Public Data Type **********************************\
  643.  *
  644.  * hLogicalKBD -- A logical keyboard in the sense of OS|2.11
  645.  *
  646. \***********************************************************************/
  647.  
  648. /* NOINC */
  649. #define HLogicalKbd USHORT
  650. /* INC */
  651.  
  652. typedef HLogicalKbd FAR * LPHLogicalKbd;
  653.  
  654.  
  655. /* Bit Definitions for the fsState field of the KBDKEYINFO
  656.  * data structure:
  657.  */
  658. #define RightShiftDown    (0x0001)
  659. #define LeftShiftDown     (0x0002)
  660. #define CtrlKeyDown       (0x0004)
  661. #define AltKeyDown        (0x0008)
  662. #define ScrollLockOn      (0x0010)
  663. #define NumLockOn         (0x0020)
  664. #define CapsLockOn        (0x0040)
  665. #define InsertOn          (0x0080)
  666. #define LeftCtrlKeyDown   (0x0100)
  667. #define LeftAltKeyDown    (0x0200)
  668. #define RightCtrlKeyDown  (0x0400)
  669. #define RightAltKeyDown   (0x0800)
  670. #define ScrollLockKeyDown (0x1000)
  671. #define NumLockKeyDown    (0x2000)
  672. #define CapsLockKeyDown   (0x4000)
  673. #define SysReqKeyDown     (0x8000)
  674.  
  675.  
  676. /* NOINC */
  677. /******************* Public Data Type **********************************\
  678.  *
  679.  * ErrVal -- The error condition returned by the interface functions.
  680.  *
  681. \***********************************************************************/
  682.  
  683. #define ErrVal int
  684.  
  685.  
  686. /******************* Public Data Type **********************************\
  687.  *
  688.  * CODEPAGEID -- A Code Page ID in the sense of OS|2.11
  689.  *
  690. \***********************************************************************/
  691.  
  692. #define CODEPAGEID USHORT
  693. /* INC */
  694.  
  695. typedef CODEPAGEID FAR *LPCODEPAGEID;
  696.  
  697.  
  698. /* Bit definitions for the fsMask field of the KBDINFO
  699.  * data structure:
  700.  */
  701. #define Shift_Return_On         0x0100
  702. #define Two_Byte_Turnaround     0x0080
  703. #define Set_Turnaround_Char     0x0040
  704. #define Set_Interim_Char_Flags  0x0020
  705. #define Set_Shift_State         0x0010
  706. #define Ascii_Mode_On           0x0008
  707. #define Binary_Mode_On          0x0004
  708. #define Echo_Off                0x0002
  709. #define Echo_On                 0x0001
  710.  
  711.  
  712. /* NOINC */
  713.  
  714. #ifndef INCL_NOSHIELDPROCS
  715.  
  716. /************************ Public Functions *****************************\
  717.  *
  718.  * LockVioPS and UnlockVioPS -- These interfaces are provided as a
  719.  * convenience for procuring and releasing PresentationSpaceLock's.
  720.  *
  721. \***********************************************************************/
  722.  
  723. extern ErrVal APIENTRY16    LockVioPS(VioPresentationSpace FAR *);
  724. extern ErrVal APIENTRY16  UnlockVioPS(VioPresentationSpace FAR *);
  725.  
  726.  
  727. /************************ Public Function ******************************\
  728.  *
  729.  * WinCreateConsole -- Create a console handle.
  730.  *
  731. \***********************************************************************/
  732.  
  733. ErrVal APIENTRY16  WinCreateConsole(USHORT,
  734.                                     VioPresentationSpace FAR *,
  735.                                     KbdMouParameters FAR *,
  736.                                     HCONSOLE FAR *
  737.                                    );
  738.  
  739.  
  740. /************************ Public Function ******************************\
  741.  *
  742.  * WinDestroyConsole -- Dispose of a console handle.
  743.  *
  744. \***********************************************************************/
  745.  
  746. ErrVal APIENTRY16  WinDestroyConsole(USHORT);
  747.  
  748.  
  749.  
  750. /************************ Public Function ******************************\
  751.  *
  752.  * WinSyncWithPS -- Synchronize the window image with the PS.
  753.  *
  754. \***********************************************************************/
  755.  
  756. ErrVal APIENTRY16  WinSyncWithPS(HCONSOLE);
  757.  
  758.  
  759.  
  760.  
  761. /************************ Public Function ******************************\
  762.  *
  763.  * WinConsoleReadKeyEvent -- Read an event from the keyboard queue.
  764.  *
  765. \***********************************************************************/
  766.  
  767. ErrVal APIENTRY16  WinConsoleReadKeyEvent(HCONSOLE, HLogicalKbd, BOOL, BOOL,
  768.                                           KBDKEYINFO FAR *);
  769.  
  770.  
  771.  
  772. /************************ Public Function ******************************\
  773.  *
  774.  * WinConsoleFlushKeyEvents -- Empty the keyboard event queue.
  775.  *
  776. \***********************************************************************/
  777.  
  778. ErrVal APIENTRY16  WinConsoleFlushKeyEvents(HCONSOLE, HLogicalKbd);
  779.  
  780.  
  781.  
  782. /************************ Public Function ******************************\
  783.  *
  784.  * WinConsoleOpenKbd -- Create a logical keyboard.
  785.  *
  786. \***********************************************************************/
  787.  
  788. ErrVal APIENTRY16 WinConsoleOpenKbd(HCONSOLE, LPHLogicalKbd);
  789.  
  790.  
  791.  
  792. /************************ Public Function ******************************\
  793.  *
  794.  * WinConsoleCloseKbd -- Destroy a logical keyboard.
  795.  *
  796. \***********************************************************************/
  797.  
  798. ErrVal APIENTRY16 WinConsoleCloseKbd(HCONSOLE, HLogicalKbd);
  799.  
  800.  
  801.  
  802. /************************ Public Function ******************************\
  803.  *
  804.  * WinConsoleSetStatus -- Set the fbStatus of a logical keyboard.
  805.  *
  806. \***********************************************************************/
  807.  
  808. ErrVal APIENTRY16 WinConsoleSetStatus(HCONSOLE, HLogicalKbd,
  809.                                       PKBDINFO);
  810.  
  811.  
  812.  
  813. /************************ Public Function ******************************\
  814.  *
  815.  * WinConsoleGetStatus -- Retrieve the fbStatus of a logical keyboard.
  816.  *
  817. \***********************************************************************/
  818.  
  819. ErrVal APIENTRY16 WinConsoleGetStatus(HCONSOLE, HLogicalKbd,
  820.                                       PKBDINFO);
  821.  
  822.  
  823.  
  824. /************************ Public Function ******************************\
  825.  *
  826.  * WinConsoleSetCP -- Set the code page id for a logical keyboard.
  827.  *
  828. \***********************************************************************/
  829.  
  830. ErrVal APIENTRY16 WinConsoleSetCP(HCONSOLE, HLogicalKbd, CODEPAGEID);
  831.  
  832.  
  833.  
  834. /************************ Public Function ******************************\
  835.  *
  836.  * WinConsoleGetCP -- Retrieve the code page id bound to a logical keyboard.
  837.  *
  838. \***********************************************************************/
  839.  
  840. ErrVal APIENTRY16 WinConsoleGetCP(HCONSOLE, HLogicalKbd, LPCODEPAGEID);
  841.  
  842.  
  843.  
  844. /************************ Public Function ******************************\
  845.  *
  846.  * WinConsoleKbdXlate -- Translate scan codes to ascii codes.
  847.  *
  848. \***********************************************************************/
  849.  
  850. ErrVal APIENTRY16 WinConsoleKbdXlate(HCONSOLE, HLogicalKbd, PKBDTRANS);
  851.  
  852.  
  853.  
  854. /************************ Public Function ******************************\
  855.  *
  856.  * WinConsoleSetCustXT -- Bind a custom translate table to a logical kbd.
  857.  *
  858. \***********************************************************************/
  859.  
  860. ErrVal APIENTRY16 WinConsoleSetCustXT(HCONSOLE, HLogicalKbd, PUSHORT);
  861.  
  862.  
  863.  
  864. /************************ Public Function ******************************\
  865.  *
  866.  * WinConsoleGetFocus -- Direct incoming keystrokes to a particular
  867.  *                       logical keyboard.
  868.  *
  869. \***********************************************************************/
  870.  
  871. ErrVal APIENTRY16 WinConsoleGetFocus(HCONSOLE, HLogicalKbd);
  872.  
  873.  
  874.  
  875. /************************ Public Function ******************************\
  876.  *
  877.  * WinConsoleFreeFocus -- Release the binding made by WinConsoleGetFocus.
  878.  *
  879. \***********************************************************************/
  880.  
  881. ErrVal APIENTRY16 WinConsoleFreeFocus(HCONSOLE, HLogicalKbd);
  882.  
  883.  
  884.  
  885. /************************ Public Function ******************************\
  886.  *
  887.  * WinConsoleQueuedPointerEvents -- Query the number of mouse events.
  888.  *
  889. \***********************************************************************/
  890.  
  891. ErrVal APIENTRY16  WinConsoleQueuedPointerEvents(HCONSOLE, PMOUQUEINFO);
  892.  
  893.  
  894. /************************ Public Function ******************************\
  895.  *
  896.  * WinConsoleReadPointerEvent -- Read a mouse event from the queue.
  897.  *
  898. \***********************************************************************/
  899.  
  900. ErrVal APIENTRY16  WinConsoleReadPointerEvent(HCONSOLE, BOOL, BOOL,
  901.                                               PMOUEVENTINFO);
  902.  
  903.  
  904.  
  905. /************************ Public Function ******************************\
  906.  *
  907.  * WinConsoleFlushPointerEvents -- Empty the mouse event queue.
  908.  *
  909. \***********************************************************************/
  910.  
  911. ErrVal APIENTRY16  WinConsoleFlushPointerEvents(HCONSOLE);
  912.  
  913.  
  914.  
  915. /************************ Public Function ******************************\
  916.  *
  917.  * WinConsoleGetPointerFilterMask -- Retrieve the mouse event filter mask
  918.  *
  919. \***********************************************************************/
  920.  
  921. ErrVal APIENTRY16  WinConsoleGetPointerFilterMask(HCONSOLE, USHORT FAR *);
  922.  
  923.  
  924. /************************ Public Function ******************************\
  925.  *
  926.  * WinConsoleSetPointerFilterMask -- Defines the mouse event filter mask
  927.  *
  928. \***********************************************************************/
  929.  
  930. ErrVal APIENTRY16  WinConsoleSetPointerFilterMask(HCONSOLE, USHORT);
  931.  
  932.  
  933. /************************ Public Function ******************************\
  934.  *
  935.  * WinConsoleGetPtrPos -- Retrieves the current mouse position.
  936.  *
  937. \***********************************************************************/
  938.  
  939. ErrVal APIENTRY16 WinConsoleGetPtrPos(HCONSOLE, USHORT FAR *, USHORT FAR *);
  940.  
  941.  
  942. /************************ Public Function ******************************\
  943.  *
  944.  * WinConsoleSetPtrPos -- Sets the mouse to a designated cell position.
  945.  *
  946. \***********************************************************************/
  947.  
  948. ErrVal APIENTRY16 WinConsoleSetPtrPos(HCONSOLE, USHORT, USHORT);
  949.  
  950.  
  951. /************************ Public Function ******************************\
  952.  *
  953.  * WinConsoleAttachMouseUser -- Increments mouse user count.
  954.  *
  955. \***********************************************************************/
  956.  
  957. ErrVal APIENTRY16 WinConsoleAttachMouseUser(HCONSOLE);
  958.  
  959.  
  960. /************************ Public Function ******************************\
  961.  *
  962.  * WinConsoleDetachMouseUser -- Decrements mouse user count.
  963.  *
  964. \***********************************************************************/
  965.  
  966. ErrVal APIENTRY16 WinConsoleDetachMouseUser(HCONSOLE);
  967.  
  968. /* NB: Mouse Events are only recorded when the mouse user count for
  969.  *     the console is non-zero.
  970.  */
  971.  
  972. #endif /* INCL_NOSHIELDPROCS */
  973.  
  974. /* INC */
  975.  
  976.  
  977. /***************************Error Values *******************************
  978. *
  979. * Abstract: Error values returned by portions of the Shield Layer.
  980. *
  981. * Created:  14-May-87
  982. * Author:   Ron Murray  [ronm]
  983. *
  984. *
  985. * These are the error values returned by
  986. * the components of the Shield Layer.
  987. *
  988. \***********************************************************************/
  989.  
  990.  
  991. /* Error values returned by the Shield Layer
  992.  * Dyn-Link API:
  993.  */
  994.  
  995. #define SHIELD_API_ERROR_BASE                   (-32)
  996.  
  997. #define CE_NULL_PRESENTATION_SPACE              (-33)
  998. #define CE_INVALID_PRESENTATION_SPACE           (-34)
  999. #define CE_TOO_MANY_PS_ROWS                     (-35)
  1000. #define CE_TOO_MANY_PS_COLS                     (-36)
  1001. #define CE_CANT_CREATE_GLOBAL_HEAP              (-37)
  1002. #define CE_NULL_HCONSOLE_POINTER                (-38)
  1003. #define CE_OUT_OF_DGROUP_MEMORY                 (-39)
  1004. #define CE_CANT_CREATE_INSTANCEHEAP             (-40)
  1005. #define CE_OUT_OF_INSTANCE_MEMORY               (-41)
  1006. #define CE_INVALID_MOUSE_FILTER_MASK            (-42)
  1007.  
  1008. #define CE_CANT_REGISTER_WINDOW_CLASS           (-44)
  1009. #define CE_CANT_CREATE_STD_WINDOW               (-45)
  1010. #define CE_CANT_SUBCLASS_FRAME_PROC             (-46)
  1011.  
  1012. #define CE_CANT_DISCARD_KEY_BUFFER              (-48)
  1013. #define CE_CANT_DISCARD_MOU_BUFFER              (-49)
  1014. #define CE_CANT_DISCARD_CONSOLE_STATE           (-50)
  1015. #define CE_INVALID_CONSOLE_HANDLE               (-51)
  1016.  
  1017. #define CE_CANT_ALLOCATE_DC                     (-53)
  1018. #define CE_CANT_ALLOCATE_LVB                    (-54)
  1019. #define CE_PSPACE_INACCESSABLE                  (-55)
  1020. #define CE_CANT_DISCARD_INSTANCE_SEG            (-56)
  1021.  
  1022. #define CE_CANT_DISCARD_KBD_STATE               (-59)
  1023. #define CE_PS_NOT_LOCKED                        (-60)
  1024. #define CE_CONSOLE_DOES_NOT_HAVE_FOCUS          (-61)
  1025. #define CE_NOT_A_SIZE_MESSAGE                   (-62)
  1026. #define CE_CANT_LOAD_STRING_RESOURCES           (-63)
  1027. #define CE_NO_CELL_INFO                         (-64)
  1028. #define CE_CANT_MAP_WND_TO_DC                   (-65)
  1029. #define CE_CANT_MAP_DC_TO_LPVIOPS               (-66)
  1030. #define CE_TOO_MANY_MOUSE_DETACHES              (-67)
  1031. #define CE_SHIELD_ALREADY_INITIALED             (-68)
  1032. #define CE_NOT_ENOUGH_SHELL_HOOKS               (-69)
  1033. #define CE_CANT_SUBCLASS_TASK_MGR               (-70)
  1034. #define CE_CANT_LOAD_MARKING_CURSOR             (-71)
  1035. #define CE_SGID_NOT_ACTIVE                      (-72)
  1036. #define CE_CANT_DEALLOCATE_LVB                  (-73)
  1037. #define CE_CANT_DEALLOCATE_VIO_PS               (-74)
  1038. #define CE_INVALID_VIO_PS_ADDRESS               (-75)
  1039. #define CE_INVALID_LVB_SELECTOR                 (-76)
  1040. #define CE_CANT_ALLOCATE_TITLE_BUFFER           (-77)
  1041. #define CE_NOT_CALLED_FROM_SHELL_PID            (-78)
  1042. #define CE_SHIELD_NOT_INITIALED                 (-79)
  1043.  
  1044. /* Error values added for use by VDM-related portions of the Shield Layer:
  1045.  */
  1046.  
  1047. #define CE_UNKNOWN_PROG_TYPE                    (-80)
  1048. #define CE_DLL_LOAD_FAILURE                     (-81)
  1049. #define CE_DLL_PROC_FAILURE                     (-82)
  1050. #define CE_DLL_FREE_FAILURE                     (-83)
  1051.  
  1052. #define CE_VDM_HEAP_CREATE_FAILURE              (-84)
  1053. #define CE_VDM_HEAP_ALLOC_FAILURE               (-85)
  1054. #define CE_VDM_HEAP_FREE_FAILURE                (-86)
  1055. #define CE_VDM_VIDEO_VDD_NOT_FOUND              (-87)
  1056. #define CE_VDM_VIDEO_ACCESS_DENIED              (-88)
  1057. #define CE_VDM_KEYBOARD_VDD_NOT_FOUND           (-89)
  1058. #define CE_VDM_KEYBOARD_ACCESS_DENIED           (-90)
  1059. #define CE_VDM_MOUSE_VDD_NOT_FOUND              (-91)
  1060. #define CE_VDM_MOUSE_ACCESS_DENIED              (-92)
  1061. #define CE_VDM_TIMER_VDD_NOT_FOUND              (-93)
  1062. #define CE_VDM_TIMER_ACCESS_DENIED              (-94)
  1063. #define CE_VDM_STACK_ALLOCATION_FAILURE         (-95)
  1064. #define CE_VDM_THREAD_CREATION_FAILURE          (-96)
  1065.  
  1066.  
  1067. /* Error values returned by the Graphics Engine API for
  1068.  * Vio/AVio presentation spaces:
  1069.  */
  1070.  
  1071. #define GRAPHICSENGINEAPIERRORBASE              (-128)
  1072.  
  1073. #define GRE_INVALIDROWINDEX                     (-129)
  1074. #define GRE_INVALIDCOLUMNINDEX                  (-130)
  1075. #define GRE_NEGATIVEWIDTH                       (-131)
  1076. #define GRE_NEGATIVEDEPTH                       (-132)
  1077. #define GRE_NEGATIVELENGTH                      (-133)
  1078. #define GRE_CURSORSTATEFAILURE                  (-134)
  1079. #define GRE_OUTOFMEMORY                         (-135)
  1080.  
  1081.  
  1082. #define AVIO_PS_HANDLE_INDEX 1
  1083. #define CNT_LOADABLE_LCIDS   3
  1084.  
  1085. /* NOINC */
  1086. #ifdef __IBMC__
  1087.    #pragma checkout( suspend )
  1088.       #ifndef __CHKHDR__
  1089.          #pragma checkout( resume )
  1090.       #endif
  1091.    #pragma checkout( resume )
  1092. #endif
  1093. /* INC */
  1094.  
  1095. /**************************** end of file **********************************/
  1096.