Logo ROOT   6.10/09
Reference Guide
TGedEditor.h
Go to the documentation of this file.
1 // @(#)root/ged:$Id$
2 // Author: Marek Biskup, Ilka Antcheva 02/12/2003
3 
4 /*************************************************************************
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  *************************************************************************/
11 
12 #ifndef ROOT_TGedEditor
13 #define ROOT_TGedEditor
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TGedEditor //
18 // //
19 // Editor is a composite frame that contains GUI for editting objects //
20 // in a canvas. It looks for the class ROOT_classname + 'Editor'. //
21 // //
22 // It connects to a Canvas and listens for selected objects //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "TGFrame.h"
27 #include "TVirtualPadEditor.h"
28 #include "TList.h"
29 #include "TMap.h"
30 
31 class TCanvas;
32 class TGCanvas;
33 class TGTab;
34 class TGTabElement;
35 class TVirtualPad;
36 class TGedFrame;
37 class TGedNameFrame;
38 
39 class TGedTabInfo;
40 
42 {
43 private:
44  TGedEditor(const TGedEditor&); // Not implemented
45  TGedEditor& operator=(const TGedEditor&); // Not implemented
46 
47 protected:
48  TMap fFrameMap; //global map of available frames
49  TMap fExclMap; //map of excluded editors for selected model
50  TList fGedFrames; //list visible of frames
51 
52  TGCanvas *fCan; //provides scroll bars
53  TGTab *fTab; //tab widget holding the editor
54 
55  TList fCreatedTabs; //list of created tabs
56  TList fVisibleTabs; //list ofcurrently used tabs
57  TGCompositeFrame *fTabContainer; //main tab container
58 
59  TObject *fModel; //selected object
60  TVirtualPad *fPad; //selected pad
61  TCanvas *fCanvas; //canvas related to the editor
62  TClass *fClass; //class of the selected object
63  Bool_t fGlobal; //true if editor is global
64 
65  void ConfigureGedFrames(Bool_t objChaged);
66 
67  virtual TGedFrame* CreateNameFrame(const TGWindow* parent, const char* tab_name);
68 
70 
71 public:
72  TGedEditor(TCanvas* canvas = 0, UInt_t width = 175, UInt_t height = 20);
73  virtual ~TGedEditor();
74 
75  void PrintFrameStat();
76  virtual void Update(TGedFrame* frame = 0);
77  void ReinitWorkspace();
78  void ActivateEditor (TClass* cl, Bool_t recurse);
79  void ActivateEditors(TList* bcl, Bool_t recurse);
80  void ExcludeClassEditor(TClass* cl, Bool_t recurse = kFALSE);
81  void InsertGedFrame(TGedFrame* f);
82 
83  TGCanvas* GetTGCanvas() const { return fCan; }
84  TGTab* GetTab() const { return fTab; }
85  virtual TGCompositeFrame* GetEditorTab(const char* name);
86  virtual TGedTabInfo* GetEditorTabInfo(const char* name);
87 
88  virtual TCanvas* GetCanvas() const { return fCanvas; }
89  virtual TVirtualPad* GetPad() const { return fPad; }
90  virtual TObject* GetModel() const { return fModel; }
91 
92 
93  virtual void CloseWindow();
94  virtual void ConnectToCanvas(TCanvas *c);
95  virtual void DisconnectFromCanvas();
96  virtual Bool_t IsGlobal() const { return fGlobal; }
97  virtual void Hide();
98  virtual void GlobalClosed();
99  virtual void SetCanvas(TCanvas *c);
100  virtual void SetGlobal(Bool_t global);
101  virtual void GlobalSetModel(TVirtualPad *, TObject *, Int_t);
102  virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event, Bool_t force=kFALSE);
103  virtual void Show();
104  virtual void RecursiveRemove(TObject* obj);
105 
106  static TGedEditor* GetFrameCreator();
107  static void SetFrameCreator(TGedEditor* e);
108 
109  ClassDef(TGedEditor,0) // ROOT graphics editor
110 };
111 
112 #endif
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:188
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:89
Definition: TGTab.h:62
void InsertGedFrame(TGedFrame *f)
Insert GedFrame in fGedFrames list according to priorities.
Definition: TGedEditor.cxx:592
void ActivateEditor(TClass *cl, Bool_t recurse)
Searches for GedFrames for given class.
Definition: TGedEditor.cxx:503
TGCanvas * fCan
Definition: TGedEditor.h:52
void ActivateEditors(TList *bcl, Bool_t recurse)
Searches GedFrames for classes in the given list.
Definition: TGedEditor.cxx:564
TMap fExclMap
Definition: TGedEditor.h:49
TGTab * GetTab() const
Definition: TGedEditor.h:84
TMap fFrameMap
Definition: TGedEditor.h:48
int Int_t
Definition: RtypesCore.h:41
static TGedEditor * fgFrameCreator
Definition: TGedEditor.h:69
bool Bool_t
Definition: RtypesCore.h:59
void ExcludeClassEditor(TClass *cl, Bool_t recurse=kFALSE)
Exclude editor for class cl from current construction.
Definition: TGedEditor.cxx:578
virtual TGedFrame * CreateNameFrame(const TGWindow *parent, const char *tab_name)
Virtual function for creation of top name-frame in each tab.
Definition: TGedEditor.cxx:659
static TGedEditor * GetFrameCreator()
Returns TGedEditor that currently creates TGedFrames.
Definition: TGedEditor.cxx:85
void PrintFrameStat()
Print contents of fFrameMap.
Definition: TGedEditor.cxx:667
static void SetFrameCreator(TGedEditor *e)
Set the TGedEditor that currently creates TGedFrames.
Definition: TGedEditor.cxx:93
virtual ~TGedEditor()
Editor destructor.
Definition: TGedEditor.cxx:142
TList fGedFrames
Definition: TGedEditor.h:50
virtual void ConnectToCanvas(TCanvas *c)
Connect this editor to the Selected signal of canvas 'c'.
Definition: TGedEditor.cxx:313
TCanvas * fCanvas
Definition: TGedEditor.h:61
TGedEditor & operator=(const TGedEditor &)
virtual Bool_t IsGlobal() const
Definition: TGedEditor.h:96
virtual TObject * GetModel() const
Definition: TGedEditor.h:90
#define ClassDef(name, id)
Definition: Rtypes.h:297
TGedEditor(const TGedEditor &)
virtual void SetGlobal(Bool_t global)
Set editor global.
Definition: TGedEditor.cxx:271
TGCanvas * GetTGCanvas() const
Definition: TGedEditor.h:83
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:49
virtual TGedTabInfo * GetEditorTabInfo(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:196
TGTab * fTab
Definition: TGedEditor.h:53
A doubly linked list.
Definition: TList.h:43
virtual void Update(TGedFrame *frame=0)
Virtual method that is called on any change in the dependent frames.
Definition: TGedEditor.cxx:177
TList fCreatedTabs
Definition: TGedEditor.h:55
unsigned int UInt_t
Definition: RtypesCore.h:42
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
virtual void RecursiveRemove(TObject *obj)
Remove references to fModel in case the fModel is being deleted.
Definition: TGedEditor.cxx:484
TVirtualPad * fPad
Definition: TGedEditor.h:60
Bool_t fGlobal
Definition: TGedEditor.h:63
virtual void GlobalSetModel(TVirtualPad *, TObject *, Int_t)
Set canvas to global editor.
Definition: TGedEditor.cxx:295
virtual void Show()
Show editor.
Definition: TGedEditor.cxx:424
const Bool_t kFALSE
Definition: RtypesCore.h:92
The Canvas class.
Definition: TCanvas.h:31
double f(double x)
void ReinitWorkspace()
Clears windows in editor tab.
Definition: TGedEditor.cxx:243
TClass * fClass
Definition: TGedEditor.h:62
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
virtual void Hide()
Hide editor. The editor is put into non-active state.
Definition: TGedEditor.cxx:470
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
Abstract base class used by ROOT graphics editor.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
Definition: TGedEditor.cxx:349
void ConfigureGedFrames(Bool_t objChaged)
Call SetModel in class editors.
Definition: TGedEditor.cxx:615
Mother of all ROOT objects.
Definition: TObject.h:37
TObject * fModel
Definition: TGedEditor.h:59
virtual void CloseWindow()
Called when closed via WM close button. Calls Hide().
Definition: TGedEditor.cxx:233
virtual void GlobalClosed()
Delete global editor if no canvas exists.
Definition: TGedEditor.cxx:286
virtual void DisconnectFromCanvas()
Disconnect this editor from the Selected signal of fCanvas.
Definition: TGedEditor.cxx:322
TGCompositeFrame * fTabContainer
Definition: TGedEditor.h:57
TList fVisibleTabs
Definition: TGedEditor.h:56
virtual void SetCanvas(TCanvas *c)
Change connection to another canvas.
Definition: TGedEditor.cxx:331
virtual TCanvas * GetCanvas() const
Definition: TGedEditor.h:88