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 = nullptr;
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 cut)
83{
84 fItem->SetExpression(name, alias, cut);
85}
86
88
89/** \class TTVLVEntry
90This class represent entries that goes into the TreeViewer listview container.
91It subclasses TGLVEntry and adds two data 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 = nullptr;
107 fIsCut = false;
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 false;
161 }
162 }
163 return true;
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 true;
189}
190
191////////////////////////////////////////////////////////////////////////////////
192/// Check if alias name is not empty.
193
195{
196 if (fAlias.Length()) return true;
197 return false;
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 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 = nullptr;
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 = nullptr;
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 TreeView class.
306It is a TGLVContainer with item dragging capabilities for the TTVLVEntry objects inside.
307*/
308
309////////////////////////////////////////////////////////////////////////////////
310/// TGLVContainer constructor
311
313 :TGLVContainer(p, w, h,options | kSunkenFrame)
314{
315 fListView = nullptr;
316 fViewer = nullptr;
318 fCursor = gVirtualX->CreateCursor(kMove);
319 fDefaultCursor = gVirtualX->CreateCursor(kPointer);
320 fMapSubwindows = true;
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// TGLVContainer destructor
325
327{
328 delete fExpressionList;
329}
330
331////////////////////////////////////////////////////////////////////////////////
332/// Return the cut entry
333
335{
337 if (el) {
338 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
339 if (f) return f->ConvertAliases();
340 return nullptr;
341 }
342 return nullptr;
343}
344
345////////////////////////////////////////////////////////////////////////////////
346/// Return the expression item at specific position
347
349{
351 if (el) {
352 TTVLVEntry *item = (TTVLVEntry *) el->fFrame;
353 return item;
354 }
355 return nullptr;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Return the list of user-defined expressions
360
362{
364 TIter next(fList);
365 TGFrameElement *el;
366 while ((el = (TGFrameElement*)next())) {
367 TTVLVEntry *item = (TTVLVEntry *)el->fFrame;
368 if (item) {
369 ULong_t *itemType = (ULong_t *) item->GetUserData();
370 if ((*itemType & TTreeViewer::kLTExpressionType) &&
371 (*itemType & TTreeViewer::kLTDragType)) fExpressionList->Add(item);
372 }
373 }
374 return fExpressionList;
375}
376
377////////////////////////////////////////////////////////////////////////////////
378/// Return the expression on X
379
381{
383 if (el) {
384 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
385 if (f) return f->ConvertAliases();
386 return nullptr;
387 }
388 return nullptr;
389}
390
391////////////////////////////////////////////////////////////////////////////////
392/// Return the expression on Y
393
395{
397 if (el) {
398 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
399 if (f) return f->ConvertAliases();
400 return nullptr;
401 }
402 return nullptr;
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Return the expression on Z
407
409{
411 if (el) {
412 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
413 if (f) return f->ConvertAliases();
414 return nullptr;
415 }
416 return nullptr;
417}
418
419////////////////////////////////////////////////////////////////////////////////
420/// Return the cut entry
421
423{
425 if (el) {
426 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
427 if (f) return f->GetTrueName();
428 return nullptr;
429 }
430 return nullptr;
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// Handle mouse button event in container.
435
437{
438 int total, selected;
439
440 if (event->fType == kButtonPress) {
441 fXp = event->fX;
442 fYp = event->fY;
443 if (fLastActive) {
444 fLastActive->Activate(false);
445 fLastActive = nullptr;
446 }
447 total = selected = 0;
448
449 TGFrameElement *el;
450 TIter next(fList);
451 while ((el = (TGFrameElement *) next())) {
452 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
453 ++total;
454 if (f->GetId() == (Window_t)event->fUser[0]) { // fUser[0] = subwindow
455 f->Activate(true);
456 if (f->GetTip()) (f->GetTip())->Hide();
457 fX0 = f->GetX();
458 fY0 = f->GetY();
459 ++selected;
460 fLastActive = f;
461 } else {
462 f->Activate(false);
463 }
464 }
465
466 if (fTotal != total || fSelected != selected) {
467 fTotal = total;
468 fSelected = selected;
471 }
472
473 if (selected == 1 && event->fCode == 1) {
474 ULong_t *itemType = (ULong_t *) fLastActive->GetUserData();
475 if (*itemType & TTreeViewer::kLTDragType) {
476 fDragging = true;
477 gVirtualX->SetCursor(fId,fCursor);
478 fXp = event->fX;
479 fYp = event->fY;
480 }
481 }
482 }
483
484 if (event->fType == kButtonRelease) {
485 if (fDragging) {
486 fDragging = false;
487 gVirtualX->SetCursor(fId,fDefaultCursor);
489 TGFrameElement *el;
490 TIter next(fList);
491 while ((el = (TGFrameElement *) next())) {
492 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
493 if ((f == fLastActive) || !f->IsActive()) continue;
494 ULong_t *itemType = (ULong_t *) f->GetUserData();
495 fLastActive->Activate(false);
496 if (!(*itemType & TTreeViewer::kLTPackType)) {
497 // dragging items to expressions
498 ((TTVLVEntry *) fLastActive)->CopyItem(f);
499 if (*itemType & TTreeViewer::kLTDragType)
500 f->SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
501 } else {
502 if (strlen(((TTVLVEntry *) fLastActive)->GetTrueName())) {
503 // dragging to scan box
504 if (!strlen(f->GetTrueName())) {
505 f->SetTrueName(((TTVLVEntry *)fLastActive)->GetTrueName());
506 f->SetSmallPic(fClient->GetPicture("pack_t.xpm"));
507 } else {
508 TString name(2000);
509 TString dragged = ((TTVLVEntry *)fLastActive)->ConvertAliases();
510 name = f->GetTrueName();
511 if ((name.Length()+dragged.Length()) < 228) {
512 name += ":";
513 name += dragged;
514 f->SetTrueName(name.Data());
515 } else {
516 Warning("HandleButton",
517 "Name too long. Can not add any more items to scan box.");
518 }
519 }
520 }
521 }
522 fLastActive = f;
523 if (fViewer) {
524 char msg[2000];
525 msg[0] = 0;
526 snprintf(msg,2000, "Content : %s", f->GetTrueName());
527 fViewer->Message(msg);
528 }
529 }
530 if ((TMath::Abs(event->fX - fXp) < 2) && (TMath::Abs(event->fY - fYp) < 2)) {
532 event->fCode, (event->fYRoot << 16) | event->fXRoot);
533 }
534 } else {
536 event->fCode, (event->fYRoot << 16) | event->fXRoot);
537 }
538 }
539 return true;
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Handle mouse motion events.
544
546{
547 Int_t xf0, xff, yf0, yff;
548 Int_t xpos = event->fX - (fXp-fX0);
549 Int_t ypos = event->fY - (fYp-fY0);
550
551 if (fDragging) {
552 TGFrameElement *el;
553 ULong_t *itemType;
554 TIter next(fList);
555 while ((el = (TGFrameElement *) next())) {
556 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
557 if (f == fLastActive) {
558 if (f->GetTip()) (f->GetTip())->Hide();
559 continue;
560 }
561 xf0 = f->GetX();
562 yf0 = f->GetY();
563 xff = f->GetX() + f->GetWidth();
564 yff = f->GetY() + f->GetHeight();
565 itemType = (ULong_t *) f->GetUserData();
566 if (*itemType & TTreeViewer::kLTExpressionType) {
567 if (xpos>xf0 && xpos<xff && ypos>yf0 && ypos<yff) {
568 f->Activate(true);
569 } else {
570 f->Activate(false);
571 }
572 }
573 }
574 if ((fXp - event->fX) > 10) {
577 }
579 gVirtualX->RaiseWindow(fLastActive->GetId());
581 }
582 return true;
583}
584
585////////////////////////////////////////////////////////////////////////////////
586/// Clear all names and aliases for expression type items
587
589{
590 TGFrameElement *el;
591 TIter next(fList);
592 while ((el = (TGFrameElement *) next())) {
593 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
594 UInt_t *userData = (UInt_t *) f->GetUserData();
595 if (*userData & TTreeViewer::kLTExpressionType) {
596 if (*userData & TTreeViewer::kLTPackType) {
597 f->SetSmallPic(fClient->GetPicture("pack-empty_t.xpm"));
598 f->SetTrueName("");
599 } else {
600 f->Empty();
601 }
602 }
603 }
604}
605
606////////////////////////////////////////////////////////////////////////////////
607/// Remove all non-static items from the list view, except expressions
608
610{
611 TGFrameElement *el;
612 TIter next(fList);
613 while ((el = (TGFrameElement *) next())) {
614 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
615 UInt_t *userData = (UInt_t *) f->GetUserData();
616 if (!((*userData) & TTreeViewer::kLTExpressionType)) {
617 RemoveItem(f);
618 }
619 }
620 fLastActive = nullptr;
621}
622
623////////////////////////////////////////////////////////////////////////////////
624/// Select an item
625
627{
628 if (fLastActive) {
629 fLastActive->Activate(false);
630 fLastActive = nullptr;
631 }
632 TGFrameElement *el;
633 fSelected = 0;
634 TIter next(fList);
635 while ((el = (TGFrameElement *) next())) {
636 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
637 if (!strcmp(f->GetItemName()->GetString(),name)) {
638 f->Activate(true);
639 fLastActive = (TGLVEntry *) f;
640 fSelected++;
641 } else {
642 f->Activate(false);
643 }
644 }
645}
646
648
649/** \class TGSelectBox
650This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data members.
651It is a singleton in order to be able to use it for several expressions.
652*/
653
658
660
661////////////////////////////////////////////////////////////////////////////////
662/// TGSelectBox constructor
663
665 UInt_t w, UInt_t h)
667{
668 if (!fgInstance) {
669 fgInstance = this;
671 if (!fViewer) Error("TGSelectBox", "Must be started from viewer");
672 fEntry = nullptr;
674 fBLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 2, 2, 2);
676
677 fLabel = new TGLabel(this, "");
679
680 fTe = new TGTextEntry(this, new TGTextBuffer(2000));
681 fTe->SetToolTipText("Type an expression using C++ syntax. Click other expression/leaves to paste them here.");
683
684 fLabelAlias = new TGLabel(this, "Alias");
686
687 fTeAlias = new TGTextEntry(this, new TGTextBuffer(100));
688 fTeAlias->SetToolTipText("Define an alias for this expression. Do NOT use leading strings of other aliases.");
690
691 fBf = new TGHorizontalFrame(this, 10, 10);
692
693 fCANCEL = new TGTextButton(fBf, "&Cancel", kTFCancel);
694 fCANCEL->Associate(this);
696
697 fDONE = new TGTextButton(fBf, "&Done", kTFDone);
698 fDONE->Associate(this);
700
702
705
706// SetBackgroundColor(color);
707 Window_t wdum;
708 Int_t ax, ay;
709 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(), 25,
710 (Int_t)(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
711 ax, ay, wdum);
712 MoveResize(ax, ay, w, GetDefaultHeight());
713 MapWindow();
714 }
715}
716
717////////////////////////////////////////////////////////////////////////////////
718/// TGSelectBox destructor
719
721{
722 fgInstance = nullptr;
723 delete fLabel;
724 delete fTe;
725 delete fLabelAlias;
726 delete fTeAlias;
727 delete fDONE;
728 delete fCANCEL;
729 delete fBf;
730 delete fLayout;
731 delete fBLayout;
732 delete fBLayout1;
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Close the select box
737
739{
740 gVirtualX->UnmapWindow(GetId());
741 delete this;
742}
743
744////////////////////////////////////////////////////////////////////////////////
745/// Return the pointer to the instantiated singleton
746
748{
749 return fgInstance;
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Just focus the cursor inside
754
756{
757 Event_t event;
758 event.fType = kButtonPress;
759 event.fCode = kButton1;
760 event.fX = event.fY = 1;
761 Int_t position = fTe->GetCursorPosition();
762 fTe->HandleButton(&event);
763 fTe->SetCursorPosition(position);
764}
765
766////////////////////////////////////////////////////////////////////////////////
767/// Set label of selection box
768
769void TGSelectBox::SetLabel(const char* title)
770{
771 fLabel->SetText(new TGString(title));
772}
773
774////////////////////////////////////////////////////////////////////////////////
775/// Save the edited entry true name and alias
776
778{
779 if (fEntry) {
780
781 bool cutType;
783 if (name.Length())
784 fEntry->SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
785 else
786 fEntry->SetToolTipText("User-defined expression/cut. Double-click to edit");
787 // Set type of item to "cut" if containing boolean operators
788 cutType = name.Contains("<") || name.Contains(">") || name.Contains("=") ||
789 name.Contains("!") || name.Contains("&") || name.Contains("|");
790 TString alias(fTeAlias->GetText());
791 if (!alias.BeginsWith("~") && !alias.Contains("empty")) fTeAlias->InsertText("~", 0);
793
794 if (fOldAlias.Contains("empty")) {
796 return;
797 }
798 TList *list = fViewer->ExpressionList();
799 TIter next(list);
800 TTVLVEntry* item;
801 while ((item=(TTVLVEntry*)next())) {
802 if (item != fEntry) {
803 name = item->GetTrueName();
804 name.ReplaceAll(fOldAlias.Data(), fTeAlias->GetText());
805 item->SetTrueName(name.Data());
806 }
807 }
808 }
809}
810
811////////////////////////////////////////////////////////////////////////////////
812/// Connect one entry
813
815{
816 fEntry = entry;
817 fTe->SetText(entry->GetTrueName());
818 fTeAlias->SetText(entry->GetAlias());
819 fOldAlias = entry->GetAlias();
820}
821
822////////////////////////////////////////////////////////////////////////////////
823/// Insert text in text entry
824
826{
827 Int_t start = fTe->GetCursorPosition();
829 fTe->SetCursorPosition(start+strlen(text));
830}
831
832////////////////////////////////////////////////////////////////////////////////
833/// Message interpreter
834
836{
837 switch (GET_MSG(msg)) {
838 case kC_TEXTENTRY:
839 switch (GET_SUBMSG(msg)) {
840 case kTE_ENTER:
841 if (ValidateAlias()) SaveText();
842 break;
843 default:
844 break;
845 }
846 break;
847 case kC_COMMAND:
848 switch (GET_SUBMSG(msg)) {
849 case kCM_BUTTON:
850 switch (parm1) {
851 case kTFDone:
852 if (!ValidateAlias()) break;
853 SaveText();
854 CloseWindow();
855 break;
856 case kTFCancel:
857 CloseWindow();
858 break;
859 default:
860 break;
861 }
862 break;
863 default:
864 break;
865 }
866 break;
867 default:
868 if (parm2) break; // just to avoid warning on CC compiler
869 break;
870 }
871 return true;
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Return true if edited alias is not a leading string of other expression aliases
876
878{
879 if (!strcmp(fTeAlias->GetText(), "-empty-") || !strlen(fTeAlias->GetText())) {
880 fViewer->Warning("ValidateAlias", "You should define the alias first.");
881 return false;
882 }
883 TList *list = fViewer->ExpressionList();
884 TIter next(list);
885 TTVLVEntry* item;
886 while ((item=(TTVLVEntry*)next())) {
887 if (item != fEntry) {
888 TString itemalias(item->GetAlias());
889 if (itemalias.Contains(fTeAlias->GetText())) {
890 fViewer->Warning("ValidAlias", "Alias can not be the leading string of other alias.");
891 return false;
892 }
893 }
894 }
895 return true;
896}
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
@ kEnterNotify
Definition GuiTypes.h:61
@ kMove
Definition GuiTypes.h:374
@ kPointer
Definition GuiTypes.h:375
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
@ kSunkenFrame
Definition GuiTypes.h:383
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:168
const Mask_t kEnterWindowMask
Definition GuiTypes.h:167
@ kButton1
Definition GuiTypes.h:214
int main()
Definition Prototype.cxx:12
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Definition RtypesCore.h:82
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
EListViewMode
Definition TGListView.h:21
static unsigned int total
winID h TVirtualViewer3D TVirtualGLPainter p
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 xpos
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void ypos
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
ETransientFrameCommands
@ kTFCancel
@ kTFDone
#define gVirtualX
Definition TVirtualX.h:337
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
EWidgetMessageTypes
WidgetMessageTypes.
@ 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: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
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:314
Bool_t fMapSubwindows
kTRUE - map subwindows
Definition TGFrame.h:295
TList * fList
container of frame elements
Definition TGFrame.h:292
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition TGCanvas.cxx:660
const TGWindow * fMsgWindow
window handling container messages
Definition TGCanvas.h:42
Int_t fYp
previous pointer position
Definition TGCanvas.h:44
Int_t fY0
corner of rubber band box
Definition TGCanvas.h:45
Int_t fSelected
number of selected items
Definition TGCanvas.h:49
Int_t fX0
Definition TGCanvas.h:45
Int_t fXp
Definition TGCanvas.h:44
Bool_t fDragging
true if in dragging mode
Definition TGCanvas.h:47
Int_t fTotal
total items
Definition TGCanvas.h:48
TGFrame * fFrame
Definition TGLayout.h:112
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:629
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
UInt_t fHeight
frame height
Definition TGFrame.h:88
void MapWindow() override
map window
Definition TGFrame.h:204
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:593
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
UInt_t GetHeight() const
Definition TGFrame.h:225
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
Empty object used as context menu support for TGLVTreeEntries.
void EditExpression()
Edit expression.
void SetExpression(const char *name="", const char *alias="-empty-", bool cut=false)
Set item expression.
void Empty()
Empty item.
void Draw(Option_t *option="") override
Draw item.
TGItemContext()
Constructor.
void RemoveItem()
Remove item.
TTVLVEntry * fItem
void Scan()
Scan item.
void Associate(TTVLVEntry *item)
TGLVEntry * fLastActive
last active item
Definition TGListView.h:191
const TGPicture * fCurrent
current icon
Definition TGListView.h:55
UInt_t fTHeight
height of name
Definition TGListView.h:49
void DoRedraw() override
Redraw list view item.
UInt_t fTWidth
width of name
Definition TGListView.h:48
TGDimension GetDefaultSize() const override
Get default size of list item.
void Activate(Bool_t a) override
Make list view item active.
Bool_t fActive
true if item is active
Definition TGListView.h:50
FontStruct_t fFontStruct
text font
Definition TGListView.h:59
TGString * fItemName
name of item
Definition TGListView.h:43
void * GetUserData() const
Definition TGListView.h:95
TGSelectedPicture * fSelPic
selected icon
Definition TGListView.h:57
const TGPicture * fSmallPic
small icon
Definition TGListView.h:54
This class handles GUI labels.
Definition TGLabel.h:24
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:180
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
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.
TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w=10, UInt_t h=10)
TGSelectBox constructor.
bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Message interpreter.
TGLayoutHints * fBLayout1
Layout for close button.
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
Int_t GetLength() const
Definition TGString.h:29
const char * GetString() const
Definition TGString.h:30
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
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
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.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in text entry widget.
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
void Hide()
Hide tool tip window.
void Reset()
Reset tool tip popup delay timer.
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
const TGWindow * fMain
Definition TGFrame.h:501
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
const TGWindow * GetParent() const
Definition TGWindow.h:83
void Reset()
A doubly linked list.
Definition TList.h:38
void Clear(Option_t *option="") override
Remove all objects from the list.
Definition TList.cxx:400
void Add(TObject *obj) override
Definition TList.h:81
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:355
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
const char * Data() const
Definition TString.h:376
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:623
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
This class represent the list view container for the TreeView class.
Cursor_t fDefaultCursor
Default cursor.
void SelectItem(const char *name)
Select an item.
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.
~TTVLVContainer() override
TGLVContainer destructor.
TTVLVEntry * ExpressionItem(Int_t index)
Return the expression item at specific position.
bool HandleMotion(Event_t *event) override
Handle mouse motion events.
const char * Ex()
Return the expression on X.
TTVLVContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options=kSunkenFrame)
TGLVContainer constructor.
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.
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.
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.
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()
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 mode=true)
void Message(const char *msg) override
TList * ExpressionList()
bool ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
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
UInt_t fCode
key or button code
Definition GuiTypes.h:180
Longptr_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