home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / FACETV.ZIP / BOXTOOLS.H < prev    next >
C/C++ Source or Header  |  1993-12-09  |  5KB  |  137 lines

  1. /************************************************************************
  2. **
  3. ** @(#)boxtools.h    06/03/93    Chris Ahlstrom
  4. **
  5. **    C++ version
  6. **
  7. **    Help support for banner-presentations and error-message displays.
  8. **
  9. *************************************************************************/
  10.  
  11. #if !defined(BOXTOOLS_h)                // { BOXTOOLS_h
  12. #define BOXTOOLS_h
  13.  
  14. #define Uses_TDeskTop
  15. #define Uses_TDialog
  16. #define Uses_TLabel
  17. #define Uses_TPoint
  18. #define Uses_TRect
  19. #define Uses_TView
  20. #include <tv.h>            // Turbo Vision functionality
  21. #include <util.h>        // Turbo Vision utility functions
  22.  
  23. #include <dos.h>
  24. #include <ctype.h>
  25. #include <stdio.h>
  26. #include <string.h>
  27.  
  28.  
  29. /************************************************************************
  30. ** Handy dandy #defines for annunciation and other routines!
  31. *************************************************************************/
  32.  
  33. #define SCROLL_END      0x00FFu    // marks end of the viewbox
  34. #define SCROLL_END_CHAR     "\xFF"        // handy for readability
  35.  
  36. #define STRINGMAX      512        // largest strings we'll allow
  37. #define SCREENWIDTH       80        // too bad it's hardwired
  38. #define SCREENHEIGHT    (25-2)        // ditto
  39.  
  40. #define OK_SIZE    9            // size of each OK/Cancel bar
  41. #define OK_SPACE   4            // distance between each bar
  42. #define OK_THICK   2            // thickness of the bars
  43. #define OK_LENGTH 2*(OK_SIZE+OK_SPACE)    // total length of OK/Cancel bars
  44. #define OK_BOTTOM  1            // distance of bar from bottom
  45. #define OK_ADJUST  5            // another magic number
  46.  
  47. #define BOX_WIDTH   16            // width of the annunciator box
  48. #define BOX_HEIGHT   5            // height of the annunciator box
  49. #define BOX_TOP      2            // desired spacing around value
  50. #define BOX_BOTTOM   1            // distance of bar from bottom
  51. #define BOX_MARGIN   2            // desired spacing around value
  52. #define BOX_EXCESS   2            // padding for enhanced viewability
  53. #define VAL_WIDTH (BOX_WIDTH-2*BOX_MARGIN-1)    // allowable width
  54. #define VAL_MIN      -99999.0        // desultory checkpoint
  55. #define VAL_MAX       99999.0        // desultory checkpoint
  56. #define VAL_FLOAT "%8.3f"        // desultory format string
  57. #define VAL_INT   "%6d"            // desultory format string
  58.  
  59. #define MAX_HEIGHT    (SCREENHEIGHT - BOX_TOP - OK_THICK - OK_BOTTOM)
  60. #define MAX_WIDTH    (SCREENWIDTH - 2 * BOX_MARGIN)
  61.  
  62.  
  63. /************************************************************************
  64. ** Handy dandy dialog box functions for annunciation!
  65. *************************************************************************/
  66.  
  67. extern TPoint banner_size    // calculates the 2-D size of a string
  68. (
  69.     char *message,        // the text string
  70.     int xpadding = 0,        // optional padding to add to width
  71.     int ypadding = 0        // optional padding to add to height
  72. );
  73. extern TPoint banner_list_size    // calculate 2-D size of a string-array
  74. (
  75.     char *string[],        // the array of strings
  76.     int xpadding = 0,        // optional padding to add to width
  77.     int ypadding = 0        // optional padding to add to height
  78. );
  79. extern TRect banner_spec    // calculates size and central location
  80. (
  81.     TPoint textbox        // dimensions of the text string
  82. );
  83. extern TRect banner_OK        // calculates location of an OK button
  84. (
  85.     TRect banner        // dimensions of the dialog box
  86. );
  87. extern TRect banner_OK_Cancel    // calculates location of OK with Cancel
  88. (
  89.     TRect banner        // dimensions of the dialog box
  90. );
  91. extern TRect banner_Cancel    // calculates location of Cancel button
  92. (
  93.     TRect banner        // dimensions of the dialog box
  94. );
  95. extern TDialog *flashHandler    // displays a string very quickly in a box
  96. (
  97.     TDeskTop *desktop,        // where to display the box
  98.     int location_x,        // the desired row to display it at
  99.     int location_y,        // the desired column to display it at
  100.     char *message,        // the pre-formatted string to display
  101.     char *label            // a short label for the dialog box
  102. );
  103. extern TDialog *closeBox    // removes a "Box" from the desktop
  104. (
  105.     TDialog *pd,        // pointer to the dialog
  106.     unsigned delay_ms        // optional delay in milliseconds
  107. );
  108. extern TDialog *intBox        // displays an integer on the desktop
  109. (
  110.     TDeskTop *desktop,        // where to display the box
  111.     int location_x,        // the desired row to display it at
  112.     int location_y,        // the desired column to display it at
  113.     char *string,        // a short label for the dialog box
  114.     int value            // the value to display
  115. );
  116. extern TDialog *floatBox    // displays a double on the desktop
  117. (
  118.     TDeskTop *desktop,        // where to display the box
  119.     int location_x,        // the desired row to display it at
  120.     int location_y,        // the desired column to display it at
  121.     char *string,        // a short label for the dialog box
  122.     double value        // the value to display
  123. );
  124. extern TDialog *stringBox    // displays a string on the desktop
  125. (
  126.     TDeskTop *desktop,        // where to display the box
  127.     int location_x,        // the desired row to display it at
  128.     int location_y,        // the desired column to display it at
  129.     char *string,        // a short label for the dialog box
  130.     char *value            // the string value to display
  131. );
  132.  
  133.  
  134.  
  135.  
  136. #endif                            // } BOXTOOLS_h
  137.