Logo ROOT   6.10/09
Reference Guide
TTVLVContainer.h
Go to the documentation of this file.
1 // @(#)root/treeviewer:$Id$
2 //Author : Andrei Gheata 16/08/00
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_TTVLVContainer
13 #define ROOT_TTVLVContainer
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TTVLVEntry //
19 // //
20 // This class represent entries that goes into the TreeViewer //
21 // listview container. It subclasses TGLVEntry and adds 2 //
22 // data members: the item true name and the alias //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "TGListView.h"
27 
28 
29 class TGLabel;
30 class TGTextEntry;
31 class TTreeViewer;
32 class TGToolTip;
33 class TTVLVEntry;
34 class TTVLVContainer;
35 
36 class TGItemContext : public TObject {
37 
38 protected:
39  TTVLVEntry *fItem; // pointer to associated item
40 public:
41  TGItemContext();
42  virtual ~TGItemContext() { }
43  void Associate(TTVLVEntry *item) { fItem = item; }
44  virtual void Delete(Option_t *) { } // *MENU*
45  void Draw(Option_t *option=""); // *MENU*
46  void EditExpression(); // *MENU*
47  void Empty(); // *MENU*
48  void RemoveItem(); // *MENU*
49  void Scan(); // *MENU*
50  void SetExpression(const char *name="", const char *alias="-empty-", Bool_t cut=kFALSE); // *MENU*
51 
52  ClassDef(TGItemContext, 0) // Context menu for TTVLVEntry
53 };
54 
55 
56 class TTVLVEntry : public TGLVEntry {
57 
58 protected:
59  TTVLVContainer *fContainer; // container to whom this item belongs
60  TString fTrueName; // name for this entry
61  TString fAlias; // alias for this entry
62  TString fConvName; // name converted into true expressions
63  TGToolTip *fTip; // tool tip associated with item
64  Bool_t fIsCut; // flag for cut type items
65  TGItemContext *fContext; // associated context menu
66 
67 protected:
68  Bool_t FullConverted();
69 
70 public:
71  TTVLVEntry(const TGWindow *p,
72  const TGPicture *bigpic, const TGPicture *smallpic,
73  TGString *name, TGString **subnames, EListViewMode ViewMode);
74  virtual ~TTVLVEntry();
75  const char *ConvertAliases();
76  void CopyItem(TTVLVEntry *dest);
77  const char *GetAlias() {return fAlias.Data();}
78  TTVLVContainer *GetContainer() {return fContainer;}
79  TGItemContext *GetContext() {return fContext;}
80  const char *GetConvName() {return fConvName;}
81  const char *GetTrueName() {return fTrueName.Data();}
82  TGToolTip *GetTip() {return fTip;}
83  virtual Bool_t HandleCrossing(Event_t *event);
84  Bool_t HasAlias();
85  Bool_t IsCut() {return fIsCut;}
86  void PrependTilde();
87  void SetCutType(Bool_t type=kFALSE);
88  void SetItemName(const char* name);
89  void SetAlias(const char* alias) {fAlias = alias;}
90  void SetExpression(const char* name, const char* alias, Bool_t cutType=kFALSE);
91  void SetTrueName(const char* name) {fTrueName = name;}
92  void SetToolTipText(const char *text, Long_t delayms = 1000);
93  void SetSmallPic(const TGPicture *spic);
94  void Empty();
95 
96  ClassDef(TTVLVEntry,0) // Item that goes into the tree list view widget
97 };
98 
99 
100 //////////////////////////////////////////////////////////////////////////
101 // //
102 // TTVLVContainer //
103 // //
104 // This class represent the list view container for the //
105 // TreeView class. It is a TGLVContainer with item dragging //
106 // capabilities for the TTVLVEntry objects inside //
107 // //
108 //////////////////////////////////////////////////////////////////////////
109 
111 
112 friend class TGClient;
113 
114 private:
115  Cursor_t fCursor; // current cursor
116  Cursor_t fDefaultCursor; // default cursor
117  TGListView *fListView; // associated list view
118  TTreeViewer *fViewer; // pointer to tree viewer
119  TList *fExpressionList; // list of user defined expression widgets
120 public:
121  TTVLVContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame);
122  virtual ~TTVLVContainer();
123  virtual void AddThisItem(TTVLVEntry *item)
124  { AddFrame(item, fItemLayout); item->SetColumns(fCpos, fJmode); }
125  const char *Cut();
126  void EmptyAll(); // empty all items of expression type
127  TTVLVEntry *ExpressionItem(Int_t index);
128  TList *ExpressionList();
129  const char *Ex();
130  const char *Ey();
131  const char *Ez();
132  TTreeViewer *GetViewer() {return fViewer;}
133  void SetListView(TGListView *lv) {fListView = lv;}
134  void SetViewer(TTreeViewer *viewer) {fViewer = viewer;}
135  void RemoveNonStatic();
136  const char *ScanList();
137  void SelectItem(const char* name);
138  virtual Bool_t HandleButton(Event_t *event);
139  virtual Bool_t HandleMotion(Event_t *event);
140 
141  ClassDef(TTVLVContainer,0) // A dragging-capable LVContainer
142 };
143 
144 
145 //////////////////////////////////////////////////////////////////////////
146 // //
147 // TGSelectBox //
148 // //
149 // This class represent a specialized expression editor for //
150 // TTVLVEntry 'true name' and 'alias' data members. //
151 // It is a singleton in order to be able to use it for several //
152 // expressions. //
153 // //
154 //////////////////////////////////////////////////////////////////////////
155 
157 
158 private:
159  TTreeViewer *fViewer; // pointer to tree viewer
160  TGLabel *fLabel; // label
161  TTVLVEntry *fEntry; // edited expression entry
162  TGTextEntry *fTe; // text entry box
163  TGLabel *fLabelAlias; // alias label
164  TGTextEntry *fTeAlias; // alias text entry
165  TString fOldAlias; // old alias for edited entry
166  TGLayoutHints *fLayout; // layout hints for widgets inside
167  TGLayoutHints *fBLayout; // layout for cancel button
168  TGLayoutHints *fBLayout1; // layout for close button
169  TGHorizontalFrame *fBf; // buttons frame
170  TGTextButton *fDONE; // close button
171  TGTextButton *fCANCEL; // cancel button
172 
173 protected:
174  static TGSelectBox *fgInstance;// pointer to this select box
175 
176 public:
177  TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w = 10, UInt_t h = 10);
178  virtual ~TGSelectBox();
179  virtual void CloseWindow();
180  TTVLVEntry *EditedEntry() {return fEntry;}
181  void GrabPointer();
182  void SetLabel(const char* title);
183  void SetEntry(TTVLVEntry *entry);
184  void SaveText();
185  void InsertText(const char* text);
186  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
187  Bool_t ValidateAlias();
188 
189  static TGSelectBox *GetInstance();
190 
191  ClassDef(TGSelectBox,0) // TreeView dialog widget
192 };
193 
194 #endif
const char * GetTrueName()
void Empty()
Empty item.
const char * GetAlias()
TGLayoutHints * fBLayout1
RooCmdArg Cut(const char *cutSpec)
virtual ~TGItemContext()
const char Option_t
Definition: RtypesCore.h:62
TTVLVEntry * EditedEntry()
Cursor_t fDefaultCursor
void Scan()
Scan item.
TH1 * h
Definition: legend2.C:5
Handle_t Cursor_t
Definition: GuiTypes.h:33
TGListView * fListView
void SetListView(TGListView *lv)
EListViewMode
Definition: TGListView.h:39
TString fConvName
Basic string class.
Definition: TString.h:129
void SetTrueName(const char *name)
TList * fExpressionList
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TTVLVContainer * GetContainer()
TGToolTip * fTip
TGLabel * fLabel
TGItemContext * GetContext()
TString fOldAlias
TGHorizontalFrame * fBf
void RemoveItem()
Remove item.
static TGSelectBox * fgInstance
#define ClassDef(name, id)
Definition: Rtypes.h:297
empty object used as context menu support for TGLVTreeEntries.
TGLabel * fLabelAlias
virtual void AddThisItem(TTVLVEntry *item)
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features...
Definition: TTreeViewer.h:56
TGToolTip * GetTip()
TGLayoutHints * fBLayout
void SetExpression(const char *name="", const char *alias="-empty-", Bool_t cut=kFALSE)
Set item expression.
virtual void Delete(Option_t *)
Delete this object.
TGItemContext()
Constructor.
A doubly linked list.
Definition: TList.h:43
Bool_t fIsCut
TGTextButton * fCANCEL
TGTextEntry * fTe
void Associate(TTVLVEntry *item)
This class represent entries that goes into the TreeViewer listview container.
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void SetColumns(Int_t *cpos, Int_t *jmode)
Definition: TGListView.h:121
const Bool_t kFALSE
Definition: RtypesCore.h:92
void SetAlias(const char *alias)
void SetViewer(TTreeViewer *viewer)
long Long_t
Definition: RtypesCore.h:50
TTreeViewer * fViewer
TText * text
int type
Definition: TGX11.cxx:120
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
TGTextEntry * fTeAlias
TTreeViewer * fViewer
TTVLVContainer * fContainer
TGLayoutHints * fLayout
TString fAlias
TTVLVEntry * fItem
Mother of all ROOT objects.
Definition: TObject.h:37
#define dest(otri, vertexptr)
Definition: triangle.c:1040
const char * GetConvName()
TLine * lv
Definition: textalign.C:5
void Draw(Option_t *option="")
Draw item.
TTreeViewer * GetViewer()
Bool_t IsCut()
TGTextButton * fDONE
TString fTrueName
int main(int argc, char **argv)
TTVLVEntry * fEntry
This class represent the list view container for the.
void EditExpression()
Edit expression.
const char * Data() const
Definition: TString.h:347
TGItemContext * fContext