Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 20/06/06
5 * Copyright (C) 1995-2000, 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_TGTextEditor
13#define ROOT_TGTextEditor
17// //
18// TGTextEditor //
19// //
22#include "TGFrame.h"
23#include "TGTextEdit.h"
25class TGComboBox;
26class TGLabel;
27class TGLayoutHints;
28class TGMenuBar;
29class TGPopupMenu;
30class TGStatusBar;
31class TGText;
32class TGTextBuffer;
33class TGTextEntry;
34class TGToolBar;
35class TMacro;
36class TString;
37class TTimer;
39class TGTextEditor : public TGMainFrame {
43 TTimer *fTimer; // for statusbar and toolbar update
44 TGStatusBar *fStatusBar; // for file name, line and col number
45 TGToolBar *fToolBar; // toolbar with common tool buttons
46 TGTextEdit *fTextEdit; // text edit widget
47 TGLabel *fLabel; // "command" label
48 TGComboBox *fComboCmd; // commands combobox
49 TGTextEntry *fCommand; // command text entry widget
50 TGTextBuffer *fCommandBuf; // command text buffer
51 TGLayoutHints *fMenuBarLayout; // used for the menubar
52 TGLayoutHints *fMenuBarItemLayout; // used for for menubar items
53 TGMenuBar *fMenuBar; // editor's menu bar
54 TGPopupMenu *fMenuFile; // "File" menu entry
55 TGPopupMenu *fMenuEdit; // "Edit" menu entry
56 TGPopupMenu *fMenuSearch; // "Search" menu entry
57 TGPopupMenu *fMenuTools; // "Tools" menu entry
58 TGPopupMenu *fMenuHelp; // "Help" menu entry
59 Bool_t fExiting; // true if editor is closing
60 Bool_t fTextChanged; // true if text has changed
61 TString fFilename; // name of the opened file
62 TMacro *fMacro; // pointer on the opened macro
63 virtual void Build();
66 TGTextEditor(const char *filename = 0, const TGWindow *p = 0,
67 UInt_t w = 900, UInt_t h = 600);
68 TGTextEditor(TMacro *macro, const TGWindow *p = 0, UInt_t w = 0,
69 UInt_t h = 0);
70 virtual ~TGTextEditor();
72 void ClearText();
73 Bool_t LoadBuffer(const char *buf) { return fTextEdit->LoadBuffer(buf); }
74 void LoadFile(const char *fname = 0);
75 void SaveFile(const char *fname);
77 void PrintText();
78 void Search(Bool_t ret);
79 void Goto();
80 void About();
81 void DataChanged();
82 void DataDropped(char *fname);
83 Int_t IsSaved();
84 void CompileMacro();
85 void ExecuteMacro();
86 void InterruptMacro();
89 void AddLine(const char *string) { fTextEdit->AddLine(string); }
90 void AddLineFast(const char *string) { fTextEdit->AddLineFast(string); }
91 TGText *GetText() const { return fTextEdit->GetText(); }
93 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
94 virtual Bool_t HandleKey(Event_t *event);
95 virtual Bool_t HandleTimer(TTimer *t);
96 virtual void CloseWindow();
97 virtual void DeleteWindow();
99 ClassDef(TGTextEditor,0) // Simple text editor using TGTextEdit widget
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
#define ClassDef(name, id)
Definition Rtypes.h:325
virtual void DeleteWindow()
Delete TGTextEditor Window.
Bool_t LoadBuffer(const char *buf)
virtual Bool_t HandleKey(Event_t *event)
Keyboard event handler.
TGStatusBar * fStatusBar
Bool_t fTextChanged
TGPopupMenu * fMenuTools
void DataChanged()
Slot setting the fTextChanged flag to true when the text has been modified in fTextEdit.
TString fFilename
void InterruptMacro()
Interrupt execution of a macro.
Int_t IsSaved()
Check if file has to be saved in case of modifications.
void Search(Bool_t ret)
Invokes search dialog, or just search previous string if again is true.
TTimer * fTimer
void SetText(TGText *text)
TGPopupMenu * fMenuFile
TGLayoutHints * fMenuBarLayout
TGTextEntry * fCommand
TGText * GetText() const
TGLabel * fLabel
void DataDropped(char *fname)
Update file information when receiving the signal DataDropped from TGTextEdit widget.
void CompileMacro()
Save the edited text in a temporary macro, then compile it.
void ClearText()
Clear text edit widget.
virtual void Build()
Build TGTextEditor widget.
virtual void CloseWindow()
Close TGTextEditor window.
void AddLineFast(const char *string)
void Goto()
Invokes goto dialog, and go to the specified line.
void About()
Display ROOT splash screen.
void ExecuteMacro()
Save the edited text in a temporary macro, execute it, and then delete the temporary file.
Bool_t SaveFileAs()
Save the edited text in a file selected with TGFileDialog.
TMacro * fMacro
virtual Bool_t HandleTimer(TTimer *t)
Handle timer event.
TGMenuBar * fMenuBar
TGTextEdit * fTextEdit
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
void PrintText()
Open the print dialog and send current buffer to printer.
void AddLine(const char *string)
TGLayoutHints * fMenuBarItemLayout
void SaveFile(const char *fname)
Save the edited text in the file "fname".
TGComboBox * fComboCmd
TGPopupMenu * fMenuEdit
TGPopupMenu * fMenuSearch
virtual ~TGTextEditor()
TGTextEditor destructor.
TGTextBuffer * fCommandBuf
TGPopupMenu * fMenuHelp
void AddText(TGText *text)
void LoadFile(const char *fname=0)
Load a file into the editor. If fname is 0, a TGFileDialog will popup.
TGToolBar * fToolBar
Bool_t fExiting
virtual Bool_t LoadBuffer(const char *txtbuf)
Load text from a text buffer. Return false in case of failure.
virtual void AddLine(const char *string)
Add a line of text to the view widget.
TGText * GetText() const
Definition TGTextView.h:127
virtual void AddLineFast(const char *string)
Add a line of text to the view widget.
virtual void SetText(TGText *text)
Adopt a new text buffer. The text will be deleted by this object.
virtual void AddText(TGText *text)
Add text to the view widget.
Class supporting a collection of lines with C++ code.
Definition TMacro.h:31
Basic string class.
Definition TString.h:136
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
TText * text
Event structure.
Definition GuiTypes.h:174