#ifndef ROOT_TGTextEdit
#define ROOT_TGTextEdit
#ifndef ROOT_TGTextView
#include "TGTextView.h"
#endif
class TGPopupMenu;
class TGSearchType;
class TGTextEditHist;
class TGTextEdit : public TGTextView {
private:
TGTextEdit(const TGTextEdit&);
TGTextEdit& operator=(const TGTextEdit&);
public:
enum EInsertMode { kInsert, kReplace };
enum {
kM_FILE_NEW, kM_FILE_OPEN, kM_FILE_CLOSE, kM_FILE_SAVE, kM_FILE_SAVEAS,
kM_FILE_PRINT, kM_EDIT_CUT, kM_EDIT_COPY, kM_EDIT_PASTE, kM_EDIT_SELECTALL,
kM_SEARCH_FIND, kM_SEARCH_FINDAGAIN, kM_SEARCH_GOTO
};
protected:
GContext_t fCursor0GC;
GContext_t fCursor1GC;
Int_t fCursorState;
TViewTimer *fCurBlink;
TGPopupMenu *fMenu;
TGSearchType *fSearch;
TGLongPosition fCurrent;
EInsertMode fInsertMode;
Bool_t fEnableMenu;
TGTextEditHist *fHistory;
Bool_t fEnableCursorWithoutFocus;
static TGGC *fgCursor0GC;
static TGGC *fgCursor1GC;
void Init();
virtual void SetMenuState();
virtual void CursorOn();
virtual void CursorOff();
virtual void DrawCursor(Int_t mode);
virtual void AdjustPos();
virtual void Copy(TObject &) const { MayNotUse("Copy(TObject &)"); }
static const TGGC &GetCursor0GC();
static const TGGC &GetCursor1GC();
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());
virtual ~TGTextEdit();
virtual Bool_t SaveFile(const char *fname, Bool_t saveas = kFALSE);
virtual void Clear(Option_t * = "");
virtual Bool_t Copy();
virtual Bool_t Cut();
virtual Bool_t Paste();
virtual void InsChar(char character);
virtual void DelChar();
virtual void BreakLine();
virtual void PrevChar();
virtual void NextChar();
virtual void LineUp();
virtual void LineDown();
virtual void ScreenUp();
virtual void ScreenDown();
virtual void Home();
virtual void End();
virtual void Print(Option_t * = "") const;
virtual void Delete(Option_t * = "");
virtual Bool_t Search(const char *string, Bool_t direction = kTRUE, Bool_t caseSensitive = kFALSE);
virtual void Search(Bool_t close);
virtual Bool_t Replace(TGLongPosition pos, const char *oldText, const char *newText,
Bool_t direction, Bool_t caseSensitive);
virtual Bool_t Goto(Long_t line, Long_t column = 0);
virtual void SetInsertMode(EInsertMode mode = kInsert);
EInsertMode GetInsertMode() const { return fInsertMode; }
TGPopupMenu *GetMenu() const { return fMenu; }
virtual void EnableMenu(Bool_t on = kTRUE) { fEnableMenu = on; }
virtual Bool_t IsMenuEnabled() const { return fEnableMenu; }
TList *GetHistory() const { return (TList *)fHistory; }
virtual void EnableCursorWithoutFocus(Bool_t on = kTRUE) { fEnableCursorWithoutFocus = on; }
virtual Bool_t IsCursorEnabledithoutFocus() const { return fEnableCursorWithoutFocus; }
virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height);
virtual void ScrollCanvas(Int_t newTop, Int_t direction);
virtual void SetFocus() { RequestFocus(); }
virtual void SetCurrent(TGLongPosition new_coord);
TGLongPosition GetCurrentPos() const { return fCurrent; }
virtual Long_t ReturnLongestLineWidth();
virtual Bool_t HandleTimer(TTimer *t);
virtual Bool_t HandleSelection (Event_t *event);
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleKey(Event_t *event);
virtual Bool_t HandleMotion(Event_t *event);
virtual Bool_t HandleCrossing(Event_t *event);
virtual Bool_t HandleFocusChange(Event_t *event);
virtual Bool_t HandleDoubleClick(Event_t *event);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
virtual void FindAgain() { Emit("FindAgain()"); }
virtual void Closed() { Emit("Closed()"); }
virtual void Opened() { Emit("Opened()"); }
virtual void Saved() { Emit("Saved()"); }
virtual void SavedAs() { Emit("SavedAs()"); }
virtual void SavePrimitive(ostream &out, Option_t * = "");
ClassDef(TGTextEdit,0)
};
#endif