Logo ROOT  
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
TGedEditor::GetEditorTabInfo
virtual TGedTabInfo * GetEditorTabInfo(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:197
TGedEditor::Show
virtual void Show()
Show editor.
Definition: TGedEditor.cxx:425
TGedEditor::fTab
TGTab * fTab
Definition: TGedEditor.h:53
c
#define c(i)
Definition: RSha256.hxx:119
TGWindow
Definition: TGWindow.h:31
e
#define e(i)
Definition: RSha256.hxx:121
TGMainFrame
Definition: TGFrame.h:444
TGedEditor::RecursiveRemove
virtual void RecursiveRemove(TObject *obj)
Remove references to fModel in case the fModel is being deleted.
Definition: TGedEditor.cxx:485
TGedNameFrame
Definition: TGedFrame.h:92
f
#define f(i)
Definition: RSha256.hxx:122
TGedEditor::SetModel
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:350
TGedEditor::fCreatedTabs
TList fCreatedTabs
Definition: TGedEditor.h:55
TGedEditor::fGlobal
Bool_t fGlobal
Definition: TGedEditor.h:63
TGedEditor::Hide
virtual void Hide()
Hide editor. The editor is put into non-active state.
Definition: TGedEditor.cxx:471
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
Int_t
int Int_t
Definition: RtypesCore.h:45
TGedEditor::GlobalClosed
virtual void GlobalClosed()
Delete global editor if no canvas exists.
Definition: TGedEditor.cxx:287
TGedEditor::fClass
TClass * fClass
Definition: TGedEditor.h:62
TList.h
TGedEditor::CloseWindow
virtual void CloseWindow()
Called when closed via WM close button. Calls Hide().
Definition: TGedEditor.cxx:234
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGedEditor::fTabContainer
TGCompositeFrame * fTabContainer
Definition: TGedEditor.h:57
TGTabElement
Definition: TGTab.h:130
TGedEditor::ReinitWorkspace
void ReinitWorkspace()
Clears windows in editor tab.
Definition: TGedEditor.cxx:244
bool
TGedEditor::fVisibleTabs
TList fVisibleTabs
Definition: TGedEditor.h:56
TGedEditor::GetPad
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:89
TGedEditor::ConfigureGedFrames
void ConfigureGedFrames(Bool_t objChaged)
Call SetModel in class editors.
Definition: TGedEditor.cxx:616
TGedEditor::SetCanvas
virtual void SetCanvas(TCanvas *c)
Change connection to another canvas.
Definition: TGedEditor.cxx:332
TGedEditor::fModel
TObject * fModel
Definition: TGedEditor.h:59
TVirtualPadEditor.h
TGedEditor::DisconnectFromCanvas
virtual void DisconnectFromCanvas()
Disconnect this editor from the Selected signal of fCanvas.
Definition: TGedEditor.cxx:323
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGFrame.h
TGedEditor::fgFrameCreator
static TGedEditor * fgFrameCreator
Definition: TGedEditor.h:69
TGedEditor::GetTab
TGTab * GetTab() const
Definition: TGedEditor.h:84
TGedEditor::GetEditorTab
virtual TGCompositeFrame * GetEditorTab(const char *name)
Find or create tab with name.
Definition: TGedEditor.cxx:189
TGTab
Definition: TGTab.h:62
TGedEditor::ActivateEditor
void ActivateEditor(TClass *cl, Bool_t recurse)
Searches for GedFrames for given class.
Definition: TGedEditor.cxx:504
TGedEditor::~TGedEditor
virtual ~TGedEditor()
Editor destructor.
Definition: TGedEditor.cxx:143
TGedEditor::GetCanvas
virtual TCanvas * GetCanvas() const
Definition: TGedEditor.h:88
TGedEditor::ConnectToCanvas
virtual void ConnectToCanvas(TCanvas *c)
Connect this editor to the Selected signal of canvas 'c'.
Definition: TGedEditor.cxx:314
TGedEditor::operator=
TGedEditor & operator=(const TGedEditor &)
unsigned int
TGedEditor::fCanvas
TCanvas * fCanvas
Definition: TGedEditor.h:61
TGedEditor::CreateNameFrame
virtual TGedFrame * CreateNameFrame(const TGWindow *parent, const char *tab_name)
Virtual function for creation of top name-frame in each tab.
Definition: TGedEditor.cxx:660
TGedEditor::PrintFrameStat
void PrintFrameStat()
Print contents of fFrameMap.
Definition: TGedEditor.cxx:668
TGedFrame
Definition: TGedFrame.h:33
TGedEditor::GetModel
virtual TObject * GetModel() const
Definition: TGedEditor.h:90
TGedEditor::fCan
TGCanvas * fCan
Definition: TGedEditor.h:52
TGedEditor::ActivateEditors
void ActivateEditors(TList *bcl, Bool_t recurse)
Searches GedFrames for classes in the given list.
Definition: TGedEditor.cxx:565
TGedEditor::fExclMap
TMap fExclMap
Definition: TGedEditor.h:49
TVirtualPad
Definition: TVirtualPad.h:50
TGedEditor::SetGlobal
virtual void SetGlobal(Bool_t global)
Set editor global.
Definition: TGedEditor.cxx:272
TCanvas
Definition: TCanvas.h:23
TGedEditor::fFrameMap
TMap fFrameMap
Definition: TGedEditor.h:48
TGedEditor::IsGlobal
virtual Bool_t IsGlobal() const
Definition: TGedEditor.h:96
TClass
Definition: TClass.h:80
TGedEditor::ExcludeClassEditor
void ExcludeClassEditor(TClass *cl, Bool_t recurse=kFALSE)
Exclude editor for class cl from current construction.
Definition: TGedEditor.cxx:579
TGedEditor::InsertGedFrame
void InsertGedFrame(TGedFrame *f)
Insert GedFrame in fGedFrames list according to priorities.
Definition: TGedEditor.cxx:593
TObject
Definition: TObject.h:37
TGedEditor::GetTGCanvas
TGCanvas * GetTGCanvas() const
Definition: TGedEditor.h:83
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMap.h
TGedEditor::TGedEditor
TGedEditor(const TGedEditor &)
name
char name[80]
Definition: TGX11.cxx:110
TGedEditor::fGedFrames
TList fGedFrames
Definition: TGedEditor.h:50
TVirtualPadEditor
Definition: TVirtualPadEditor.h:27
TGedEditor::GetFrameCreator
static TGedEditor * GetFrameCreator()
Returns TGedEditor that currently creates TGedFrames.
Definition: TGedEditor.cxx:86
TGedEditor::SetFrameCreator
static void SetFrameCreator(TGedEditor *e)
Set the TGedEditor that currently creates TGedFrames.
Definition: TGedEditor.cxx:94
TGCompositeFrame
Definition: TGFrame.h:324
TGCanvas
Definition: TGCanvas.h:202
TGedEditor
Definition: TGedEditor.h:41
TList
Definition: TList.h:44
TGedEditor::Update
virtual void Update(TGedFrame *frame=0)
Virtual method that is called on any change in the dependent frames.
Definition: TGedEditor.cxx:178
TGedEditor::GlobalSetModel
virtual void GlobalSetModel(TVirtualPad *, TObject *, Int_t)
Set canvas to global editor.
Definition: TGedEditor.cxx:296
TGedEditor::fPad
TVirtualPad * fPad
Definition: TGedEditor.h:60
TMap
Definition: TMap.h:40