Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
29class TGLabel;
30class TGTextEntry;
31class TTreeViewer;
32class TGToolTip;
33class TTVLVEntry;
34class TTVLVContainer;
35
36class TGItemContext : public TObject {
37
38protected:
39 TTVLVEntry *fItem; // pointer to associated item
40public:
42 ~TGItemContext() override { }
43 void Associate(TTVLVEntry *item) { fItem = item; }
44 void Delete(Option_t *) override { } // *MENU*
45 void Draw(Option_t *option="") override; // *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 cut=false); // *MENU*
51
52 ClassDefOverride(TGItemContext, 0) // Context menu for TTVLVEntry
53};
54
55
56class TTVLVEntry : public TGLVEntry {
57
58protected:
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 fIsCut; ///< Flag for cut type items
65 TGItemContext *fContext; ///< Associated context menu
66
67protected:
68 bool FullConverted();
69
70public:
71 TTVLVEntry(const TGWindow *p,
72 const TGPicture *bigpic, const TGPicture *smallpic,
73 TGString *name, TGString **subnames, EListViewMode ViewMode);
74 ~TTVLVEntry() override;
75 const char *ConvertAliases();
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 bool HandleCrossing(Event_t *event) override;
84 bool HasAlias();
85 bool IsCut() {return fIsCut;}
86 void PrependTilde();
87 void SetCutType(bool type=false);
88 void SetItemName(const char* name);
89 void SetAlias(const char* alias) {fAlias = alias;}
90 void SetExpression(const char* name, const char* alias, bool cutType=false);
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 ClassDefOverride(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
112friend class TGClient;
113
114private:
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
121public:
123 ~TTVLVContainer() override;
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();
134 void SetListView(TGListView *lv) override {fListView = lv;}
135 void SetViewer(TTreeViewer *viewer) {fViewer = viewer;}
136 void RemoveNonStatic();
137 const char *ScanList();
138 void SelectItem(const char* name);
139 bool HandleButton(Event_t *event) override;
140 bool HandleMotion(Event_t *event) override;
141
142 ClassDefOverride(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
159private:
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
174protected:
175 static TGSelectBox *fgInstance;// pointer to this select box
176
177public:
178 TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w = 10, UInt_t h = 10);
179 ~TGSelectBox() override;
180 void CloseWindow() override;
182 void GrabPointer();
183 void SetLabel(const char* title);
184 void SetEntry(TTVLVEntry *entry);
185 void SaveText();
186 void InsertText(const char* text);
187 bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
188 bool ValidateAlias();
189
190 static TGSelectBox *GetInstance();
191
192 ClassDefOverride(TGSelectBox,0) // TreeView dialog widget
193};
194
195#endif
@ kSunkenFrame
Definition GuiTypes.h:383
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
int main()
Definition Prototype.cxx:12
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:75
long Long_t
Definition RtypesCore.h:54
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
EListViewMode
Definition TGListView.h:21
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition TGX11.cxx:110
Window client.
Definition TGClient.h:37
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
Empty object used as context menu support for TGLVTreeEntries.
~TGItemContext() override
void EditExpression()
Edit expression.
void SetExpression(const char *name="", const char *alias="-empty-", bool cut=false)
Set item expression.
void Empty()
Empty item.
TGItemContext()
Constructor.
void RemoveItem()
Remove item.
TTVLVEntry * fItem
void Scan()
Scan item.
void Associate(TTVLVEntry *item)
void Delete(Option_t *) override
Delete this object.
TGLayoutHints * fItemLayout
item layout hints
Definition TGListView.h:185
Int_t * fCpos
position of sub names
Definition TGListView.h:187
Int_t * fJmode
alignment of sub names
Definition TGListView.h:188
virtual void SetColumns(Int_t *cpos, Int_t *jmode)
Definition TGListView.h:103
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition TGListView.h:115
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
bool ValidateAlias()
Return true if edited alias is not a leading string of other expression aliases.
TGHorizontalFrame * fBf
Buttons frame.
bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Message interpreter.
TGLayoutHints * fBLayout1
Layout for close button.
TTVLVEntry * EditedEntry()
TGTextEntry * fTeAlias
Alias text entry.
void CloseWindow() override
Close the select box.
void InsertText(const char *text)
Insert text in text entry.
TGLayoutHints * fBLayout
Layout for cancel button.
TGLabel * fLabelAlias
Alias label.
TGLayoutHints * fLayout
Layout hints for widgets inside.
TGTextButton * fCANCEL
Cancel button.
void GrabPointer()
Just focus the cursor inside.
~TGSelectBox() override
TGSelectBox destructor.
void SetLabel(const char *title)
Set label of selection box.
void SetEntry(TTVLVEntry *entry)
Connect one entry.
static TGSelectBox * fgInstance
TTVLVEntry * fEntry
Edited expression entry.
static TGSelectBox * GetInstance()
Return the pointer to the instantiated singleton.
TGLabel * fLabel
Label.
TString fOldAlias
Old alias for edited entry.
TGTextEntry * fTe
Text entry box.
TTreeViewer * fViewer
Pointer to tree viewer.
TGTextButton * fDONE
Close button.
void SaveText()
Save the edited entry true name and alias.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
ROOT GUI Window base class.
Definition TGWindow.h:23
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
This class represent the list view container for the TreeView class.
Cursor_t fDefaultCursor
Default cursor.
void SelectItem(const char *name)
Select an item.
void SetViewer(TTreeViewer *viewer)
TList * fExpressionList
List of user defined expression widgets.
TList * ExpressionList()
Return the list of user-defined expressions.
const char * Cut()
Return the cut entry.
TTreeViewer * GetViewer()
const char * Ez()
Return the expression on Z.
TGListView * fListView
Associated list view.
const char * Ey()
Return the expression on Y.
const char * ScanList()
Return the cut entry.
TTreeViewer * fViewer
Pointer to tree viewer.
Cursor_t fCursor
Current cursor.
virtual void AddThisItem(TTVLVEntry *item)
~TTVLVContainer() override
TGLVContainer destructor.
TTVLVEntry * ExpressionItem(Int_t index)
Return the expression item at specific position.
void SetListView(TGListView *lv) override
bool HandleMotion(Event_t *event) override
Handle mouse motion events.
const char * Ex()
Return the expression on X.
bool HandleButton(Event_t *event) override
Handle mouse button event in container.
void EmptyAll()
Clear all names and aliases for expression type items.
void RemoveNonStatic()
Remove all non-static items from the list view, except expressions.
This class represent entries that goes into the TreeViewer listview container.
TGItemContext * GetContext()
void SetSmallPic(const TGPicture *spic)
Set small picture.
~TTVLVEntry() override
TTVLVEntry destructor.
bool HasAlias()
Check if alias name is not empty.
TTVLVContainer * GetContainer()
TTVLVContainer * fContainer
Container to whom this item belongs.
TGToolTip * fTip
Tool tip associated with item.
bool fIsCut
Flag for cut type items.
TGToolTip * GetTip()
void SetCutType(bool type=false)
Set cut type.
void SetAlias(const char *alias)
void SetExpression(const char *name, const char *alias, bool cutType=false)
Set the true name, alias and type of the expression, then refresh it.
void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this item.
void SetTrueName(const char *name)
TGItemContext * fContext
Associated context menu.
bool HandleCrossing(Event_t *event) override
Handle mouse crossing event.
const char * ConvertAliases()
Convert all aliases into true names.
const char * GetConvName()
void CopyItem(TTVLVEntry *dest)
Copy this item's name and alias to an other.
const char * GetAlias()
TString fConvName
Name converted into true expressions.
TString fTrueName
Name for this entry.
TString fAlias
Alias for this entry.
void Empty()
Clear all names and alias.
bool FullConverted()
Return true if converted name is alias free.
void SetItemName(const char *name)
Redraw this entry with new name.
const char * GetTrueName()
void PrependTilde()
Prepend a ~ to item alias.
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features.
Definition TTreeViewer.h:54
Event structure.
Definition GuiTypes.h:174
th1 Draw()
TLine lv
Definition textalign.C:5