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