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
24
25/** \class TGItemContext
26Empty object used as context menu support for TGLVTreeEntries.
27*/
28
29////////////////////////////////////////////////////////////////////////////////
30/// Constructor
31
33{
34 fItem = nullptr;
35}
36
37////////////////////////////////////////////////////////////////////////////////
38/// Draw item
39
44
45////////////////////////////////////////////////////////////////////////////////
46/// Edit expression
47
52
53////////////////////////////////////////////////////////////////////////////////
54/// Empty item
55
57{
58 fItem->Empty();
59}
60
61////////////////////////////////////////////////////////////////////////////////
62/// Remove item
63
68
69////////////////////////////////////////////////////////////////////////////////
70/// Scan item
71
77
78////////////////////////////////////////////////////////////////////////////////
79/// Set item expression
80
81void TGItemContext::SetExpression(const char *name, const char *alias, bool cut)
82{
84}
85
86
87/** \class TTVLVEntry
88This class represent entries that goes into the TreeViewer listview container.
89It subclasses TGLVEntry and adds two data members: the item true name and the alias.
90*/
91
92////////////////////////////////////////////////////////////////////////////////
93/// TTVLVEntry constructor.
94
96 const TGPicture *bigpic, const TGPicture *smallpic,
100{
101 // both alias and true name are initialized to name
103
104 fTip = nullptr;
105 fIsCut = false;
106 fTrueName = name->GetString();
107 fContext = new TGItemContext();
108 fContext->Associate(this);
109
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// TTVLVEntry destructor
115
117{
118 if (fTip) delete fTip;
119 delete fContext;
120}
121
122////////////////////////////////////////////////////////////////////////////////
123/// Convert all aliases into true names
124
126{
129 TString start(fConvName);
130 TIter next(list);
132 while (!FullConverted()) {
133 next.Reset();
134 start = fConvName;
135 while ((item=(TTVLVEntry*)next())) {
136 if (item != this)
137 fConvName.ReplaceAll(item->GetAlias(), item->GetTrueName());
138 }
139 if (fConvName == start) {
140 //the following line is deadcode reported by coverity because item=0
141 //if (item) Warning(item->GetAlias(), "Cannot convert aliases for this expression.");
142 return(fConvName.Data());
143 }
144 }
145 return(fConvName.Data());
146}
147
148////////////////////////////////////////////////////////////////////////////////
149/// Return true if converted name is alias free
150
152{
154 TIter next(list);
156 while ((item=(TTVLVEntry*)next())) {
157 if (item != this) {
158 if (fConvName.Contains(item->GetAlias())) return false;
159 }
160 }
161 return true;
162}
163
164////////////////////////////////////////////////////////////////////////////////
165/// Copy this item's name and alias to an other.
166
168{
169 if (!dest) return;
170 dest->SetExpression(fTrueName.Data(), fAlias.Data(), fIsCut);
171 TString alias = dest->GetAlias();
172 if (!alias.BeginsWith("~") && !alias.Contains("empty")) dest->PrependTilde();
173}
174
175////////////////////////////////////////////////////////////////////////////////
176/// Handle mouse crossing event.
177
179{
180 if (fTip) {
181 if (event->fType == kEnterNotify)
182 fTip->Reset();
183 else
184 fTip->Hide();
185 }
186 return true;
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Check if alias name is not empty.
191
193{
194 if (fAlias.Length()) return true;
195 return false;
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Prepend a ~ to item alias
200
202{
203 fAlias = "~" + fAlias;
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Redraw this entry with new name
209
211{
212 if (fItemName) delete fItemName;
213 fItemName = new TGString(name);
216 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
218 gVirtualX->ClearWindow(fId);
220 fClient->NeedRedraw(this);
221}
222
223////////////////////////////////////////////////////////////////////////////////
224/// Set cut type
225
227{
228 if (fIsCut && type) return;
229 if (!fIsCut && !type) return;
230 if (type) {
231 SetSmallPic(fClient->GetPicture("selection_t.xpm"));
232 SetToolTipText("Selection expression. Drag to scissors to activate");
233 } else
234 SetSmallPic(fClient->GetPicture("expression_t.xpm"));
235 fIsCut = type;
236}
237
238////////////////////////////////////////////////////////////////////////////////
239/// Set the true name, alias and type of the expression, then refresh it
240
241void TTVLVEntry::SetExpression(const char* name, const char* alias, bool cutType)
242{
248 if (strlen(name))
249 SetSmallPic(fClient->GetPicture("pack_t.xpm"));
250 else
251 SetSmallPic(fClient->GetPicture("pack-empty_t.xpm"));
252 }
254 SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// Clear all names and alias
260
262{
263 SetExpression("","-empty-");
266 SetToolTipText("User-defined expression/cut. Double-click to edit");
267}
268
269////////////////////////////////////////////////////////////////////////////////
270/// Set tool tip text associated with this item. The delay is in
271/// milliseconds (minimum 250). To remove tool tip call method with text = 0
272
274{
275 if (fTip) {
276 delete fTip;
277 fTip = nullptr;
278 }
279
280 if (text && strlen(text))
281 fTip = new TGToolTip(fClient->GetRoot(), this, text, delayms);
282}
283////////////////////////////////////////////////////////////////////////////////
284/// Set small picture
285
287{
288 const TGPicture *cspic = fSmallPic;
289 fSmallPic = spic;
291 if (fSelPic) delete fSelPic;
292 fSelPic = nullptr;
293 if (fActive) {
295 }
296 DoRedraw();
298}
299
300
301/** \class TTVLVContainer
302This class represent the list view container for the TreeView class.
303It is a TGLVContainer with item dragging capabilities for the TTVLVEntry objects inside.
304*/
305
306////////////////////////////////////////////////////////////////////////////////
307/// TGLVContainer constructor
308
310 :TGLVContainer(p, w, h,options | kSunkenFrame)
311{
312 fListView = nullptr;
313 fViewer = nullptr;
315 fCursor = gVirtualX->CreateCursor(kMove);
316 fDefaultCursor = gVirtualX->CreateCursor(kPointer);
317 fMapSubwindows = true;
318}
319
320////////////////////////////////////////////////////////////////////////////////
321/// TGLVContainer destructor
322
327
328////////////////////////////////////////////////////////////////////////////////
329/// Return the cut entry
330
332{
334 if (el) {
335 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
336 if (f) return f->ConvertAliases();
337 return nullptr;
338 }
339 return nullptr;
340}
341
342////////////////////////////////////////////////////////////////////////////////
343/// Return the expression item at specific position
344
346{
348 if (el) {
349 TTVLVEntry *item = (TTVLVEntry *) el->fFrame;
350 return item;
351 }
352 return nullptr;
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Return the list of user-defined expressions
357
359{
361 TIter next(fList);
363 while ((el = (TGFrameElement*)next())) {
364 TTVLVEntry *item = (TTVLVEntry *)el->fFrame;
365 if (item) {
366 ULong_t *itemType = (ULong_t *) item->GetUserData();
369 }
370 }
371 return fExpressionList;
372}
373
374////////////////////////////////////////////////////////////////////////////////
375/// Return the expression on X
376
378{
380 if (el) {
381 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
382 if (f) return f->ConvertAliases();
383 return nullptr;
384 }
385 return nullptr;
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// Return the expression on Y
390
392{
394 if (el) {
395 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
396 if (f) return f->ConvertAliases();
397 return nullptr;
398 }
399 return nullptr;
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Return the expression on Z
404
406{
408 if (el) {
409 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
410 if (f) return f->ConvertAliases();
411 return nullptr;
412 }
413 return nullptr;
414}
415
416////////////////////////////////////////////////////////////////////////////////
417/// Return the cut entry
418
420{
422 if (el) {
423 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
424 if (f) return f->GetTrueName();
425 return nullptr;
426 }
427 return nullptr;
428}
429
430////////////////////////////////////////////////////////////////////////////////
431/// Handle mouse button event in container.
432
434{
435 int total, selected;
436
437 if (event->fType == kButtonPress) {
438 fXp = event->fX;
439 fYp = event->fY;
440 if (fLastActive) {
441 fLastActive->Activate(false);
442 fLastActive = nullptr;
443 }
444 total = selected = 0;
445
447 TIter next(fList);
448 while ((el = (TGFrameElement *) next())) {
449 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
450 ++total;
451 if (f->GetId() == (Window_t)event->fUser[0]) { // fUser[0] = subwindow
452 f->Activate(true);
453 if (f->GetTip()) (f->GetTip())->Hide();
454 fX0 = f->GetX();
455 fY0 = f->GetY();
456 ++selected;
457 fLastActive = f;
458 } else {
459 f->Activate(false);
460 }
461 }
462
463 if (fTotal != total || fSelected != selected) {
464 fTotal = total;
465 fSelected = selected;
468 }
469
470 if (selected == 1 && event->fCode == 1) {
473 fDragging = true;
474 gVirtualX->SetCursor(fId,fCursor);
475 fXp = event->fX;
476 fYp = event->fY;
477 }
478 }
479 }
480
481 if (event->fType == kButtonRelease) {
482 if (fDragging) {
483 fDragging = false;
484 gVirtualX->SetCursor(fId,fDefaultCursor);
487 TIter next(fList);
488 while ((el = (TGFrameElement *) next())) {
489 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
490 if ((f == fLastActive) || !f->IsActive()) continue;
491 ULong_t *itemType = (ULong_t *) f->GetUserData();
492 fLastActive->Activate(false);
494 // dragging items to expressions
495 ((TTVLVEntry *) fLastActive)->CopyItem(f);
497 f->SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
498 } else {
499 if (strlen(((TTVLVEntry *) fLastActive)->GetTrueName())) {
500 // dragging to scan box
501 if (!strlen(f->GetTrueName())) {
502 f->SetTrueName(((TTVLVEntry *)fLastActive)->GetTrueName());
503 f->SetSmallPic(fClient->GetPicture("pack_t.xpm"));
504 } else {
505 TString name(2000);
506 TString dragged = ((TTVLVEntry *)fLastActive)->ConvertAliases();
507 name = f->GetTrueName();
508 if ((name.Length()+dragged.Length()) < 228) {
509 name += ":";
510 name += dragged;
511 f->SetTrueName(name.Data());
512 } else {
513 Warning("HandleButton",
514 "Name too long. Can not add any more items to scan box.");
515 }
516 }
517 }
518 }
519 fLastActive = f;
520 if (fViewer) {
521 char msg[2000];
522 msg[0] = 0;
523 snprintf(msg,2000, "Content : %s", f->GetTrueName());
525 }
526 }
527 if ((std::abs(event->fX - fXp) < 2) && (std::abs(event->fY - fYp) < 2)) {
529 event->fCode, (event->fYRoot << 16) | event->fXRoot);
530 }
531 } else {
533 event->fCode, (event->fYRoot << 16) | event->fXRoot);
534 }
535 }
536 return true;
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Handle mouse motion events.
541
543{
544 Int_t xf0, xff, yf0, yff;
545 Int_t xpos = event->fX - (fXp-fX0);
546 Int_t ypos = event->fY - (fYp-fY0);
547
548 if (fDragging) {
551 TIter next(fList);
552 while ((el = (TGFrameElement *) next())) {
553 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
554 if (f == fLastActive) {
555 if (f->GetTip()) (f->GetTip())->Hide();
556 continue;
557 }
558 xf0 = f->GetX();
559 yf0 = f->GetY();
560 xff = f->GetX() + f->GetWidth();
561 yff = f->GetY() + f->GetHeight();
562 itemType = (ULong_t *) f->GetUserData();
565 f->Activate(true);
566 } else {
567 f->Activate(false);
568 }
569 }
570 }
571 if ((fXp - event->fX) > 10) {
574 }
576 gVirtualX->RaiseWindow(fLastActive->GetId());
578 }
579 return true;
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Clear all names and aliases for expression type items
584
586{
588 TIter next(fList);
589 while ((el = (TGFrameElement *) next())) {
590 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
591 UInt_t *userData = (UInt_t *) f->GetUserData();
594 f->SetSmallPic(fClient->GetPicture("pack-empty_t.xpm"));
595 f->SetTrueName("");
596 } else {
597 f->Empty();
598 }
599 }
600 }
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Remove all non-static items from the list view, except expressions
605
607{
609 TIter next(fList);
610 while ((el = (TGFrameElement *) next())) {
611 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
612 UInt_t *userData = (UInt_t *) f->GetUserData();
614 RemoveItem(f);
615 }
616 }
617 fLastActive = nullptr;
618}
619
620////////////////////////////////////////////////////////////////////////////////
621/// Select an item
622
624{
625 if (fLastActive) {
626 fLastActive->Activate(false);
627 fLastActive = nullptr;
628 }
630 fSelected = 0;
631 TIter next(fList);
632 while ((el = (TGFrameElement *) next())) {
633 TTVLVEntry *f = (TTVLVEntry *) el->fFrame;
634 if (!strcmp(f->GetItemName()->GetString(),name)) {
635 f->Activate(true);
636 fLastActive = (TGLVEntry *) f;
637 fSelected++;
638 } else {
639 f->Activate(false);
640 }
641 }
642}
643
644
645/** \class TGSelectBox
646This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data members.
647It is a singleton in order to be able to use it for several expressions.
648*/
649
654
656
657////////////////////////////////////////////////////////////////////////////////
658/// TGSelectBox constructor
659
661 UInt_t w, UInt_t h)
663{
664 if (!fgInstance) {
665 fgInstance = this;
667 if (!fViewer) Error("TGSelectBox", "Must be started from viewer");
668 fEntry = nullptr;
670 fBLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 2, 2, 2);
672
673 fLabel = new TGLabel(this, "");
675
676 fTe = new TGTextEntry(this, new TGTextBuffer(2000));
677 fTe->SetToolTipText("Type an expression using C++ syntax. Click other expression/leaves to paste them here.");
679
680 fLabelAlias = new TGLabel(this, "Alias");
682
683 fTeAlias = new TGTextEntry(this, new TGTextBuffer(100));
684 fTeAlias->SetToolTipText("Define an alias for this expression. Do NOT use leading strings of other aliases.");
686
687 fBf = new TGHorizontalFrame(this, 10, 10);
688
689 fCANCEL = new TGTextButton(fBf, "&Cancel", kTFCancel);
690 fCANCEL->Associate(this);
692
693 fDONE = new TGTextButton(fBf, "&Done", kTFDone);
694 fDONE->Associate(this);
696
698
701
702// SetBackgroundColor(color);
704 Int_t ax, ay;
705 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(), 25,
706 (Int_t)(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
707 ax, ay, wdum);
709 MapWindow();
710 }
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// TGSelectBox destructor
715
717{
718 fgInstance = nullptr;
719 delete fLabel;
720 delete fTe;
721 delete fLabelAlias;
722 delete fTeAlias;
723 delete fDONE;
724 delete fCANCEL;
725 delete fBf;
726 delete fLayout;
727 delete fBLayout;
728 delete fBLayout1;
729}
730
731////////////////////////////////////////////////////////////////////////////////
732/// Close the select box
733
735{
736 gVirtualX->UnmapWindow(GetId());
737 delete this;
738}
739
740////////////////////////////////////////////////////////////////////////////////
741/// Return the pointer to the instantiated singleton
742
747
748////////////////////////////////////////////////////////////////////////////////
749/// Just focus the cursor inside
750
752{
753 Event_t event;
754 event.fType = kButtonPress;
755 event.fCode = kButton1;
756 event.fX = event.fY = 1;
757 Int_t position = fTe->GetCursorPosition();
758 fTe->HandleButton(&event);
759 fTe->SetCursorPosition(position);
760}
761
762////////////////////////////////////////////////////////////////////////////////
763/// Set label of selection box
764
765void TGSelectBox::SetLabel(const char* title)
766{
767 fLabel->SetText(new TGString(title));
768}
769
770////////////////////////////////////////////////////////////////////////////////
771/// Save the edited entry true name and alias
772
774{
775 if (fEntry) {
776
777 bool cutType;
779 if (name.Length())
780 fEntry->SetToolTipText("Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
781 else
782 fEntry->SetToolTipText("User-defined expression/cut. Double-click to edit");
783 // Set type of item to "cut" if containing boolean operators
784 cutType = name.Contains("<") || name.Contains(">") || name.Contains("=") ||
785 name.Contains("!") || name.Contains("&") || name.Contains("|");
787 if (!alias.BeginsWith("~") && !alias.Contains("empty")) fTeAlias->InsertText("~", 0);
789
790 if (fOldAlias.Contains("empty")) {
792 return;
793 }
794 TList *list = fViewer->ExpressionList();
795 TIter next(list);
797 while ((item=(TTVLVEntry*)next())) {
798 if (item != fEntry) {
799 name = item->GetTrueName();
800 name.ReplaceAll(fOldAlias.Data(), fTeAlias->GetText());
801 item->SetTrueName(name.Data());
802 }
803 }
804 }
805}
806
807////////////////////////////////////////////////////////////////////////////////
808/// Connect one entry
809
811{
812 fEntry = entry;
813 fTe->SetText(entry->GetTrueName());
814 fTeAlias->SetText(entry->GetAlias());
815 fOldAlias = entry->GetAlias();
816}
817
818////////////////////////////////////////////////////////////////////////////////
819/// Insert text in text entry
820
822{
823 Int_t start = fTe->GetCursorPosition();
826}
827
828////////////////////////////////////////////////////////////////////////////////
829/// Message interpreter
830
832{
833 switch (GET_MSG(msg)) {
834 case kC_TEXTENTRY:
835 switch (GET_SUBMSG(msg)) {
836 case kTE_ENTER:
837 if (ValidateAlias()) SaveText();
838 break;
839 default:
840 break;
841 }
842 break;
843 case kC_COMMAND:
844 switch (GET_SUBMSG(msg)) {
845 case kCM_BUTTON:
846 switch (parm1) {
847 case kTFDone:
848 if (!ValidateAlias()) break;
849 SaveText();
850 CloseWindow();
851 break;
852 case kTFCancel:
853 CloseWindow();
854 break;
855 default:
856 break;
857 }
858 break;
859 default:
860 break;
861 }
862 break;
863 default:
864 if (parm2) break; // just to avoid warning on CC compiler
865 break;
866 }
867 return true;
868}
869
870////////////////////////////////////////////////////////////////////////////////
871/// Return true if edited alias is not a leading string of other expression aliases
872
874{
875 if (!strcmp(fTeAlias->GetText(), "-empty-") || !strlen(fTeAlias->GetText())) {
876 fViewer->Warning("ValidateAlias", "You should define the alias first.");
877 return false;
878 }
879 TList *list = fViewer->ExpressionList();
880 TIter next(list);
882 while ((item=(TTVLVEntry*)next())) {
883 if (item != fEntry) {
884 TString itemalias(item->GetAlias());
885 if (itemalias.Contains(fTeAlias->GetText())) {
886 fViewer->Warning("ValidAlias", "Alias can not be the leading string of other alias.");
887 return false;
888 }
889 }
890 }
891 return true;
892}
@ 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
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
@ 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:1579
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:380
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:316
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:316
Bool_t fMapSubwindows
kTRUE - map subwindows
Definition TGFrame.h:297
TList * fList
container of frame elements
Definition TGFrame.h:294
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition TGCanvas.cxx:657
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
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:331
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:621
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
UInt_t fHeight
frame height
Definition TGFrame.h:88
void MapWindow() override
map window
Definition TGFrame.h:206
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:585
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:637
UInt_t GetHeight() const
Definition TGFrame.h:227
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
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:179
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:500
const TGWindow * fMain
Definition TGFrame.h:503
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:399
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:354
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
Basic string class.
Definition TString.h:138
Ssiz_t Length() const
Definition TString.h:425
const char * Data() const
Definition TString.h:384
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:712
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
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.
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.
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
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