home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / FACETV.ZIP / DLG_BOX.H < prev    next >
C/C++ Source or Header  |  1994-01-04  |  4KB  |  152 lines

  1. /************************************************************************
  2. **
  3. ** @(#)dlg_box.h    11/09/93    Chris Ahlstrom
  4. **
  5. **    C++
  6. **
  7. **    Declares the DialogBox class.  See dlg_box.cpp for full details.
  8. **
  9. *************************************************************************/
  10.  
  11. #if !defined(DLG_BOX_h)                    // { DLG_BOX_h
  12. #define DLG_BOX_h
  13.  
  14. #if defined(_Windows)                    // { _Windows
  15.  
  16. #include "win_box.h"    // Windows class support
  17.  
  18. #else                            // }{ _Windows
  19.  
  20. #include "tv_box.h"    // Turbo Vision class support
  21.  
  22. #endif                            // } _Windows
  23.  
  24.  
  25. //#include <stdio.h>
  26. //#include <string.h>    // ANSI string functions
  27.  
  28. #include "tv_menu.h"    // the C++ version
  29. #include "tinpmous.h"    // "Variations on TInputLine in C++", Op. 3.03
  30.  
  31.  
  32. /************************************************************************
  33. ** GeneralDialogData
  34. *************************************************************************/
  35.  
  36. typedef void *GeneralDialogData;
  37.  
  38.  
  39. /************************************************************************
  40. ** DialogBox
  41. *************************************************************************/
  42.  
  43. class DialogBox
  44. {
  45.  
  46. public:
  47.  
  48.     DialogBox                // the full-blown constructor
  49.     (
  50.     MainBox *dialogwindow,        // nested structure (tv_menu.h)
  51.     GeneralDialogData dialog,    // pointer to general dialog structure
  52.     int size,            // number of bytes in the data
  53.     DeskTop *desk,            // pointer to main display
  54.     ExtendedDescriptor *dmap = NULL,    // special extensions
  55.     MappedFieldDescriptor *fMap = NULL    // whole new idea
  56.     );
  57.     DialogBox                // constructor without extended maps
  58.     (
  59.     MainBox *dialogwindow,        // nested structure (tv_menu.h)
  60.     GeneralDialogData dialog,    // pointer to general dialog structure
  61.     int size,            // number of bytes in the data
  62.     DeskTop *desk,
  63.     MappedFieldDescriptor *fMap
  64.     );
  65.     virtual ~DialogBox();
  66.  
  67. public:                    // more public interface functions
  68.  
  69.     Boolean doDialog (void);        // data dialogs
  70.     Boolean mappedDialog (void);    // special data dialogs
  71.     int write
  72.     (
  73.     FILE *fptr
  74.     );
  75.     int read
  76.     (
  77.     FILE *fptr
  78.     );
  79.  
  80. protected:                // internal functions
  81.  
  82.     TView *makeField
  83.     (
  84.     DataType datatype,        // the exact type of boxy data item
  85.     char **strings,            // pointer to list of button-strings
  86.     TPoint dul,            // upper-left corner of the box
  87.     TPoint dlr,            // lower-right corner of the box
  88.     int maxlength,            // for TInputLine(s)
  89.     Range& code,            // internal range of the units
  90.     char *format,            // format of the display
  91.     int mapped,            // is data mapping to be employed?
  92.     Range& user,            // user-viewable range of the units
  93.     MouseMap& map            // mouse- and arrow-mappings
  94.     );
  95.     TView *makeButtons
  96.     (
  97.     DataType type,            // the type of (we hope) boxy data
  98.     char **list,            // 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.     );
  102.     void buttonsOKCancel
  103.     (
  104.     TDialog *pd,
  105.     TPoint lr
  106.     );
  107.  
  108. private:                // logical functions for types
  109.  
  110.     Boolean isBox
  111.     (
  112.     DataType type
  113.     );
  114.     Boolean isNumeric
  115.     (
  116.     DataType type
  117.     );
  118.     Boolean isString
  119.     (
  120.     DataType type
  121.     );
  122.     Boolean isControl
  123.     (
  124.     DataType type
  125.     );
  126.     Boolean isExtended
  127.     (
  128.     DataType type
  129.     );
  130.  
  131. private:
  132.  
  133.     DeskTop *boxTop;            // indirect access to deskTop
  134.  
  135. private:
  136.  
  137.     int useDataMap;            // quick flag
  138.     int useFieldMap;            // quick flag
  139.     ExtendedDescriptor *dataMap;    // access to special types
  140.     MappedFieldDescriptor *fieldMap;    // access to special types
  141.  
  142.     int dataSize;            // size of the structure
  143.  
  144.     MainBox *dialogWindow;        // nested structure (tv_menu.h)
  145.     MappedBox *mappedWindow;        // nested structure (tv_menu.h)
  146.     GeneralDialogData dialogData;    // pointer to general dialog structure
  147.  
  148. };
  149.  
  150. #endif                            // } DLG_BOX_h
  151.  
  152.