TGText


class description - source file - inheritance tree

class TGText


    protected:
void Init() void LongestLine() Bool_t SetCurrentRow(Long_t row) public:
TGText TGText() TGText TGText(TGText* text) TGText TGText(const char* string) TGText TGText(const TGText&) virtual void ~TGText() Bool_t AddText(TGText* text) Bool_t Append(const char* fn) Bool_t BreakLine(TGLongPosition pos) static TClass* Class() void Clear() Long_t ColCount() const Bool_t DelChar(TGLongPosition pos) Bool_t DelLine(ULong_t pos) Bool_t DelText(TGLongPosition start, TGLongPosition end) char GetChar(TGLongPosition pos) const char* GetFileName() const char* GetLine(TGLongPosition pos, ULong_t length) Long_t GetLineLength(Long_t row) Long_t GetLongestLine() const Bool_t InsChar(TGLongPosition pos, char c) Bool_t InsLine(ULong_t row, const char* string) Bool_t InsText(TGLongPosition pos, const char* buf) Bool_t InsText(TGLongPosition ins_pos, TGText* src, TGLongPosition start_src, TGLongPosition end_src) virtual TClass* IsA() const Bool_t IsSaved() const Bool_t Load(const char* fn, Long_t startpos = 0, Long_t length = -1) Bool_t LoadBuffer(const char* txtbuf) TGText& operator=(const TGText&) Bool_t Replace(TGLongPosition start, const char* oldText, const char* newText, Bool_t direction, Bool_t caseSensitive) void ReTab(Long_t row) Long_t RowCount() const Bool_t Save(const char* fn) Bool_t Search(TGLongPosition* foundPos, TGLongPosition start, const char* searchString, Bool_t direction, Bool_t caseSensitive) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
TString fFilename name of opened file ("" if open buffer) Bool_t fIsSaved false if text needs to be saved TGTextLine* fFirst first line of text TGTextLine* fCurrent current line Long_t fCurrentRow current row number Long_t fRowCount number of rows Long_t fColCount number of columns in current line Long_t fLongestLine length of longest line

Class Description

                                                                      
 TGText                                                               
                                                                      
 A TGText is a multi line text buffer. It allows the text to be       
 loaded from file, saved to file and edited. It is used in the        
 TGTextEdit widget. Single line text is handled by TGTextBuffer       
 and the TGTextEntry widget.                                          
                                                                      


void Init()
 Common initialization method.

TGText()
 Create default (empty) text buffer.

TGText(TGText *text)
 Create text buffer and initialize with other text buffer.

TGText(const char *string)
 Create text buffer and initialize with single line string.

~TGText()
 Destroy text buffer.

void Clear()
 Clear text buffer.

Bool_t Load(const char *fn, Long_t startpos, Long_t length)
 Load text from file fn. Startpos is the begin from where to
 load the file and length is the number of characters to read
 from the file.

Bool_t LoadBuffer(const char *txtbuf)
 Load a 0 terminated buffer. Lines will be split at 'n'.

Bool_t Save(const char *fn)
 Save text buffer to file fn.

Bool_t Append(const char *fn)
 Append buffer to file fn.

Bool_t DelChar(TGLongPosition pos)
 Delete character at specified position pos.

Bool_t InsChar(TGLongPosition pos, char c)
 Insert character c at the specified position pos.

char GetChar(TGLongPosition pos)
 Get character a position pos. If charcater not valid return -1.

Bool_t DelText(TGLongPosition start, TGLongPosition end)
 Delete text between start and end positions. Returns false in
 case of failure (start and end not being within bounds).

Bool_t InsText(TGLongPosition ins_pos, TGText *src, TGLongPosition start_src, TGLongPosition end_src)
 Insert src text from start_src to end_src into text at position ins_pos.
 Returns false in case of failure (start_src, end_src out of range for
 src, and ins_pos out of range for this).

Bool_t InsText(TGLongPosition pos, const char *buffer)
 Insert single line at specified position. Return false in case position
 is out of bounds.

Bool_t AddText(TGText *text)
 Add another text buffer to this buffer.

Bool_t InsLine(ULong_t pos, const char *string)
 Insert string before specified position.
 Returns false if insertion failed.

Bool_t DelLine(ULong_t pos)
 Delete specified row. Returns false if row does not exist.

char* GetLine(TGLongPosition pos, ULong_t length)
 Return string at position pos. Returns 0 in case pos is not valid.
 The returned string must be deleted by the user.

Bool_t BreakLine(TGLongPosition pos)
 Break line at position pos. Returns false if pos is not valid.

Long_t GetLineLength(Long_t row)
 Get length of specified line. Returns -1 if row does not exist.

Bool_t SetCurrentRow(Long_t row)
 Make specified row the current row. Returns false if row does not exist.
 In which case fCurrent is not changed or set to the last valid line.

void ReTab(Long_t row)
 Redo all tabs in a line. Needed after a new tab is inserted.

Bool_t Search(TGLongPosition *foundPos, TGLongPosition start, const char *searchString, Bool_t direction, Bool_t caseSensitive)
 Search for string searchString starting at the specified position going
 in forward (direction = true) or backward direction. Returns true if
 found and foundPos is set accordingly.

Bool_t Replace(TGLongPosition start, const char *oldText, const char *newText, Bool_t direction, Bool_t caseSensitive)
 Replace oldText by newText. Returns false if nothing replaced.

void LongestLine()
 Set fLongestLine.



Inline Functions


             Bool_t IsSaved() const
        const char* GetFileName() const
             Long_t RowCount() const
             Long_t ColCount() const
             Long_t GetLongestLine() const
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)
             TGText TGText(const TGText&)
            TGText& operator=(const TGText&)


Author: Fons Rademakers 26/04/98
Last update: root/gui:$Name: $:$Id: TGText.cxx,v 1.13 2002/06/10 18:35:38 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.