home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tv20cpp.zip / demos / ascii.h < prev    next >
C/C++ Source or Header  |  1998-01-19  |  3KB  |  140 lines

  1. /*-------------------------------------------------------*/
  2. /*                                                       */
  3. /*   Ascii.h: Header file for Ascii.cpp                  */
  4. /*                                                       */
  5. /*-------------------------------------------------------*/
  6. /*
  7.  *      Turbo Vision - Version 2.0
  8.  *
  9.  *      Copyright (c) 1994 by Borland International
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. #if !defined( __ASCII_H )
  15. #define __ASCII_H
  16.  
  17. const int cmAsciiTableCmdBase = 910;
  18. const int cmCharFocused       =   0;
  19.  
  20.  
  21. class TTable : public TView
  22. {
  23.  
  24. public:
  25.  
  26.     TTable( TRect& r );
  27.     TTable( StreamableInit ) : TView(streamableInit) { };
  28.     virtual void draw();
  29.     virtual void handleEvent( TEvent& event );
  30.     void charFocused();
  31.  
  32. private:
  33.  
  34.     virtual const char *streamableName() const
  35.         { return name; }
  36.  
  37. protected:
  38.  
  39.     virtual void write( opstream& );
  40.     virtual void *read( ipstream& );
  41.  
  42. public:
  43.  
  44.     static const char * const name;
  45.     static TStreamable *build();
  46.  
  47. };
  48.  
  49.  
  50. inline ipstream& operator >> ( ipstream& is, TTable& cl )
  51.     { return is >> (TStreamable&) cl; }
  52. inline ipstream& operator >> ( ipstream& is, TTable*& cl )
  53.     { return is >> (void *&) cl; }
  54.  
  55. inline opstream& operator << ( opstream& os, TTable& cl )
  56.     { return os << (TStreamable&) cl; }
  57. inline opstream& operator << ( opstream& os, TTable* cl )
  58.     { return os << (TStreamable *) cl; }
  59.  
  60.  
  61. class TReport : public TView
  62. {
  63.  
  64. public:
  65.  
  66.     TReport( TRect& r );
  67.     TReport( StreamableInit ) : TView(streamableInit) { };
  68.     virtual void draw();
  69.     virtual void handleEvent( TEvent& event );
  70.  
  71. private:
  72.  
  73.     long asciiChar;
  74.  
  75.     virtual const char *streamableName() const
  76.          { return name; }
  77.  
  78. protected:
  79.  
  80.     virtual void write( opstream& );
  81.     virtual void *read( ipstream& );
  82.  
  83. public:
  84.  
  85.     static const char * const name;
  86.     static TStreamable *build();
  87.  
  88. };
  89.  
  90. inline ipstream& operator >> ( ipstream& is, TReport& cl )
  91.     { return is >> (TStreamable&) cl; }
  92. inline ipstream& operator >> ( ipstream& is, TReport*& cl )
  93.     { return is >> (void *&) cl; }
  94.  
  95. inline opstream& operator << ( opstream& os, TReport& cl )
  96.     { return os << (TStreamable&) cl; }
  97. inline opstream& operator << ( opstream& os, TReport* cl )
  98.     { return os << (TStreamable *) cl; }
  99.  
  100.  
  101. class TAsciiChart : public TWindow
  102. {
  103.  
  104. public:
  105.  
  106.     TAsciiChart();
  107.     TAsciiChart( StreamableInit ) : TWindow(streamableInit),
  108.        TWindowInit(&initFrame) { };
  109.     virtual void handleEvent( TEvent &event );
  110.  
  111. private:
  112.  
  113.     virtual const char *streamableName() const
  114.        { return name; }
  115.  
  116. protected:
  117.  
  118.     virtual void write( opstream& );
  119.     virtual void *read( ipstream& );
  120.  
  121. public:
  122.  
  123.     static const char * const name;
  124.     static TStreamable *build();
  125.  
  126. };
  127.  
  128. inline ipstream& operator >> ( ipstream& is, TAsciiChart& cl )
  129.     { return is >> (TStreamable&) cl; }
  130. inline ipstream& operator >> ( ipstream& is, TAsciiChart*& cl )
  131.     { return is >> (void *&) cl; }
  132.  
  133. inline opstream& operator << ( opstream& os, TAsciiChart& cl )
  134.     { return os << (TStreamable&) cl; }
  135. inline opstream& operator << ( opstream& os, TAsciiChart* cl )
  136.     { return os << (TStreamable *) cl; }
  137.  
  138.  
  139. #endif      // __ASCII_H
  140.