home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / WINPROTO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  12.2 KB  |  289 lines

  1. /*
  2.     winproto.h
  3.  
  4.     % definitions for windows
  5.  
  6.     1/20/88    by Ted
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1988, 1989 by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      8/13/88 jmd    Changed win_GetAttr and win_SetAttr
  15.      8/15/88 jmd    added winopen_struct (later removed)
  16.      2/12/88 ted    Fixed up mouse support for new current window cases
  17.  
  18.      3/20/89 ted    Made everything refer to static curr_dmgr / curr_wmgr
  19.      3/24/89 ted    Made windows pure objects; shook everything up.
  20.      3/24/89 ted    Changed order of args to win_Open and win_PixOpen.
  21.      3/29/89 ted    Extracted winpriv.h.
  22.      3/31/89 ted    Added wmgr_PointWin.
  23.      4/21/89 ted    Renamed xd elements box and border to wbox and bord for Unix.
  24.      5/28/89 jmd    added Shadow support
  25.      6/26/89 ted    Added macros for fromwin, nextwin, mousecode.
  26.      7/08/89 gam    Changed NULL to FNULL where necessary
  27.      7/10/89 ted    Moved nextwin to window structure from wmgr.
  28.      7/25/89 ted    Added explode function.
  29.      8/08/89 jmd    Added win_Really funcs.
  30.      8/16/89 ted    Added mev_IsFake macro.
  31.      8/23/89 ted    Added disp_Get/Set[Shadow]Attr macros.
  32. */
  33.  
  34. /* -------------------------------------------------------------------------- */
  35. /* Macros */
  36. #define    win_Close(win)                obj_Close(win)
  37.  
  38. #define win_getxd(win)                ((win_xd *) obj_getxd(win))
  39.  
  40. #define win_GetParent(win)            bob_GetParent(win)
  41. #define win_IsParentClip(win)        bob_IsDepend(win)
  42.  
  43. #define win_SetParent(win, parnt)    bob_SetParent(win, parnt)
  44. #define win_SetParentClip(win, c)      bob_SetDepend(win, c)
  45.  
  46. #define win_IsEmployed(win)            ((boolean) win_getxd(win)->employed)
  47. #define win_GetAbove(win)            (win_getxd(win)->above)
  48. #define win_GetBelow(win)            (win_getxd(win)->below)
  49.  
  50. #define win_pixboxp(win)            (&win_getxd(win)->wbox)
  51. #define win_inboxp(win)                (&win_getxd(win)->inbox)
  52. #define win_border(win)                (win_getxd(win)->bord)
  53.  
  54. #define win_GetFont(win)            (win_getxd(win)->font)
  55. #define win_GetAttr(win)            (win_getxd(win)->attribute)
  56. #define win_GetCursx(win)            (win_getxd(win)->cursx)
  57. #define win_GetCursy(win)            (win_getxd(win)->cursy)
  58. #define win_GetCursorType(win)        (win_getxd(win)->curstype)
  59. #define win_GetNullfont(win)        ((boolean) win_getxd(win)->nullfont)
  60.  
  61. #define win_GetShadowAttr(win)        (win_getxd(win)->shadowattr)
  62. #define win_SetShadowAttr(win, a)     (win_getxd(win)->shadowattr = (a))
  63.  
  64. #define win_GetShadowX(win)            (win_getxd(win)->shadowx)
  65. #define win_SetShadowX(win,x)        (win_getxd(win)->shadowx = (x))
  66. #define win_GetShadowY(win)            (win_getxd(win)->shadowy)
  67. #define win_SetShadowY(win,y)        (win_getxd(win)->shadowy = (y))
  68. #define win_SetPixShadow(win, x ,y)    (win_SetShadowX(win, x), win_SetShadowY(win, y))
  69.  
  70. #define win_SetMouse(win, mh)        (win_getxd(win)->mouhandler = (mh))
  71. #define win_GetMouhandler(win)        (win_getxd(win)->mouhandler)
  72. #define win_MouseOk(win)            (win_getxd(win)->mouhandler != FNULL)
  73. #define win_GetDebounced(win)        ((boolean) win_getxd(win)->debounced)
  74. #define win_SetDebounced(win, db)    (win_getxd(win)->debounced = (unsigned)(db))
  75. #define win_SetNextWin(win, nwin)    (win_getxd(win)->nextwin = (nwin))
  76.  
  77. #define win_SetExplode(win, ex)        (win_getxd(win)->explode = (ex))
  78. #define win_GetExplodeFptr(win)        (win_getxd(win)->explode)
  79.  
  80. #define win_IsCharSize(win)            ((boolean) win_getxd(win)->charsize)
  81. #define win_SetCharSize(win, cs)    (win_getxd(win)->charsize = (unsigned)(cs))
  82. #define win_GetResize(win)            ((boolean) win_getxd(win)->resize)
  83. #define win_SetResize(win, rs)        (win_getxd(win)->charsize = (unsigned)(rs))
  84. /* -------------------------------------------------------------------------- */
  85. #define win_Ok(win)                                    \
  86.     (((win) == NULL) ? FALSE : (win_getxd(win)->idmgr == curr_dmgr->id))
  87.  
  88. #define win_GetBorderFunc(win)                        \
  89.     ((win_border(win) == NULL) ? FNULL : win_border(win)->dispatch)
  90.  
  91. #define win_GetXmin(win)            (win_pixboxp(win)->xmin + win_inboxp(win)->xmin)
  92. #define win_GetYmin(win)            (win_pixboxp(win)->ymin + win_inboxp(win)->ymin)
  93. #define win_GetXmax(win)            (win_pixboxp(win)->xmin + win_inboxp(win)->xmax)
  94. #define win_GetYmax(win)            (win_pixboxp(win)->ymin + win_inboxp(win)->ymax)
  95.  
  96. #define win_GetBgColor(win)            disp_GetAttrBgColor(win_GetAttr(win))
  97. #define win_GetFgColor(win)            disp_GetAttrFgColor(win_GetAttr(win))
  98. #define win_GetPixCursorPos(win, cxp, cyp)            \
  99.     (*(cxp) = win_GetCursx(win), *(cyp) = win_GetCursy(win))
  100.  
  101. #define win_SetFont(win, font)        ((boolean) win_Do(win, WINM_SETFONT, font, NULL))
  102. #define win_GetFontWidth(win)        ofont_GetWidth(win_GetFont(win))
  103. #define win_GetFontHeight(win)        ofont_GetHeight(win_GetFont(win))
  104.  
  105. #define win_CheckEventWait(win, wt)    hard_CheckEvent(wt)
  106. #define win_CheckEvent(win)            hard_CheckEvent(0)
  107.  
  108. #define win_MouseHoldDown(win, mev)                    \
  109.     win_MouseHoldDownTime(win, mev,    disp_MouseTimeout())
  110.  
  111. #define win_MouseReleaseWait(win, mev)                    \
  112.     win_MouseHoldDownTime(win, mev, (unsigned)-1)
  113.  
  114. /* -------------------------------------------------------------------------- */
  115. #define win_GetPixWidth(win)        ((opcoord)opbox_GetWidth(win_inboxp(win)))
  116. #define win_GetPixHeight(win)        ((opcoord)opbox_GetHeight(win_inboxp(win)))
  117.  
  118. #define win_GetPixBox(win, boxp)                    \
  119.     ((boxp)->xmin = 0, (boxp)->ymin = 0,            \
  120.      (boxp)->xmax = win_GetPixWidth(win), (boxp)->ymax = win_GetPixHeight(win))
  121.  
  122. /*    Paints all unobscured parts of win in relbox. */
  123. #define win_PaintPixBox(win, relboxp) win_ExposePixBox(win, relboxp, WINM_PAINT, NULL)
  124.  
  125. /*    Paints all unobscured parts of win. */
  126. #define    win_Paint(win)                win_Expose(win, WINM_PAINT, NULL)
  127.  
  128. /*    Saves all unobscured parts of win in relbox. */
  129. #define win_SavePixBox(win, relboxp)  win_ExposePixBox(win, relboxp, WINM_SAVE, NULL)
  130.  
  131. /*    Saves all unobscured parts of win. */
  132. #define    win_Save(win)                win_Expose(win, WINM_SAVE, NULL)
  133.  
  134. #define win_Employ(win)                win_PutUnder(win, curr_wmgr->bot_sys_win)
  135.  
  136. #define win_UnEmploy(win)            win_Do(win, WINM_UNEMPLOY, NULL, NULL)
  137.  
  138. #define win_Top(win)                win_Do(win, WINM_PUTUNDER, NULL, NULL)
  139. #define win_PutUnder(win, dest)        win_Do(win, WINM_PUTUNDER, dest, NULL)
  140.  
  141. /* Character-grid coordinate window macros */
  142. #define win_GetLeftCol(win)                            \
  143.     opcoord_GetXCol(win_GetXmin(win), win_GetFont(win))
  144.  
  145. #define win_GetTopRow(win)                            \
  146.     opcoord_GetYRow(win_GetYmin(win), win_GetFont(win))
  147.  
  148. #define win_GetRightCol(win)                        \
  149.     (opcoord_GetXCol(win_GetXmax(win), win_GetFont(win)) - 1)
  150.  
  151. #define win_GetBotRow(win)                            \
  152.     (opcoord_GetYRow(win_GetYmax(win), win_GetFont(win)) - 1)
  153.  
  154. #define win_GetWidth(win)                            \
  155.     ((int)(win_GetPixWidth(win) / win_GetFontWidth(win)))
  156.  
  157. #define win_GetHeight(win)                            \
  158.     ((int)(win_GetPixHeight(win) / win_GetFontHeight(win)))
  159.  
  160. #define win_Scroll(win, nrows, ncols)                \
  161.     win_ScrollPix(win, (ncols)*win_GetFontWidth(win), \
  162.                         (nrows)*win_GetFontHeight(win))
  163.  
  164. #define win_SetPosition(win, row, col)                \
  165.     win_SetPixPosition(win, (col)*win_GetFontWidth(win), \
  166.                             (row)*win_GetFontHeight(win))
  167.  
  168. #define win_GetBox(win, cboxp)                        \
  169.     ((cboxp)->toprow = 0, (cboxp)->leftcol = 0,        \
  170.      (cboxp)->botrow = win_GetHeight(win) - 1,        \
  171.      (cboxp)->rightcol = win_GetWidth(win) - 1)
  172.  
  173. #define win_GetCursorPos(win, rowp, colp)            \
  174.     (*(colp) = opcoord_GetXCol(win_GetCursx(win), win_GetFont(win)), \
  175.      *(rowp) = opcoord_GetYRow(win_GetCursy(win), win_GetFont(win)) - 1)
  176.  
  177. #define win_SetCursorPos(win, row, col)                \
  178.     win_SetPixCursorPos(win, (col) * win_GetFontWidth(win), \
  179.                             ((row+1)) * win_GetFontHeight(win))
  180.  
  181. #define win_SetSize(win, rows, cols)                \
  182.     win_SetPixSize(win, (cols) * win_GetFontWidth(win), \
  183.                         (rows) * win_GetFontHeight(win))
  184.  
  185. #define win_PaintChar(win, row, col)    win_PaintRow(win, row, col, 1)
  186.  
  187.  
  188. /* -------------------------------------------------------------------------- */
  189. /* *** wmgr_ funcs renamed to win_ for public consumption *** */
  190.  
  191. #define win_IsObscured(win)                            \
  192.     (wmgr_IsObscuredPixBox(curr_wmgr->bot_sys_win, win, win_pixboxp(win), TRUE) != NULL)
  193. /* -------------------------------------------------------------------------- */
  194. /* *** wmgr_ funcs renamed to disp_ for public consumption *** */
  195.  
  196. #define disp_GetBackWin()            (curr_wmgr->backwin)
  197. #define disp_GetBotWin()            (curr_wmgr->bot_employed_win)
  198. #define disp_GetCurrentWin()        (curr_wmgr->currwin)
  199. #define disp_GetDispWin()            (curr_wmgr->dispwin)
  200. #define disp_GetAttr()                win_GetAttr(disp_GetDispWin())
  201. #define disp_SetAttr(at)            win_SetAttr(disp_GetDispWin(), at)
  202. #define disp_GetShadowAttr()        win_GetShadowAttr(disp_GetDispWin())
  203. #define disp_SetShadowAttr(at)        win_SetShadowAttr(disp_GetDispWin(), at)
  204. #define disp_TrapMouse(win)            (curr_wmgr->trapmousewin = (win))
  205. #define disp_TrapMouseOff()            (curr_wmgr->trapmousewin = NULL)
  206. #define disp_GetFromWin()            (curr_wmgr->fromwin)
  207. #define disp_SetMouseCode(mcode)    (curr_wmgr->mousecode = (mcode))
  208. #define cls()                        disp_Clear(win_GetBgColor(disp_GetDispWin()))
  209. /* -------------------------------------------------------------------------- */
  210. /* *** wmgr_ funcs renamed to kb_ for public consumption *** */
  211.  
  212. #define kb_WasMouse()                ((boolean) curr_wmgr->wasmouse)
  213. #define mev_IsFake()                ((boolean) curr_wmgr->fakemouse)
  214. /* -------------------------------------------------------------------------- */
  215. /* Function prototypes */
  216.  
  217. /* winopen.c */
  218. extern win_type    win_Open(_arg2(class_fptr winclass, ocbox *cboxp));
  219. extern win_type    win_PixOpen(_arg3(class_fptr winclass, opbox *boxp, ofont_type font));
  220. extern void     win_SetAttr(_arg2(win_type win, byte attr));
  221. extern void     win_SetShadow(_arg2(win_type win, int shadow));
  222.  
  223. /* wingo.c */
  224. extern int        win_Go(_arg1(win_type win));
  225.  
  226. /* winobsc.c */
  227. extern win_type    wmgr_IsObscuredPixBox(_arg4(win_type topwin, win_type win, opbox *winboxp, boolean doshad));
  228. extern win_type wmgr_PointWin(_arg2(opcoord x, opcoord y));
  229. extern win_type wmgr_FindBelow(_arg1(win_type win));
  230.  
  231. /* winexpos.c */
  232. extern void        win_Expose(_arg3(win_type win, int msg, VOID *emsgdata));
  233. extern void        win_ExposePixBox(_arg4(win_type win, opbox *relboxp, int msg, VOID *emsgdata));
  234.  
  235. /* winpaint.c */
  236. extern void        win_PaintRow(_arg4(win_type win, int row, int col, int length));
  237. extern void        win_PaintCol(_arg4(win_type win, int row, int col, int length));
  238. extern void        win_PaintBox(_arg2(win_type win, ocbox *cboxp));
  239.  
  240. /* winscrol.c */
  241. extern void        win_ScrollPix(_arg3(win_type win, opcoord nx, opcoord ny));
  242. extern void        win_ScrollPixBox(_arg4(win_type win, opbox* relboxp, opcoord nx, opcoord ny));
  243. extern void        win_ScrollBox(_arg4(win_type win, ocbox *cboxp, int nx, int ny));
  244.  
  245. /* winclear.c */
  246. extern void        win_Clear(_arg2(win_type win, opixval color));
  247. extern void        win_ClearPixBox(_arg3(win_type win, opbox* relboxp, opixval color));
  248. extern void        win_ClearBox(_arg3(win_type win, ocbox *cboxp, opixval color));
  249.  
  250. /* wincursor.c */
  251. extern void        win_SetPixCursorPos(_arg3(win_type win, opcoord cursx, opcoord cursy));
  252. extern void        win_SetCursorType(_arg2(win_type win, cursortype ctype));
  253. extern void        win_GetCursorPixBox(_arg2(win_type win, opbox *cursboxp));
  254. extern boolean    win_ShowCursor(_arg1(win_type win));
  255. extern boolean    win_HideCursor(_arg1(win_type win));
  256.  
  257. /* winsetp.c */
  258. extern void        win_SetPixPosition(_arg3(win_type win, opcoord xpos, opcoord ypos));
  259. extern void        win_ReallySetPixPosition(_arg3(win_type win, opcoord xpos, opcoord ypos));
  260.  
  261. /* winsize.c */
  262. extern void        win_SetPixSize(_arg3(win_type win, odim width, odim height));
  263. extern void        win_ReallySetPixSize(_arg3(win_type win, odim width, odim height));
  264.  
  265. /* wingetp.c */
  266. extern void        win_GetPixPosition(_arg2(win_type, opbox *));
  267. extern void        win_GetPosition(_arg2(win_type, ocbox *));
  268.  
  269. /* wintop.c */
  270.  
  271. extern boolean    win_ReallyPutUnder(_arg2(win_type win, win_type destwin));
  272. extern boolean    win_ReallyUnEmploy(_arg1(win_type));
  273. extern boolean    win_IsAbove(_arg2(win_type, win_type));
  274.  
  275. /* winclip.c */
  276. extern unsigned    win_clipbox(_arg2(win_type, opbox *));
  277. extern unsigned    win_clippoint(_arg3(win_type, opcoord *, opcoord *));
  278.  
  279. /* winmouse.c */
  280. extern unsigned    win_ReadEvent(_arg2(win_type win, mev_struct *moueventp));
  281. extern unsigned    win_MouseDblClick(_arg2(win_type win, mev_struct *mev));
  282. extern unsigned    win_MouseHoldDownTime(_arg3(win_type win, mev_struct *mev, unsigned duration));
  283. extern boolean    win_MouseCurrEvent(_arg1(mev_struct *mev));
  284.  
  285. /* windump.c (debugging aid) */
  286. extern void        win_Dump(_arg1(char *));
  287. /* -------------------------------------------------------------------------- */
  288.  
  289.