home *** CD-ROM | disk | FTP | other *** search
- /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
- | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
- | All Rights Reserved.
- |
- | This Library is part of IDC's TesSeRact Development Tools product
- | line. For information about other IDC products, call 1-215-443-9705.
- *-V--------------------------------------------------------------------*
- | $Header: tcxlwin.h 552.0 17 Mar 1991 18:27:00 $
- |
- | $Log: tcxlwin.h $
- *-D--------------------------------------------------------------------*
- | <TCXLwin.h> : Definitions and prototypes for TCXL window-system.
- *-N-----------------------[ Notes and Caveats ]------------------------*
- | 1) Included by: <TCXLent.h>, <TCXLhlp.h>, <TCXLmnu.h>, <TCXLsel.h>
- | 2) To open an e*x*p*l*o*d*i*n*g window, OR the BOX_EXP bit with the
- | <bt> argument to Wopen() or WpopUp().
- | 3) [A] indicates active window in function prototype comments.
- | 4) Functions marked internal are not for public use!
- *======================================================================*/
- #ifndef _TCXLwin_
- # define _TCXLwin_ 1
- # ifndef _TCXLvid_
- # include <TCXLvid.h> /* video definitions */
- # endif
- # ifndef _TCXLerr_
- # include <TCXLerr.h> /* error definitions */
- # endif
- /*- Frame (border) sides --------*/
- #define BRD_TOP 0x00 /* Top */
- #define BRD_BOT 0x01 /* Bottom */
- #define BRD_LFT 0x02 /* Left */
- #define BRD_RGT 0x03 /* Right */
- /*- Wcenter(), WpopUp() flags ---*/
- #define CNT_HOR 0x01 /* Horizontal */
- #define CNT_VER 0x02 /* Vertical */
- #define CNT_CNT 0x03 /* Both */
- /*- Direction codes -------------*/
- #define DIR_DWN 0x00 /* Down */
- #define DIR_UP 0x01 /* Up */
- #define DIR_LFT 0x02 /* Left */
- #define DIR_RGT 0x03 /* Right */
- /*- Wtitle() positions ----------*/
- #define TTL_LFT 0x01 /* Left */
- #define TTL_CNT 0x02 /* Center */
- #define TTL_RGT 0x03 /* Right */
- /*- error-return macros ---------*/
-
- /*------------------[ Data objects and access macros ]------------------*/
-
- TYP struct _Box BoxT, *BoxP; /* Object and pointer types */
- TYP struct _Ttl TtlT, *Ttlp;
- TYP struct _Wctl WctlT, *WctlP;
- TYP struct _Wdf WdfT, *WdfP;
-
- struct _Box /*-[ Window-frame object ]----------------*/
- { BytT btyp; /* 00|00 : BoxTyp : Type */
- BytT batr; /* 01|01 : BoxAtr : Attribute */
- }; /* 02|02 ]--------------------------------*/
- #define BoxTyp(b) ((b).btyp)
- #define BoxAtr(b) ((b).batr)
-
- struct _Ttl /*-[ Window-title object ]----------------*/
- { ChrP tstr; /* 00|00 : TtlStr : String */
- BytT tpos; /* 02|04 : TtlPos : Position */
- AtrT tatr; /* 03|05 : TtlAtr : Attribute */
- }; /* 04|06 ]--------------------------------*/
- #define TtlStr(t) ((t).tstr)
- #define TtlPos(t) ((t).tpos)
- #define TtlAtr(t) ((t).tatr)
-
- struct _Wctl /*-[ Window-control object ]--------------*/
- { WdfP wact; /* 00|00 : WctlAct : Active window */
- WdfP whid; /* 02|04 : WctlHid : Top hidden window */
- VOID (CTYP *wfun) /* 04|08 : WctlFun : Fill-function */
- (WrdT, WrdT, ChrT, AtrT);
- WndT whdl; /* 06|0C : WctlHdl : Last handle assigned */
- TagT whlp; /* 08|0E : WctlHlp : Help category */
- IntT wopn; /* 0A|10 : WctlOpn : Total open windows */
- BytT wesc; /* 0C|12 : WctlEsc : [Esc] check ? 1 : 0 */
- BytT wtab; /* 0D|13 : WctlTab : TTY output tab width */
- BytT wfil; /* 0E|14 : WctlFil : Fill character */
- BytT wflg; /* 0F|15 : WctlFlg : Internal flag byte */
- }; /* 10|16 ]--------------------------------*/
-
- GBL WctlT CDC _WinCtl; /*- Global window-control object ---------*/
- #define WctlAct (_WinCtl.wact) /* Active window */
- #define WctlHid (_WinCtl.whid) /* Top hidden window */
- #define WctlFun (_WinCtl.wfun) /* Fill function */
- #define WctlHdl (_WinCtl.whdl) /* Last handle */
- #define WctlHlp (_WinCtl.whlp) /* Help category */
- #define WctlOpn (_WinCtl.wopn) /* Total open */
- #define WctlEsc (_WinCtl.wesc) /* [Esc] check */
- #define WctlTab (_WinCtl.wtab) /* Tab width */
- #define WctlFil (_WinCtl.wfil) /* Fill char */
- #define WctlFlg (_WinCtl.wflg) /* Internal flag byte */
-
- struct _Wdf /*-[ Window-definition object ]-----------*/
- { WdfP wprv; /* 00|00 : WdfPrv : Previous window */
- WdfP wnxt; /* 02|04 : WdfNxt : Next window */
- VcelP wbfr; /* 04|08 : WdfBfr : Buffer */
- VcelP wsbf; /* 06|0C : WdfSbf : Shadow buffer */
- TtlT wttl; /* 08|10 : WdfTtl : Title */
- WndT whdl; /* 0C|14 : WdfHdl : Handle */
- TagT whlp; /* 0E|16 : WdfHlp : Help category */
- VposT wbeg; /* 10|18 : WdfBeg : Start position */
- VposT wend; /* 12|1A : WdfEnd : End position */
- VposT wmin; /* 14|1C : WdfMin : Minimum position */
- VposT wmax; /* 16|1E : WdfMax : Maximum position */
- VposT wpos; /* 18|20 : WdfPos : Cursor position */
- BoxT wfrm; /* 1A|22 : WdfFrm : Frame */
- AtrT wdat; /* 1C|24 : WdfDat : Default attribute */
- AtrT wcat; /* 1D|25 : WdfCat : Current attribute */
- AtrT wsat; /* 1E|26 : WdfSat : Shadow attribute */
- BytT wflg; /* 1F|27 : WdfFlg : Internal flags */
- }; /* 20|28 ]--------------------------------*/
-
- #define WdfPrv(w) ((w)->wprv) /* Previous window */
- #define WdfNxt(w) ((w)->wnxt) /* Next window */
- #define WdfBfr(w) ((w)->wbfr) /* Buffer */
- #define WdfSbf(w) ((w)->wsbf) /* Shadow buffer */
- #define WdfTtl(w) ((w)->wttl) /* Title */
- #define WdfTtlS(w) (TtlStr(WdfTtl(w))) /* String */
- #define WdfTtlP(w) (TtlPos(WdfTtl(w))) /* Position */
- #define WdfTtlA(w) (TtlAtr(WdfTtl(w))) /* Attribute */
- #define WdfHdl(w) ((w)->whdl) /* Handle */
- #define WdfHlp(w) ((w)->whlp) /* Help category */
- #define WdfBeg(w) ((w)->wbeg) /* Start position */
- #define WdfBegW(w) (VposW(WdfBeg(w))) /* Word */
- #define WdfBegC(w) (VposC(WdfBeg(w))) /* Col */
- #define WdfBegR(w) (VposR(WdfBeg(w))) /* Row */
- #define WdfEnd(w) ((w)->wend) /* End position */
- #define WdfEndW(w) (VposW(WdfEnd(w))) /* Word */
- #define WdfEndC(w) (VposC(WdfEnd(w))) /* Col */
- #define WdfEndR(w) (VposR(WdfEnd(w))) /* Row */
- #define WdfMin(w) ((w)->wmin) /* Minimum position */
- #define WdfMinW(w) (VposW(WdfMin(w))) /* Word */
- #define WdfMinC(w) (VposC(WdfMin(w))) /* Col */
- #define WdfMinR(w) (VposR(WdfMin(w))) /* Row */
- #define WdfMax(w) ((w)->wmax) /* Maximum position */
- #define WdfMaxW(w) (VposW(WdfMax(w))) /* Word */
- #define WdfMaxC(w) (VposC(WdfMax(w))) /* Col */
- #define WdfMaxR(w) (VposR(WdfMax(w))) /* Row */
- #define WdfPos(w) ((w)->wpos) /* Cursor position */
- #define WdfPosW(w) (VposW(WdfPos(w))) /* Word */
- #define WdfPosC(w) (VposC(WdfPos(w))) /* Col */
- #define WdfPosR(w) (VposR(WdfPos(w))) /* Row */
- #define WdfFrm(w) ((w)->wfrm) /* Frame (border) */
- #define WdfFrmT(w) (BoxTyp(WdfFrm(w))) /* Type */
- #define WdfFrmA(w) (BoxAtr(WdfFrm(w))) /* Attribute */
- #define WdfDat(w) ((w)->wdat) /* Default attribute */
- #define WdfCat(w) ((w)->wcat) /* Current attribute */
- #define WdfSat(w) ((w)->wsat) /* Shadow attribute */
- #define WdfFlg(w) ((w)->wflg) /* Internal flag byte */
- #define WdfUse(w) (WdfFlg(w) & 0x0F) /* Window usage */
- #define WdfUwin(w) (0x00 == WdfUse(w)) /* Vanilla */
- #define WdfUmnu(w) (0x01 == (WdfUse(w)) /* Menu */
- #define WdfUent(w) (0x02 == (WdfUse(w)) /* Entry-form */
- #define WdfUsel(w) (0x04 == (WdfUse(w)) /* Selection-list */
- #define WdfUhlp(w) (0x08 == (WdfUse(w)) /* Help */
- #define WdfBrd(w) (WdfBegW(w) != WdfMinW(w)) /* Border flag */
-
- /*------------------------[ Function prototypes ]-----------------------*/
-
- #ifdef __cplusplus /* No mangling, please */
- extern "C" {
- #endif
- /*- General window functions -------------*/
- IntT CTYP Wactiv(WndT wh); /* Activate window <wh> */
- IntT CTYP WcloseAll(NOARG); /* Close all windows */
- ChrP CTYP WerrMsg(NOARG); /* get error-message text */
- VOID CTYP Werror(NOARG); /* exit with error-message */
- WndT CTYP Windowat(IntT sr, /* Handle of window at <sr,sc> */
- IntT sc);
- WdfP CTYP WinLoc(WndT wh); /* Find window by handle <wh> */
- IntT Wisactiv(WndT a); /* Test for active handle */
- WndT CTYP Wopen(IntT sr, IntT sc, /* Open window */
- IntT er, IntT ec, BytT bt, AtrT ba, AtrT wa);
- IntT CTYP Wperror(ChrP mp); /* Display error window */
- WndT CTYP WpopUp(IntT cf, IntT sr, /* Open centered window */
- IntT sc, IntT er, IntT ec, BytT bt, AtrT ba, AtrT wa);
- VOID CTYP Wrestore(VcelP wb); /* Restore saved window */
- VcelP CTYP Wsave(IntT sr, IntT sc, /* Save window */
- IntT er, IntT ec);
- VOID CTYP Wpop(VcelP wb, /* Restore saved window to new */
- IntT sr, IntT sc, IntT er, IntT ec); /* screen position */
- VcelP Wpush(IntT sr, IntT sc, /* Save window (alias) */
- IntT er, IntT ec);
- VOID CTYP WsetEsc(FlgT a); /* Enable/Disable [Esc] key */
- VOID WsetFil(ChrT a); /* Set fill char */
- VOID WsetFun( /* Set fill function */
- VOID (CTYP *f)(WrdT, WrdT, ChrT, AtrT));
- VOID WsetTab(BytT a); /* Set tab-width */
- IntT CTYP WsetTxt(AtrT a); /* Set text attr */
- IntT Wunhide(WndT wh); /* Unhide window <wh> */
- IntT CTYP Wunlink(WndT wh); /* Unlink window <wh> */
- IntT CTYP Wwprints(WndT wh, BytT wr, /* Put string to window <wh> */
- BytT wc, AtrT at, ChrP ps);
- /*- Active window movement ---------------*/
- IntT CTYP Wcenter(BytT cf); /* Center window on screen [A] */
- IntT CTYP Wclose(NOARG); /* Close window [A] */
- WndT CTYP Wcopy(IntT nr, IntT nc); /* Copy window [A] */
- IntT CTYP Wdrag(BytT di); /* Drag one row or col [A] */
- IntT CTYP Wdump(NOARG); /* Dump window to printer [A] */
- WndT CTYP Whandle(NOARG); /* Get active handle [A] */
- IntT Whide(NOARG); /* Hide window [A] */
- IntT CTYP Wmove(IntT sr, IntT sc); /* Move window [A] */
- IntT CTYP Wsize(IntT nr, IntT nc); /* Resize window [A] */
- IntT CTYP Wgrow(IntT nr, IntT nc); /* Resize window [A] */
- IntT CTYP Wslide(IntT sr, IntT sc); /* Slide window [A] */
- IntT CTYP Wstretch(IntT sr, IntT sc);/* Stretch window [A] */
- /*- Active window-control ----------------*/
- IntT CTYP WchgAtr(AtrT ba, AtrT wa); /* Change window/border attr [A] */
- IntT Wclear(NOARG); /* Clear window to default [A] */
- IntT CTYP WclrEol(NOARG); /* Clear cursor to EOL [A] */
- IntT CTYP WclrEos(NOARG); /* Clear to end of window [A] */
- IntT CTYP WclrWin(AtrT at); /* Clear window [A] */
- IntT Wdepth(NOARG); /* Depth of window [A] */
- IntT CTYP WfilBox(BytT sr, BytT sc, /* Fill region [A] */
- BytT er, BytT ec, ChrT ch, AtrT at);
- IntT WlinDel(BytT wr, BytT di); /* Delete line [A] */
- IntT WlinIns(BytT wr, BytT di); /* Insert line [A] */
- IntT CTYP WscrBox(BytT sr, /* Scroll region [A] */
- BytT sc, BytT er, BytT ec, BytT nr, BytT di);
- IntT CTYP WscrWin(BytT nr, BytT di); /* Scroll window [A] */
- IntT Wwidth(NOARG); /* Width of window [A] */
- /*- Active border, box drawing -----------*/
- IntT CTYP Wborder(BytT bt); /* Add border [A] */
- IntT CTYP Wbprintc(BytT bd, BytT of, /* Put char/attr on border [A] */
- BytT at, ChrT ch);
- IntT CTYP WdrwBox(BytT sr, BytT sc, /* Draw internal box [A] */
- BytT er, BytT ec, BytT bt, AtrT at);
- IntT CTYP WdrwHor(BytT sr, BytT sc, /* Draw horizontal line [A] */
- BytT nc, BytT bt, AtrT at);
- IntT CTYP WdrwVer(BytT sr, BytT sc, /* Draw vertical line [A] */
- BytT n, BytT bt, AtrT at);
- IntT CTYP Wmessage(ChrP ps, BytT bo, /* Put message on border [A] */
- BytT lo, AtrT at);
- IntT CTYP Wtitle(ChrP ps, BytT tp, /* Put title on border [A] */
- AtrT ta);
- /*- Active window shadow -----------------*/
- IntT Wshadoff(NOARG); /* Remove shadow [A] */
- IntT Wshadow(AtrT at); /* Add shadow [A] */
- /*- Active window cursor -----------------*/
- VOID WcurGet(VposT rc); /* Get position [A] */
- WrdT CTYP WcurGt_(NOARG);
- IntT WcurPut(VposT rc); /* Put cursor [A] */
- IntT CTYP WcurPt_(WrdT rc);
- IntT CTYP Wgotoxy(BytT wr, BytT wc); /* Set position [A] */
- IntT CTYP Wpgotoxy(BytT wr, /* Provisional position [A] */
- BytT wc);
- VOID CTYP WposGet(IntP r, IntP c); /* Get cursor position as <r,c> */
- /*- Active Output / Current Cursor/Attrib */
- VOID CTYP WdupChr(ChrT ch, IntT nd); /* Put duplicated char [A] */
- VOID CTYP WdupStr(ChrP ps, IntT nd); /* Put duplicated string [A] */
- IntT CTYP WputCen(ChrP ps); /* Put centered string [A] */
- IntT CTYP WputFmt(ChrP fs, ChrP ps); /* Format-string output [A] */
- VOID CTYP Wputc(ChrT ch); /* Put char [A] */
- IntT CDC Wputf(ChrP fs, ...); /* Put printf() string [A] */
- VOID CTYP Wputs(ChrP ps); /* Put string [A] */
- VOID CTYP Wputns(ChrP ps, IntT wd); /* Put limited string [A] */
- IntT CTYP Wputrj(ChrP ps); /* Right-justify string/attr [A] */
- IntT CTYP Wputsw(ChrP ps); /* Put string with word-wrap [A] */
- /*- Active Output / Passed Cursor/Attrib -*/
- VOID CTYP WdupChrA(BytT wr, BytT wc, /* Put duplicated char/attr [A] */
- AtrT at, ChrT ch, IntT nd);
- VOID CTYP WdupStrA(BytT wr, BytT wc, /* Put duplicated str/attr [A] */
- AtrT at, ChrP ps, IntT nd);
- IntT CTYP WprtCen(BytT wr, AtrT at, /* Put centered string/attr [A] */
- ChrP ps);
- IntT CTYP WprtFmt(BytT wr, BytT wc, /* Format-string/attr output [A] */
- AtrT at, ChrP fs, ChrP ps);
- IntT CTYP Wprtc(BytT wr, BytT wc, /* Put char/attr [A] */
- AtrT at, ChrT ch);
- IntT CDC Wprtf(BytT wr, BytT wc, /* Put printf() string/attr [A] */
- AtrT at, ChrP fs, ...);
- VOID CTYP Wprtns(BytT wr, BytT wc, /* Put limited string/attr [A] */
- AtrT at, ChrP ps, IntT wd);
- IntT CTYP Wprtrj(BytT wr, BytT wc, /* Right-justify string/attr [A] */
- AtrT at, ChrP ps);
- IntT CTYP Wprts(BytT wr, BytT wc, /* Put string/attr [A] */
- AtrT at, ChrP ps);
- IntT CTYP Wprtsw(BytT wr, BytT wc, /* Put string/attr with wrap [A] */
- AtrT at, ChrP ps);
- /*- Internals ----------------------------*/
- FlgT CTYP WchkBox(BytT sr, BytT sc, BytT er, BytT ec);
- FlgT CTYP WchkCol(BytT wc);
- FlgT CTYP WchkPos(BytT wr, BytT wc);
- FlgT CTYP WchkRow(BytT wr);
- VOID CTYP _WatrSet(WrdT p, AtrT at, IntT ln);
- IntT CTYP _Whide_(FlgT m, WndT h);
- VcelP CTYP _WinBlk(WdfP w, WrdT c);
- VcelP CTYP _WinPos(WdfP w, WrdT c);
- IntT CTYP _WlinDI_(BytT id, BytT wr, BytT di);
- VOID _Woutp(VposT p, VcelP b, IntT l);
- VOID CTYP _Woutp_(WrdT p, VcelP b, IntT l);
- IntT CTYP _Wputl(ChrP tp);
- IntT CTYP _Wshadow_(FlgT m, AtrT at);
- VcelP CTYP _WshBlk(WdfP w, WrdT c);
- VcelP CTYP _WshPos(WdfP w, WrdT c, BytT s);
- /*- Implementation macros ----------------*/
- #define Wclear() (WclrWin(WdfDat(WctlAct)))
- #define WcurGet(rc) (VposW(rc)=WcurGt_())
- #define WcurPut(rc) (WcurPt_(VposW(rc)))
- #define Wdepth() MsInt(WdfMaxR(WctlAct)-WdfMinR(WctlAct))
- #define Whide() (_Whide_(1,0))
- #define Wisactiv(a) ((a)==WdfHdl(WctlAct))
- #define WlinDel(wr,di) (_WlinDI_(0,(wr),(di)))
- #define WlinIns(wr,di) (_WlinDI_(1,(wr),(di)))
- #define Wpush(sr,sc,er,ec) (Wsave((sr),(sc),(er),(ec))
- #define WsetFil(a) (WctlFil=(a))
- #define WsetFun(f) (WctlFun=(f))
- #define WsetTab(a) (WctlTab=(((a)==0)?1:(a)))
- #define Wshadoff() (_Wshadow_(0,0))
- #define Wshadow(a) (_Wshadow_(1,(a)))
- #define Wunhide(h) (_Whide_(0,(h)))
- #define Wwidth() MsInt(WdfMaxC(WctlAct)-WdfMinC(WctlAct))
- #define _Woutp(p,b,l) (_Woutp_(VposW(p),(b),(l)))
- #ifdef __cplusplus
- }
- #endif
- #endif /*- _TCXLwin_ : End of TCXLwin.h ------------------------------*/