Logo ROOT   6.08/07
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 #ifndef ROOT_TGFrame
27 #include "TGFrame.h"
28 #endif
29 #ifndef ROOT_TVirtualPadEditor
30 #include "TVirtualPadEditor.h"
31 #endif
32 #ifndef ROOT_TList
33 #include "TList.h"
34 #endif
35 #ifndef ROOT_TMap
36 #include "TMap.h"
37 #endif
38 
39 class TCanvas;
40 class TGCanvas;
41 class TGTab;
42 class TGTabElement;
43 class TVirtualPad;
44 class TGedFrame;
45 class TGedNameFrame;
46 
47 class TGedTabInfo;
48 
50 {
51 private:
52  TGedEditor(const TGedEditor&); // Not implemented
53  TGedEditor& operator=(const TGedEditor&); // Not implemented
54 
55 protected:
56  TMap fFrameMap; //global map of available frames
57  TMap fExclMap; //map of excluded editors for selected model
58  TList fGedFrames; //list visible of frames
59 
60  TGCanvas *fCan; //provides scroll bars
61  TGTab *fTab; //tab widget holding the editor
62 
63  TList fCreatedTabs; //list of created tabs
64  TList fVisibleTabs; //list ofcurrently used tabs
65  TGCompositeFrame *fTabContainer; //main tab container
66 
67  TObject *fModel; //selected object
68  TVirtualPad *fPad; //selected pad
69  TCanvas *fCanvas; //canvas related to the editor
70  TClass *fClass; //class of the selected object
71  Bool_t fGlobal; //true if editor is global
72 
73  void ConfigureGedFrames(Bool_t objChaged);
74 
75  virtual TGedFrame* CreateNameFrame(const TGWindow* parent, const char* tab_name);
76 
78 
79 public:
80  TGedEditor(TCanvas* canvas = 0, UInt_t width = 175, UInt_t height = 20);
81  virtual ~TGedEditor();
82 
83  void PrintFrameStat();
84  virtual void Update(TGedFrame* frame = 0);
85  void ReinitWorkspace();
86  void ActivateEditor (TClass* cl, Bool_t recurse);
87  void ActivateEditors(TList* bcl, Bool_t recurse);
88  void ExcludeClassEditor(TClass* cl, Bool_t recurse = kFALSE);
89  void InsertGedFrame(TGedFrame* f);
90 
91  TGCanvas* GetTGCanvas() const { return fCan; }
92  TGTab* GetTab() const { return fTab; }
93  virtual TGCompositeFrame* GetEditorTab(const char* name);
94  virtual TGedTabInfo* GetEditorTabInfo(const char* name);
95 
96  virtual TCanvas* GetCanvas() const { return fCanvas; }
97  virtual TVirtualPad* GetPad() const { return fPad; }
98  virtual TObject* GetModel() const { return fModel; }
99 
100 
101  virtual void CloseWindow();
102  virtual void ConnectToCanvas(TCanvas *c);
103  virtual void DisconnectFromCanvas();
104  virtual Bool_t IsGlobal() const { return fGlobal; }
105  virtual void Hide();
106  virtual void GlobalClosed();
107  virtual void SetCanvas(TCanvas *c);
108  virtual void SetGlobal(Bool_t global);
109  virtual void GlobalSetModel(TVirtualPad *, TObject *, Int_t);
110  virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event);
111  virtual void Show();
112  virtual void RecursiveRemove(TObject* obj);
113 
114  static TGedEditor* GetFrameCreator();
115  static void SetFrameCreator(TGedEditor* e);
116 
117  ClassDef(TGedEditor,0) // ROOT graphics editor
118 };
119 
120 #endif
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:188
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:97
Definition: TGTab.h:66
return c
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:60
void ActivateEditors(TList *bcl, Bool_t recurse)
Searches GedFrames for classes in the given list.
Definition: TGedEditor.cxx:564
TMap fExclMap
Definition: TGedEditor.h:57
TGTab * GetTab() const
Definition: TGedEditor.h:92
TMap fFrameMap
Definition: TGedEditor.h:56
int Int_t
Definition: RtypesCore.h:41
static TGedEditor * fgFrameCreator
Definition: TGedEditor.h:77
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void ExcludeClassEditor(TClass *cl, Bool_t recurse=kFALSE)
Exclude editor for class cl from current construction.
Definition: TGedEditor.cxx:578
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event)
Activate object editors according to the selected object.
Definition: TGedEditor.cxx:349
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:58
virtual void ConnectToCanvas(TCanvas *c)
Connect this editor to the Selected signal of canvas 'c'.
Definition: TGedEditor.cxx:313
TCanvas * fCanvas
Definition: TGedEditor.h:69
TGedEditor & operator=(const TGedEditor &)
virtual Bool_t IsGlobal() const
Definition: TGedEditor.h:104
virtual TObject * GetModel() const
Definition: TGedEditor.h:98
#define ClassDef(name, id)
Definition: Rtypes.h:254
TGedEditor(const TGedEditor &)
virtual void SetGlobal(Bool_t global)
Set editor global.
Definition: TGedEditor.cxx:271
TGCanvas * GetTGCanvas() const
Definition: TGedEditor.h:91
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
virtual TGedTabInfo * GetEditorTabInfo(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:196
TGTab * fTab
Definition: TGedEditor.h:61
A doubly linked list.
Definition: TList.h:47
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:63
unsigned int UInt_t
Definition: RtypesCore.h:42
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
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:68
Bool_t fGlobal
Definition: TGedEditor.h:71
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
The Canvas class.
Definition: TCanvas.h:41
double f(double x)
void ReinitWorkspace()
Clears windows in editor tab.
Definition: TGedEditor.cxx:243
TClass * fClass
Definition: TGedEditor.h:70
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
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.
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:67
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
char name[80]
Definition: TGX11.cxx:109
TGCompositeFrame * fTabContainer
Definition: TGedEditor.h:65
TList fVisibleTabs
Definition: TGedEditor.h:64
virtual void SetCanvas(TCanvas *c)
Change connection to another canvas.
Definition: TGedEditor.cxx:331
virtual TCanvas * GetCanvas() const
Definition: TGedEditor.h:96