home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / txcl552 / inc / tcxlcur.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-15  |  6.6 KB  |  122 lines

  1. /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
  2.  | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
  3.  | All Rights Reserved.
  4.  |
  5.  | This Library is part of IDC's TesSeRact Development Tools product
  6.  | line. For information about other IDC products, call  1-215-443-9705.
  7.  *-V--------------------------------------------------------------------*
  8.  | $Header:   tcxlcur.h     552.0   17 Mar 1991 18:26:32  $
  9.  |
  10.  | $Log:   tcxlcur.h    $
  11.  *-D--------------------------------------------------------------------*
  12.  | <TCXLcur.h> : Public definitions and prototypes for TCXL Cursor
  13.  | subsystem.
  14.  *-N-----------------------[ Notes and Caveats ]------------------------*
  15.  | 1) User code should call the Cursor subsystem to control the display
  16.  |    and mouse cursors, NOT the display and mouse systems. The User
  17.  |    level TCXL systems also make use of these functions.
  18.  | 2) CurPush() saves the current cursor-state on a 16-level stack and
  19.  |    updates the hidden/shown state, size and position as follows:
  20.  |    a) Update hidden/shown state to <h> (CUR_HID or CUR_SHO) unless <h>
  21.  |       is -1.
  22.  |    b) Update size to <s> (CUR_NOR, CUR_MID or CUR_BLK), unless <s> is
  23.  |       -1.
  24.  |    c) Update position to screen position <r, c>, unless <r> is -1.
  25.  |    The CurSave() macro saves the current cursor-state without change.
  26.  | 3) CurHide() and CurShow() explicitly hide or show the cursor.
  27.  | 4) CurSize() explicitly sets the size of the cursor.
  28.  | 5) The Display system functions VcurGet(), VcurHid(), VcurPut() and
  29.  |    VcurSet() maintain the _CurPos, _CurSiz and _CurHid globals for use
  30.  |    by the Cursor subsystem and update them whenever changed.
  31.  | 6) The _CurCtl object is internal and NOT intended for user access.
  32.  | 7) All mouse positions are in text rows and columns.
  33.  | 8) Mouse-support is defined by MouPush(), which saves the active
  34.  |    mouse-state, consisting of the support level and cursor position,
  35.  |    and sets a new support level. Up to 15 states can be saved. If a
  36.  |    mouse is detected at startup, it must be activated via an initial
  37.  |    MouPush() call. Four support levels are available:
  38.  |    a) MOU_NONE - cursor invisible, buttons not active (initial state,
  39.  |       mouse inactive).
  40.  |    b) MOU_KEYS - cursor invisible, movement emulates cursor arrow
  41.  |       keys, buttons active.
  42.  |    c) MOU_CURS - cursor visible and free-moving, buttons active.
  43.  |    d) MOU_FULL - full mouse support.
  44.  |    MouPop() restores the mouse-state last saved by MouPush(). The
  45.  |    MOU_??? constants are defined in <TCXLmou.h>, along with the rest
  46.  |    of the Mouse system.
  47.  *======================================================================*/
  48. #ifndef  _TCXLcur_
  49. #  define   _TCXLcur_ 1
  50. #  ifndef   _TCXLvid_
  51. #     include  <TCXLvid.h>             /* video definitions             */
  52. #  endif
  53. #  ifndef   _TCXLmou_
  54. #     include  <TCXLmou.h>             /* video definitions             */
  55. #  endif
  56.                                        /*- Cursor sizes for CurSize() --*/
  57. #define  CUR_NOR  0                    /* Normal (underline)            */
  58. #define  CUR_MID  1                    /* Half-block                    */
  59. #define  CUR_BLK  2                    /* Full-block                    */
  60.                                        /*- Cursor states for CurPush() -*/
  61. #define  CUR_HID  0                    /* Hidden                        */
  62. #define  CUR_SHO  1                    /* Shown                         */
  63. #define  CUR_MAX  16                   /*- Max stack levels ------------*/
  64.  
  65. /*------------------[ Data objects and access macros ]------------------*/
  66.  
  67. TYP   struct   _Cur  _CurT;
  68.  
  69. struct   _Cur                 /*-[ Cursor-control object ]--------------*/
  70. {  VposT    cpos;             /* 00 : _CurPos : Current position        */
  71.    BytT     csiz;             /* 02 : _CurSiz : Current size            */
  72.    FlgT     chid;             /* 03 : _CurHid : Current hidden state    */
  73.    IntT     clvl;             /* 04 : _CurLvl : Stack level             */
  74.    struct   _s_               /* 06 : _CurStk : 16-level stack          */
  75.    {  BytT  sta;              /*    :         : State                   */
  76.       VposT pos;              /*    :         : Position                */
  77.    }        cstk[CUR_MAX];    /*    :         :                         */
  78. };                            /* 36 ]-----------------------------------*/
  79.  
  80. GBL   _CurT CDC   _CurCtl;    /*- Global cursor-control object ---------*/
  81. #define  _CurPos     (_CurCtl.cpos)
  82. #define  _CurPosW    (VposW(_CurPos))
  83. #define  _CurPosR    (VposR(_CurPos))
  84. #define  _CurPosC    (VposC(_CurPos))
  85. #define  _CurSiz     (_CurCtl.csiz)
  86. #define  _CurHid     (_CurCtl.chid)
  87. #define  _CurLvl     (_CurCtl.clvl)
  88. #define  _CurStk(i)  (_CurCtl.cstk[i])
  89.  
  90. /*------------------------[ Function prototypes ]-----------------------*/
  91.  
  92. #ifdef __cplusplus                     /* no mangling, please           */
  93.    extern   "C"   {
  94. #endif
  95.                               /*- Video cursor -------------------------*/
  96. VOID  CTYP  CurHide(NOARG);            /* Hide cursor                   */
  97. VOID  CTYP  CurPush(IntT h, IntT s,    /* Preserve cursor state, with   */
  98.    IntT r, IntT c);                    /*    optional update            */
  99. VOID  CTYP  CurPop(NOARG);             /* Restore cursor state          */
  100. VOID  CTYP  CurShow(NOARG);            /* Show cursor                   */
  101. VOID        CurSave(NOARG);            /* Preserve cursor state         */
  102. VOID  CTYP  CurSize(IntT s);           /* Size cursor                   */
  103.                               /*- Mouse cursor -------------------------*/
  104. VOID  PAS   MouHide(NOARG);            /* Hide mouse-cursor if shown    */
  105. VOID  CTYP  MouHome(NOARG);            /* Home the mouse                */
  106. VOID  CTYP  MouPop(NOARG);             /* Restore state                 */
  107. VOID  CTYP  MouPush(BytT s);           /* Save state, set level <s>     */
  108. VOID  PAS   MouShow(NOARG);            /* Show mouse-cursor if hidden   */
  109.                               /*- Other user-callable mouse functions --*/
  110. VOID        MSpop(NOARG);              /* 5.51 alias ...                */
  111. VOID        MSpush(BytT s);            /* 5.51 alias ...                */
  112.                               /*- Implementation macros ----------------*/
  113. #define  CurSave()   (CurPush(-1, -1, -1, -1))
  114. #define  MSpop()     (MouPop())
  115. #define  MSpush(s)   (MouPush(s))
  116. #define  MShide()    (MouHide())
  117. #define  MSshow()    (MouShow())
  118. #ifdef __cplusplus
  119.    }
  120. #endif
  121. #endif   /* _TCXLcur_ : End of TCXLcur.h -------------------------------*/
  122.