Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 1/7/2000
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_TGTextEdit
13#define ROOT_TGTextEdit
16#include "TGTextView.h"
18class TGPopupMenu;
19class TGSearchType;
20class TGTextEditHist;
22class TGTextEdit : public TGTextView {
25 TGTextEdit(const TGTextEdit&) = delete;
26 TGTextEdit& operator=(const TGTextEdit&) = delete;
30 enum {
34 };
37 GContext_t fCursor0GC; ///< graphics context for erasing cursor
38 GContext_t fCursor1GC; ///< graphics context for drawing cursor
39 Int_t fCursorState; ///< cursor state (1=drawn, 2=erased)
40 TViewTimer *fCurBlink; ///< cursor blink timer
41 TGPopupMenu *fMenu; ///< popup menu with editor actions
42 TGSearchType *fSearch; ///< structure used by search dialog
43 TGLongPosition fCurrent; ///< current cursor position
44 EInsertMode fInsertMode; ///< *OPTION={GetMethod="GetInsertMode";SetMethod="SetInsertMode";Items=(kInsert="&Insert",kReplace="&Replace")}*
45 Bool_t fEnableMenu; ///< enable context menu with editor actions
46 TGTextEditHist *fHistory; ///< undo manager
47 Bool_t fEnableCursorWithoutFocus; ///< enable cursor visibility when focus went out from
48 ///< text editor window (default is kTRUE)
53 void Init();
55 virtual void SetMenuState();
56 virtual void CursorOn();
57 virtual void CursorOff();
58 virtual void DrawCursor(Int_t mode);
59 virtual void AdjustPos();
60 virtual void Copy(TObject &) const { MayNotUse("Copy(TObject &)"); }
62 static const TGGC &GetCursor0GC();
63 static const TGGC &GetCursor1GC();
66 TGTextEdit(const TGWindow *parent = nullptr, UInt_t w = 1, UInt_t h = 1, Int_t id = -1,
67 UInt_t sboptions = 0, Pixel_t back = GetWhitePixel());
68 TGTextEdit(const TGWindow *parent, UInt_t w, UInt_t h, TGText *text,
69 Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel());
70 TGTextEdit(const TGWindow *parent, UInt_t w, UInt_t h, const char *string,
71 Int_t id = -1, UInt_t sboptions = 0, Pixel_t back = GetWhitePixel());
73 virtual ~TGTextEdit();
75 virtual Bool_t SaveFile(const char *fname, Bool_t saveas = kFALSE);
76 virtual void Clear(Option_t * = "");
77 virtual Bool_t Copy();
78 virtual Bool_t Cut();
79 virtual Bool_t Paste();
80 virtual void InsChar(char character);
81 virtual void DelChar();
82 virtual void BreakLine();
83 virtual void PrevChar();
84 virtual void NextChar();
85 virtual void LineUp();
86 virtual void LineDown();
87 virtual void ScreenUp();
88 virtual void ScreenDown();
89 virtual void Home();
90 virtual void End();
91 virtual void Print(Option_t * = "") const;
92 virtual void Delete(Option_t * = "");
93 virtual Bool_t Search(const char *string, Bool_t direction = kTRUE, Bool_t caseSensitive = kFALSE);
94 virtual void Search(Bool_t close);
95 virtual Bool_t Replace(TGLongPosition pos, const char *oldText, const char *newText,
96 Bool_t direction, Bool_t caseSensitive);
97 virtual Bool_t Goto(Long_t line, Long_t column = 0);
98 virtual void SetInsertMode(EInsertMode mode = kInsert); //*SUBMENU*
100 TGPopupMenu *GetMenu() const { return fMenu; }
101 virtual void EnableMenu(Bool_t on = kTRUE) { fEnableMenu = on; } //*TOGGLE* *GETTER=IsMenuEnabled
102 virtual Bool_t IsMenuEnabled() const { return fEnableMenu; }
103 TList *GetHistory() const { return (TList *)fHistory; }
107 virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height);
108 virtual void ScrollCanvas(Int_t newTop, Int_t direction);
109 virtual void SetFocus() { RequestFocus(); }
111 virtual void SetCurrent(TGLongPosition new_coord);
115 virtual Bool_t HandleTimer(TTimer *t);
118 virtual Bool_t HandleKey(Event_t *event);
123 virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
125 virtual void FindAgain() { Emit("FindAgain()"); } //*SIGNAL*
126 virtual void Closed() { Emit("Closed()"); } //*SIGNAL*
127 virtual void Opened() { Emit("Opened()"); } //*SIGNAL*
128 virtual void Saved() { Emit("Saved()"); } //*SIGNAL*
129 virtual void SavedAs() { Emit("SavedAs()"); } //*SIGNAL*
131 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
133 ClassDef(TGTextEdit,0) // Text edit widget
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
This class creates a popup menu object.
Definition: TGMenu.h:110
A TGTextEdit is a specialization of TGTextView.
Definition: TGTextEdit.h:22
TGLongPosition fCurrent
current cursor position
Definition: TGTextEdit.h:43
TGTextEditHist * fHistory
undo manager
Definition: TGTextEdit.h:46
Definition: TGTextEdit.h:33
Definition: TGTextEdit.h:31
Definition: TGTextEdit.h:33
Definition: TGTextEdit.h:32
Definition: TGTextEdit.h:32
Definition: TGTextEdit.h:31
Definition: TGTextEdit.h:31
Definition: TGTextEdit.h:32
Definition: TGTextEdit.h:33
Definition: TGTextEdit.h:31
Definition: TGTextEdit.h:32
GContext_t fCursor1GC
graphics context for drawing cursor
Definition: TGTextEdit.h:38
virtual void Closed()
Definition: TGTextEdit.h:126
virtual Bool_t HandleFocusChange(Event_t *event)
Handle focus change event in text edit widget.
TGTextEdit(const TGTextEdit &)=delete
virtual Bool_t Goto(Long_t line, Long_t column=0)
Goto the specified line.
Definition: TGTextEdit.cxx:738
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click event.
static TGGC * fgCursor0GC
Definition: TGTextEdit.h:50
static const TGGC & GetCursor1GC()
Return default graphics context for text cursor.
virtual void Saved()
Definition: TGTextEdit.h:128
virtual Bool_t Replace(TGLongPosition pos, const char *oldText, const char *newText, Bool_t direction, Bool_t caseSensitive)
Replace text starting at textPos.
Definition: TGTextEdit.cxx:696
virtual void DrawCursor(Int_t mode)
Draw cursor. If mode = 1 draw cursor, if mode = 2 erase cursor.
Definition: TGTextEdit.cxx:824
TGPopupMenu * GetMenu() const
Definition: TGTextEdit.h:100
virtual Bool_t Copy()
Copy text.
Definition: TGTextEdit.cxx:416
TList * GetHistory() const
Definition: TGTextEdit.h:103
virtual void AdjustPos()
Adjust current position.
Definition: TGTextEdit.cxx:901
virtual Bool_t SaveFile(const char *fname, Bool_t saveas=kFALSE)
Save file.
Definition: TGTextEdit.cxx:388
EInsertMode GetInsertMode() const
Definition: TGTextEdit.h:99
virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)
Redraw the text edit widget.
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
virtual void SetMenuState()
Enable/disable menu items in function of what is possible.
Definition: TGTextEdit.cxx:327
virtual Bool_t Cut()
Cut text.
Definition: TGTextEdit.cxx:442
Bool_t fEnableMenu
enable context menu with editor actions
Definition: TGTextEdit.h:45
TGLongPosition GetCurrentPos() const
Definition: TGTextEdit.h:112
virtual Long_t ReturnLongestLineWidth()
Return width of longest line in widget.
Definition: TGTextEdit.cxx:366
virtual void Print(Option_t *="") const
Send current buffer to printer.
Definition: TGTextEdit.cxx:477
virtual void DelChar()
Delete a character from the text edit widget.
virtual Bool_t HandleSelection(Event_t *event)
Handle selection notify event.
Definition: TGTextEdit.cxx:946
GContext_t fCursor0GC
graphics context for erasing cursor
Definition: TGTextEdit.h:37
virtual Bool_t HandleKey(Event_t *event)
The key press event handler converts a key press to some line editor action.
virtual void SavedAs()
Definition: TGTextEdit.h:129
virtual void LineDown()
Move one line down.
virtual void Clear(Option_t *="")
Clear text edit widget.
Definition: TGTextEdit.cxx:376
virtual void ScreenDown()
Move one screen down.
virtual void Delete(Option_t *="")
Delete selection.
Definition: TGTextEdit.cxx:532
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a text edit widget as a C++ statement(s) on output stream out.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in text edit widget.
virtual void LineUp()
Make current position first line in window by scrolling up.
EInsertMode fInsertMode
Definition: TGTextEdit.h:44
virtual void CursorOn()
Turn cursor on.
Definition: TGTextEdit.cxx:795
virtual Bool_t IsCursorEnabledithoutFocus() const
Definition: TGTextEdit.h:105
virtual void SetCurrent(TGLongPosition new_coord)
Make the specified position the current position.
Definition: TGTextEdit.cxx:808
virtual void NextChar()
Go to next character.
virtual void ScreenUp()
Move one screen up.
virtual void BreakLine()
Break a line.
virtual ~TGTextEdit()
Cleanup text edit widget.
Definition: TGTextEdit.cxx:272
virtual void FindAgain()
Definition: TGTextEdit.h:125
virtual void InsChar(char character)
Insert a character in the text edit widget.
virtual void SetInsertMode(EInsertMode mode=kInsert)
Sets the mode how characters are entered.
Definition: TGTextEdit.cxx:774
virtual void CursorOff()
If cursor if on, turn it off.
Definition: TGTextEdit.cxx:784
virtual Bool_t Search(const char *string, Bool_t direction=kTRUE, Bool_t caseSensitive=kFALSE)
Search for string in the specified direction.
Definition: TGTextEdit.cxx:634
Int_t fCursorState
cursor state (1=drawn, 2=erased)
Definition: TGTextEdit.h:39
TGSearchType * fSearch
structure used by search dialog
Definition: TGTextEdit.h:42
virtual void Opened()
Definition: TGTextEdit.h:127
virtual void PrevChar()
Go to the previous character.
virtual Bool_t Paste()
Paste text into widget.
Definition: TGTextEdit.cxx:455
virtual void EnableCursorWithoutFocus(Bool_t on=kTRUE)
Definition: TGTextEdit.h:104
virtual Bool_t IsMenuEnabled() const
Definition: TGTextEdit.h:102
virtual void SetFocus()
Definition: TGTextEdit.h:109
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text edit widget.
TGPopupMenu * fMenu
popup menu with editor actions
Definition: TGTextEdit.h:41
virtual void Copy(TObject &) const
Copy this to obj.
Definition: TGTextEdit.h:60
virtual void ScrollCanvas(Int_t newTop, Int_t direction)
Scroll the canvas to new_top in the kVertical or kHorizontal direction.
virtual void EnableMenu(Bool_t on=kTRUE)
Definition: TGTextEdit.h:101
Bool_t fEnableCursorWithoutFocus
enable cursor visibility when focus went out from text editor window (default is kTRUE)
Definition: TGTextEdit.h:47
virtual void Home()
Move to beginning of line.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process context menu messages.
static TGGC * fgCursor1GC
Definition: TGTextEdit.h:51
TViewTimer * fCurBlink
cursor blink timer
Definition: TGTextEdit.h:40
virtual void End()
Move to end of line.
void Init()
Initialize a text edit widget.
Definition: TGTextEdit.cxx:285
static const TGGC & GetCursor0GC()
Return selection graphics context for text cursor.
virtual Bool_t HandleTimer(TTimer *t)
Handle timer cursor blink timer.
Definition: TGTextEdit.cxx:925
TGTextEdit & operator=(const TGTextEdit &)=delete
A TGTextView is a text viewer widget.
Definition: TGTextView.h:22
A TGText is a multi line text buffer.
Definition: TGText.h:57
ROOT GUI Window base class.
Definition: TGWindow.h:23
virtual void RequestFocus()
request focus
Definition: TGWindow.cxx:232
A doubly linked list.
Definition: TList.h:44
Mother of all ROOT objects.
Definition: TObject.h:37
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition: TObject.cxx:946
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
TText * text
TLine * line
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Event structure.
Definition: GuiTypes.h:174