Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTVLVContainer.cxx
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#include "TTVLVContainer.h"
13#include "TTreeViewer.h"
14#include "TGPicture.h"
15#include "TGLabel.h"
16#include "TGButton.h"
17#include "TGTextEntry.h"
18#include "TGToolTip.h"
19#include "TList.h"
20#include "TVirtualX.h"
21#include "snprintf.h"
22
23
25
26/** \class TGItemContext
27empty object used as context menu support for TGLVTreeEntries.
28*/
29
30////////////////////////////////////////////////////////////////////////////////
31/// Constructor
32
34{
35 fItem = 0;
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// Draw item
40
42{
44}
45
46////////////////////////////////////////////////////////////////////////////////
47/// Edit expression
48
50{
52}
53
54////////////////////////////////////////////////////////////////////////////////
55/// Empty item
56
58{
59 fItem->Empty();
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// Remove item
64
66{
68}
69
70////////////////////////////////////////////////////////////////////////////////
71/// Scan item
72
74{
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// Set item expression
81
82void TGItemContext::SetExpression(const char *name, const char *alias, Bool_t cut)
83{
84 fItem->SetExpression(name, alias, cut);
85}
86
88
89/** \class TTVLVEntry
90This class represent entries that goes into the TreeViewer
91listview container. It subclasses TGLVEntry and adds 2
92data members: the item true name and the alias.
93*/
94
95////////////////////////////////////////////////////////////////////////////////
96/// TTVLVEntry constructor.
97
99 const TGPicture *bigpic, const TGPicture *smallpic,
100 TGString *name, TGString **subnames,
101 EListViewMode ViewMode)
102 :TGLVEntry(p, bigpic, smallpic, name, subnames, ViewMode)
103{
104 // both alias and true name are initialized to name
106
107 fTip = 0;
108 fIsCut = kFALSE;
109 fTrueName = name->GetString();
110 fContext = new TGItemContext();
111 fContext->Associate(this);
112
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// TTVLVEntry destructor
118
120{
121 if (fTip) delete fTip;
122 delete fContext;
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Convert all aliases into true names
127
129{
132 TString start(fConvName);
133 TIter next(list);
134 TTVLVEntry* item;
135 while (!FullConverted()) {
136 next.Reset();
137 start = fConvName;
138 while ((item=(TTVLVEntry*)next())) {
139 if (item != this)
140 fConvName.ReplaceAll(item->GetAlias(), item->GetTrueName());
141 }
142 if (fConvName == start) {
143 //the following line is deadcode reported by coverity because item=0
144 //if (item) Warning(item->GetAlias(), "Cannot convert aliases for this expression.");
145 return(fConvName.Data());
146 }
147 }
148 return(fConvName.Data());
149}
150
151////////////////////////////////////////////////////////////////////////////////
152/// Return true if converted name is alias free
153
155{
157 TIter next(list);
158 TTVLVEntry* item;
159 while ((item=(TTVLVEntry*)next())) {
160 if (item != this) {
161 if (fConvName.Contains(item->GetAlias())) return kFALSE;
162 }
163 }
164 return kTRUE;
165}
166
167////////////////////////////////////////////////////////////////////////////////
168/// Copy this item's name and alias to an other.
169
171{
172 if (!dest) return;
174 TString alias = dest->GetAlias();
175 if (!alias.BeginsWith("~") && !alias.Contains("empty")) dest->PrependTilde();
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Handle mouse crossing event.
180
182{
183 if (fTip) {
184 if (event->fType == kEnterNotify)
185 fTip->Reset();
186 else
187 fTip->Hide();
188 }
189 return kTRUE;
190}
191
192////////////////////////////////////////////////////////////////////////////////
193/// Check if alias name is not empty.
194
196{
197 if (fAlias.Length()) return kTRUE;
198 return kFALSE;
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Prepend a ~ to item alias
203
205{
206 fAlias = "~" + fAlias;
208}
209
210////////////////////////////////////////////////////////////////////////////////
211/// Redraw this entry with new name
212
214{
215 if (fItemName) delete fItemName;
216 fItemName = new TGString(name);
217 Int_t max_ascent, max_descent;
219 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
220 fTHeight = max_ascent + max_descent;
221 gVirtualX->ClearWindow(fId);
223 fClient->NeedRedraw(this);
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// Set cut type
228
230{
231 if (fIsCut && type) return;
232 if (!fIsCut && !type) return;
233 if (type) {
234 SetSmallPic(fClient->GetPicture("selection_t.xpm"));
235 SetToolTipText("Selection expression. Drag to scissors to activate");
236 } else
237 SetSmallPic(fClient->GetPicture("expression_t.xpm"));
238 fIsCut = type;
239}
240
241////////////////////////////////////////////////////////////////////////////////
242/// Set the true name, alias and type of the expression, then refresh it
243
244void TTVLVEntry::SetExpression(const char* name, const char* alias, Bool_t cutType)
245{
246 SetItemName(alias);
247 SetAlias(alias);
249 ULong_t *itemType = (ULong_t *) GetUserData();
250 if (*itemType & TTreeViewer::kLTPackType) {
251 if (strlen(name))
252 SetSmallPic(fClient->GetPicture("pack_t.xpm"));
253 else
254 SetSmallPic(fClient->GetPicture("pack-empty_t.xpm"));
255 }
256 if ((*itemType & TTreeViewer::kLTDragType) && strlen(name) && !fIsCut)
257 SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
258 if (*itemType & TTreeViewer::kLTDragType) SetCutType(cutType);
259}
260
261////////////////////////////////////////////////////////////////////////////////
262/// Clear all names and alias
263
265{
266 SetExpression("","-empty-");
267 ULong_t *itemType = (ULong_t *) GetUserData();
268 if (itemType && (*itemType & TTreeViewer::kLTDragType))
269 SetToolTipText("User-defined expression/cut. Double-click to edit");
270}
271
272////////////////////////////////////////////////////////////////////////////////
273/// Set tool tip text associated with this item. The delay is in
274/// milliseconds (minimum 250). To remove tool tip call method with text = 0
275
276void TTVLVEntry::SetToolTipText(const char *text, Long_t delayms)
277{
278 if (fTip) {
279 delete fTip;
280 fTip = 0;
281 }
282
283 if (text && strlen(text))
284 fTip = new TGToolTip(fClient->GetRoot(), this, text, delayms);
285}
286////////////////////////////////////////////////////////////////////////////////
287/// Set small picture
288
290{
291 const TGPicture *cspic = fSmallPic;
292 fSmallPic = spic;
294 if (fSelPic) delete fSelPic;
295 fSelPic = 0;
296 if (fActive) {
298 }
299 DoRedraw();
300 fClient->FreePicture(cspic);
301}
302
304
305/** \class TTVLVContainer
306This class represent the list view container for the.
307TreeView class. It is a TGLVContainer with item dragging
308capabilities for the TTVLVEntry objects inside.
309*/
310
311////////////////////////////////////////////////////////////////////////////////
312/// TGLVContainer constructor
313
315 :TGLVContainer(p, w, h,options | kSunkenFrame)
316{
317 fListView = 0;
318 fViewer = 0;
320 fCursor = gVirtualX->CreateCursor(kMove);
321 fDefaultCursor = gVirtualX->CreateCursor(kPointer);
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// TGLVContainer destructor
327
329{
330 delete fExpressionList;
331}
332
333////////////////////////////////////////////////////////////////////////////////
334/// Return the cut entry
335
337{
339 if (el) {
340 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
341 if (f) return f->ConvertAliases();
342 return 0;
343 }
344 return 0;
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Return the expression item at specific position
349
351{
352 TGFrameElement *el = (TGFrameElement *) fList->At(index);
353 if (el) {
354 TTVLVEntry *item = (TTVLVEntry *) el->fFrame;
355 return item;
356 }
357 return 0;
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Return the list of user-defined expressions
362
364{
366 TIter next(fList);
367 TGFrameElement *el;
368 while ((el = (TGFrameElement*)next())) {
369 TTVLVEntry *item = (TTVLVEntry *)el->fFrame;
370 if (item) {
371 ULong_t *itemType = (ULong_t *) item->GetUserData();
372 if ((*itemType & TTreeViewer::kLTExpressionType) &&
373 (*itemType & TTreeViewer::kLTDragType)) fExpressionList->Add(item);
374 }
375 }
376 return fExpressionList;
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// Return the expression on X
381
383{
385 if (el) {
386 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
387 if (f) return f->ConvertAliases();
388 return 0;
389 }
390 return 0;
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// Return the expression on Y
395
397{
399 if (el) {
400 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
401 if (f) return f->ConvertAliases();
402 return 0;
403 }
404 return 0;
405}
406
407////////////////////////////////////////////////////////////////////////////////
408/// Return the expression on Z
409
411{
413 if (el) {
414 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
415 if (f) return f->ConvertAliases();
416 return 0;
417 }
418 return 0;
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Return the cut entry
423
425{
427 if (el) {
428 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
429 if (f) return f->GetTrueName();
430 return 0;
431 }
432 return 0;
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Handle mouse button event in container.
437
439{
440 int total, selected;
441
442 if (event->fType == kButtonPress) {
443 fXp = event->fX;
444 fYp = event->fY;
445 if (fLastActive) {
447 fLastActive = 0;
448 }
449 total = selected = 0;
450
451 TGFrameElement *el;
452 TIter next(fList);
453 while ((el = (TGFrameElement *) next())) {
454 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
455 ++total;
456 if (f->GetId() == (Window_t)event->fUser[0]) { // fUser[0] = subwindow
457 f->Activate(kTRUE);
458 if (f->GetTip()) (f->GetTip())->Hide();
459 fX0 = f->GetX();
460 fY0 = f->GetY();
461 ++selected;
462 fLastActive = f;
463 } else {
464 f->Activate(kFALSE);
465 }
466 }
467
468 if (fTotal != total || fSelected != selected) {
469 fTotal = total;
470 fSelected = selected;
473 }
474
475 if (selected == 1 && event->fCode == 1) {
476 ULong_t *itemType = (ULong_t *) fLastActive->GetUserData();
477 if (*itemType & TTreeViewer::kLTDragType) {
479 gVirtualX->SetCursor(fId,fCursor);
480 fXp = event->fX;
481 fYp = event->fY;
482 }
483 }
484 }
485
486 if (event->fType == kButtonRelease) {
487 if (fDragging) {
489 gVirtualX->SetCursor(fId,fDefaultCursor);
491 TGFrameElement *el;
492 TIter next(fList);
493 while ((el = (TGFrameElement *) next())) {
494 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
495 if ((f == fLastActive) || !f->IsActive()) continue;
496 ULong_t *itemType = (ULong_t *) f->GetUserData();
498 if (!(*itemType & TTreeViewer::kLTPackType)) {
499 // dragging items to expressions
500 ((TTVLVEntry *) fLastActive)->CopyItem(f);
501 if (*itemType & TTreeViewer::kLTDragType)
502 f->SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
503 } else {
504 if (strlen(((TTVLVEntry *) fLastActive)->GetTrueName())) {
505 // dragging to scan box
506 if (!strlen(f->GetTrueName())) {
507 f->SetTrueName(((TTVLVEntry *)fLastActive)->GetTrueName());
508 f->SetSmallPic(fClient->GetPicture("pack_t.xpm"));
509 } else {
510 TString name(2000);
511 TString dragged = ((TTVLVEntry *)fLastActive)->ConvertAliases();
512 name = f->GetTrueName();
513 if ((name.Length()+dragged.Length()) < 228) {
514 name += ":";
515 name += dragged;
516 f->SetTrueName(name.Data());
517 } else {
518 Warning("HandleButton",
519 "Name too long. Can not add any more items to scan box.");
520 }
521 }
522 }
523 }
524 fLastActive = f;
525 if (fViewer) {
526 char msg[2000];
527 msg[0] = 0;
528 snprintf(msg,2000, "Content : %s", f->GetTrueName());
529 fViewer->Message(msg);
530 }
531 }
532 if ((TMath::Abs(event->fX - fXp) < 2) && (TMath::Abs(event->fY - fYp) < 2)) {
534 event->fCode, (event->fYRoot << 16) | event->fXRoot);
535 }
536 } else {
538 event->fCode, (event->fYRoot << 16) | event->fXRoot);
539 }
540 }
541 return kTRUE;
542}
543
544////////////////////////////////////////////////////////////////////////////////
545/// Handle mouse motion events.
546
548{
549 Int_t xf0, xff, yf0, yff;
550 Int_t xpos = event->fX - (fXp-fX0);
551 Int_t ypos = event->fY - (fYp-fY0);
552
553 if (fDragging) {
554 TGFrameElement *el;
555 ULong_t *itemType;
556 TIter next(fList);
557 while ((el = (TGFrameElement *) next())) {
558 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
559 if (f == fLastActive) {
560 if (f->GetTip()) (f->GetTip())->Hide();
561 continue;
562 }
563 xf0 = f->GetX();
564 yf0 = f->GetY();
565 xff = f->GetX() + f->GetWidth();
566 yff = f->GetY() + f->GetHeight();
567 itemType = (ULong_t *) f->GetUserData();
568 if (*itemType & TTreeViewer::kLTExpressionType) {
569 if (xpos>xf0 && xpos<xff && ypos>yf0 && ypos<yff) {
570 f->Activate(kTRUE);
571 } else {
572 f->Activate(kFALSE);
573 }
574 }
575 }
576 if ((fXp - event->fX) > 10) {
579 }
580 fLastActive->Move(xpos, ypos);
581 gVirtualX->RaiseWindow(fLastActive->GetId());
583 }
584 return kTRUE;
585}
586
587////////////////////////////////////////////////////////////////////////////////
588/// Clear all names and aliases for expression type items
589
591{
592 TGFrameElement *el;
593 TIter next(fList);
594 while ((el = (TGFrameElement *) next())) {
595 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
596 UInt_t *userData = (UInt_t *) f->GetUserData();
597 if (*userData & TTreeViewer::kLTExpressionType) {
598 if (*userData & TTreeViewer::kLTPackType) {
599 f->SetSmallPic(fClient->GetPicture("pack-empty_t.xpm"));
600 f->SetTrueName("");
601 } else {
602 f->Empty();
603 }
604 }
605 }
606}
607
608////////////////////////////////////////////////////////////////////////////////
609/// Remove all non-static items from the list view, except expressions
610
612{
613 TGFrameElement *el;
614 TIter next(fList);
615 while ((el = (TGFrameElement *) next())) {
616 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
617 UInt_t *userData = (UInt_t *) f->GetUserData();
618 if (!((*userData) & TTreeViewer::kLTExpressionType)) {
619 RemoveItem(f);
620 }
621 }
622 fLastActive = 0;
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Select an item
627
629{
630 if (fLastActive) {
632 fLastActive = 0;
633 }
634 TGFrameElement *el;
635 fSelected = 0;
636 TIter next(fList);
637 while ((el = (TGFrameElement *) next())) {
638 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
639 if (!strcmp(f->GetItemName()->GetString(),name)) {
640 f->Activate(kTRUE);
641 fLastActive = (TGLVEntry *) f;
642 fSelected++;
643 } else {
644 f->Activate(kFALSE);
645 }
646 }
647}
648
650
651/** \class TGSelectBox
652This class represent a specialized expression editor for
653TTVLVEntry 'true name' and 'alias' data members.
654It is a singleton in order to be able to use it for several
655expressions.
656*/
657
662
664
665////////////////////////////////////////////////////////////////////////////////
666/// TGSelectBox constructor
667
669 UInt_t w, UInt_t h)
670 :TGTransientFrame(p, main, w, h)
671{
672 if (!fgInstance) {
673 fgInstance = this;
675 if (!fViewer) Error("TGSelectBox", "Must be started from viewer");
676 fEntry = 0;
678 fBLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 2, 2, 2);
680
681 fLabel = new TGLabel(this, "");
683
684 fTe = new TGTextEntry(this, new TGTextBuffer(2000));
685 fTe->SetToolTipText("Type an expression using C++ syntax. Click other expression/leaves to paste them here.");
687
688 fLabelAlias = new TGLabel(this, "Alias");
690
691 fTeAlias = new TGTextEntry(this, new TGTextBuffer(100));
692 fTeAlias->SetToolTipText("Define an alias for this expression. Do NOT use leading strings of other aliases.");
694
695 fBf = new TGHorizontalFrame(this, 10, 10);
696
697 fCANCEL = new TGTextButton(fBf, "&Cancel", kTFCancel);
698 fCANCEL->Associate(this);
700
701 fDONE = new TGTextButton(fBf, "&Done", kTFDone);
702 fDONE->Associate(this);
704
706
709
710// SetBackgroundColor(color);
711 Window_t wdum;
712 Int_t ax, ay;
713 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(), 25,
714 (Int_t)(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
715 ax, ay, wdum);
716 MoveResize(ax, ay, w, GetDefaultHeight());
717 MapWindow();
718 }
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// TGSelectBox destructor
723
725{
726 fgInstance = 0;
727 delete fLabel;
728 delete fTe;
729 delete fLabelAlias;
730 delete fTeAlias;
731 delete fDONE;
732 delete fCANCEL;
733 delete fBf;
734 delete fLayout;
735 delete fBLayout;
736 delete fBLayout1;
737}
738
739////////////////////////////////////////////////////////////////////////////////
740/// Close the select box
741
743{
744 gVirtualX->UnmapWindow(GetId());
745 delete this;
746}
747
748////////////////////////////////////////////////////////////////////////////////
749/// Return the pointer to the instantiated singleton
750
752{
753 return fgInstance;
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Just focus the cursor inside
758
760{
761 Event_t event;
762 event.fType = kButtonPress;
763 event.fCode = kButton1;
764 event.fX = event.fY = 1;
765 Int_t position = fTe->GetCursorPosition();
766 fTe->HandleButton(&event);
767 fTe->SetCursorPosition(position);
768}
769
770////////////////////////////////////////////////////////////////////////////////
771/// Set label of selection box
772
773void TGSelectBox::SetLabel(const char* title)
774{
775 fLabel->SetText(new TGString(title));
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Save the edited entry true name and alias
780
782{
783 if (fEntry) {
784
785 Bool_t cutType;
787 if (name.Length())
788 fEntry->SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
789 else
790 fEntry->SetToolTipText("User-defined expression/cut. Double-click to edit");
791 // Set type of item to "cut" if containing boolean operators
792 cutType = name.Contains("<") || name.Contains(">") || name.Contains("=") ||
793 name.Contains("!") || name.Contains("&") || name.Contains("|");
794 TString alias(fTeAlias->GetText());
795 if (!alias.BeginsWith("~") && !alias.Contains("empty")) fTeAlias->InsertText("~", 0);
797
798 if (fOldAlias.Contains("empty")) {
800 return;
801 }
802 TList *list = fViewer->ExpressionList();
803 TIter next(list);
804 TTVLVEntry* item;
805 while ((item=(TTVLVEntry*)next())) {
806 if (item != fEntry) {
807 name = item->GetTrueName();
808 name.ReplaceAll(fOldAlias.Data(), fTeAlias->GetText());
809 item->SetTrueName(name.Data());
810 }
811 }
812 }
813}
814
815////////////////////////////////////////////////////////////////////////////////
816/// Connect one entry
817
819{
820 fEntry = entry;
821 fTe->SetText(entry->GetTrueName());
822 fTeAlias->SetText(entry->GetAlias());
823 fOldAlias = entry->GetAlias();
824}
825
826////////////////////////////////////////////////////////////////////////////////
827/// Insert text in text entry
828
830{
831 Int_t start = fTe->GetCursorPosition();
833 fTe->SetCursorPosition(start+strlen(text));
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Message interpreter
838
840{
841 switch (GET_MSG(msg)) {
842 case kC_TEXTENTRY:
843 switch (GET_SUBMSG(msg)) {
844 case kTE_ENTER:
845 if (ValidateAlias()) SaveText();
846 break;
847 default:
848 break;
849 }
850 break;
851 case kC_COMMAND:
852 switch (GET_SUBMSG(msg)) {
853 case kCM_BUTTON:
854 switch (parm1) {
855 case kTFDone:
856 if (!ValidateAlias()) break;
857 SaveText();
858 CloseWindow();
859 break;
860 case kTFCancel:
861 CloseWindow();
862 break;
863 default:
864 break;
865 }
866 break;
867 default:
868 break;
869 }
870 break;
871 default:
872 if (parm2) break; // just to avoid warning on CC compiler
873 break;
874 }
875 return kTRUE;
876}
877
878////////////////////////////////////////////////////////////////////////////////
879/// Return true if edited alias is not a leading string of other expression aliases
880
882{
883 if (!strcmp(fTeAlias->GetText(), "-empty-") || !strlen(fTeAlias->GetText())) {
884 fViewer->Warning("ValidateAlias", "You should define the alias first.");
885 return kFALSE;
886 }
887 TList *list = fViewer->ExpressionList();
888 TIter next(list);
889 TTVLVEntry* item;
890 while ((item=(TTVLVEntry*)next())) {
891 if (item != fEntry) {
892 TString itemalias(item->GetAlias());
893 if (itemalias.Contains(fTeAlias->GetText())) {
894 fViewer->Warning("ValidAlias", "Alias can not be the leading string of other alias.");
895 return kFALSE;
896 }
897 }
898 }
899 return kTRUE;
900}
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
@ kEnterNotify
Definition GuiTypes.h:61
@ kSunkenFrame
Definition GuiTypes.h:383
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:168
@ kMove
Definition GuiTypes.h:374
@ kPointer
Definition GuiTypes.h:375
const Mask_t kEnterWindowMask
Definition GuiTypes.h:167
@ kButton1
Definition GuiTypes.h:214
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:231
@ kLHintsRight
Definition TGLayout.h:33
@ kLHintsLeft
Definition TGLayout.h:31
@ kLHintsCenterY
Definition TGLayout.h:35
@ kLHintsTop
Definition TGLayout.h:34
@ kLHintsExpandX
Definition TGLayout.h:37
EListViewMode
Definition TGListView.h:39
static unsigned int total
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
ETransientFrameCommands
@ kTFCancel
@ kTFDone
#define gVirtualX
Definition TVirtualX.h:338
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
EWidgetMessageTypes
@ kCT_SELCHANGED
@ kTE_ENTER
@ kCT_ITEMCLICK
@ kC_COMMAND
@ kCM_BUTTON
@ kC_TEXTENTRY
@ kCT_ITEMDBLCLICK
@ kC_CONTAINER
Int_t GET_SUBMSG(Long_t val)
#define snprintf
Definition civetweb.c:1540
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
virtual void SetHsbPosition(Int_t newPos)
Set position of horizontal scrollbar.
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:223
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:307
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:352
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1149
Bool_t fMapSubwindows
Definition TGFrame.h:331
TList * fList
Definition TGFrame.h:328
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:350
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition TGCanvas.cxx:656
const TGWindow * fMsgWindow
Definition TGCanvas.h:52
Int_t fYp
Definition TGCanvas.h:54
Int_t fY0
Definition TGCanvas.h:55
Int_t fSelected
Definition TGCanvas.h:59
Int_t fX0
Definition TGCanvas.h:55
Int_t fXp
Definition TGCanvas.h:54
Bool_t fDragging
Definition TGCanvas.h:57
Int_t fTotal
Definition TGCanvas.h:58
TGFrame * fFrame
Definition TGLayout.h:119
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:324
UInt_t fHeight
Definition TGFrame.h:112
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition TGFrame.cxx:630
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition TGFrame.cxx:578
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
UInt_t GetHeight() const
Definition TGFrame.h:249
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition TGFrame.cxx:614
virtual void MapWindow()
map window
Definition TGFrame.h:228
empty object used as context menu support for TGLVTreeEntries.
void EditExpression()
Edit expression.
void Empty()
Empty item.
TGItemContext()
Constructor.
void Draw(Option_t *option="")
Draw item.
void RemoveItem()
Remove item.
TTVLVEntry * fItem
void Scan()
Scan item.
void SetExpression(const char *name="", const char *alias="-empty-", Bool_t cut=kFALSE)
Set item expression.
void Associate(TTVLVEntry *item)
TGLVEntry * fLastActive
Definition TGListView.h:209
const TGPicture * fCurrent
Definition TGListView.h:73
UInt_t fTHeight
Definition TGListView.h:67
UInt_t fTWidth
Definition TGListView.h:66
virtual void DoRedraw()
Redraw list view item.
Bool_t fActive
Definition TGListView.h:68
FontStruct_t fFontStruct
Definition TGListView.h:77
TGString * fItemName
Definition TGListView.h:61
void * GetUserData() const
Definition TGListView.h:113
virtual TGDimension GetDefaultSize() const
Get default size of list item.
virtual void Activate(Bool_t a)
Make list view item active.
TGSelectedPicture * fSelPic
Definition TGListView.h:75
const TGPicture * fSmallPic
Definition TGListView.h:72
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:179
TGClient * fClient
Definition TGObject.h:37
Handle_t GetId() const
Definition TGObject.h:47
Handle_t fId
Definition TGObject.h:36
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Message interpreter.
TGHorizontalFrame * fBf
TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w=10, UInt_t h=10)
TGSelectBox constructor.
TGLayoutHints * fBLayout1
TGTextEntry * fTeAlias
virtual void CloseWindow()
Close the select box.
virtual ~TGSelectBox()
TGSelectBox destructor.
void InsertText(const char *text)
Insert text in text entry.
TGLayoutHints * fBLayout
TGLabel * fLabelAlias
TGLayoutHints * fLayout
TGTextButton * fCANCEL
void GrabPointer()
Just focus the cursor inside.
void SetLabel(const char *title)
Set label of selection box.
void SetEntry(TTVLVEntry *entry)
Connect one entry.
static TGSelectBox * fgInstance
TTVLVEntry * fEntry
static TGSelectBox * GetInstance()
Return the pointer to the instantiated singleton.
Bool_t ValidateAlias()
Return true if edited alias is not a leading string of other expression aliases.
TGLabel * fLabel
TString fOldAlias
TGTextEntry * fTe
TTreeViewer * fViewer
TGTextButton * fDONE
void SaveText()
Save the edited entry true name and alias.
Int_t GetLength() const
Definition TGString.h:39
const char * GetString() const
Definition TGString.h:40
Int_t GetCursorPosition() const
const char * GetText() const
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
virtual void InsertText(const char *text, Int_t pos)
Inserts text at position pos, clears the selection and moves the cursor to the end of the line.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text entry widget.
void Hide()
Hide tool tip window.
void Reset()
Reset tool tip popup delay timer.
const TGWindow * fMain
Definition TGFrame.h:555
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:82
const TGWindow * GetParent() const
Definition TGWindow.h:84
void Reset()
A doubly linked list.
Definition TList.h:44
virtual void Add(TObject *obj)
Definition TList.h:87
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:357
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition TList.cxx:402
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:879
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:615
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
This class represent the list view container for the.
Cursor_t fDefaultCursor
void SelectItem(const char *name)
Select an item.
TList * fExpressionList
TList * ExpressionList()
Return the list of user-defined expressions.
const char * Cut()
Return the cut entry.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events.
TTreeViewer * GetViewer()
const char * Ez()
Return the expression on Z.
TGListView * fListView
const char * Ey()
Return the expression on Y.
const char * ScanList()
Return the cut entry.
TTreeViewer * fViewer
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in container.
TTVLVEntry * ExpressionItem(Int_t index)
Return the expression item at specific position.
virtual ~TTVLVContainer()
TGLVContainer destructor.
const char * Ex()
Return the expression on X.
TTVLVContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame)
TGLVContainer constructor.
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.
void SetSmallPic(const TGPicture *spic)
Set small picture.
void SetCutType(Bool_t type=kFALSE)
Set cut type.
Bool_t HasAlias()
Check if alias name is not empty.
TTVLVContainer * GetContainer()
TTVLVContainer * fContainer
TGToolTip * fTip
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
void SetAlias(const char *alias)
void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this item.
void SetTrueName(const char *name)
TGItemContext * fContext
const char * ConvertAliases()
Convert all aliases into true names.
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.
void CopyItem(TTVLVEntry *dest)
Copy this item's name and alias to an other.
const char * GetAlias()
TString fConvName
TString fTrueName
TString fAlias
void Empty()
Clear all names and alias.
void SetItemName(const char *name)
Redraw this entry with new name.
virtual ~TTVLVEntry()
TTVLVEntry destructor.
const char * GetTrueName()
Bool_t FullConverted()
Return true if converted name is alias free.
TTVLVEntry(const TGWindow *p, const TGPicture *bigpic, const TGPicture *smallpic, TGString *name, TGString **subnames, EListViewMode ViewMode)
TTVLVEntry constructor.
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
void EditExpression()
void RemoveItem()
void SetScanMode(Bool_t mode=kTRUE)
void Message(const char *msg)
TList * ExpressionList()
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
TText * text
int main()
Short_t Abs(Short_t d)
Definition TMathBase.h:120
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Int_t fXRoot
Definition GuiTypes.h:179
Int_t fYRoot
coordinates relative to root
Definition GuiTypes.h:179
Int_t fX
Definition GuiTypes.h:178
Long_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Definition GuiTypes.h:187
UInt_t fCode
key or button code
Definition GuiTypes.h:180
#define dest(otri, vertexptr)
Definition triangle.c:1040