library: libGui #include "TGTextView.h"

# TGTextView

class description - source file - inheritance tree (.pdf)

## class TGTextView : public TGView

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGCompositeFrame`
`TGWidget`
| <- | `TGView`
| <- | `TGTextView` |
<- |
`TGTextEdit` |

        protected:

                 virtual void Copy(TObject&) const
                 virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
          static FontStruct_t GetDefaultFontStruct()
           static const TGGC& GetDefaultGC() const
           static const TGGC& GetDefaultSelectedBackgroundGC() const
           static const TGGC& GetDefaultSelectedGC() const
                         void Init(Pixel_t bg)
                 virtual void Mark(Long_t xPos, Long_t yPos)
                 virtual void UnMark()

        public:

                          TGTextView(const TGWindow* parent = 0, UInt_t w = 1, UInt_t h = 1, Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel())
                          TGTextView(const TGWindow* parent, UInt_t w, UInt_t h, TGText* text, Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel())
                          TGTextView(const TGWindow* parent, UInt_t w, UInt_t h, const char* string, Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel())
                          TGTextView(const TGTextView&)
                  virtual ~TGTextView()
             virtual void AddLine(const char* string)
             virtual void AddLineFast(const char* string)
             virtual void AddText(TGText* text)
             virtual void AdjustWidth()
           static TClass* Class()
             virtual void Clear(Option_t* = "")
           virtual Bool_t Copy()
             virtual void DataChanged()
                  TGText* GetText() const
           virtual Bool_t HandleButton(Event_t* event)
           virtual Bool_t HandleSelectionRequest(Event_t* event)
          virtual TClass* IsA() const
           virtual Bool_t IsSaved()
           virtual Bool_t LoadBuffer(const char* txtbuf)
           virtual Bool_t LoadFile(const char* fname, long startpos = 0, long length = -1)
           virtual Long_t ReturnHeighestColHeight()
           virtual Long_t ReturnLineCount()
           virtual Long_t ReturnLineLength(Long_t line)
           virtual Long_t ReturnLongestLine()
           virtual Long_t ReturnLongestLineWidth()
           virtual Bool_t Search(const char* string, Bool_t direction, Bool_t caseSensitive)
           virtual Bool_t SelectAll()
             virtual void SetFont(FontStruct_t font)
             virtual void SetText(TGText* text)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
           virtual Long_t ToObjXCoord(Long_t xCoord, Long_t line)
           virtual Long_t ToObjYCoord(Long_t yCoord)
           virtual Long_t ToScrXCoord(Long_t xCoord, Long_t line)
           virtual Long_t ToScrYCoord(Long_t yCoord)
             virtual void Update()

### Data Members

        protected:

                       TGText* fText                          text buffer
                       TGText* fClipText                      clipboard text buffer
                  FontStruct_t fFont                          text font
                         Int_t fMaxAscent                     maximum ascent in font
                         Int_t fMaxDescent                    maximum descent in font
                         Int_t fMaxWidth                      maximum width of character in font
                          TGGC fNormGC                        graphics context for drawing text
                          TGGC fSelGC                         graphics context for drawing marked text
                    GContext_t fSelbackGC                     graphics context for drawing marked background
                        Bool_t fMarkedFromX                   true if text is marked from x
                        Bool_t fMarkedFromY                   true if text is marker from y
          static const TGFont* fgDefaultFont
                  static TGGC* fgDefaultGC
                  static TGGC* fgDefaultSelectedGC
            static const TGGC* fgDefaultSelectedBackgroundGC

## Class Description

     TGTextView

     A TGTextView is a text viewer widget. It is a specialization of
     TGView. It uses the TGText class (which contains all text
     manipulation code, i.e. loading a file in memory, changing,
     removing lines, etc.). Use a TGTextView to view non-editable text.
     For supported messages see TGView.

void Init(ULong_t /*back*/)

     Initialize a text view widget.

TGTextView(const TGWindow *parent, UInt_t w, UInt_t h, Int_t id, UInt_t sboptions, ULong_t back) : TGView(parent, w, h, id, 3, 3, kSunkenFrame | kDoubleBorder, sboptions, back)

     Create a text view widget.

TGTextView(const TGWindow *parent, UInt_t w, UInt_t h, TGText *text, Int_t id, UInt_t sboptions, ULong_t back) : TGView(parent, w, h, id, 3, 3, kSunkenFrame | kDoubleBorder, sboptions, back)

     Create a text view widget.

TGTextView(const TGWindow *parent, UInt_t w, UInt_t h, const char *string, Int_t id, UInt_t sboptions, ULong_t back) : TGView(parent, w, h, id, 3, 3, kSunkenFrame | kDoubleBorder, sboptions, back)

     Create a text view widget.

~TGTextView()

     Cleanup text view widget.

void SetText(TGText *text)

     Adopt a new text buffer. The text will be deleted by this object.

void AddText(TGText *text)

     Add text to the view widget.

void AddLine(const char *string)

     Add a line of text to the view widget.

void AddLineFast(const char *string)

     Add a line of text to the view widget.
     Fast version. Use it if you are going to add
     several lines, than call Update().

void Update ()

     Call this function after AddLineFast().

Long_t ReturnLongestLineWidth()

     Return width of longest line.

Bool_t Search(const char *string, Bool_t direction, Bool_t caseSensitive)

     Search for string in text. If direction is true search forward.
     Returns true if string is found.

void SetFont(FontStruct_t font)

     Changes text entry font.

Long_t ToScrYCoord(Long_t yCoord)

     Convert line number to screen coordinate.

Long_t ToScrXCoord(Long_t xCoord, Long_t line)

     Convert column number in specified line to screen coordinate.

Long_t ToObjYCoord(Long_t yCoord)

     Convert y screen coordinate to line number.

Long_t ToObjXCoord(Long_t xCoord, Long_t line)

     Convert x screen coordinate to column in specified line.

void Clear(Option_t *)

     Clear text view widget.

Bool_t LoadFile(const char *filename, Long_t startpos, Long_t length)

     Load a file in the text view widget. Return false in case file does not
     exist.

Bool_t LoadBuffer(const char *txtbuf)

     Load text from a text buffer. Return false in case of failure.

Bool_t Copy()

     Copy selected text to clipboard.

Bool_t SelectAll()

     Select all text in the viewer.

void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)

     Draw lines in exposed region.

Bool_t HandleButton(Event_t *event)

     Handle mouse button event in text view widget.

Bool_t HandleSelectionRequest(Event_t *event)

     Handle request to send current clipboard contents to requestor window.

void Mark(Long_t xPos, Long_t yPos)

     Mark a text region from xPos to yPos.

void UnMark()

     Clear marked region.

void AdjustWidth()

     Adjust widget width to longest line.

FontStruct_t GetDefaultFontStruct()

const TGGC& GetDefaultGC()

const TGGC& GetDefaultSelectedGC()

const TGGC& GetDefaultSelectedBackgroundGC()

### Inline Functions

                 Bool_t IsSaved()
                 Bool_t Copy()
                 Long_t ReturnHeighestColHeight()
                 Long_t ReturnLineLength(Long_t line)
                 Long_t ReturnLongestLine()
                 Long_t ReturnLineCount()
                TGText* GetText() const
                   void DataChanged()
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TGTextView TGTextView(const TGTextView&)

Author: Fons Rademakers 1/7/2000
Last update: root/gui:$Name: $:$Id: TGTextView.cxx,v 1.20 2004/09/01 14:35:33 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *