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