home *** CD-ROM | disk | FTP | other *** search
- /*
- winproto.h
-
- % definitions for windows
-
- 1/20/88 by Ted
-
- OWL 1.1
- 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.
- */
-
- /* -------------------------------------------------------------------------- */
- /* Macros */
- #define win_Close(win) obj_Close(win)
-
- #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_border(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_SetExplode(win, ex) (win_getxd(win)->explode = (ex))
- #define win_GetExplodeFptr(win) (win_getxd(win)->explode)
-
- #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)->charsize = (unsigned)(rs))
- /* -------------------------------------------------------------------------- */
- #define win_Ok(win) \
- (((win) == NULL) ? FALSE : (win_getxd(win)->idmgr == curr_dmgr->id))
-
- #define win_GetBorderFunc(win) \
- ((win_border(win) == NULL) ? FNULL : win_border(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_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)
-
- /* Paints all unobscured parts of win. */
- #define win_Paint(win) win_Expose(win, WINM_PAINT, NULL)
-
- /* Saves all unobscured parts of win in relbox. */
- #define win_SavePixBox(win, relboxp) win_ExposePixBox(win, relboxp, WINM_SAVE, NULL)
-
- /* Saves all unobscured parts of win. */
- #define win_Save(win) win_Expose(win, WINM_SAVE, 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_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_GetFromWin() (curr_wmgr->fromwin)
- #define disp_SetMouseCode(mcode) (curr_wmgr->mousecode = (mcode))
- #define cls() disp_Clear(win_GetBgColor(disp_GetDispWin()))
- /* -------------------------------------------------------------------------- */
- /* *** wmgr_ funcs renamed to kb_ for public consumption *** */
-
- #define kb_WasMouse() ((boolean) curr_wmgr->wasmouse)
- #define mev_IsFake() ((boolean) curr_wmgr->fakemouse)
- /* -------------------------------------------------------------------------- */
- /* Function prototypes */
-
- /* winopen.c */
- extern win_type win_Open(_arg2(class_fptr winclass, ocbox *cboxp));
- extern win_type win_PixOpen(_arg3(class_fptr winclass, opbox *boxp, ofont_type font));
- extern void win_SetAttr(_arg2(win_type win, byte attr));
- extern void win_SetShadow(_arg2(win_type win, int shadow));
-
- /* wingo.c */
- extern int win_Go(_arg1(win_type win));
-
- /* winobsc.c */
- extern win_type wmgr_IsObscuredPixBox(_arg4(win_type topwin, win_type win, opbox *winboxp, boolean doshad));
- extern win_type wmgr_PointWin(_arg2(opcoord x, opcoord y));
- extern win_type wmgr_FindBelow(_arg1(win_type win));
-
- /* winexpos.c */
- extern void win_Expose(_arg3(win_type win, int msg, VOID *emsgdata));
- extern void win_ExposePixBox(_arg4(win_type win, opbox *relboxp, int msg, VOID *emsgdata));
-
- /* winpaint.c */
- extern void win_PaintRow(_arg4(win_type win, int row, int col, int length));
- extern void win_PaintCol(_arg4(win_type win, int row, int col, int length));
- extern void win_PaintBox(_arg2(win_type win, ocbox *cboxp));
-
- /* winscrol.c */
- extern void win_ScrollPix(_arg3(win_type win, opcoord nx, opcoord ny));
- extern void win_ScrollPixBox(_arg4(win_type win, opbox* relboxp, opcoord nx, opcoord ny));
- extern void win_ScrollBox(_arg4(win_type win, ocbox *cboxp, int nx, int ny));
-
- /* winclear.c */
- extern void win_Clear(_arg2(win_type win, opixval color));
- extern void win_ClearPixBox(_arg3(win_type win, opbox* relboxp, opixval color));
- extern void win_ClearBox(_arg3(win_type win, ocbox *cboxp, opixval color));
-
- /* wincursor.c */
- extern void win_SetPixCursorPos(_arg3(win_type win, opcoord cursx, opcoord cursy));
- extern void win_SetCursorType(_arg2(win_type win, cursortype ctype));
- extern void win_GetCursorPixBox(_arg2(win_type win, opbox *cursboxp));
- extern boolean win_ShowCursor(_arg1(win_type win));
- extern boolean win_HideCursor(_arg1(win_type win));
-
- /* winsetp.c */
- extern void win_SetPixPosition(_arg3(win_type win, opcoord xpos, opcoord ypos));
- extern void win_ReallySetPixPosition(_arg3(win_type win, opcoord xpos, opcoord ypos));
-
- /* winsize.c */
- extern void win_SetPixSize(_arg3(win_type win, odim width, odim height));
- extern void win_ReallySetPixSize(_arg3(win_type win, odim width, odim height));
-
- /* wingetp.c */
- extern void win_GetPixPosition(_arg2(win_type, opbox *));
- extern void win_GetPosition(_arg2(win_type, ocbox *));
-
- /* wintop.c */
-
- extern boolean win_ReallyPutUnder(_arg2(win_type win, win_type destwin));
- extern boolean win_ReallyUnEmploy(_arg1(win_type));
- extern boolean win_IsAbove(_arg2(win_type, win_type));
-
- /* winclip.c */
- extern unsigned win_clipbox(_arg2(win_type, opbox *));
- extern unsigned win_clippoint(_arg3(win_type, opcoord *, opcoord *));
-
- /* winmouse.c */
- extern unsigned win_ReadEvent(_arg2(win_type win, mev_struct *moueventp));
- extern unsigned win_MouseDblClick(_arg2(win_type win, mev_struct *mev));
- extern unsigned win_MouseHoldDownTime(_arg3(win_type win, mev_struct *mev, unsigned duration));
- extern boolean win_MouseCurrEvent(_arg1(mev_struct *mev));
-
- /* windump.c (debugging aid) */
- extern void win_Dump(_arg1(char *));
- /* -------------------------------------------------------------------------- */
-
-