class TGText


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.


Function Members (Methods)

public:
TGText()
TGText(TGText* text)
TGText(const char* string)
virtual~TGText()
Bool_tAddText(TGText* text)
Bool_tAppend(const char* fn)
TStringAsString()
Bool_tBreakLine(TGLongPosition pos)
static TClass*Class()
voidClear()
Long_tColCount() const
Bool_tDelChar(TGLongPosition pos)
Bool_tDelLine(ULong_t pos)
Bool_tDelText(TGLongPosition start, TGLongPosition end)
charGetChar(TGLongPosition pos)
TGTextLine*GetCurrentLine() const
const char*GetFileName() const
char*GetLine(TGLongPosition pos, ULong_t length)
Long_tGetLineLength(Long_t row)
Long_tGetLongestLine() const
Bool_tInsChar(TGLongPosition pos, char c)
Bool_tInsLine(ULong_t row, const char* string)
Bool_tInsText(TGLongPosition pos, const char* buf)
Bool_tInsText(TGLongPosition ins_pos, TGText* src, TGLongPosition start_src, TGLongPosition end_src)
virtual TClass*IsA() const
Bool_tIsSaved() const
Bool_tLoad(const char* fn, Long_t startpos = 0, Long_t length = -1)
Bool_tLoadBuffer(const char* txtbuf)
Bool_tReplace(TGLongPosition start, const char* oldText, const char* newText, Bool_t direction, Bool_t caseSensitive)
voidReTab(Long_t row)
Long_tRowCount() const
Bool_tSave(const char* fn)
Bool_tSearch(TGLongPosition* foundPos, TGLongPosition start, const char* searchString, Bool_t direction, Bool_t caseSensitive)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
protected:
TGText(const TGText&)
voidInit()
voidLongestLine()
TGText&operator=(const TGText&)
Bool_tSetCurrentRow(Long_t row)

Data Members

protected:
Long_tfColCountnumber of columns in current line
TGTextLine*fCurrentcurrent line
Long_tfCurrentRowcurrent row number
TStringfFilenamename of opened file ("" if open buffer)
TGTextLine*fFirstfirst line of text
Bool_tfIsSavedfalse if text needs to be saved
Long_tfLongestLinelength of longest line
Long_tfRowCountnumber of rows

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGText(const TGText& gt)
copy constructor
TGText& operator=(const TGText& )
assignment operator
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 = 0, Long_t length = -1)
 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* buf)
 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 row, 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.
TString AsString()
 Returns content as ROOT string
Bool_t IsSaved()
{ return fIsSaved; }
const char * GetFileName()
{ return fFilename.Data(); }
TGTextLine * GetCurrentLine()
{ return fCurrent; }
Long_t RowCount()
{ return fRowCount; }
Long_t ColCount()
{ return fColCount; }
Long_t GetLongestLine()
{ return fLongestLine; }

Author: Fons Rademakers 26/04/98
Last change: root/gui:$Id: TGText.h 23115 2008-04-10 13:35:37Z rdm $
Last generated: 2008-06-25 08:43
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

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.