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

  1. /************************************************************************
  2. **
  3. ** @(#)tbox.h        06/15/93    Chris Ahlstrom
  4. **
  5. **    C++ version.
  6. **
  7. **    Defines a base class that provides only a couple things:
  8. **
  9. **    1.  A function called "doDialog()", that can read any old
  10. **        MainBox structure (see tv_menu.h), link it with a
  11. **        GenParameters structure, and display it all as a dialog
  12. **        box.
  13. **
  14. **    2.  A "GenParameters" structure pointer; it points to any
  15. **        kind of structure that contains data for a dialog box.
  16. **
  17. *************************************************************************/
  18.  
  19.  
  20. #if !defined(TBOX_h)                    // { TBOX_h
  21. #define TBOX_h
  22.  
  23. #define Uses_TButton
  24. #define Uses_TCheckBoxes
  25. #define Uses_TDeskTop
  26. #define Uses_TDialog
  27. #define Uses_TEvent
  28. #define Uses_TInputLine
  29. #define Uses_TLabel
  30. #define Uses_TPoint
  31. #define Uses_TRadioButtons
  32. #define Uses_TRect
  33. #define Uses_TSItem
  34. #define Uses_TView
  35. #include <tv.h>            // Turbo Vision functionality
  36. #include <string.h>        // ANSI string functions
  37.  
  38. #include "tv_menu.h"        // the C++ version
  39. #include "tinput.h"        // "Variations on TInputLine in C++", Op. 2.01
  40. #include "tinpmous.h"        // "Variations on TInputLine in C++", Op. 3.03
  41.  
  42. #define RADIOBUTTON_PAD    5    // room for the checkmarks
  43. #define SCROLLARROW_PAD    2    // room for TInputLine's scroll-arrows
  44. #define LABEL_PAD    1    // handy padding for the label
  45.  
  46.  
  47. /************************************************************************
  48. ** GenParameters
  49. *************************************************************************/
  50.  
  51. typedef void *GenParameters;
  52.  
  53.  
  54. /************************************************************************
  55. ** TBox
  56. *************************************************************************/
  57.  
  58. class TBox
  59. {
  60.  
  61. public:
  62.  
  63.     TBox                // the full-blown constructor
  64.     (
  65.     TDeskTop *desk,
  66.     ExtendedDescriptor *dmap,
  67.     MappedFieldDescriptor *fMap
  68.     );
  69.     TBox                // constructor without field maps
  70.     (
  71.     TDeskTop *desk,
  72.     ExtendedDescriptor *dmap
  73.     );
  74.     TBox                // constructor without extended maps
  75.     (
  76.     TDeskTop *desk,
  77.     MappedFieldDescriptor *fMap
  78.     );
  79.     TBox                // constructor without any maps
  80.     (
  81.     TDeskTop *desk
  82.     );
  83.     // ~TBox();
  84.  
  85.     Boolean doDialog            // data dialogs
  86.     (
  87.     MainBox *b,            // describes everything about box
  88.     GenParameters p            // points to the data structure
  89.     );
  90.     Boolean mappedDialog
  91.     (
  92.     MappedBox *d,            // nested structure (tv_menu.h)
  93.     GenParameters dialog        // general dialog structure
  94.     );
  95.     TView *makeField
  96.     (
  97.     DataType datatype,        // the exact type of boxy data item
  98.     char **strings,            // pointer to list of button-strings
  99.     TPoint dul,            // upper-left corner of the box
  100.     TPoint dlr,            // lower-right corner of the box
  101.     int maxlength,            // for TInputLine(s)
  102.     Range& code,            // internal range of the units
  103.     char *format,            // format of the display
  104.     int mapped,            // is data mapping to be employed?
  105.     Range& user,            // user-viewable range of the units
  106.     MouseMap& map            // mouse- and arrow-mappings
  107.     );
  108.     TView *makeButtons
  109.     (
  110.     DataType type,            // the type of (we hope) boxy data
  111.     char **list,            // pointer to list of button-strings
  112.     TPoint dul,            // upper-left corner of the box
  113.     TPoint dlr            // lower-right corner of the box
  114.     );
  115.     void buttonsOKCancel
  116.     (
  117.     TDialog *pd,
  118.     TPoint lr
  119.     );
  120.  
  121. private:                // logical functions for types
  122.  
  123.     Boolean isBox
  124.     (
  125.     DataType type
  126.     );
  127.     Boolean isNumeric
  128.     (
  129.     DataType type
  130.     );
  131.     Boolean isString
  132.     (
  133.     DataType type
  134.     );
  135.     Boolean isControl
  136.     (
  137.     DataType type
  138.     );
  139.     Boolean isExtended
  140.     (
  141.     DataType type
  142.     );
  143.  
  144. public:
  145.  
  146.     TDeskTop *tBoxTop;            // indirect access to deskTop
  147.  
  148. private:
  149.  
  150.     int useDataMap;            // quick flag
  151.     int useFieldMap;            // quick flag
  152.     ExtendedDescriptor *dataMap;    // access to special types
  153.     MappedFieldDescriptor *fieldMap;    // access to special types
  154.  
  155. };
  156.  
  157. #endif                            // } TBOX_h
  158.  
  159.