home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VIOUTL.ZIP / EXPBOX.C < prev    next >
C/C++ Source or Header  |  1989-06-28  |  2KB  |  76 lines

  1. /* ----------------------------------------------------------------------
  2. .context ExpBox
  3. .category VioUtil
  4. void far ExpBox ( BYTE *cb, int x1, int y1, int x2, int y2, char *name )
  5.  
  6. Description: 
  7.      Create a named bounded area on the screen that appears to grow from
  8. a small box to a big one.
  9.  
  10. Parameter     Description
  11. -------------------------------------------------------------------------
  12. cb            a pointer to a two byte character attribute
  13.               that defines the character to fill the
  14.               screen area with.
  15. x1            upper left column of box
  16. y1            upper left row of box
  17. x2            lower right column of box
  18. y2            lower right row of box
  19. name          a pointer to a 0 terminated character string
  20.  
  21. Returns: 
  22.      nothing
  23.  
  24. Comments: 
  25.  
  26. References: 
  27.  
  28. See Also: box, boxerase
  29. .ref box, boxerase
  30.  
  31. Development History: 
  32.   Date         Programmer          Description of modification   
  33.   06/16/1989   Paul Montgomery     Initial development           
  34. -------------------------------------------------------------------- */
  35.  
  36. #define INCL_SUB
  37. #include <os2.h>
  38.  
  39. #include "box.h"
  40.  
  41. #define LEVELS  4
  42.  
  43. void far ExpBox ( BYTE *cb, int x1, int y1, int x2, int y2, char *name )
  44.    {
  45.  
  46.    int i;
  47.    int k;
  48.    int j;
  49.  
  50.  
  51.    // calculate size increments of successive boxes
  52.    // ( width of box ) / ( number of boxes we will draw / 2 )
  53.    // ( height of box ) / ( number of boxes we will draw / 2 )
  54.  
  55.    i = ( x2 - x1 ) / ( LEVELS * 2 );
  56.    k = ( y2 - y1 ) / ( LEVELS * 2 );
  57.  
  58.    // draw LEVELS number of boxes from the inside out
  59.    for ( j = LEVELS ; j > 0 ; j -- )
  60.       {
  61.       box ( cb,
  62.             x1 + ( i * j),
  63.             y1 + ( k * j ),
  64.             x2 - ( i * j),
  65.             y2 - ( k * j ),
  66.             name );
  67.  
  68.       }
  69.  
  70.    // draw final box of proper size
  71.    box ( cb, x1, y1, x2, y2, name );
  72.  
  73.    }
  74.  
  75.  
  76.