home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / TVDEMOS.ZIP / FIELDS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.6 KB  |  98 lines

  1. /*-------------------------------------------------------*/
  2. /*                                                       */
  3. /*   Turbo Vision 1.0                                    */
  4. /*   Turbo Vision Forms Demo                             */
  5. /*   Copyright (c) 1991 by Borland International         */
  6. /*                                                       */
  7. /*   Fields.h: Header file for Fields.cpp                */
  8. /*             (Support header file for TVFORMS Demo)    */
  9. /*-------------------------------------------------------*/
  10.  
  11. #if !defined( __FIELDS_H )
  12. #define __FIELDS_H
  13.  
  14. #define Uses_TInputLine
  15. #define Uses_TStreamable
  16. #include <tv.h>
  17.  
  18. // Same as TInputLine, except invalid if empty 
  19.  
  20. class TKeyInputLine : public TInputLine
  21. {
  22.  
  23. public:
  24.  
  25.     TKeyInputLine( const TRect&, int );
  26.     virtual Boolean valid( ushort );
  27.  
  28. protected:
  29.  
  30.     TKeyInputLine( StreamableInit ) : TInputLine( streamableInit ) {};
  31.  
  32. private:
  33.  
  34.     virtual const char *streamableName() const
  35.         { return name; }
  36.  
  37. public:
  38.  
  39.     static const char * const name;
  40.     static TStreamable *build();
  41.      
  42. };
  43.  
  44.  
  45. inline ipstream& operator >> ( ipstream& is, TKeyInputLine& cl )
  46.     { return is >> (TStreamable&)cl; }
  47. inline ipstream& operator >> ( ipstream& is, TKeyInputLine*& cl )
  48.     { return is >> (void *&)cl; }
  49. inline opstream& operator << ( opstream& os, TKeyInputLine& cl )
  50.     { return os << (TStreamable&)cl; }
  51. inline opstream& operator << ( opstream& os, TKeyInputLine* cl )
  52.     { return os << (TStreamable *)cl; }
  53.  
  54.  
  55. // Accepts only valid numeric input between Min and Max
  56.  
  57. class TNumInputLine : public TInputLine
  58. {
  59.  
  60. public:
  61.  
  62.     TNumInputLine( const TRect&, int, long, long );
  63.     virtual ushort dataSize();
  64.     virtual void getData( void *);
  65.     virtual void setData( void *);
  66.     virtual Boolean valid( ushort );
  67.     long min;
  68.     long max;
  69.  
  70. protected:
  71.  
  72.     TNumInputLine( StreamableInit ) : TInputLine( streamableInit ) {};
  73.     virtual void write( opstream& );
  74.     virtual void *read( ipstream& );
  75.  
  76. private:
  77.  
  78.     virtual const char *streamableName() const
  79.         { return name; }
  80.  
  81. public:
  82.  
  83.     static const char * const name;
  84.     static TStreamable *build();
  85.  
  86. };
  87.  
  88. inline ipstream& operator >> ( ipstream& is, TNumInputLine& cl )
  89.     { return is >> (TStreamable&)cl; }
  90. inline ipstream& operator >> ( ipstream& is, TNumInputLine*& cl )
  91.     { return is >> (void *&)cl; }
  92. inline opstream& operator << ( opstream& os, TNumInputLine& cl )
  93.     { return os << (TStreamable&)cl; }
  94. inline opstream& operator << ( opstream& os, TNumInputLine* cl )
  95.     { return os << (TStreamable *)cl; }
  96.  
  97. #endif  // __FIELDS_H
  98.