Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGTextEditor.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gui:$Id$
0002 // Author: Bertrand Bellenot   20/06/06
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGTextEditor
0013 #define ROOT_TGTextEditor
0014 
0015 
0016 #include "TGFrame.h"
0017 #include "TGTextEdit.h"
0018 
0019 class TGComboBox;
0020 class TGLabel;
0021 class TGLayoutHints;
0022 class TGMenuBar;
0023 class TGPopupMenu;
0024 class TGStatusBar;
0025 class TGText;
0026 class TGTextBuffer;
0027 class TGTextEntry;
0028 class TGToolBar;
0029 class TMacro;
0030 class TString;
0031 class TTimer;
0032 
0033 class TGTextEditor : public TGMainFrame {
0034 
0035 protected:
0036 
0037    TTimer           *fTimer;              ///< for statusbar and toolbar update
0038    TGStatusBar      *fStatusBar;          ///< for file name, line and col number
0039    TGToolBar        *fToolBar;            ///< toolbar with common tool buttons
0040    TGTextEdit       *fTextEdit;           ///< text edit widget
0041    TGLabel          *fLabel;              ///< "command" label
0042    TGComboBox       *fComboCmd;           ///< commands combobox
0043    TGTextEntry      *fCommand;            ///< command text entry widget
0044    TGTextBuffer     *fCommandBuf;         ///< command text buffer
0045    TGLayoutHints    *fMenuBarLayout;      ///< used for the menubar
0046    TGLayoutHints    *fMenuBarItemLayout;  ///< used for for menubar items
0047    TGMenuBar        *fMenuBar;            ///< editor's menu bar
0048    TGPopupMenu      *fMenuFile;           ///< "File" menu entry
0049    TGPopupMenu      *fMenuEdit;           ///< "Edit" menu entry
0050    TGPopupMenu      *fMenuSearch;         ///< "Search" menu entry
0051    TGPopupMenu      *fMenuTools;          ///< "Tools" menu entry
0052    TGPopupMenu      *fMenuHelp;           ///< "Help" menu entry
0053    Bool_t            fExiting;            ///< true if editor is closing
0054    Bool_t            fTextChanged;        ///< true if text has changed
0055    TString           fFilename;           ///< name of the opened file
0056    TMacro           *fMacro;              ///< pointer on the opened macro
0057    virtual void      Build();
0058 
0059 public:
0060    TGTextEditor(const char *filename = nullptr, const TGWindow *p = nullptr,
0061                 UInt_t w = 900, UInt_t h = 600);
0062    TGTextEditor(TMacro *macro, const TGWindow *p = nullptr, UInt_t w = 0,
0063                 UInt_t h = 0);
0064    ~TGTextEditor() override;
0065 
0066    void           ClearText();
0067    Bool_t         LoadBuffer(const char *buf) { return fTextEdit->LoadBuffer(buf); }
0068    void           LoadFile(const char *fname = nullptr);
0069    void           SaveFile(const char *fname);
0070    Bool_t         SaveFileAs();
0071    void           PrintText();
0072    void           Search(Bool_t ret);
0073    void           Goto();
0074    void           About();
0075    void           DataChanged();
0076    void           DataDropped(char *fname);
0077    Int_t          IsSaved();
0078    void           CompileMacro();
0079    void           ExecuteMacro();
0080    void           InterruptMacro();
0081    void           SetText(TGText *text) { fTextEdit->SetText(text); }
0082    void           AddText(TGText *text) { fTextEdit->AddText(text); }
0083    void           AddLine(const char *string) { fTextEdit->AddLine(string); }
0084    void           AddLineFast(const char *string) { fTextEdit->AddLineFast(string); }
0085    TGText        *GetText() const { return fTextEdit->GetText(); }
0086 
0087    Bool_t         ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0088    Bool_t         HandleKey(Event_t *event) override;
0089    Bool_t         HandleTimer(TTimer *t) override;
0090    void           CloseWindow() override;
0091    void           DeleteWindow() override;
0092 
0093    ClassDefOverride(TGTextEditor,0)  // Simple text editor using TGTextEdit widget
0094 };
0095 
0096 #endif