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

  1. /*
  2.  * textview.h
  3.  *
  4.  * Turbo Vision - Version 2.0
  5.  *
  6.  * Copyright (c) 1994 by Borland International
  7.  * All Rights Reserved.
  8.  *
  9.  * Modified by Sergio Sigala <ssigala@globalnet.it>
  10.  */
  11.  
  12. #if defined( Uses_TTextDevice ) && !defined( __TTextDevice )
  13. #define __TTextDevice
  14.  
  15. #include <iostream.h>
  16.  
  17. class TRect;
  18. class TScrollBar;
  19.  
  20. class TTextDevice : public TScroller
  21. {
  22.  
  23. public:
  24.  
  25.     TTextDevice( const TRect& bounds,
  26.                  TScrollBar *aHScrollBar,
  27.                  TScrollBar *aVScrollBar
  28.                );
  29.  
  30.     virtual int do_sputn( const char *s, int count ) = 0;
  31.  
  32. };
  33.  
  34. #endif  // Uses_TTextDevice
  35.  
  36. #if defined( Uses_TTerminal ) && !defined( __TTerminal )
  37. #define __TTerminal
  38.  
  39. class TRect;
  40. class TScrollBar;
  41.  
  42. class TTerminal: public TTextDevice
  43. {
  44.  
  45. public:
  46.  
  47.     friend void genRefs();
  48.  
  49.     TTerminal( const TRect& bounds,
  50.                TScrollBar *aHScrollBar,
  51.                TScrollBar *aVScrollBar,
  52.                ushort aBufSize
  53.              );
  54.     ~TTerminal();
  55.  
  56.     virtual int do_sputn( const char *s, int count );
  57.  
  58.     void bufInc( ushort& val );
  59.     Boolean canInsert( ushort amount );
  60.     short calcWidth();
  61.     virtual void draw();
  62.     ushort nextLine( ushort pos );
  63.     ushort prevLines( ushort pos, ushort lines );
  64.     Boolean queEmpty();
  65.  
  66. protected:
  67.  
  68.     ushort bufSize;
  69.     char *buffer;
  70.     ushort queFront, queBack;
  71.     void bufDec(ushort& val);
  72. #ifndef __UNPATCHED
  73.     ushort curLineWidth;   // Added horizontal cursor tracking
  74. #endif
  75. };
  76.  
  77. #endif  // Uses_TTerminal
  78.  
  79. #if defined( Uses_otstream ) && !defined( __otstream )
  80. #define __otstream
  81.  
  82. #include <iostream.h>
  83.  
  84. class TerminalBuf: public streambuf
  85. {
  86. protected:
  87.     TTerminal *term;
  88. public:
  89.     TerminalBuf(TTerminal *tt);
  90.     virtual int overflow( int = EOF );
  91.     virtual int sync();
  92. };
  93.  
  94. class otstream : public ostream
  95. {
  96. protected:
  97.     TerminalBuf buf;
  98. public:
  99.     otstream( TTerminal *tt );
  100. };
  101.  
  102.  
  103. #endif
  104.