Logo ROOT  
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:
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();}
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();
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 
121 public:
122  TTVLVContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame);
123  virtual ~TTVLVContainer();
124  virtual void AddThisItem(TTVLVEntry *item)
125  { AddFrame(item, fItemLayout); item->SetColumns(fCpos, fJmode); }
126  const char *Cut();
127  void EmptyAll(); // empty all items of expression type
130  const char *Ex();
131  const char *Ey();
132  const char *Ez();
135  void SetViewer(TTreeViewer *viewer) {fViewer = viewer;}
136  void RemoveNonStatic();
137  const char *ScanList();
138  void SelectItem(const char* name);
139  virtual Bool_t HandleButton(Event_t *event);
140  virtual Bool_t HandleMotion(Event_t *event);
141 
142  ClassDef(TTVLVContainer,0) // A dragging-capable LVContainer
143 };
144 
145 
146 //////////////////////////////////////////////////////////////////////////
147 // //
148 // TGSelectBox //
149 // //
150 // This class represent a specialized expression editor for //
151 // TTVLVEntry 'true name' and 'alias' data members. //
152 // It is a singleton in order to be able to use it for several //
153 // expressions. //
154 // //
155 //////////////////////////////////////////////////////////////////////////
156 
158 
159 private:
160  TTreeViewer *fViewer; ///< Pointer to tree viewer
161  TGLabel *fLabel; ///< Label
162  TTVLVEntry *fEntry; ///< Edited expression entry
163  TGTextEntry *fTe; ///< Text entry box
164  TGLabel *fLabelAlias; ///< Alias label
165  TGTextEntry *fTeAlias; ///< Alias text entry
166  TString fOldAlias; ///< Old alias for edited entry
167  TGLayoutHints *fLayout; ///< Layout hints for widgets inside
168  TGLayoutHints *fBLayout; ///< Layout for cancel button
169  TGLayoutHints *fBLayout1; ///< Layout for close button
170  TGHorizontalFrame *fBf; ///< Buttons frame
171  TGTextButton *fDONE; ///< Close button
172  TGTextButton *fCANCEL; ///< Cancel button
173 
174 protected:
175  static TGSelectBox *fgInstance;// pointer to this select box
176 
177 public:
178  TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w = 10, UInt_t h = 10);
179  virtual ~TGSelectBox();
180  virtual void CloseWindow();
182  void GrabPointer();
183  void SetLabel(const char* title);
184  void SetEntry(TTVLVEntry *entry);
185  void SaveText();
186  void InsertText(const char* text);
187  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
189 
190  static TGSelectBox *GetInstance();
191 
192  ClassDef(TGSelectBox,0) // TreeView dialog widget
193 };
194 
195 #endif
TTVLVContainer::RemoveNonStatic
void RemoveNonStatic()
Remove all non-static items from the list view, except expressions.
Definition: TTVLVContainer.cxx:609
EListViewMode
EListViewMode
Definition: TGListView.h:21
TGSelectBox::SaveText
void SaveText()
Save the edited entry true name and alias.
Definition: TTVLVContainer.cxx:777
TGSelectBox::fBLayout1
TGLayoutHints * fBLayout1
Layout for close button.
Definition: TTVLVContainer.h:169
TGTransientFrame
Defines transient windows that typically are used for dialogs windows.
Definition: TGFrame.h:498
TGSelectBox::fEntry
TTVLVEntry * fEntry
Edited expression entry.
Definition: TTVLVContainer.h:162
TTVLVContainer::TTVLVContainer
TTVLVContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame)
TGLVContainer constructor.
Definition: TTVLVContainer.cxx:312
TGSelectBox
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
Definition: TTVLVContainer.h:157
TTVLVContainer::fDefaultCursor
Cursor_t fDefaultCursor
Default cursor.
Definition: TTVLVContainer.h:116
TGSelectBox::InsertText
void InsertText(const char *text)
Insert text in text entry.
Definition: TTVLVContainer.cxx:825
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
TTVLVEntry::SetToolTipText
void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this item.
Definition: TTVLVContainer.cxx:275
Option_t
const char Option_t
Definition: RtypesCore.h:66
dest
#define dest(otri, vertexptr)
Definition: triangle.c:1040
TGSelectBox::~TGSelectBox
virtual ~TGSelectBox()
TGSelectBox destructor.
Definition: TTVLVContainer.cxx:720
TGSelectBox::SetEntry
void SetEntry(TTVLVEntry *entry)
Connect one entry.
Definition: TTVLVContainer.cxx:814
TTVLVEntry::SetAlias
void SetAlias(const char *alias)
Definition: TTVLVContainer.h:89
TString::Data
const char * Data() const
Definition: TString.h:369
TTVLVContainer::Ey
const char * Ey()
Return the expression on Y.
Definition: TTVLVContainer.cxx:394
TTVLVContainer
This class represent the list view container for the TreeView class.
Definition: TTVLVContainer.h:110
TGLabel
This class handles GUI labels.
Definition: TGLabel.h:24
TTVLVEntry::GetConvName
const char * GetConvName()
Definition: TTVLVContainer.h:80
TGTextButton
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
TGLVContainer::fJmode
Int_t * fJmode
Definition: TGListView.h:188
TGLVEntry
Definition: TGListView.h:36
TTVLVEntry::fContainer
TTVLVContainer * fContainer
Container to whom this item belongs.
Definition: TTVLVContainer.h:59
Int_t
int Int_t
Definition: RtypesCore.h:45
TGSelectBox::fLabel
TGLabel * fLabel
Label.
Definition: TTVLVContainer.h:161
TGSelectBox::fOldAlias
TString fOldAlias
Old alias for edited entry.
Definition: TTVLVContainer.h:166
TGLVContainer::fCpos
Int_t * fCpos
Definition: TGListView.h:187
TGItemContext::~TGItemContext
virtual ~TGItemContext()
Definition: TTVLVContainer.h:42
TTVLVEntry::IsCut
Bool_t IsCut()
Definition: TTVLVContainer.h:85
TTVLVEntry::PrependTilde
void PrependTilde()
Prepend a ~ to item alias.
Definition: TTVLVContainer.cxx:203
TGItemContext
Empty object used as context menu support for TGLVTreeEntries.
Definition: TTVLVContainer.h:36
TGToolTip
Definition: TGToolTip.h:24
TGSelectBox::EditedEntry
TTVLVEntry * EditedEntry()
Definition: TTVLVContainer.h:181
TTreeViewer
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features.
Definition: TTreeViewer.h:54
TGItemContext::TGItemContext
TGItemContext()
Constructor.
Definition: TTVLVContainer.cxx:33
TTVLVContainer::ExpressionList
TList * ExpressionList()
Return the list of user-defined expressions.
Definition: TTVLVContainer.cxx:361
TGHorizontalFrame
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:386
TGItemContext::Associate
void Associate(TTVLVEntry *item)
Definition: TTVLVContainer.h:43
TGSelectBox::GetInstance
static TGSelectBox * GetInstance()
Return the pointer to the instantiated singleton.
Definition: TTVLVContainer.cxx:747
TGSelectBox::TGSelectBox
TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w=10, UInt_t h=10)
TGSelectBox constructor.
Definition: TTVLVContainer.cxx:664
TGSelectBox::GrabPointer
void GrabPointer()
Just focus the cursor inside.
Definition: TTVLVContainer.cxx:755
TGSelectBox::fLabelAlias
TGLabel * fLabelAlias
Alias label.
Definition: TTVLVContainer.h:164
TString
Basic string class.
Definition: TString.h:136
TTVLVEntry::fAlias
TString fAlias
Alias for this entry.
Definition: TTVLVContainer.h:61
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TTVLVContainer::AddThisItem
virtual void AddThisItem(TTVLVEntry *item)
Definition: TTVLVContainer.h:124
TGListView
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition: TGListView.h:115
text
TText * text
Definition: entrylist_figure1.C:10
bool
TGSelectBox::fBf
TGHorizontalFrame * fBf
Buttons frame.
Definition: TTVLVContainer.h:170
Cursor_t
Handle_t Cursor_t
Cursor handle.
Definition: GuiTypes.h:34
TTVLVEntry::SetSmallPic
void SetSmallPic(const TGPicture *spic)
Set small picture.
Definition: TTVLVContainer.cxx:288
lv
auto * lv
Definition: textalign.C:5
TGSelectBox::fTe
TGTextEntry * fTe
Text entry box.
Definition: TTVLVContainer.h:163
TTVLVContainer::SetViewer
void SetViewer(TTreeViewer *viewer)
Definition: TTVLVContainer.h:135
TGSelectBox::fgInstance
static TGSelectBox * fgInstance
Definition: TTVLVContainer.h:175
TTVLVContainer::fExpressionList
TList * fExpressionList
List of user defined expression widgets.
Definition: TTVLVContainer.h:119
TTVLVEntry::GetAlias
const char * GetAlias()
Definition: TTVLVContainer.h:77
TTVLVEntry::FullConverted
Bool_t FullConverted()
Return true if converted name is alias free.
Definition: TTVLVContainer.cxx:153
TTVLVEntry::SetCutType
void SetCutType(Bool_t type=kFALSE)
Set cut type.
Definition: TTVLVContainer.cxx:228
TTVLVContainer::Ez
const char * Ez()
Return the expression on Z.
Definition: TTVLVContainer.cxx:408
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TTVLVEntry::Empty
void Empty()
Clear all names and alias.
Definition: TTVLVContainer.cxx:263
TTVLVEntry::TTVLVEntry
TTVLVEntry(const TGWindow *p, const TGPicture *bigpic, const TGPicture *smallpic, TGString *name, TGString **subnames, EListViewMode ViewMode)
TTVLVEntry constructor.
Definition: TTVLVContainer.cxx:97
h
#define h(i)
Definition: RSha256.hxx:106
TTVLVEntry::HasAlias
Bool_t HasAlias()
Check if alias name is not empty.
Definition: TTVLVContainer.cxx:194
TGTextEntry
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
TGSelectBox::SetLabel
void SetLabel(const char *title)
Set label of selection box.
Definition: TTVLVContainer.cxx:769
TTVLVContainer::SelectItem
void SelectItem(const char *name)
Select an item.
Definition: TTVLVContainer.cxx:626
TTVLVContainer::fViewer
TTreeViewer * fViewer
Pointer to tree viewer.
Definition: TTVLVContainer.h:118
TGItemContext::RemoveItem
void RemoveItem()
Remove item.
Definition: TTVLVContainer.cxx:65
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
Long_t
long Long_t
Definition: RtypesCore.h:54
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGSelectBox::fBLayout
TGLayoutHints * fBLayout
Layout for cancel button.
Definition: TTVLVContainer.h:168
TGLVContainer::fItemLayout
TGLayoutHints * fItemLayout
Definition: TGListView.h:185
TTVLVEntry::fTrueName
TString fTrueName
Name for this entry.
Definition: TTVLVContainer.h:60
TGItemContext::Scan
void Scan()
Scan item.
Definition: TTVLVContainer.cxx:73
TGSelectBox::fTeAlias
TGTextEntry * fTeAlias
Alias text entry.
Definition: TTVLVContainer.h:165
TTVLVContainer::EmptyAll
void EmptyAll()
Clear all names and aliases for expression type items.
Definition: TTVLVContainer.cxx:588
TGSelectBox::ValidateAlias
Bool_t ValidateAlias()
Return true if edited alias is not a leading string of other expression aliases.
Definition: TTVLVContainer.cxx:877
TTVLVEntry::SetItemName
void SetItemName(const char *name)
Redraw this entry with new name.
Definition: TTVLVContainer.cxx:212
TTVLVEntry::fContext
TGItemContext * fContext
Associated context menu.
Definition: TTVLVContainer.h:65
TGSelectBox::fCANCEL
TGTextButton * fCANCEL
Cancel button.
Definition: TTVLVContainer.h:172
TTVLVEntry::GetTrueName
const char * GetTrueName()
Definition: TTVLVContainer.h:81
TTVLVContainer::GetViewer
TTreeViewer * GetViewer()
Definition: TTVLVContainer.h:133
TTVLVEntry::ConvertAliases
const char * ConvertAliases()
Convert all aliases into true names.
Definition: TTVLVContainer.cxx:127
TTVLVEntry::GetContext
TGItemContext * GetContext()
Definition: TTVLVContainer.h:79
unsigned int
TGSelectBox::CloseWindow
virtual void CloseWindow()
Close the select box.
Definition: TTVLVContainer.cxx:738
TGItemContext::Empty
void Empty()
Empty item.
Definition: TTVLVContainer.cxx:57
TGSelectBox::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Message interpreter.
Definition: TTVLVContainer.cxx:835
TGLVEntry::SetColumns
virtual void SetColumns(Int_t *cpos, Int_t *jmode)
Definition: TGListView.h:103
TTVLVEntry::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TTVLVContainer.cxx:180
TTVLVContainer::Cut
const char * Cut()
Return the cut entry.
Definition: TTVLVContainer.cxx:334
TTVLVEntry::fConvName
TString fConvName
Name converted into true expressions.
Definition: TTVLVContainer.h:62
TTVLVEntry::SetTrueName
void SetTrueName(const char *name)
Definition: TTVLVContainer.h:91
TGLVContainer
Definition: TGListView.h:178
TGSelectBox::fViewer
TTreeViewer * fViewer
Pointer to tree viewer.
Definition: TTVLVContainer.h:160
TGItemContext::fItem
TTVLVEntry * fItem
Definition: TTVLVContainer.h:39
TTVLVContainer::SetListView
void SetListView(TGListView *lv)
Definition: TTVLVContainer.h:134
TTVLVEntry
This class represent entries that goes into the TreeViewer listview container.
Definition: TTVLVContainer.h:56
TTVLVEntry::GetContainer
TTVLVContainer * GetContainer()
Definition: TTVLVContainer.h:78
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TTVLVEntry::~TTVLVEntry
virtual ~TTVLVEntry()
TTVLVEntry destructor.
Definition: TTVLVContainer.cxx:118
Event_t
Event structure.
Definition: GuiTypes.h:174
name
char name[80]
Definition: TGX11.cxx:110
TGItemContext::SetExpression
void SetExpression(const char *name="", const char *alias="-empty-", Bool_t cut=kFALSE)
Set item expression.
Definition: TTVLVContainer.cxx:82
TTVLVContainer::ScanList
const char * ScanList()
Return the cut entry.
Definition: TTVLVContainer.cxx:422
TGSelectBox::fLayout
TGLayoutHints * fLayout
Layout hints for widgets inside.
Definition: TTVLVContainer.h:167
TGItemContext::Delete
virtual void Delete(Option_t *)
Delete this object.
Definition: TTVLVContainer.h:44
TTVLVEntry::GetTip
TGToolTip * GetTip()
Definition: TTVLVContainer.h:82
TTVLVContainer::fCursor
Cursor_t fCursor
Current cursor.
Definition: TTVLVContainer.h:115
TTVLVContainer::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in container.
Definition: TTVLVContainer.cxx:436
type
int type
Definition: TGX11.cxx:121
TTVLVContainer::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events.
Definition: TTVLVContainer.cxx:545
TGItemContext::Draw
void Draw(Option_t *option="")
Draw item.
Definition: TTVLVContainer.cxx:41
TGListView.h
TTVLVContainer::~TTVLVContainer
virtual ~TTVLVContainer()
TGLVContainer destructor.
Definition: TTVLVContainer.cxx:326
TTVLVEntry::fTip
TGToolTip * fTip
Tool tip associated with item.
Definition: TTVLVContainer.h:63
TGCompositeFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TTVLVEntry::fIsCut
Bool_t fIsCut
Flag for cut type items.
Definition: TTVLVContainer.h:64
TTVLVContainer::ExpressionItem
TTVLVEntry * ExpressionItem(Int_t index)
Return the expression item at specific position.
Definition: TTVLVContainer.cxx:348
TGClient
Window client.
Definition: TGClient.h:37
TTVLVEntry::CopyItem
void CopyItem(TTVLVEntry *dest)
Copy this item's name and alias to an other.
Definition: TTVLVContainer.cxx:169
TList
A doubly linked list.
Definition: TList.h:44
TTVLVEntry::SetExpression
void SetExpression(const char *name, const char *alias, Bool_t cutType=kFALSE)
Set the true name, alias and type of the expression, then refresh it.
Definition: TTVLVContainer.cxx:243
TGSelectBox::fDONE
TGTextButton * fDONE
Close button.
Definition: TTVLVContainer.h:171
main
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
TGItemContext::EditExpression
void EditExpression()
Edit expression.
Definition: TTVLVContainer.cxx:49
TTVLVContainer::Ex
const char * Ex()
Return the expression on X.
Definition: TTVLVContainer.cxx:380
TTVLVContainer::fListView
TGListView * fListView
Associated list view.
Definition: TTVLVContainer.h:117