ROOT logo
// @(#)root/gui:$Id: TGTextEditor.h 23115 2008-04-10 13:35:37Z rdm $
// Author: Bertrand Bellenot   20/06/06

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGTextEditor
#define ROOT_TGTextEditor


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGTextEditor                                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGTextEdit
#include "TGTextEdit.h"
#endif

class TGComboBox;
class TGLabel;
class TGLayoutHints;
class TGMenuBar;
class TGPopupMenu;
class TGStatusBar;
class TGText;
class TGTextBuffer;
class TGTextEntry;
class TGToolBar;
class TMacro;
class TString;
class TTimer;

class TGTextEditor : public TGMainFrame {

protected:

   TTimer           *fTimer;              // for statusbar and toolbar update
   TGStatusBar      *fStatusBar;          // for file name, line and col number
   TGToolBar        *fToolBar;            // toolbar with common tool buttons
   TGTextEdit       *fTextEdit;           // text edit widget
   TGLabel          *fLabel;              // "command" label
   TGComboBox       *fComboCmd;           // commands combobox
   TGTextEntry      *fCommand;            // command text entry widget
   TGTextBuffer     *fCommandBuf;         // command text buffer
   TGLayoutHints    *fMenuBarLayout;      // used for the menubar
   TGLayoutHints    *fMenuBarItemLayout;  // used for for menubar items
   TGMenuBar        *fMenuBar;            // editor's menu bar
   TGPopupMenu      *fMenuFile;           // "File" menu entry
   TGPopupMenu      *fMenuEdit;           // "Edit" menu entry
   TGPopupMenu      *fMenuSearch;         // "Search" menu entry
   TGPopupMenu      *fMenuTools;          // "Tools" menu entry
   TGPopupMenu      *fMenuHelp;           // "Help" menu entry
   Bool_t            fExiting;            // true if editor is closing
   Bool_t            fTextChanged;        // true if text has changed
   TString           fFilename;           // name of the opened file
   TMacro           *fMacro;              // pointer on the opened macro
   virtual void      Build();

public:
   TGTextEditor(const char *filename = 0, const TGWindow *p = 0,
                UInt_t w = 900, UInt_t h = 600);
   TGTextEditor(TMacro *macro, const TGWindow *p = 0, UInt_t w = 0,
                UInt_t h = 0);
   virtual ~TGTextEditor();

   void           ClearText();
   Bool_t         LoadBuffer(const char *buf) { return fTextEdit->LoadBuffer(buf); }
   void           LoadFile(char *fname = 0);
   void           SaveFile(const char *fname);
   Bool_t         SaveFileAs();
   void           PrintText();
   void           Search(Bool_t ret);
   void           Goto();
   void           About();
   void           DataChanged() { fTextChanged = kTRUE; }
   void           DataDropped(char *fname);
   Int_t          IsSaved();
   void           CompileMacro();
   void           ExecuteMacro();
   void           InterruptMacro();
   void           SetText(TGText *text) { fTextEdit->SetText(text); }
   void           AddText(TGText *text) { fTextEdit->AddText(text); }
   void           AddLine(const char *string) { fTextEdit->AddLine(string); }
   void           AddLineFast(const char *string) { fTextEdit->AddLineFast(string); }
   TGText        *GetText() const { return fTextEdit->GetText(); }

   virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
   virtual Bool_t HandleKey(Event_t *event);
   virtual Bool_t HandleTimer(TTimer *t);
   virtual void   CloseWindow();
   virtual void   DeleteWindow();

   ClassDef(TGTextEditor,0)  // Simple text editor using TGTextEdit widget
};

#endif
 TGTextEditor.h:1
 TGTextEditor.h:2
 TGTextEditor.h:3
 TGTextEditor.h:4
 TGTextEditor.h:5
 TGTextEditor.h:6
 TGTextEditor.h:7
 TGTextEditor.h:8
 TGTextEditor.h:9
 TGTextEditor.h:10
 TGTextEditor.h:11
 TGTextEditor.h:12
 TGTextEditor.h:13
 TGTextEditor.h:14
 TGTextEditor.h:15
 TGTextEditor.h:16
 TGTextEditor.h:17
 TGTextEditor.h:18
 TGTextEditor.h:19
 TGTextEditor.h:20
 TGTextEditor.h:21
 TGTextEditor.h:22
 TGTextEditor.h:23
 TGTextEditor.h:24
 TGTextEditor.h:25
 TGTextEditor.h:26
 TGTextEditor.h:27
 TGTextEditor.h:28
 TGTextEditor.h:29
 TGTextEditor.h:30
 TGTextEditor.h:31
 TGTextEditor.h:32
 TGTextEditor.h:33
 TGTextEditor.h:34
 TGTextEditor.h:35
 TGTextEditor.h:36
 TGTextEditor.h:37
 TGTextEditor.h:38
 TGTextEditor.h:39
 TGTextEditor.h:40
 TGTextEditor.h:41
 TGTextEditor.h:42
 TGTextEditor.h:43
 TGTextEditor.h:44
 TGTextEditor.h:45
 TGTextEditor.h:46
 TGTextEditor.h:47
 TGTextEditor.h:48
 TGTextEditor.h:49
 TGTextEditor.h:50
 TGTextEditor.h:51
 TGTextEditor.h:52
 TGTextEditor.h:53
 TGTextEditor.h:54
 TGTextEditor.h:55
 TGTextEditor.h:56
 TGTextEditor.h:57
 TGTextEditor.h:58
 TGTextEditor.h:59
 TGTextEditor.h:60
 TGTextEditor.h:61
 TGTextEditor.h:62
 TGTextEditor.h:63
 TGTextEditor.h:64
 TGTextEditor.h:65
 TGTextEditor.h:66
 TGTextEditor.h:67
 TGTextEditor.h:68
 TGTextEditor.h:69
 TGTextEditor.h:70
 TGTextEditor.h:71
 TGTextEditor.h:72
 TGTextEditor.h:73
 TGTextEditor.h:74
 TGTextEditor.h:75
 TGTextEditor.h:76
 TGTextEditor.h:77
 TGTextEditor.h:78
 TGTextEditor.h:79
 TGTextEditor.h:80
 TGTextEditor.h:81
 TGTextEditor.h:82
 TGTextEditor.h:83
 TGTextEditor.h:84
 TGTextEditor.h:85
 TGTextEditor.h:86
 TGTextEditor.h:87
 TGTextEditor.h:88
 TGTextEditor.h:89
 TGTextEditor.h:90
 TGTextEditor.h:91
 TGTextEditor.h:92
 TGTextEditor.h:93
 TGTextEditor.h:94
 TGTextEditor.h:95
 TGTextEditor.h:96
 TGTextEditor.h:97
 TGTextEditor.h:98
 TGTextEditor.h:99
 TGTextEditor.h:100
 TGTextEditor.h:101
 TGTextEditor.h:102
 TGTextEditor.h:103
 TGTextEditor.h:104
 TGTextEditor.h:105
 TGTextEditor.h:106