home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / WINCLEAR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-28  |  1.8 KB  |  80 lines

  1. /*
  2.     winclear.c    10/30/88
  3.  
  4.     % functions that Clear a window on the display.
  5.  
  6.     Consolidated from other files.
  7.  
  8.     OWL 1.2
  9.     Copyright (c) 1988, by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14.      5/01/89 ted    Took out tcol relics.
  15.  
  16.      1/17/90 ted    Added shademsg args to _Expose functions.
  17.      3/28/90 jmd    ansi-fied
  18. */
  19.  
  20. #include "oakhead.h"
  21. #include "disppriv.h"
  22. /* -------------------------------------------------------------------------- */
  23.  
  24. /*    Clears all unobscured parts of win. */
  25. void win_Clear(win_type win, opixval color)
  26. {
  27.     boolean wasshown;
  28.  
  29.     disp_Cache();
  30.     wasshown = win_HideCursor(win);
  31.  
  32.     win_Expose(win, WINM_CLEAR, (VOID *) &color, WINM_SHADOW, NULL);
  33.  
  34.     if (wasshown) win_ShowCursor(win);
  35.     disp_Flush();
  36. }
  37. /* -------------------------------------------------------------------------- */
  38.  
  39. void win_ClearPixBox(win_type win, opbox *boxp, opixval color)
  40. /*    Clears all unobscured parts of win in relbox. */
  41. {
  42.     boolean cursin;
  43.     opbox cursbox;
  44.     boolean wasshown;
  45.  
  46.     win_GetCursorPixBox(win, &cursbox);
  47.     cursin = (opbox_clipbox(boxp, &cursbox) != 0);
  48.  
  49.     if (cursin) {
  50.         disp_Cache();
  51.         wasshown = win_HideCursor(win);
  52.     }
  53.     win_ExposePixBox(win, boxp, WINM_CLEAR, (VOID *) &color, WINM_SHADOW, NULL);
  54.  
  55.     if (cursin) {
  56.         if (wasshown) win_ShowCursor(win);
  57.         disp_Flush();
  58.     }
  59. }
  60. /* -------------------------------------------------------------------------- */
  61.  
  62. void win_ClearBox(win_type win, ocbox *cboxp, opixval color)
  63. /*
  64.     'cboxp'     Clipping coords relative to win
  65. */ 
  66. {
  67.     opbox box;        /* display coords */
  68.  
  69.     if (win == NULL) return;
  70.  
  71.     ocbox_pixcoords(cboxp, win_GetFont(win), &box);
  72.  
  73.     /* Quit if box is not in window */
  74.     if (!win_clipbox(win, &box)) return;
  75.  
  76.     win_ClearPixBox(win, &box, color);
  77. }
  78. /* -------------------------------------------------------------------------- */
  79.  
  80.