Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveBrowser.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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_TEveBrowser
13 #define ROOT_TEveBrowser
14 
15 #include "TEveElement.h"
16 
17 #include "TContextMenu.h"
18 #include "TGListTree.h"
19 #include "TRootBrowser.h"
20 #include "TString.h"
21 
22 
23 class TGFileBrowser;
24 class TGSplitter;
25 
26 class TEveGedEditor;
27 
28 
29 class TEveListTreeItem : public TGListTreeItem
30 {
31 private:
32  TEveListTreeItem(const TEveListTreeItem&); // not implemented
33  TEveListTreeItem& operator=(const TEveListTreeItem&); // not implemented
34 
35 protected:
36  TEveElement* fElement;
37 
38  void NotSupported(const char* func) const;
39 
40 public:
41  TEveListTreeItem(TEveElement* el) : TGListTreeItem(), fElement(el) {}
42  virtual ~TEveListTreeItem() {}
43 
44  virtual Bool_t IsActive() const { return fElement->GetSelectedLevel() != 0; }
45  virtual Pixel_t GetActiveColor() const;
46  virtual void SetActive(Bool_t) { NotSupported("SetActive"); }
47 
48  virtual const char *GetText() const { return fElement->GetElementName(); }
49  virtual Int_t GetTextLength() const { return strlen(fElement->GetElementName()); }
50  virtual const char *GetTipText() const { return fElement->GetElementTitle(); }
51  virtual Int_t GetTipTextLength() const { return strlen(fElement->GetElementTitle()); }
52  virtual void SetText(const char *) { NotSupported("SetText"); }
53  virtual void SetTipText(const char *) { NotSupported("SetTipText"); }
54 
55  virtual void SetUserData(void *, Bool_t=kFALSE) { NotSupported("SetUserData"); }
56  virtual void *GetUserData() const { return fElement; }
57 
58  virtual const TGPicture*GetPicture() const { return fElement->GetListTreeIcon(fOpen); }
59  virtual const TGPicture*GetCheckBoxPicture() const { return fElement->GetListTreeCheckBoxIcon(); }
60 
61  virtual void SetPictures(const TGPicture*, const TGPicture*) { NotSupported("SetUserData"); }
62  virtual void SetCheckBoxPictures(const TGPicture*, const TGPicture*) { NotSupported("SetUserData"); }
63 
64  virtual void SetCheckBox(Bool_t=kTRUE) { NotSupported("SetCheckBox"); }
65  virtual Bool_t HasCheckBox() const { return kTRUE; }
66  virtual void CheckItem(Bool_t=kTRUE) { printf("TEveListTreeItem::CheckItem - to be ignored ... all done via signal Checked().\n"); }
67  virtual void Toggle();
68  virtual Bool_t IsChecked() const { return fElement->GetRnrState(); }
69 
70  // Propagation of checked-state form children to parents. Not needed, ignore.
71 
72  // Item coloration (underline + minibox)
73  virtual Bool_t HasColor() const { return fElement->HasMainColor(); }
74  virtual Color_t GetColor() const { return fElement->GetMainColor(); }
75  virtual void SetColor(Color_t) { NotSupported("SetColor"); }
76  virtual void ClearColor() { NotSupported("ClearColor"); }
77 
78  ClassDef(TEveListTreeItem,0); // Special llist-tree-item for Eve.
79 };
80 
81 
82 class TEveGListTreeEditorFrame : public TGMainFrame
83 {
84  TEveGListTreeEditorFrame(const TEveGListTreeEditorFrame&); // Not implemented
85  TEveGListTreeEditorFrame& operator=(const TEveGListTreeEditorFrame&); // Not implemented
86 
87  friend class TEveManager;
88 
89 protected:
90  TGCompositeFrame *fFrame;
91  TGCompositeFrame *fLTFrame;
92 
93  TGCanvas *fLTCanvas;
94  TGListTree *fListTree;
95  TGSplitter *fSplitter;
96  TEveGedEditor *fEditor;
97 
98  TContextMenu *fCtxMenu;
99 
100  Bool_t fSignalsConnected;
101 
102  static TString fgEditorClass;
103 
104 public:
105  TEveGListTreeEditorFrame(const TGWindow* p=0, Int_t width=250, Int_t height=700);
106  virtual ~TEveGListTreeEditorFrame();
107 
108  void ConnectSignals();
109  void DisconnectSignals();
110 
111  void ReconfToHorizontal();
112  void ReconfToVertical();
113 
114  TGListTree* GetListTree() const { return fListTree; }
115  TEveGedEditor* GetEditor() const { return fEditor; }
116 
117  void ItemBelowMouse(TGListTreeItem *entry, UInt_t mask);
118  void ItemClicked(TGListTreeItem *entry, Int_t btn, UInt_t mask, Int_t x, Int_t y);
119  void ItemDblClicked(TGListTreeItem* item, Int_t btn);
120  void ItemKeyPress(TGListTreeItem *entry, UInt_t keysym, UInt_t mask);
121 
122  static void SetEditorClass(const char* edclass);
123 
124  ClassDef(TEveGListTreeEditorFrame, 0); // Composite GUI frame for parallel display of a TGListTree and TEveGedEditor.
125 };
126 
127 // ----------------------------------------------------------------
128 
129 class TEveBrowser : public TRootBrowser
130 {
131  TEveBrowser(const TEveBrowser&); // Not implemented
132  TEveBrowser& operator=(const TEveBrowser&); // Not implemented
133 
134 protected:
135  void SetupCintExport(TClass* cl);
136  void CalculateReparentXY(TGObject* parent, Int_t& x, Int_t& y);
137 
138  TGFileBrowser *fFileBrowser;
139  TGPopupMenu *fEvePopup;
140  TGPopupMenu *fSelPopup;
141  TGPopupMenu *fHilPopup;
142 
143 public:
144  TEveBrowser(UInt_t w, UInt_t h);
145  virtual ~TEveBrowser() { CloseTabs(); }
146 
147  virtual void ReallyDelete();
148  virtual void CloseTab(Int_t id);
149  virtual void CloseWindow();
150 
151  void InitPlugins(Option_t *opt="FI");
152 
153  TGFileBrowser* MakeFileBrowser(Bool_t make_default=kFALSE);
154  TGFileBrowser* GetFileBrowser() const;
155  void SetFileBrowser(TGFileBrowser* b);
156 
157  void EveMenu(Int_t id);
158 
159  // Some getters missing in TRootBrowser
160  TGMenuBar* GetMenuBar() const { return fMenuBar; }
161  TGHorizontalFrame* GetTopMenuFrame() const { return fTopMenuFrame; }
162 
163  void HideBottomTab();
164 
165  void SanitizeTabCounts();
166 
167  ClassDef(TEveBrowser, 0); // Specialization of TRootBrowser for Eve.
168 };
169 
170 #endif