home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CommToolbox (modified) / Headers / CScrollBuffer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  2.3 KB  |  69 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CScrollBuffer.h
  3.  
  4.         Interface for CScrollBuffer class.
  5.         
  6.     SUPERCLASS = CAbstractBuffer
  7.     
  8.     Copyright © 1994-95 Ithran Einhorn. All rights reserved.
  9.  ******************************************************************************/
  10.  
  11. #pragma once
  12.  
  13. #include "CAbstractBuffer.h"
  14.  
  15. #define        kDefMaxLines    128
  16.  
  17. class CScrollBuffer : public CAbstractBuffer
  18. {
  19.     private:
  20.     Handle                itsTextHandle;        /* Handle to text to display        */
  21.     long                itsTextLength;        /* Length of text to display        */
  22.     long                itsActualLength;    /* Length of actual buffer            */
  23.     long                itsNumLines;        /* Number of lines in text            */
  24.     LongHandle            itsLineStarts;        /* Offsets to starts of lines        */
  25.     long                maxLines;            /* maximum number of lines to store    */
  26.     
  27.     public:
  28.     
  29.     void        IScrollBuffer(long maxNumLines = kDefMaxLines);
  30.     void        Dispose(void);
  31.     
  32.     /** Text Specification **/
  33.     void    SetTextPtr(Ptr textPtr, long numChars);
  34.     void    UseTextHandle(Handle textHandle);
  35.     void    InsertTextPtr(Ptr insertPtr, long insertLen);
  36.     Handle    CopyTextRange(long start, long end);
  37.     void    ReplaceSelection(Ptr replacePtr, long replaceLen);
  38.  
  39.     /** Accessing **/
  40.     Handle    GetTextHandle(void);
  41.     Handle    GetRawTextHandle(void);
  42.     
  43.     long    FindLine(long charPos);
  44.     long    GetLineStart(long line);
  45.     long    GetLineEnd(long line);
  46.     short    GetLineLength(long line);
  47.     long    GetLength(void);
  48.     long    GetNumLines(void);
  49.     void    GetSelection(long *selStart, long *selEnd);
  50.     void    GetCharAt(long *aPosition, tCharBuf charBuf);
  51.     void    GetCharBefore(long *aPosition, tCharBuf charBuf);
  52.     void    GetCharAfter(long *aPosition, tCharBuf charBuf);
  53.     long    GetGapPosition(void);
  54.     long    GetGapLength(void);
  55.     
  56.     /** new access functions */
  57.     virtual void    GetLineInfo(long line, long *start, long *len);
  58.     virtual void    GetLineInfoX(long line, long *start, long *log_start, long *len);
  59.     virtual long    GetMaxLines(void);
  60.     virtual    void    ReplaceLine(Ptr replacePtr, long replaceLen, long line);
  61.     virtual    void    AddLine(Ptr newLinePtr, long newLineLen);
  62.     virtual    void    DeleteLine(long line);
  63.     virtual    void    GetLine(long line, StringPtr strLine, long maxLen);    
  64.     virtual    Boolean    EnlargeBuffer(long delta);
  65.     virtual    long    GetActualBufferLength(long startLine, long startLine);
  66.     virtual    void    Truncate(void);
  67.     virtual    long    GetTextLength(void);
  68.     virtual void    GetCharInfo(long charPos, long *line, long *physLineBegin, long *physCharOffset);
  69. };