library: libGui #include "TGTextEdit.h"

# TGTextEdit

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

## class TGTextEdit : public TGTextView

| Inheritance Chart:

`TObject`

<-

`TGObject`

<-

`TGWindow`

`TQObject`

<-

`TGFrame`

<-

`TGCompositeFrame`

`TGWidget`

<-

`TGView`

<-

`TGTextView`

<-

`TGTextEdit`

        protected:

                virtual void AdjustPos()
                virtual void BreakLine()
                virtual void Copy(TObject&) const
                virtual void CursorOff()
                virtual void CursorOn()
                virtual void DelChar()
                virtual void DrawCursor(Int_t mode)
                virtual void End()
          static const TGGC& GetCursor0GC() const
          static const TGGC& GetCursor1GC() const
                virtual void Home()
                        void Init()
                virtual void InsChar(char character)
                virtual void LineDown()
                virtual void LineUp()
                virtual void NextChar()
                virtual void PrevChar()
                virtual void ScreenDown()
                virtual void ScreenUp()
                virtual void SetCurrent(TGLongPosition new_coord)
                virtual void SetMenuState()

        public:

                                  TGTextEdit(const TGWindow* parent = 0, UInt_t w = 1, UInt_t h = 1, Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel())
                                  TGTextEdit(const TGWindow* parent, UInt_t w, UInt_t h, TGText* text, Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel())
                                  TGTextEdit(const TGWindow* parent, UInt_t w, UInt_t h, const char* string, Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel())
                                  TGTextEdit(const TGTextEdit&)
                          virtual ~TGTextEdit()
                   static TClass* Class()
                     virtual void Clear(Option_t* = "")
                     virtual void Closed()
                   virtual Bool_t Copy()
                   virtual Bool_t Cut()
                     virtual void Delete(Option_t* = "")
                     virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)
                     virtual void FindAgain()
                   TGLongPosition GetCurrentPos() const
          TGTextEdit::EInsertMode GetInsertMode() const
                     TGPopupMenu* GetMenu() const
                   virtual Bool_t Goto(Long_t line, Long_t column = 0)
                   virtual Bool_t HandleButton(Event_t* event)
                   virtual Bool_t HandleCrossing(Event_t* event)
                   virtual Bool_t HandleFocusChange(Event_t* event)
                   virtual Bool_t HandleKey(Event_t* event)
                   virtual Bool_t HandleMotion(Event_t* event)
                   virtual Bool_t HandleSelection(Event_t* event)
                   virtual Bool_t HandleTimer(TTimer* t)
                  virtual TClass* IsA() const
                     virtual void Opened()
                   virtual Bool_t Paste()
                     virtual void Print(Option_t* = "") const
                   virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
                   virtual Bool_t Replace(TGLongPosition pos, const char* oldText, const char* newText, Bool_t direction, Bool_t caseSensitive)
                   virtual Long_t ReturnLongestLineWidth()
                     virtual void Saved()
                     virtual void SavedAs()
                   virtual Bool_t SaveFile(const char* fname, Bool_t saveas = kFALSE)
                     virtual void SavePrimitive(ofstream& out, Option_t*)
                     virtual void ScrollCanvas(Int_t newTop, Int_t direction)
                   virtual Bool_t Search(const char* string, Bool_t direction, Bool_t caseSensitive)
                     virtual void SetFocus()
                     virtual void SetInsertMode(TGTextEdit::EInsertMode mode = kInsert)
                     virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     virtual void Streamer(TBuffer& b)
                             void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                       GContext_t fCursor0GC    graphics context for erasing cursor
                       GContext_t fCursor1GC    graphics context for drawing cursor
                            Int_t fCursorState  cursor state (1=drawn, 2=erased)
                      TViewTimer* fCurBlink     cursor blink timer
                     TGPopupMenu* fMenu         popup menu with editor actions
                    TGSearchType* fSearch       structure used by search dialog
                   TGLongPosition fCurrent      current cursor position
          TGTextEdit::EInsertMode fInsertMode   text insertion mode (kInsert (default), kReplace)
                     static TGGC* fgCursor0GC
                     static TGGC* fgCursor1GC

        public:

          static const TGTextEdit::EInsertMode kInsert
          static const TGTextEdit::EInsertMode kReplace
                static const enum TGTextEdit:: kM_FILE_NEW
                static const enum TGTextEdit:: kM_FILE_OPEN
                static const enum TGTextEdit:: kM_FILE_CLOSE
                static const enum TGTextEdit:: kM_FILE_SAVE
                static const enum TGTextEdit:: kM_FILE_SAVEAS
                static const enum TGTextEdit:: kM_FILE_PRINT
                static const enum TGTextEdit:: kM_EDIT_CUT
                static const enum TGTextEdit:: kM_EDIT_COPY
                static const enum TGTextEdit:: kM_EDIT_PASTE
                static const enum TGTextEdit:: kM_EDIT_SELECTALL
                static const enum TGTextEdit:: kM_SEARCH_FIND
                static const enum TGTextEdit:: kM_SEARCH_FINDAGAIN
                static const enum TGTextEdit:: kM_SEARCH_GOTO

## Class Description

     TGTextEdit

     A TGTextEdit is a specialization of TGTextView. It provides the
     text edit functionality to the static text viewing widget.
     For the messages supported by this widget see the TGView class.

TGTextEdit(const TGWindow *parent, UInt_t w, UInt_t h, Int_t id, UInt_t sboptions, ULong_t back) : TGTextView(parent, w, h, id, sboptions, back)

     Create a text edit widget.

TGTextEdit(const TGWindow *parent, UInt_t w, UInt_t h, TGText *text, Int_t id, UInt_t sboptions, ULong_t back) : TGTextView(parent, w, h, text, id, sboptions, back)

     Create a text edit widget. Initialize it with the specified text buffer.

TGTextEdit(const TGWindow *parent, UInt_t w, UInt_t h, const char *string, Int_t id, UInt_t sboptions, ULong_t back) : TGTextView(parent, w, h, string, id, sboptions, back)

     Create a text edit widget. Initialize it with the specified string.

~TGTextEdit()

     Cleanup text edit widget.

void Init()

     Initiliaze a text edit widget.

void SetMenuState()

     Enable/disable menu items in function of what is possible.

Long_t ReturnLongestLineWidth()

     Return width of longest line in widget.

void Clear(Option_t *)

     Clear text edit widget.

Bool_t SaveFile(const char *filename, Bool_t saveas)

     Save file. If filename==0 ask user via dialog for a filename, if in
     addition saveas==kTRUE always ask for new filename. Returns
     kTRUE if file was correctly saved, kFALSE otherwise.

Bool_t Copy()

     Copy text.

Bool_t Cut()

     Cut text.

Bool_t Paste()

     Paste text into widget.

void Print(Option_t *) const

     Send current buffer to printer.

void Delete(Option_t *)

     Delete selection.

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

     Search for string in the specified direction. If direction is true
     the search will be in forward direction.

Bool_t Replace(TGLongPosition textPos, const char *oldText, const char *newText, Bool_t direction, Bool_t caseSensitive)

     Replace text starting at textPos.

Bool_t Goto(Long_t line, Long_t column)

     Goto the specified line.

void SetInsertMode(EInsertMode mode)

     Sets the mode how characters are entered.

void CursorOff()

     If cursor if on, turn it off.

void CursorOn()

     Turn cursor on.

void SetCurrent(TGLongPosition new_coord)

     Make the specified position the current position.

void DrawCursor(Int_t mode)

     Draw cursor. If mode = 1 draw cursor, if mode = 2 erase cursor.

void AdjustPos()

     Adjust current position.

Bool_t HandleTimer(TTimer *t)

     Handle timer cursor blink timer.

Bool_t HandleSelection(Event_t *event)

     Handle selection notify event.

Bool_t HandleButton(Event_t *event)

     Handle mouse button event in text edit widget.

Bool_t HandleMotion(Event_t *event)

     Handle mouse motion event in text edit widget.

Bool_t HandleKey(Event_t *event)

     The key press event handler converts a key press to some line editor
     action.

Bool_t HandleCrossing(Event_t *event)

     Handle mouse crossing event.

Bool_t HandleFocusChange(Event_t *event)

     Handle focus change event in text edit widget.

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)

     Process context menu messages.

void InsChar(char character)

     Insert a character in the text edit widget.

void DelChar()

     Delete a character from the text edit widget.

void BreakLine()

     Break a line.

void ScrollCanvas(Int_t new_top, Int_t direction)

     Scroll the canvas to new_top in the kVertical or kHorizontal direction.

void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)

     Redraw the text edit widget.

void PrevChar()

     Go to the previous character.

void NextChar()

     Go to next character.

void LineUp()

     Make current position first line in window by scrolling up.

void LineDown()

     Move one line down.

void ScreenUp()

     Move one screen up.

void ScreenDown()

     Move one screen down.

void Home()

     Move to beginning of line.

void End()

     Move to end of line.

const TGGC& GetCursor0GC()

const TGGC& GetCursor1GC()

void SavePrimitive(ofstream &out, Option_t *)

     Save a text edit widget as a C++ statement(s) on output stream out

### Inline Functions

                             Bool_t Copy()
            TGTextEdit::EInsertMode GetInsertMode() const
                       TGPopupMenu* GetMenu() const
                               void SetFocus()
                     TGLongPosition GetCurrentPos() const
                               void FindAgain()
                               void Closed()
                               void Opened()
                               void Saved()
                               void SavedAs()
                            TClass* Class()
                            TClass* IsA() const
                               void ShowMembers(TMemberInspector& insp, char* parent)
                               void Streamer(TBuffer& b)
                               void StreamerNVirtual(TBuffer& b)
                         TGTextEdit TGTextEdit(const TGTextEdit&)

Author: Fons Rademakers 3/7/2000
Last update: root/gui:$Name: $:$Id: TGTextEdit.cxx,v 1.28 2005/02/18 11:22:28 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *