Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
41 class TGedEditor : public TVirtualPadEditor, public TGMainFrame
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 
69  static TGedEditor *fgFrameCreator;
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