home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c222 / 1.ddi / SOURCE / CLIB / SC_BOX.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-10  |  1.3 KB  |  72 lines

  1. /*********************
  2.  *
  3.  *  sc_box.c - screen boxing routines.
  4.  *
  5.  *  Purpose: This file contains the functions to draw text boxes
  6.  *           on the screen.
  7.  *
  8.  *  Blackstar C Function Library
  9.  *  (c) Copyright 1985,1989 Sterling Castle Software
  10.  *
  11.  *******/
  12.  
  13. #include "blackstr.h"
  14. #include "sc_head.h"
  15.  
  16.  
  17. /********
  18.  *
  19.  *   sc_vline(col,r1,r2) - display vertical line at col from r1 to r2
  20.  *
  21.  **/
  22.  
  23. void sc_vline(int col, int r1, int r2)
  24. {
  25.     int i;
  26.  
  27.     for(i=r1; i<=r2; ++i) {
  28.     sc_setcur(col,i);
  29.     sc_putc(VL_CHAR);
  30.     }
  31. }
  32.  
  33.  
  34. /********
  35.  *
  36.  *   sc_hline(row,c1,c2) - display horizontal line at row from c1 to c2
  37.  *
  38.  **/
  39.  
  40. void sc_hline(int row, int c1, int c2)
  41. {
  42.     int i;
  43.  
  44.     for (i=c1; i<=c2; ++i) {
  45.     sc_setcur(i,row);
  46.     sc_putc(HL_CHAR);
  47.     }
  48. }
  49.  
  50.  
  51. /********
  52.  *
  53.  *   sc_box(x1,y1,x2,y2) - display a box
  54.  *
  55.  **/
  56.  
  57. void sc_box(int x1, int y1, int x2, int y2)
  58. {
  59.     sc_setcur(x1,y1);           /* Draw corners, then lines of box */
  60.     sc_putc(LT_CHAR);
  61.     sc_hline(y1,x1+1,x2-1);
  62.     sc_setcur(x2,y1);
  63.     sc_putc(RT_CHAR);
  64.     sc_vline(x2,y1+1,y2-1);
  65.     sc_setcur(x1,y2);
  66.     sc_putc(LB_CHAR);
  67.     sc_hline(y2,x1+1,x2-1);
  68.     sc_setcur(x2,y2);
  69.     sc_putc(RB_CHAR);
  70.     sc_vline(x1,y1+1,y2-1);     /* in a clockwise manner */
  71. }
  72.