home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 5.ddi / C / WNPUTBOR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  2.0 KB  |  71 lines

  1. /**
  2. *
  3. * Name        wnputbor -- Display a border surrounding a rectangular
  4. *                region.
  5. *
  6. * Synopsis    result = wnputbor(pdim,pborder,pwhere);
  7. *
  8. *        int    result      0 if the border is actually written,
  9. *                  1 if not.
  10. *        DIM    *pdim      Pointer to DIM structure denoting
  11. *                  dimensions of rectangle to surround.
  12. *        WHERE  *pwhere      Pointer to WHERE structure denoting
  13. *                  display device, page, and location of
  14. *                  upper left corner of rectangular region.
  15. *        BORDER *pbord      Pointer to BORDER structure denoting
  16. *                  type of border to put around rectangle.
  17. *
  18. * Description    This function tries to display a border around a
  19. *        rectangular region on a given video device and display
  20. *        page.
  21. *
  22. *        The device and display page are made current (selected
  23. *        for I/O).
  24. *
  25. *        If the display device or page or the dimensions of the
  26. *        rectangle are illegal, no border is actually displayed
  27. *        and 1 is returned as the value of the function.
  28. *
  29. * Results    result          0 if the border is actually written,
  30. *                  1 if not.
  31. *        b_device      Current display device.
  32. *        b_curpage      Current display page.
  33. *
  34. * Version    3.0  (C)Copyright Blaise Computing Inc. 1986
  35. *
  36. **/
  37.  
  38. #include <bwindow.h>
  39.  
  40. int wnputbor(pdim,pborder,pwhere)
  41. DIM    *pdim;
  42. BORDER *pborder;
  43. WHERE  *pwhere;
  44. {
  45.     int old_npage;
  46.     int bottom_row,right_column;
  47.     int mode,columns,act_page;
  48.  
  49.     if (wnseldev(pwhere,pdim,&old_npage))
  50.     return 1;
  51.  
  52.     bottom_row     = pwhere->corner.row + pdim->h;
  53.     right_column = pwhere->corner.col + pdim->w;
  54.  
  55.     if (pborder->type == 0
  56.     || pwhere->corner.row <= 0
  57.     || pwhere->corner.col <= 0
  58.     || bottom_row          >= scrows()
  59.     || (scmode(&mode,&columns,&act_page),
  60.         (right_column     >= columns)))
  61.     return 1;          /* No border actually written.          */
  62.  
  63.     return scbox(pwhere->corner.row - 1,
  64.          pwhere->corner.col - 1,
  65.          bottom_row,
  66.          right_column,
  67.          ((pborder->type == -1) ? -1 : pborder->type - 1),
  68.          pborder->ch,
  69.          pborder->attr);
  70. }
  71.