home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / txcl552 / inc / tcxlsel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-22  |  7.4 KB  |  135 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:   tcxlsel.h     552.2   24 May 1991 14:57:04  $
  9.  |
  10.  | $Log:   tcxlsel.h    $
  11.  *-D--------------------------------------------------------------------*
  12.  | <TCXLsel.h> : Definitions and prototypes for TCXL selection system
  13.  | (User level).
  14.  *-N-----------------------[ Notes and Caveats ]------------------------*
  15.  | 1) The data-objects marked internal here are NOT for direct caller
  16.  |    access.
  17.  | 2) The Slst selection-list object exists and the SelPtr and SelNdx
  18.  |    macros are valid ONLY while _Select() is active (i.e., when called
  19.  |    by SelFile(), SelStr() or SelTxt()). SelNdx and SelPtr are intended
  20.  |    to provide access to the CURRENT selected item from user-defined
  21.  |    functions, such as those assigned to hot-keys.
  22.  | 3) The SelCur and SelItm access-macros for the _SelCtl object will
  23.  |    return the LAST selected item when _Select() returns, even if the
  24.  |    exit key is an [Esc]. SelCur and SelItm remain valid and unchanged,
  25.  |    while SelPtr and SelNdx are TRANSIENT.
  26.  | 4) SelFree() MUST be called after SelFile() to free the returned
  27.  |    pathname buffer.
  28.  | 5) _SelCtl is declared in _Select.C
  29.  *======================================================================*/
  30. #ifndef  _TCXLsel_
  31. #  define   _TCXLsel_ 1                /* Only once!                    */
  32. #  ifndef   _TCXLwin_
  33. #    include <TCXLwin.h>               /* Window definitions            */
  34. #  endif
  35. #  ifndef   _TCXLeng_
  36. #    include <TCXLeng.h>               /* Page Selection Engine         */
  37. #  endif
  38. #define  MAX_FIL  511         /* SelFile() maximum files                */
  39. #define  MAX_NAM  81          /* SelFile() maximum length of pathname   */
  40.                               /*- SelFlg control bits ------------------*/
  41. #define  SEL_BAR  0x01        /* Frame scroll-bar ON                    */
  42. #define  SEL_DIR  0x02        /* SelFile() directories ON               */
  43. #define  SEL_PAR  0x04        /* SelFile() parent directory ON          */
  44.  
  45. /*------------------[ Data-objects and access-macros ]------------------*/
  46.  
  47. TYP   struct   _Sel  SelT;             /* Object, pointer types         */
  48. TYP   struct   _Slst SlstT, *SlstP;
  49.  
  50. struct   _Sel                 /*- Selection-control object -------------*/
  51. {  SlstP slst;                /* 00|00 : SelLst : Selection-list object */
  52.    ChrP  sitm;                /* 02|04 : SelItm : Selected-item pointer */
  53.    ChrP  snam;                /* 04|08 : SelNam : Selected-item buffer  */
  54.    ChrP  sfsp[4];             /* 06|0C : SelFsp : Internal pointers     */
  55.    VfvCP sgfo;                /* 0E|1C : SelGfo : Internal pointer      */
  56.    IntT  scur;                /* 10|20 : SelCur : Selected-item index   */
  57.    FlgT  sflg;                /* 12|22 : SelFlg : Control flags         */
  58.    FlgT  sgtf;                /* 13|23 : SelGtf : Internal flags        */
  59. };                            /* 14|24 ]--------------------------------*/
  60.  
  61. GBL   SelT  CDC _SelCtl;      /*- Global selection-control object ------*/
  62. #define  SelLst   (_SelCtl.slst)                /* Selection-list       */
  63. #define  SelItm   (_SelCtl.sitm)                /* Selected pointer     */
  64. #define  SelNam   (_SelCtl.snam)                /* Selected pathname    */
  65. #define  SelCur   (_SelCtl.scur)                /* Selected index       */
  66. #define  SelFlg   (_SelCtl.sflg)                /* Control flags        */
  67. #define  SelBar   (0 != (SelFlg & SEL_BAR))        /* Scroll-bar ON     */
  68. #define  SelDir   (0 != (SelFlg & SEL_DIR))        /* Directories OFF   */
  69. #define  SelPar   (0 != (SelFlg & SEL_PAR))        /* Parent OFF        */
  70.  
  71. struct   _Slst                /*- Internal selection-list object -------*/
  72. {  ChrI  sitm;                /* 00|00 : Item string array              */
  73.    ElstP seng;                /* 02|04 : Page Selection Engine          */
  74.    IntT  scnt;                /* 04|08 : Total item count               */
  75.    IntT  smax;                /* 06|0A : Last item                      */
  76.    IntT  scur;                /* 08|0C : Current item                   */
  77.    IntT  sbeg;                /* 0A|0E : First item on page             */
  78.    IntT  send;                /* 0C|10 : Last item on page              */
  79.    IntT  swid;                /* 0E|12 : Items per line                 */
  80.    IntT  spag;                /* 10|14 : Items per page                 */
  81.    IntT  slen;                /* 12|16 : Maximum item length            */
  82.    IntT  sdep;                /* 14|18 : Page depth in lines            */
  83.    AtrT  swat;                /* 16|18 : Window attribute               */
  84.    AtrT  ssat;                /* 17|19 : Bar attribute                  */
  85.    FlgT  sflg;                /* 18|1A : Control bits                   */
  86.    BytT  sfut;                /* 19|1B : Reserved for future            */
  87. };                            /* 1A|1C ]--------------------------------*/
  88.  
  89. /*------------------[ Transient selected-item macros ]------------------*
  90.  | SelNdx is the index of the selected-item string.  SelPtr points to the
  91.  | selected-item string. CAVEAT : These macros are ONLY valid while
  92.  | _Select() is active!
  93.  *----------------------------------------------------------------------*/
  94.  
  95. #define  SelNdx   (EngCur(SelLst->seng) + SelLst->sbeg)
  96. #define  SelPtr   (SelLst->sitm[SelNdx])
  97.  
  98. /*------------------------[ Function prototypes ]-----------------------*/
  99.  
  100. #ifdef __cplusplus                     /* No mangling, please           */
  101.    extern "C" {
  102. #endif
  103. IntT   CTYP _Select(IntT sr, IntT sc,  /* Internal selection engine     */
  104.    IntT er, IntT ec, BytT bt, AtrT ab, AtrT aw, AtrT as, ChrP sa[],
  105.    IntT ie, VfvCP fo);
  106. IntT  CTYP  SelAttr(IntT sr, IntT sc,  /* Select attribute              */
  107.    BytT bt, AtrT ba, FlgT ab, VfvCP fo);
  108. VOID        SelBarOn(NOARG);           /* Frame scroll-bar ON           */
  109. VOID        SelBarOff(NOARG);          /* Frame scroll-bar OFF          */
  110. VOID        SelDirOn(NOARG);           /* SelFile() directories ON      */
  111. VOID        SelDirOff(NOARG);          /* SelFile() directories OFF     */
  112. ChrP  CTYP  SelFile(IntT sr, IntT sc,  /* Select file                   */
  113.    IntT er, IntT ec, BytT bt, AtrT ba,
  114.    AtrT wa, AtrT sa, FlgT ti, ChrP fs,
  115.    VfvCP fo);
  116. VOID  CTYP  SelFree(NOARG);            /* Free SelFile() path buffer    */
  117. VOID        SelParOn(NOARG);           /* SelFile() parent directory ON */
  118. VOID        SelParOff(NOARG);          /* SelFile() parent directory OFF*/
  119. IntT  CTYP  SelStr(IntT sr, IntT sc,   /* Select string                 */
  120.    IntT er, IntT ec, BytT bt, AtrT ba,
  121.    AtrT wa, AtrT sa, ChrP as[],
  122.    IntT ie, VfvCP fo);
  123. IntT  CTYP  SelTxt(BytT wr, BytT wc,   /* Select text (active window)   */
  124.    AtrT at, ChrP as[], IntT in);
  125. #define  SelBarOn()  (SelFlg |= SEL_BAR)
  126. #define  SelBarOff() (SelFlg &= ~SEL_BAR)
  127. #define  SelDirOn()  (SelFlg |= SEL_DIR)
  128. #define  SelDirOff() (SelFlg &= ~SEL_DIR)
  129. #define  SelParOn()  (SelFlg |= SEL_PAR)
  130. #define  SelParOff() (SelFlg &= ~SEL_PAR)
  131. #ifdef __cplusplus
  132.    }
  133. #endif
  134. #endif   /*- _TCXLsel_ : End of TCXLsel.h ------------------------------*/
  135.