TGTextEditor.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGTextEditor.h 23115 2008-04-10 13:35:37Z rdm $
00002 // Author: Bertrand Bellenot   20/06/06
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGTextEditor
00013 #define ROOT_TGTextEditor
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGTextEditor                                                         //
00019 //                                                                      //
00020 //////////////////////////////////////////////////////////////////////////
00021 
00022 #ifndef ROOT_TGFrame
00023 #include "TGFrame.h"
00024 #endif
00025 #ifndef ROOT_TGTextEdit
00026 #include "TGTextEdit.h"
00027 #endif
00028 
00029 class TGComboBox;
00030 class TGLabel;
00031 class TGLayoutHints;
00032 class TGMenuBar;
00033 class TGPopupMenu;
00034 class TGStatusBar;
00035 class TGText;
00036 class TGTextBuffer;
00037 class TGTextEntry;
00038 class TGToolBar;
00039 class TMacro;
00040 class TString;
00041 class TTimer;
00042 
00043 class TGTextEditor : public TGMainFrame {
00044 
00045 protected:
00046 
00047    TTimer           *fTimer;              // for statusbar and toolbar update
00048    TGStatusBar      *fStatusBar;          // for file name, line and col number
00049    TGToolBar        *fToolBar;            // toolbar with common tool buttons
00050    TGTextEdit       *fTextEdit;           // text edit widget
00051    TGLabel          *fLabel;              // "command" label
00052    TGComboBox       *fComboCmd;           // commands combobox
00053    TGTextEntry      *fCommand;            // command text entry widget
00054    TGTextBuffer     *fCommandBuf;         // command text buffer
00055    TGLayoutHints    *fMenuBarLayout;      // used for the menubar
00056    TGLayoutHints    *fMenuBarItemLayout;  // used for for menubar items
00057    TGMenuBar        *fMenuBar;            // editor's menu bar
00058    TGPopupMenu      *fMenuFile;           // "File" menu entry
00059    TGPopupMenu      *fMenuEdit;           // "Edit" menu entry
00060    TGPopupMenu      *fMenuSearch;         // "Search" menu entry
00061    TGPopupMenu      *fMenuTools;          // "Tools" menu entry
00062    TGPopupMenu      *fMenuHelp;           // "Help" menu entry
00063    Bool_t            fExiting;            // true if editor is closing
00064    Bool_t            fTextChanged;        // true if text has changed
00065    TString           fFilename;           // name of the opened file
00066    TMacro           *fMacro;              // pointer on the opened macro
00067    virtual void      Build();
00068 
00069 public:
00070    TGTextEditor(const char *filename = 0, const TGWindow *p = 0,
00071                 UInt_t w = 900, UInt_t h = 600);
00072    TGTextEditor(TMacro *macro, const TGWindow *p = 0, UInt_t w = 0,
00073                 UInt_t h = 0);
00074    virtual ~TGTextEditor();
00075 
00076    void           ClearText();
00077    Bool_t         LoadBuffer(const char *buf) { return fTextEdit->LoadBuffer(buf); }
00078    void           LoadFile(char *fname = 0);
00079    void           SaveFile(const char *fname);
00080    Bool_t         SaveFileAs();
00081    void           PrintText();
00082    void           Search(Bool_t ret);
00083    void           Goto();
00084    void           About();
00085    void           DataChanged() { fTextChanged = kTRUE; }
00086    void           DataDropped(char *fname);
00087    Int_t          IsSaved();
00088    void           CompileMacro();
00089    void           ExecuteMacro();
00090    void           InterruptMacro();
00091    void           SetText(TGText *text) { fTextEdit->SetText(text); }
00092    void           AddText(TGText *text) { fTextEdit->AddText(text); }
00093    void           AddLine(const char *string) { fTextEdit->AddLine(string); }
00094    void           AddLineFast(const char *string) { fTextEdit->AddLineFast(string); }
00095    TGText        *GetText() const { return fTextEdit->GetText(); }
00096 
00097    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00098    virtual Bool_t HandleKey(Event_t *event);
00099    virtual Bool_t HandleTimer(TTimer *t);
00100    virtual void   CloseWindow();
00101    virtual void   DeleteWindow();
00102 
00103    ClassDef(TGTextEditor,0)  // Simple text editor using TGTextEdit widget
00104 };
00105 
00106 #endif

Generated on Tue Jul 5 14:20:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1