home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
WINPROTO.H
< prev
next >
Wrap
Text File
|
1990-10-30
|
14KB
|
333 lines
/*
winproto.h
% definitions for windows
% macros and functions for windows
1/20/88 by Ted
OWL 1.2
Copyright (c) 1988, 1989 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
8/13/88 jmd Changed win_GetAttr and win_SetAttr
8/15/88 jmd added winopen_struct (later removed)
2/12/88 ted Fixed up mouse support for new current window cases
3/20/89 ted Made everything refer to static curr_dmgr / curr_wmgr
3/24/89 ted Made windows pure objects; shook everything up.
3/24/89 ted Changed order of args to win_Open and win_PixOpen.
3/29/89 ted Extracted winpriv.h.
3/31/89 ted Added wmgr_PointWin.
4/21/89 ted Renamed xd elements box and border to wbox and bord for Unix.
5/28/89 jmd added Shadow support
6/26/89 ted Added macros for fromwin, nextwin, mousecode.
7/08/89 gam Changed NULL to FNULL where necessary
7/10/89 ted Moved nextwin to window structure from wmgr.
7/25/89 ted Added explode function.
8/08/89 jmd Added win_Really funcs.
8/16/89 ted Added mev_IsFake macro.
8/23/89 ted Added disp_Get/Set[Shadow]Attr macros.
9/26/89 ted Fixed 'win_SetResize' macro.
11/10/89 jmd added win_Grab macro
11/27/89 ted Moved IsTrappedMouse macro here, created GetMouseTrap() macro.
12/10/89 jmd added win gofunc, made win_GetBorder macro, added Shadow color macros
1/17/90 ted Added shademsg args to _Expose functions.
3/28/90 jmd ansi-fied
5/12/90 jmd converted scancodes to ints
6/06/90 ted Added disp_GetTopWin() macro.
7/25/90 jmd added winmou_Track
8/08/90 ted Added kb_Stuff, obsoleted disp_SetMouseCode.
8/27/90 ted added nextchild stuff for offer/request mouse msgs to use.
9/01/90 ted added Claim/Release calls to win_Employ macro.
9/05/90 jmd removed Claim/Release calls from win_Employ macro.
9/24/90 jmd added userpaint flaq, removed gofunc
10/31/90 ted added cast in win_GetBorderFunc of FNULL to (class_fptr).
*/
/* -------------------------------------------------------------------------- */
/* Macros */
#define win_Close(win) obj_Close(win)
#define win_MouseInit() bord_MouseInit()
#define win_getxd(win) ((win_xd *) obj_getxd(win))
#define win_GetParent(win) bob_GetParent(win)
#define win_IsParentClip(win) bob_IsDepend(win)
#define win_SetParent(win, parnt) bob_SetParent(win, parnt)
#define win_SetParentClip(win, c) bob_SetDepend(win, c)
#define win_IsEmployed(win) ((boolean) win_getxd(win)->employed)
#define win_GetAbove(win) (win_getxd(win)->above)
#define win_GetBelow(win) (win_getxd(win)->below)
#define win_pixboxp(win) (&win_getxd(win)->wbox)
#define win_inboxp(win) (&win_getxd(win)->inbox)
#define win_GetBorder(win) (win_getxd(win)->bord)
#define win_GetFont(win) (win_getxd(win)->font)
#define win_GetAttr(win) (win_getxd(win)->attribute)
#define win_GetCursx(win) (win_getxd(win)->cursx)
#define win_GetCursy(win) (win_getxd(win)->cursy)
#define win_GetCursorType(win) (win_getxd(win)->curstype)
#define win_GetNullfont(win) ((boolean) win_getxd(win)->nullfont)
#define win_GetShadowAttr(win) (win_getxd(win)->shadowattr)
#define win_SetShadowAttr(win, a) (win_getxd(win)->shadowattr = (a))
#define win_GetShadowX(win) (win_getxd(win)->shadowx)
#define win_SetShadowX(win,x) (win_getxd(win)->shadowx = (x))
#define win_GetShadowY(win) (win_getxd(win)->shadowy)
#define win_SetShadowY(win,y) (win_getxd(win)->shadowy = (y))
#define win_SetPixShadow(win, x ,y) (win_SetShadowX(win, x), win_SetShadowY(win, y))
#define win_SetMouse(win, mh) (win_getxd(win)->mouhandler = (mh))
#define win_GetMouhandler(win) (win_getxd(win)->mouhandler)
#define win_MouseOk(win) (win_getxd(win)->mouhandler != FNULL)
#define win_GetDebounced(win) ((boolean) win_getxd(win)->debounced)
#define win_SetDebounced(win, db) (win_getxd(win)->debounced = (unsigned)(db))
#define win_SetNextWin(win, nwin) (win_getxd(win)->nextwin = (nwin))
#define win_SetNextChild(win, nch) (win_getxd(win)->nextchild = (nch))
#define win_SetExplode(win, ex) (win_getxd(win)->explode = (ex))
#define win_GetExplodeFptr(win) (win_getxd(win)->explode)
#define win_SetUserPaint(win, f) (win_getxd(win)->userpaint = (f))
#define win_IsUserPaint(win) (win_getxd(win)->userpaint)
#define win_IsCharSize(win) ((boolean) win_getxd(win)->charsize)
#define win_SetCharSize(win, cs) (win_getxd(win)->charsize = (unsigned)(cs))
#define win_GetResize(win) ((boolean) win_getxd(win)->resize)
#define win_SetResize(win, rs) (win_getxd(win)->resize = (unsigned)(rs))
#define win_GetData(win) ((win_getxd(win))->data)
#define win_SetData(win, d) ((win_getxd(win))->data = (d))
/* -------------------------------------------------------------------------- */
#define win_Ok(win) \
(((win) == NULL) ? FALSE : (win_getxd(win)->idmgr == curr_dmgr->id))
#define win_GetBorderFunc(win) \
((win_GetBorder(win) == NULL) ? ((class_fptr) FNULL) : win_GetBorder(win)->dispatch)
#define win_GetXmin(win) (win_pixboxp(win)->xmin + win_inboxp(win)->xmin)
#define win_GetYmin(win) (win_pixboxp(win)->ymin + win_inboxp(win)->ymin)
#define win_GetXmax(win) (win_pixboxp(win)->xmin + win_inboxp(win)->xmax)
#define win_GetYmax(win) (win_pixboxp(win)->ymin + win_inboxp(win)->ymax)
#define win_GetBgColor(win) disp_GetAttrBgColor(win_GetAttr(win))
#define win_GetFgColor(win) disp_GetAttrFgColor(win_GetAttr(win))
#define win_GetShadowBgColor(win) disp_GetAttrBgColor(win_GetShadowAttr(win))
#define win_GetShadowFgColor(win) disp_GetAttrFgColor(win_GetShadowAttr(win))
#define win_GetPixCursorPos(win, cxp, cyp) \
(*(cxp) = win_GetCursx(win), *(cyp) = win_GetCursy(win))
#define win_SetFont(win, font) ((boolean) win_Do(win, WINM_SETFONT, font, NULL))
#define win_GetFontWidth(win) ofont_GetWidth(win_GetFont(win))
#define win_GetFontHeight(win) ofont_GetHeight(win_GetFont(win))
#define win_CheckEventWait(win, wt) hard_CheckEvent(wt)
#define win_CheckEvent(win) hard_CheckEvent(0)
#define win_MouseHoldDown(win, mev) \
win_MouseHoldDownTime(win, mev, disp_MouseTimeout())
#define win_MouseReleaseWait(win, mev) \
win_MouseHoldDownTime(win, mev, (unsigned)-1)
/* -------------------------------------------------------------------------- */
#define win_GetPixWidth(win) ((opcoord)opbox_GetWidth(win_inboxp(win)))
#define win_GetPixHeight(win) ((opcoord)opbox_GetHeight(win_inboxp(win)))
#define win_GetPixBox(win, boxp) \
((boxp)->xmin = 0, (boxp)->ymin = 0, \
(boxp)->xmax = win_GetPixWidth(win), (boxp)->ymax = win_GetPixHeight(win))
/* Paints all unobscured parts of win in relbox. */
#define win_PaintPixBox(win, relboxp) \
win_ExposePixBox(win, relboxp, WINM_PAINT, NULL, WINM_SHADOW, NULL)
/* Paints all unobscured parts of win. */
#define win_Paint(win) win_Expose(win, WINM_PAINT, NULL, WINM_SHADOW, NULL)
/* Saves all unobscured parts of win in relbox. */
#define win_SavePixBox(win, relboxp) win_ExposePixBox(win, relboxp, WINM_SAVE, NULL, WINM_SHADOWSAVE, NULL)
/* Saves all unobscured parts of win. */
#define win_Save(win) win_Expose(win, WINM_SAVE, NULL, WINM_SHADOWSAVE, NULL)
#define win_Grab(win) win_Expose(win, WINM_GRAB, NULL, WINM_SHADOWSAVE, NULL)
#define win_Employ(win) win_PutUnder(win, curr_wmgr->bot_sys_win)
#define win_UnEmploy(win) win_Do(win, WINM_UNEMPLOY, NULL, NULL)
#define win_Top(win) win_Do(win, WINM_PUTUNDER, NULL, NULL)
#define win_PutUnder(win, dest) win_Do(win, WINM_PUTUNDER, dest, NULL)
/* Character-grid coordinate window macros */
#define win_GetLeftCol(win) \
opcoord_GetXCol(win_GetXmin(win), win_GetFont(win))
#define win_GetTopRow(win) \
opcoord_GetYRow(win_GetYmin(win), win_GetFont(win))
#define win_GetRightCol(win) \
(opcoord_GetXCol(win_GetXmax(win), win_GetFont(win)) - 1)
#define win_GetBotRow(win) \
(opcoord_GetYRow(win_GetYmax(win), win_GetFont(win)) - 1)
#define win_GetWidth(win) \
((int)(win_GetPixWidth(win) / win_GetFontWidth(win)))
#define win_GetHeight(win) \
((int)(win_GetPixHeight(win) / win_GetFontHeight(win)))
#define win_Scroll(win, nrows, ncols) \
win_ScrollPix(win, (ncols)*win_GetFontWidth(win), \
(nrows)*win_GetFontHeight(win))
#define win_SetPosition(win, row, col) \
win_SetPixPosition(win, (col)*win_GetFontWidth(win), \
(row)*win_GetFontHeight(win))
#define win_GetBox(win, cboxp) \
((cboxp)->toprow = 0, (cboxp)->leftcol = 0, \
(cboxp)->botrow = win_GetHeight(win) - 1, \
(cboxp)->rightcol = win_GetWidth(win) - 1)
#define win_GetCursorPos(win, rowp, colp) \
(*(colp) = opcoord_GetXCol(win_GetCursx(win), win_GetFont(win)), \
*(rowp) = opcoord_GetYRow(win_GetCursy(win), win_GetFont(win)) - 1)
#define win_SetCursorPos(win, row, col) \
win_SetPixCursorPos(win, (col) * win_GetFontWidth(win), \
((row+1)) * win_GetFontHeight(win))
#define win_SetSize(win, rows, cols) \
win_SetPixSize(win, (cols) * win_GetFontWidth(win), \
(rows) * win_GetFontHeight(win))
#define win_PaintChar(win, row, col) win_PaintRow(win, row, col, 1)
/* -------------------------------------------------------------------------- */
/* *** wmgr_ funcs renamed to win_ for public consumption *** */
#define win_IsObscured(win) \
(wmgr_IsObscuredPixBox(curr_wmgr->bot_sys_win, win, win_pixboxp(win), TRUE) != NULL)
/* -------------------------------------------------------------------------- */
/* *** wmgr_ funcs renamed to disp_ for public consumption *** */
#define disp_GetBackWin() (curr_wmgr->backwin)
#define disp_GetTopWin() win_GetBelow((curr_wmgr->bot_sys_win))
#define disp_GetBotWin() (curr_wmgr->bot_employed_win)
#define disp_GetCurrentWin() (curr_wmgr->currwin)
#define disp_GetDispWin() (curr_wmgr->dispwin)
#define disp_GetAttr() win_GetAttr(disp_GetDispWin())
#define disp_SetAttr(at) win_SetAttr(disp_GetDispWin(), at)
#define disp_GetShadowAttr() win_GetShadowAttr(disp_GetDispWin())
#define disp_SetShadowAttr(at) win_SetShadowAttr(disp_GetDispWin(), at)
#define disp_TrapMouse(win) (curr_wmgr->trapmousewin = (win))
#define disp_TrapMouseOff() (curr_wmgr->trapmousewin = NULL)
#define disp_GetMouseTrap() (curr_wmgr->trapmousewin)
#define disp_IsTrappedMouse() (disp_GetMouseTrap() != NULL)
#define disp_GetFromWin() (curr_wmgr->fromwin)
#define cls() disp_Clear(win_GetBgColor(disp_GetDispWin()))
/* Note: disp_SetMouseCode is now obsolete. */
#define disp_SetMouseCode(mcode) kb_Stuff(mcode)
/* -------------------------------------------------------------------------- */
/* *** wmgr_ funcs renamed to kb_ for public consumption *** */
#define kb_Stuff(code) (curr_wmgr->stuffcode = (code))
#define kb_WasMouse() ((boolean) curr_wmgr->wasmouse)
#define mev_IsFake() ((boolean) curr_wmgr->fakemouse)
/* -------------------------------------------------------------------------- */
/* Function prototypes */
/* WINCLEAR.C */
extern void win_Clear(win_type win, opixval color);
extern void win_ClearPixBox(win_type win, opbox *boxp, opixval color);
extern void win_ClearBox(win_type win, ocbox *cboxp, opixval color);
/* WINCLIP.C */
extern unsigned win_clipbox(win_type win, opbox *boxp);
extern unsigned win_clippoint(win_type win, opcoord *xp, opcoord *yp);
/* WINCURSO.C */
extern void win_SetPixCursorPos(win_type win, opcoord cursx, opcoord cursy);
extern void win_SetCursorType(win_type win, cursortype ctype);
extern void win_GetCursorPixBox(win_type win, opbox *cursboxp);
extern boolean win_ShowCursor(win_type win);
extern boolean win_HideCursor(win_type win);
extern void win_SetCursorColor(win_type win, opixval color);
/* WINDUMP.C (debugging aid) */
extern void win_Dump(char *msg);
/* WINEXPOS.C */
extern void win_Expose(win_type win, int emsg, VOID *emsgdata, int shademsg, VOID *shademsgdata);
extern void win_ExposePixBox(win_type win, opbox *relboxp, int emsg, VOID *emsgdata, int shademsg, VOID *shademsgdata);
/* WINGETP.C */
extern void win_GetPixPosition(win_type win, opbox *opboxp);
extern void win_GetPosition(win_type win, ocbox *ocboxp);
/* WINGO.C */
extern int win_Go(win_type win);
/* WINMEV.C */
extern void winmev_grantrequest(win_type win, mev_struct *mev);
/* WINMOUSE.C */
extern int win_ReadEvent(win_type win, mev_struct *mev);
extern boolean win_MouseCurrEvent(mev_struct *mev);
extern int win_MouseHoldDownTime(win_type win, mev_struct *mev, unsigned duration);
extern int win_MouseDblClick(win_type win, mev_struct *mev);
/* WINMOUTK.C */
extern mouhandler_func (winmou_Track);
/* WINOBSC.C */
extern win_type wmgr_IsObscuredPixBox(win_type topwin, win_type win, opbox *boxp, boolean doshad);
extern win_type wmgr_PointWin(opcoord x, opcoord y);
extern win_type wmgr_FindBelow(win_type win);
/* WINOPEN.C */
extern win_type win_Open(class_fptr winclass, ocbox *cboxp);
extern win_type win_PixOpen(class_fptr winclass, opbox *boxp, ofont_type font);
extern void win_SetAttr(win_type win, byte attr);
extern void win_SetShadow(win_type win, int csize);
/* WINPAINT.C */
extern void win_PaintRow(win_type win, int row, int col, int length);
extern void win_PaintCol(win_type win, int row, int col, int length);
extern void win_PaintBox(win_type win, ocbox *cboxp);
/* WINSCROL.C */
extern void win_ScrollPix(win_type win, opcoord nx, opcoord ny);
extern void win_ScrollPixBox(win_type win, opbox *boxp, opcoord nx, opcoord ny);
extern void win_ScrollBox(win_type win, ocbox *cboxp, int nrows, int ncols);
/* WINSETP.C */
extern void win_SetPixPosition(win_type win, opcoord xpos, opcoord ypos);
extern void win_ReallySetPixPosition(win_type win, opcoord xpos, opcoord ypos);
/* WINSIZE.C */
extern void win_SetPixSize(win_type win, odim width, odim height);
extern void win_ReallySetPixSize(win_type win, odim width, odim height);
/* WINTOP.C */
extern boolean win_ReallyPutUnder(win_type win, win_type destwin);
extern boolean win_ReallyUnEmploy(win_type win);
extern boolean win_IsAbove(win_type winabove, win_type win);
/* -------------------------------------------------------------------------- */