Logo ROOT  
Reference Guide
TGListTree.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id: 2897f2e70909348e1e18681c5c7b0aee8c027744 $
2 // Author: Fons Rademakers 25/02/98
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 
13  This source is based on Xclass95, a Win95-looking GUI toolkit.
14  Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15 
16  Xclass95 is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Library General Public
18  License as published by the Free Software Foundation; either
19  version 2 of the License, or (at your option) any later version.
20 
21 **************************************************************************/
22 
23 //////////////////////////////////////////////////////////////////////////
24 // //
25 // TGListTree and TGListTreeItem //
26 // //
27 // A list tree is a widget that can contain a number of items //
28 // arranged in a tree structure. The items are represented by small //
29 // folder icons that can be either open or closed. //
30 // //
31 // The TGListTree is user callable. The TGListTreeItem is a service //
32 // class of the list tree. //
33 // //
34 // A list tree can generate the following events: //
35 // kC_LISTTREE, kCT_ITEMCLICK, which button, location (y<<16|x). //
36 // kC_LISTTREE, kCT_ITEMDBLCLICK, which button, location (y<<16|x). //
37 // //
38 //////////////////////////////////////////////////////////////////////////
39 
40 #include <cstdlib>
41 #include <iostream>
42 
43 #include "TClass.h"
44 #include "TGListTree.h"
45 #include "TGPicture.h"
46 #include "TGCanvas.h"
47 #include "TGScrollBar.h"
48 #include "TGToolTip.h"
49 #include "KeySymbols.h"
50 #include "TGTextEditDialogs.h"
51 #include "TGResourcePool.h"
52 #include "TGMsgBox.h"
53 #include "TError.h"
54 #include "TColor.h"
55 #include "TSystem.h"
56 #include "TString.h"
57 #include "TObjString.h"
58 #include "TGDNDManager.h"
59 #include "TBufferFile.h"
60 #include "TVirtualX.h"
61 #include "RConfigure.h"
62 #include "strlcpy.h"
63 #include "snprintf.h"
64 
66 const TGFont *TGListTree::fgDefaultFont = nullptr;
67 TGGC *TGListTree::fgActiveGC = nullptr;
68 TGGC *TGListTree::fgDrawGC = nullptr;
69 TGGC *TGListTree::fgLineGC = nullptr;
71 TGGC *TGListTree::fgColorGC = nullptr;
72 const TGPicture *TGListTree::fgOpenPic = nullptr;
73 const TGPicture *TGListTree::fgClosedPic = nullptr;
74 const TGPicture *TGListTree::fgCheckedPic = nullptr;
75 const TGPicture *TGListTree::fgUncheckedPic = nullptr;
76 
77 
81 
82 /******************************************************************************/
83 /******************************************************************************/
84 // TGListTreeItem
85 /******************************************************************************/
86 
87 ////////////////////////////////////////////////////////////////////////////////
88 /// Constructor.
89 
91  fClient(client),
92  fParent (0), fFirstchild(0), fLastchild (0), fPrevsibling(0),
93  fNextsibling(0),fOpen (kFALSE), fDNDState (0),
94  fY (0), fXtext (0), fYtext(0), fHeight(0)
95 {
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// Return width of item's icon.
100 
102 {
103  const TGPicture *pic = GetPicture();
104  return (pic) ? pic->GetWidth() : 0;
105 }
106 
107 /******************************************************************************/
108 /******************************************************************************/
109 // TGListTreeItemStd
110 /******************************************************************************/
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 /// Create list tree item.
114 
116  const TGPicture *opened,
117  const TGPicture *closed,
118  Bool_t checkbox) :
119  TGListTreeItem(client)
120 {
121  fText = name;
122  fCheckBox = checkbox;
123  fChecked = kTRUE;
124 
125  if (!opened)
126  opened = TGListTree::GetOpenPic();
127  else
128  ((TGPicture *)opened)->AddReference();
129 
130  if (!closed)
131  closed = TGListTree::GetClosedPic();
132  else
133  ((TGPicture *)closed)->AddReference();
134 
135  fOpenPic = opened;
136  fClosedPic = closed;
137 
140 
141  fActive = kFALSE;
142 
143  fOwnsData = kFALSE;
144  fUserData = 0;
145 
146  fHasColor = kFALSE;
147  fColor = 0;
148  fDNDState = 0;
149 }
150 
151 ////////////////////////////////////////////////////////////////////////////////
152 /// Delete list tree item.
153 
155 {
156  if (fOwnsData && fUserData) {
157  TObject *obj = static_cast<TObject *>(fUserData);
158  delete dynamic_cast<TObject *>(obj);
159  }
164 }
165 
166 ////////////////////////////////////////////////////////////////////////////////
167 /// Return color for marking items that are active or selected.
168 
170 {
172 }
173 
174 ////////////////////////////////////////////////////////////////////////////////
175 /// Add all child items of 'item' into the list 'checked'.
176 
178 {
179  TGListTreeItem *item = this;
180 
181  while (item) {
182  if (item->IsChecked()) {
183  return kTRUE;
184  }
185  if (item->GetFirstChild()) {
186  if (item->GetFirstChild()->HasCheckedChild())
187  return kTRUE;
188  }
189  if (!first)
190  item = item->GetNextSibling();
191  else
192  break;
193  }
194  return kFALSE;
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// Add all child items of 'item' into the list 'checked'.
199 
201 {
202  TGListTreeItem *item = this;
203 
204  while (item) {
205  if (!item->IsChecked()) {
206  return kTRUE;
207  }
208  if (item->GetFirstChild()) {
209  if (item->GetFirstChild()->HasUnCheckedChild())
210  return kTRUE;
211  }
212  if (!first)
213  item = item->GetNextSibling();
214  else
215  break;
216  }
217  return kFALSE;
218 }
219 
220 ////////////////////////////////////////////////////////////////////////////////
221 /// Update the state of the node 'item' according to the children states.
222 
224 {
225  if ((!fChecked && HasCheckedChild(kTRUE)) ||
227  SetCheckBoxPictures(gClient->GetPicture("checked_dis_t.xpm"),
228  gClient->GetPicture("unchecked_dis_t.xpm"));
229  }
230  else {
231  SetCheckBoxPictures(gClient->GetPicture("checked_t.xpm"),
232  gClient->GetPicture("unchecked_t.xpm"));
233  }
234 }
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 /// Set all child items of this one checked if state=kTRUE,
238 /// unchecked if state=kFALSE.
239 
241 {
242  if (state) {
243  if (!IsChecked())
244  CheckItem();
245  } else {
246  if (IsChecked())
247  Toggle();
248  }
249  CheckChildren(GetFirstChild(), state);
250  UpdateState();
251 }
252 
253 ////////////////////////////////////////////////////////////////////////////////
254 /// Set all child items of 'item' checked if state=kTRUE;
255 /// unchecked if state=kFALSE.
256 
258 {
259  if (!item) return;
260 
261  while (item) {
262  if (state){
263  if (!item->IsChecked())
264  item->CheckItem();
265  } else {
266  if (item->IsChecked())
267  item->Toggle();
268  }
269  if (item->GetFirstChild()) {
270  CheckChildren(item->GetFirstChild(), state);
271  }
272  item->UpdateState();
273  item = item->GetNextSibling();
274  }
275 }
276 
277 ////////////////////////////////////////////////////////////////////////////////
278 /// Set a check box on the tree node.
279 
281 {
282  fCheckBox = on;
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Change list tree check item icons.
287 
289  const TGPicture *unchecked)
290 {
293 
294  if (!checked) {
295  ::Warning("TGListTreeItem::SetCheckBoxPictures", "checked picture not specified, defaulting to checked_t");
296  checked = fClient->GetPicture("checked_t.xpm");
297  } else
298  ((TGPicture *)checked)->AddReference();
299 
300  if (!unchecked) {
301  ::Warning("TGListTreeItem::SetCheckBoxPictures", "unchecked picture not specified, defaulting to unchecked_t");
302  unchecked = fClient->GetPicture("unchecked_t.xpm");
303  } else
304  ((TGPicture *)unchecked)->AddReference();
305 
306  fCheckedPic = checked;
307  fUncheckedPic = unchecked;
308 }
309 
310 ////////////////////////////////////////////////////////////////////////////////
311 /// Change list tree item icons.
312 
313 void TGListTreeItemStd::SetPictures(const TGPicture *opened, const TGPicture *closed)
314 {
317 
318  if (!opened) {
319  ::Warning("TGListTreeItem::SetPictures", "opened picture not specified, defaulting to ofolder_t");
320  opened = fClient->GetPicture("ofolder_t.xpm");
321  } else
322  ((TGPicture *)opened)->AddReference();
323 
324  if (!closed) {
325  ::Warning("TGListTreeItem::SetPictures", "closed picture not specified, defaulting to folder_t");
326  closed = fClient->GetPicture("folder_t.xpm");
327  } else
328  ((TGPicture *)closed)->AddReference();
329 
330  fOpenPic = opened;
331  fClosedPic = closed;
332 }
333 
334 
335 /******************************************************************************/
336 /******************************************************************************/
337 // TGListTree
338 /******************************************************************************/
339 
340 ////////////////////////////////////////////////////////////////////////////////
341 /// Create a list tree widget.
342 
344  ULong_t back) :
345  TGContainer(p, w, h, options, back)
346 {
347  fMsgWindow = p;
348  fCanvas = 0;
349  fTip = 0;
350  fTipItem = 0;
351  fAutoTips = kFALSE;
354  fBdown = kFALSE;
358  fDropItem = 0;
359  fLastEventState = 0;
360 
363 
364  fActiveGC = GetActiveGC()();
365  fDrawGC = GetDrawGC()();
366  fLineGC = GetLineGC()();
368  fColorGC = GetColorGC()();
369 
371  fDefw = fDefh = 1;
372 
373  fHspacing = 2;
374  fVspacing = 2; // 0;
375  fIndent = 3; // 0;
376  fMargin = 2;
377 
378  fXDND = fYDND = 0;
379  fDNDData.fData = 0;
380  fDNDData.fDataLength = 0;
381  fDNDData.fDataType = 0;
382  fBuf = 0;
383 
387 
388  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
390  kNone, kNone);
391 
394  SetWindowName();
395 
396  fDNDTypeList = new Atom_t[3];
397  fDNDTypeList[0] = gVirtualX->InternAtom("application/root", kFALSE);
398  fDNDTypeList[1] = gVirtualX->InternAtom("text/uri-list", kFALSE);
399  fDNDTypeList[2] = 0;
400  gVirtualX->SetDNDAware(fId, fDNDTypeList);
403 }
404 
405 ////////////////////////////////////////////////////////////////////////////////
406 /// Create a list tree widget.
407 
409  TGContainer(p, options, back)
410 {
411  fMsgWindow = p;
412  fTip = 0;
413  fTipItem = 0;
414  fAutoTips = kFALSE;
417  fBdown = kFALSE;
421  fDropItem = 0;
422  fLastEventState = 0;
423 
426 
427  fActiveGC = GetActiveGC()();
428  fDrawGC = GetDrawGC()();
429  fLineGC = GetLineGC()();
431  fColorGC = GetColorGC()();
432 
434  fDefw = fDefh = 1;
435 
436  fHspacing = 2;
437  fVspacing = 2; // 0;
438  fIndent = 3; // 0;
439  fMargin = 2;
440 
441  fXDND = fYDND = 0;
442  fDNDData.fData = 0;
443  fDNDData.fDataLength = 0;
444  fDNDData.fDataType = 0;
445  fBuf = 0;
446 
450 
451  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
453  kNone, kNone);
454 
457  SetWindowName();
458 
459  fDNDTypeList = new Atom_t[3];
460  fDNDTypeList[0] = gVirtualX->InternAtom("application/root", kFALSE);
461  fDNDTypeList[1] = gVirtualX->InternAtom("text/uri-list", kFALSE);
462  fDNDTypeList[2] = 0;
463  gVirtualX->SetDNDAware(fId, fDNDTypeList);
466 }
467 
468 ////////////////////////////////////////////////////////////////////////////////
469 /// Delete list tree widget.
470 
472 {
473  TGListTreeItem *item, *sibling;
474 
475  delete [] fDNDTypeList;
476  delete fTip;
477 
478  item = fFirst;
479  while (item) {
480  PDeleteChildren(item);
481  sibling = item->fNextsibling;
482  delete item;
483  item = sibling;
484  }
485 }
486 
487 //--- text utility functions
488 
489 ////////////////////////////////////////////////////////////////////////////////
490 /// Returns height of currently used font.
491 
493 {
494  if (!fgDefaultFont)
495  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
496  return fgDefaultFont->TextHeight();
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// Returns ascent of currently used font.
501 
503 {
505  if (!fgDefaultFont)
506  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
508  return m.fAscent;
509 }
510 
511 ////////////////////////////////////////////////////////////////////////////////
512 /// Returns text width relative to currently used font.
513 
515 {
516  if (!fgDefaultFont)
517  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
518  return fgDefaultFont->TextWidth(c);
519 }
520 
521 //---- highlighting utilities
522 
523 ////////////////////////////////////////////////////////////////////////////////
524 /// Highlight tree item.
525 
527 {
528  if (item) {
529  if ((item == fSelected) && !state) {
530  fSelected = 0;
531  if (draw) DrawItemName(fId, item);
532  } else if (state != item->IsActive()) { // !!!! leave active alone ...
533  item->SetActive(state);
534  if (draw) DrawItemName(fId, item);
535  }
536  }
537 }
538 
539 ////////////////////////////////////////////////////////////////////////////////
540 /// Higlight item children.
541 
543 {
544  while (item) {
545  HighlightItem(item, state, draw);
546  if (item->fFirstchild)
547  HighlightChildren(item->fFirstchild, state, (item->IsOpen()) ? draw : kFALSE);
548  item = item->fNextsibling;
549  }
550 }
551 
552 ////////////////////////////////////////////////////////////////////////////////
553 /// Unselect all items.
554 
556 {
557  ClearViewPort();
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 /// Handle button events in the list tree.
563 
565 {
566  TGListTreeItem *item;
567 
568  if (fTip) fTip->Hide();
569 
570  Int_t page = 0;
571  if (event->fCode == kButton4 || event->fCode == kButton5) {
572  if (!fCanvas) return kTRUE;
573  if (fCanvas->GetContainer()->GetHeight()) {
574 // page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() *
575 // fCanvas->GetViewPort()->GetHeight()) /
576 // fCanvas->GetContainer()->GetHeight());
577  // choose page size either 1/5 of viewport or 5 lines (90)
578  Int_t r = fCanvas->GetViewPort()->GetHeight() / 5;
579  page = TMath::Min(r, 90);
580  }
581  }
582 
583  if (event->fCode == kButton4) {
584  //scroll up
585  Int_t newpos = fCanvas->GetVsbPosition() - page;
586  if (newpos < 0) newpos = 0;
587  fCanvas->SetVsbPosition(newpos);
588  return kTRUE;
589  }
590  if (event->fCode == kButton5) {
591  // scroll down
592  Int_t newpos = fCanvas->GetVsbPosition() + page;
593  fCanvas->SetVsbPosition(newpos);
594  return kTRUE;
595  }
596 
597  if (event->fType == kButtonPress) {
598  if ((item = FindItem(event->fY)) != 0) {
599  if (event->fCode == kButton1) {
600  Int_t minx, maxx;
601  Int_t minxchk = 0, maxxchk = 0;
602  if (item->HasCheckBox() && item->GetCheckBoxPicture()) {
603  minxchk = (item->fXtext - item->GetCheckBoxPicture()->GetWidth());
604  maxxchk = (item->fXtext - 4);
605  maxx = maxxchk - Int_t(item->GetPicWidth()) - 8;
606  minx = minxchk - Int_t(item->GetPicWidth()) - 16;
607  }
608  else {
609  maxx = (item->fXtext - Int_t(item->GetPicWidth())) - 8;
610  minx = (item->fXtext - Int_t(item->GetPicWidth())) - 16;
611  }
612  if ((item->HasCheckBox()) && (event->fX < maxxchk) &&
613  (event->fX > minxchk))
614  {
615  ToggleItem(item);
616  if (fCheckMode == kRecursive) {
617  CheckAllChildren(item, item->IsChecked());
618  }
619  UpdateChecked(item, kTRUE);
620  Checked((TObject *)item->GetUserData(), item->IsChecked());
621  return kTRUE;
622  }
623  if ((event->fX < maxx) && (event->fX > minx)) {
624  item->SetOpen(!item->IsOpen());
625  ClearViewPort();
626  return kTRUE;
627  }
628  }
629  // DND specific
630  if (event->fCode == kButton1) {
631  fXDND = event->fX;
632  fYDND = event->fY;
633  fBdown = kTRUE;
634  }
635  if (!fUserControlled) {
638  //item->fActive = kTRUE; // this is done below w/redraw
639  fCurrent = fSelected = item;
640  HighlightItem(item, kTRUE, kTRUE);
642  event->fCode, (event->fYRoot << 16) | event->fXRoot);
643  }
644  else {
645  fCurrent = fSelected = item;
646  ClearViewPort();
647  }
648  Clicked(item, event->fCode);
649  Clicked(item, event->fCode, event->fXRoot, event->fYRoot);
650  Clicked(item, event->fCode, event->fState, event->fXRoot, event->fYRoot);
651  }
652  }
653  if (event->fType == kButtonRelease) {
654  fBdown = kFALSE;
655  }
656  return kTRUE;
657 }
658 
659 ////////////////////////////////////////////////////////////////////////////////
660 /// Handle double click event in the list tree (only for kButton1).
661 
663 {
664  TGListTreeItem *item = 0;
665 
666  if (event->fCode == kButton4 || event->fCode == kButton5) {
667  return kFALSE;
668  }
669  // If fDisableOpen is set, only send message and emit signals.
670  // It allows user to customize handling of double click events.
671  if (fDisableOpen && event->fCode == kButton1 && (item = FindItem(event->fY)) != 0) {
673  event->fCode, (event->fYRoot << 16) | event->fXRoot);
674  DoubleClicked(item, event->fCode);
675  DoubleClicked(item, event->fCode, event->fXRoot, event->fYRoot);
676  return kTRUE;
677  }
678  item = FindItem(event->fY);
679 
680  // Otherwise, just use default behaviour (open item).
681  if (event->fCode == kButton1 && item) {
682  ClearViewPort();
683  item->SetOpen(!item->IsOpen());
684  if (!fUserControlled) {
685  if (item != fSelected) { // huh?!
686  if (fSelected) fSelected->SetActive(kFALSE); // !!!!
688  HighlightItem(item, kTRUE, kTRUE);
689  }
690  }
692  event->fCode, (event->fYRoot << 16) | event->fXRoot);
693  DoubleClicked(item, event->fCode);
694  DoubleClicked(item, event->fCode, event->fXRoot, event->fYRoot);
695  }
696  if (!fUserControlled)
697  fSelected = item;
698  return kTRUE;
699 }
700 
701 ////////////////////////////////////////////////////////////////////////////////
702 /// Handle mouse crossing event.
703 
705 {
706  if (event->fType == kLeaveNotify) {
707  if (fTip) {
708  fTip->Hide();
709  fTipItem = 0;
710  }
711  if (!fUserControlled) {
712  if (fCurrent)
713  DrawOutline(fId, fCurrent, 0xffffff, kTRUE);
714  if (fBelowMouse)
715  DrawOutline(fId, fBelowMouse, 0xffffff, kTRUE);
716  fCurrent = 0;
717  }
718  if (fBelowMouse) {
719  fBelowMouse = 0;
720  MouseOver(0);
721  MouseOver(0, event->fState);
722  }
723  }
724  ClearViewPort();
725  return kTRUE;
726 }
727 
728 ////////////////////////////////////////////////////////////////////////////////
729 /// Handle dragging position events.
730 
732  Int_t /*xroot*/, Int_t /*yroot*/)
733 {
734  static TGListTreeItem *olditem = 0;
735  TGListTreeItem *item;
736  if ((item = FindItem(y)) != 0) {
737  if (item->IsDNDTarget()) {
738  fDropItem = item;
739  if (olditem)
740  HighlightItem(olditem, kFALSE, kTRUE);
741  HighlightItem(item, kTRUE, kTRUE);
742  olditem = item;
743  return action;
744  }
745  }
746  fDropItem = 0;
747  if (olditem) {
748  HighlightItem(olditem, kFALSE, kTRUE);
749  olditem = 0;
750  }
751  return kNone;
752 }
753 
754 ////////////////////////////////////////////////////////////////////////////////
755 /// Handle drag enter events.
756 
758 {
759  Atom_t ret = kNone;
760  for (int i = 0; typelist[i] != kNone; ++i) {
761  if (typelist[i] == fDNDTypeList[0])
762  ret = fDNDTypeList[0];
763  if (typelist[i] == fDNDTypeList[1])
764  ret = fDNDTypeList[1];
765  }
766  return ret;
767 }
768 
769 ////////////////////////////////////////////////////////////////////////////////
770 /// Handle drag leave events.
771 
773 {
774  return kTRUE;
775 }
776 
777 ////////////////////////////////////////////////////////////////////////////////
778 /// Handle drop events.
779 
781 {
782  DataDropped(fDropItem, data);
784  //ClearHighlighted();
785  return kTRUE;
786 }
787 
788 ////////////////////////////////////////////////////////////////////////////////
789 /// Emit DataDropped() signal.
790 
792 {
793  Long_t args[2];
794 
795  args[0] = (Long_t)item;
796  args[1] = (Long_t)data;
797 
798  Emit("DataDropped(TGListTreeItem*,TDNDData*)", args);
799 }
800 
801 ////////////////////////////////////////////////////////////////////////////////
802 /// Handle mouse motion event. Used to set tool tip, to emit
803 /// MouseOver() signal and for DND handling.
804 
806 {
807  TGListTreeItem *item;
808  TGPosition pos = GetPagePosition();
809 
810  if (gDNDManager->IsDragging()) {
811  gDNDManager->Drag(event->fXRoot, event->fYRoot,
813  } else if ((item = FindItem(event->fY)) != 0) {
814  if (!fUserControlled) {
815  if (fCurrent)
816  DrawOutline(fId, fCurrent, 0xffffff, kTRUE);
817  if (fBelowMouse)
818  DrawOutline(fId, fBelowMouse, 0xffffff, kTRUE);
819  DrawOutline(fId, item);
820  fCurrent = item;
821  }
822  if (item != fBelowMouse) {
823  fBelowMouse = item;
825  MouseOver(fBelowMouse, event->fState);
826  }
827 
828  if (item->HasCheckBox() && item->GetCheckBoxPicture()) {
829  if ((event->fX < (item->fXtext - 4) &&
830  (event->fX > (item->fXtext - (Int_t)item->GetCheckBoxPicture()->GetWidth()))))
831  {
832  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kPointer));
833  return kTRUE;
834  }
835  else {
836  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kHand));
837  }
838  }
839  if (!gDNDManager->IsDragging()) {
840  if (fBdown && ((abs(event->fX - fXDND) > 2) || (abs(event->fY - fYDND) > 2))) {
841  if (gDNDManager && item->IsDNDSource()) {
842  if (!fBuf) fBuf = new TBufferFile(TBuffer::kWrite);
843  fBuf->Reset();
844  // !!!!! Here check virtual Bool_t HandlesDragAndDrop()
845  // and let the item handle this.
846  if (item->GetUserData()) {
847  TObject *obj = static_cast<TObject *>(item->GetUserData());
848  if (dynamic_cast<TObject *>(obj)) {
849  TObjString *ostr = dynamic_cast<TObjString *>(obj);
850  if (ostr) {
851  TString& str = ostr->String();
852  if (str.BeginsWith("file://")) {
854  fDNDData.fData = (void *)strdup(str.Data());
855  fDNDData.fDataLength = str.Length()+1;
856  }
857  }
858  else {
860  fBuf->WriteObject((TObject *)item->GetUserData());
861  fDNDData.fData = fBuf->Buffer();
863  }
864  }
865  }
866  else {
868  TString str = TString::Format("file://%s/%s\r\n",
870  item->GetText());
871  fDNDData.fData = (void *)strdup(str.Data());
872  fDNDData.fDataLength = str.Length()+1;
873  }
874  if (item->GetPicture()) {
875  TString xmpname = item->GetPicture()->GetName();
876  if (xmpname.EndsWith("_t.xpm"))
877  xmpname.ReplaceAll("_t.xpm", "_s.xpm");
878  if (xmpname.EndsWith("_t.xpm__16x16"))
879  xmpname.ReplaceAll("_t.xpm__16x16", "_s.xpm");
880  const TGPicture *pic = fClient->GetPicture(xmpname.Data());
881  if (!pic) pic = item->GetPicture();
882  if (pic) SetDragPixmap(pic);
883  }
884  gDNDManager->StartDrag(this, event->fXRoot, event->fYRoot);
885  }
886  }
887  }
888  if (gDNDManager->IsDragging()) {
889  gDNDManager->Drag(event->fXRoot, event->fYRoot,
891  } else {
892  if (fTipItem == item) return kTRUE;
893  if (!fUserControlled) { // !!!! what is this? It was called above once?
894  MouseOver(item);
895  MouseOver(item, event->fState);
896  }
897  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kHand));
898  }
899 
900  if (fTip)
901  fTip->Hide();
902 
903  if (item->GetTipTextLength() > 0) {
904 
905  SetToolTipText(item->GetTipText(), item->fXtext,
906  item->fY - pos.fY + item->fHeight, 1000);
907 
908  } else if (fAutoTips && item->GetUserData()) {
909  // must derive from TObject (in principle user can put pointer
910  // to anything in user data field). Add check.
911  TObject *obj = (TObject *)item->GetUserData();
912  if (obj && obj->IsA()->IsTObject()) {
913  SetToolTipText(obj->GetTitle(), item->fXtext,
914  item->fY - pos.fY + item->fHeight, 1000);
915  }
916  }
917  fTipItem = item;
918  } else {
919  if (fBelowMouse) {
920  fBelowMouse = 0;
922  MouseOver(fBelowMouse, event->fState);
923  }
924  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kPointer));
925  }
926  return kTRUE;
927 }
928 
929 ////////////////////////////////////////////////////////////////////////////////
930 /// The key press event handler converts a key press to some line editor
931 /// action.
932 
934 {
935  char input[10];
936  UInt_t keysym;
937  TGListTreeItem *item = 0;
938 
939  fLastEventState = event->fState;
940  if (fTip) fTip->Hide();
941 
942  if (event->fType == kGKeyPress) {
943  gVirtualX->LookupString(event, input, sizeof(input), keysym);
944 
945  if (!event->fState && (EKeySym)keysym == kKey_Escape) {
947  }
948 
949  item = fCurrent;
950  if (!item) return kFALSE;
951 
953  KeyPressed(item, keysym, event->fState);
954 
956  return kTRUE;
957 
958  switch ((EKeySym)keysym) {
959  case kKey_Enter:
960  case kKey_Return:
961  event->fType = kButtonPress;
962  event->fCode = kButton1;
963 
964  if (fSelected == item) {
965  // treat 'Enter' and 'Return' as a double click
966  ClearViewPort();
967  item->SetOpen(!item->IsOpen());
968  DoubleClicked(item, 1);
969  } else {
970  // treat 'Enter' and 'Return' as a click
973  ClearViewPort();
974  fSelected = item;
976  HighlightItem(item, kTRUE, kTRUE);
977  Clicked(item, 1);
978  Clicked(item, 1, event->fXRoot, event->fYRoot);
979  Clicked(item, 1, event->fState, event->fXRoot, event->fYRoot);
980  }
981  break;
982  case kKey_Space:
983  if (item->HasCheckBox()) {
984  ToggleItem(item);
985  if (fCheckMode == kRecursive) {
986  CheckAllChildren(item, item->IsChecked());
987  }
988  UpdateChecked(item, kTRUE);
989  Checked((TObject *)item->GetUserData(), item->IsChecked());
990  }
991  break;
992  case kKey_F3:
993  Search(kFALSE);
994  break;
995  case kKey_F5:
996  Layout();
997  break;
998  case kKey_F7:
999  Search();
1000  break;
1001  case kKey_Left:
1002  ClearViewPort();
1003  item->SetOpen(kFALSE);
1004  break;
1005  case kKey_Right:
1006  ClearViewPort();
1007  item->SetOpen(kTRUE);
1008  break;
1009  case kKey_Up:
1010  LineUp(event->fState & kKeyShiftMask);
1011  break;
1012  case kKey_Down:
1013  LineDown(event->fState & kKeyShiftMask);
1014  break;
1015  case kKey_PageUp:
1016  PageUp(event->fState & kKeyShiftMask);
1017  break;
1018  case kKey_PageDown:
1019  PageDown(event->fState & kKeyShiftMask);
1020  break;
1021  case kKey_Home:
1022  Home(event->fState & kKeyShiftMask);
1023  break;
1024  case kKey_End:
1025  End(event->fState & kKeyShiftMask);
1026  break;
1027  default:
1028  break;
1029  }
1030  if (event->fState & kKeyControlMask) { // Ctrl key modifier pressed
1031  switch((EKeySym)keysym & ~0x20) { // treat upper and lower the same
1032  case kKey_F:
1033  Search();
1034  break;
1035  case kKey_G:
1036  Search(kFALSE);
1037  break;
1038  default:
1039  return kTRUE;
1040  }
1041  }
1042 
1043  }
1044  return kTRUE;
1045 }
1046 
1047 ////////////////////////////////////////////////////////////////////////////////
1048 /// Signal emitted when pointer is over entry.
1049 
1051 {
1052  Emit("MouseOver(TGListTreeItem*)", (Long_t)entry);
1053 }
1054 
1055 ////////////////////////////////////////////////////////////////////////////////
1056 /// Signal emitted when pointer is over entry.
1057 
1059 {
1060  Long_t args[2];
1061  args[0] = (Long_t)entry;
1062  args[1] = mask;
1063  Emit("MouseOver(TGListTreeItem*,UInt_t)", args);
1064 }
1065 
1066 ////////////////////////////////////////////////////////////////////////////////
1067 /// Signal emitted when keyboard key pressed
1068 ///
1069 /// entry - selected item
1070 /// keysym - defined in "KeySymbols.h"
1071 /// mask - modifier key mask, defined in "GuiTypes.h"
1072 ///
1073 /// const Mask_t kKeyShiftMask = BIT(0);
1074 /// const Mask_t kKeyLockMask = BIT(1);
1075 /// const Mask_t kKeyControlMask = BIT(2);
1076 /// const Mask_t kKeyMod1Mask = BIT(3); // typically the Alt key
1077 /// const Mask_t kButton1Mask = BIT(8);
1078 /// const Mask_t kButton2Mask = BIT(9);
1079 /// const Mask_t kButton3Mask = BIT(10);
1080 /// const Mask_t kButton4Mask = BIT(11);
1081 /// const Mask_t kButton5Mask = BIT(12);
1082 /// const Mask_t kAnyModifier = BIT(15);
1083 
1085 {
1086  Long_t args[3];
1087  args[0] = (Long_t)entry;
1088  args[1] = (Long_t)keysym;
1089  args[2] = (Long_t)mask;
1090  Emit("KeyPressed(TGListTreeItem*,ULong_t,ULong_t)", args);
1091  SendMessage(fMsgWindow, MK_MSG(kC_LISTTREE, kCT_KEY), keysym, mask);
1092 }
1093 
1094 ////////////////////////////////////////////////////////////////////////////////
1095 /// Emit ReturnPressed() signal.
1096 
1098 {
1099  Emit("ReturnPressed(TGListTreeItem*)", (Long_t)entry);
1100 }
1101 
1102 ////////////////////////////////////////////////////////////////////////////////
1103 /// Emit Checked() signal.
1104 
1106 {
1107  Long_t args[2];
1108 
1109  args[0] = (Long_t)entry;
1110  args[1] = on;
1111 
1112  Emit("Checked(TObject*,Bool_t)", args);
1113 }
1114 
1115 ////////////////////////////////////////////////////////////////////////////////
1116 /// Emit Clicked() signal.
1117 
1119 {
1120  Long_t args[2];
1121 
1122  args[0] = (Long_t)entry;
1123  args[1] = btn;
1124 
1125  Emit("Clicked(TGListTreeItem*,Int_t)", args);
1126 }
1127 
1128 ////////////////////////////////////////////////////////////////////////////////
1129 /// Emit Clicked() signal.
1130 
1132 {
1133  Long_t args[4];
1134 
1135  args[0] = (Long_t)entry;
1136  args[1] = btn;
1137  args[2] = x;
1138  args[3] = y;
1139 
1140  Emit("Clicked(TGListTreeItem*,Int_t,Int_t,Int_t)", args);
1141 }
1142 
1143 ////////////////////////////////////////////////////////////////////////////////
1144 /// Emit Clicked() signal.
1145 
1147 {
1148  Long_t args[5];
1149 
1150  args[0] = (Long_t)entry;
1151  args[1] = btn;
1152  args[2] = mask;
1153  args[3] = x;
1154  args[4] = y;
1155 
1156  Emit("Clicked(TGListTreeItem*,Int_t,UInt_t,Int_t,Int_t)", args);
1157 }
1158 
1159 ////////////////////////////////////////////////////////////////////////////////
1160 /// Emit DoubleClicked() signal.
1161 
1163 {
1164  Long_t args[2];
1165 
1166  args[0] = (Long_t)entry;
1167  args[1] = btn;
1168 
1169  Emit("DoubleClicked(TGListTreeItem*,Int_t)", args);
1170 }
1171 
1172 ////////////////////////////////////////////////////////////////////////////////
1173 /// Emit DoubleClicked() signal.
1174 
1176 {
1177  Long_t args[4];
1178 
1179  args[0] = (Long_t)entry;
1180  args[1] = btn;
1181  args[2] = x;
1182  args[3] = y;
1183 
1184  Emit("DoubleClicked(TGListTreeItem*,Int_t,Int_t,Int_t)", args);
1185 }
1186 
1187 ////////////////////////////////////////////////////////////////////////////////
1188 /// Move content to the top.
1189 
1190 void TGListTree::Home(Bool_t /*select*/)
1191 {
1192  if (fCanvas) fCanvas->SetVsbPosition(0);
1193 }
1194 
1195 ////////////////////////////////////////////////////////////////////////////////
1196 /// Move content to the bottom.
1197 
1198 void TGListTree::End(Bool_t /*select*/)
1199 {
1201 }
1202 
1203 ////////////////////////////////////////////////////////////////////////////////
1204 /// Move content one page up.
1205 
1206 void TGListTree::PageUp(Bool_t /*select*/)
1207 {
1208  if (!fCanvas) return;
1209 
1210  TGDimension dim = GetPageDimension();
1211 
1212  Int_t newpos = fCanvas->GetVsbPosition() - dim.fHeight;
1213  if (newpos<0) newpos = 0;
1214 
1215  fCanvas->SetVsbPosition(newpos);
1216 }
1217 
1218 ////////////////////////////////////////////////////////////////////////////////
1219 /// Move content one page down.
1220 
1222 {
1223  if (!fCanvas) return;
1224 
1225  TGDimension dim = GetPageDimension();
1226 
1227  Int_t newpos = fCanvas->GetVsbPosition() + dim.fHeight;
1228 
1229  fCanvas->SetVsbPosition(newpos);
1230 }
1231 
1232 ////////////////////////////////////////////////////////////////////////////////
1233 /// Move content one item-size up.
1234 
1235 void TGListTree::LineUp(Bool_t /*select*/)
1236 {
1237  Int_t height = 0;
1238  if (!fCurrent) return;
1239 
1240  TGPosition pos = GetPagePosition();
1241  const TGPicture *pic1 = fCurrent->GetPicture();
1242  if (pic1) height = pic1->GetHeight() + fVspacing;
1243  else height = fVspacing + 16;
1244  Int_t findy = (fCurrent->fY - height) + (fMargin - pos.fY);
1245  TGListTreeItem *next = FindItem(findy);
1246  if (next && (next != fCurrent)) {
1247  DrawOutline(fId, fCurrent, 0xffffff, kTRUE);
1248  if (findy <= 2*height) {
1249  Int_t newpos = fCanvas->GetVsbPosition() - height;
1250  if (newpos<0) newpos = 0;
1251  fCanvas->SetVsbPosition(newpos);
1252  }
1253  DrawOutline(fId, next);
1254  fCurrent = next;
1255  }
1256 }
1257 
1258 ////////////////////////////////////////////////////////////////////////////////
1259 /// Move content one item-size down.
1260 
1262 {
1263  Int_t height;
1264  if (!fCurrent) return;
1265 
1266  TGDimension dim = GetPageDimension();
1267  TGPosition pos = GetPagePosition();
1268  const TGPicture *pic1 = fCurrent->GetPicture();
1269  if (pic1) height = pic1->GetHeight() + fVspacing;
1270  else height = fVspacing + 16;
1271  Int_t findy = (fCurrent->fY + height) + (fMargin - pos.fY);
1272  TGListTreeItem *next = FindItem(findy);
1273  if (next && (next != fCurrent)) {
1274  DrawOutline(fId, fCurrent, 0xffffff, kTRUE);
1275  if (findy >= ((Int_t)dim.fHeight - 2*height)) {
1276  Int_t newpos = fCanvas->GetVsbPosition() + height;
1277  if (newpos<0) newpos = 0;
1278  fCanvas->SetVsbPosition(newpos);
1279  }
1280  DrawOutline(fId, next);
1281  fCurrent = next;
1282  }
1283 }
1284 
1285 ////////////////////////////////////////////////////////////////////////////////
1286 /// Move content to position of item. If item is 0, move to position
1287 /// of currently selected item.
1288 
1290 {
1291  TGListTreeItem *it = item;
1292 
1293  if (!it) it = fSelected;
1294  if (!it) {
1295  HighlightItem(fFirst); // recursive call of this function
1296  return;
1297  }
1298 
1299  Int_t y = 0;
1300  Int_t yparent = 0;
1301  Int_t vh = 0;
1302  Int_t v = 0;
1303 
1304  if (it) {
1305  y = it->fY;
1306  if (it->GetParent()) yparent = it->GetParent()->fY;
1307  }
1308 
1309  if (y==0) y = yparent; // item->fY not initiated yet
1310 
1311  if (fCanvas->GetVScrollbar()->IsMapped()) {
1313 
1314  if (y<fCanvas->GetVScrollbar()->GetPosition()) {
1315  v = TMath::Max(0,y-(Int_t)fViewPort->GetHeight()/2);
1317  } else if (y+(Int_t)it->fHeight>vh) {
1319  y+(Int_t)it->fHeight-(Int_t)fViewPort->GetHeight()/2);
1320  if (v<0) v = 0;
1322  }
1323  }
1324 }
1325 
1326 ////////////////////////////////////////////////////////////////////////////////
1327 /// Invokes search dialog. Looks for item with the entered name.
1328 
1330 {
1331  Int_t ret = 0;
1332  char msg[256];
1333  static TString buf;
1334 
1335  TGSearchType *srch = new TGSearchType;
1336  srch->fBuffer = (char *)StrDup(buf.Data());
1337 
1338  TGListTreeItem *item;
1339  if (close || buf.IsNull())
1340  new TGSearchDialog(fClient->GetDefaultRoot(), fCanvas, 400, 150, srch, &ret);
1341  else if (!buf.IsNull()) ret = 1;
1342 
1343  if (ret) {
1344  item = FindItemByPathname(srch->fBuffer);
1345  if (!item) {
1346  snprintf(msg, 255, "Couldn't find \"%s\"", srch->fBuffer);
1347  gVirtualX->Bell(20);
1348  new TGMsgBox(fClient->GetDefaultRoot(), fCanvas, "Container", msg,
1350  } else {
1351  ClearHighlighted();
1352  HighlightItem(item);
1353  }
1354  }
1355  buf = srch->fBuffer;
1356  delete srch;
1357 }
1358 
1359 //---- drawing functions
1360 
1361 ////////////////////////////////////////////////////////////////////////////////
1362 /// Redraw list tree.
1363 
1365 {
1366  static GContext_t gcBg = 0;
1367 
1368  // sanity checks
1369  if (y > (Int_t)fViewPort->GetHeight()) {
1370  return;
1371  }
1372 
1373  y = y < 0 ? 0 : y;
1374  UInt_t w = fViewPort->GetWidth();
1375 
1376  // more sanity checks
1377  if (((Int_t)w < 1) || (w > 32768) || ((Int_t)h < 1)) {
1378  return;
1379  }
1380 
1381  Pixmap_t pixmap = gVirtualX->CreatePixmap(fId, w, fViewPort->GetHeight());
1382 
1383  if (!gcBg) {
1384  GCValues_t gcValues;
1385  gcValues.fForeground = fBackground;
1386  gcValues.fForeground = fBackground;
1387  gcValues.fGraphicsExposures = kTRUE;
1389  gcBg = gVirtualX->CreateGC(fId, &gcValues);
1390  }
1391 
1392  gVirtualX->SetForeground(gcBg, fBackground);
1393  gVirtualX->FillRectangle(pixmap, gcBg, 0, 0, w, fViewPort->GetHeight());
1394 
1395  Draw(pixmap, 0, fViewPort->GetHeight());
1396 
1397  gVirtualX->CopyArea(pixmap, fId, gcBg, 0, y, w, fViewPort->GetHeight(), 0, y);
1398 
1399  gVirtualX->DeletePixmap(pixmap);
1400  gVirtualX->Update(kFALSE);
1401 }
1402 
1403 ////////////////////////////////////////////////////////////////////////////////
1404 /// Draw list tree widget.
1405 
1406 void TGListTree::Draw(Handle_t id, Int_t yevent, Int_t hevent)
1407 {
1408  TGListTreeItem *item;
1409  Int_t x, y, xbranch;
1410  UInt_t width, height, old_width, old_height;
1411 
1412  // Overestimate the expose region to be sure to draw an item that gets
1413  // cut by the region
1414  fExposeTop = yevent - FontHeight();
1415  fExposeBottom = yevent + hevent + FontHeight();
1416  old_width = fDefw;
1417  old_height = fDefh;
1418  fDefw = fDefh = 1;
1419 
1420  TGPosition pos = GetPagePosition();
1421  x = 2-pos.fX;
1422  y = fMargin;
1423  item = fFirst;
1424 
1425  while (item) {
1426  xbranch = -1;
1427 
1428  DrawItem(id, item, x, y, &xbranch, &width, &height);
1429 
1430  width += pos.fX + x + fHspacing + fMargin;
1431 
1432  if (width > fDefw) fDefw = width;
1433 
1434  y += height + fVspacing;
1435  if (item->fFirstchild && item->IsOpen()) {
1436  y = DrawChildren(id, item->fFirstchild, x, y, xbranch);
1437  }
1438 
1439  item = item->fNextsibling;
1440  }
1441 
1442  fDefh = y + fMargin;
1443 
1444  if ((old_width != fDefw) || (old_height != fDefh)) {
1445  fCanvas->Layout();
1446  }
1447 }
1448 
1449 ////////////////////////////////////////////////////////////////////////////////
1450 /// Draw children of item in list tree.
1451 
1453  Int_t x, Int_t y, Int_t xroot)
1454 {
1455  UInt_t width, height;
1456  Int_t xbranch;
1457  TGPosition pos = GetPagePosition();
1458 
1459  x += fIndent + (Int_t)item->fParent->GetPicWidth();
1460  while (item) {
1461  xbranch = xroot;
1462 
1463  DrawItem(id, item, x, y, &xbranch, &width, &height);
1464 
1465  width += pos.fX + x + fHspacing + fMargin;
1466  if (width > fDefw) fDefw = width;
1467 
1468  y += height + fVspacing;
1469  if ((item->fFirstchild) && (item->IsOpen())) {
1470  y = DrawChildren(id, item->fFirstchild, x, y, xbranch);
1471  }
1472 
1473  item = item->fNextsibling;
1474  }
1475  return y;
1476 }
1477 
1478 ////////////////////////////////////////////////////////////////////////////////
1479 /// Draw list tree item.
1480 
1482  Int_t *xroot, UInt_t *retwidth, UInt_t *retheight)
1483 {
1484  Int_t xpic1, ypic1, xbranch, ybranch, xtext, ytext = 0, xline, yline, xc;
1485  Int_t xpic2 = 0;
1486  UInt_t height;
1487  const TGPicture *pic1 = item->GetPicture();
1488  const TGPicture *pic2 = item->GetCheckBoxPicture();
1489 
1490  // Compute the height of this line
1491  height = FontHeight();
1492 
1493  xline = 0;
1494  xpic1 = x;
1495  xtext = x + fHspacing + (Int_t)item->GetPicWidth();
1496  if (pic2) {
1497  if (pic2->GetHeight() > height) {
1498  ytext = y + (Int_t)((pic2->GetHeight() - height) >> 1);
1499  height = pic2->GetHeight();
1500  } else {
1501  ytext = y;
1502  }
1503  if (pic1) xpic2 = xpic1 + pic1->GetWidth() + 1;
1504  else xpic2 = xpic1 + 1;
1505  xtext += pic2->GetWidth();
1506  } else {
1507  ypic1 = y;
1508  xline = 0;
1509  }
1510  if (pic1) {
1511  if (pic1->GetHeight() > height) {
1512  ytext = y + (Int_t)((pic1->GetHeight() - height) >> 1);
1513  height = pic1->GetHeight();
1514  ypic1 = y;
1515  } else {
1516 #ifdef R__HAS_COCOA
1517  if (!pic2)//DO NOT MODIFY ytext, it WAS ADJUSTED already!
1518 #endif
1519  ytext = y;
1520  ypic1 = y + (Int_t)((height - pic1->GetHeight()) >> 1);
1521  }
1522  xbranch = xpic1 + (Int_t)(pic1->GetWidth() >> 1);
1523  ybranch = ypic1 + (Int_t)pic1->GetHeight();
1524  yline = ypic1 + (Int_t)(pic1->GetHeight() >> 1);
1525  if (xline == 0) xline = xpic1;
1526  } else {
1527  if (xline == 0) xline = xpic1;
1528  ypic1 = ytext = y;
1529  xbranch = xpic1 + (Int_t)(item->GetPicWidth() >> 1);
1530  yline = ybranch = ypic1 + (Int_t)(height >> 1);
1531  yline = ypic1 + (Int_t)(height >> 1);
1532  }
1533 
1534  // height must be even, otherwise our dashed line wont appear properly
1535  //++height; height &= ~1;
1536 
1537  // Save the basic graphics info for use by other functions
1538  item->fY = y;
1539  item->fXtext = xtext;
1540  item->fYtext = ytext;
1541  item->fHeight = height;
1542 
1543  // projected coordinates
1544  TGPosition pos = GetPagePosition();
1545  TGDimension dim = GetPageDimension();
1546  Int_t yp = y - pos.fY;
1547  Int_t ylinep = yline - pos.fY;
1548  Int_t ybranchp = ybranch - pos.fY;
1549  Int_t ypicp = ypic1 - pos.fY;
1550 
1551  if ((yp >= fExposeTop) && (yp <= (Int_t)dim.fHeight))
1552  {
1553  DrawItemName(id, item);
1554  if (*xroot >= 0) {
1555  xc = *xroot;
1556 
1557  if (item->fNextsibling) {
1558  gVirtualX->DrawLine(id, fLineGC, xc, yp, xc, yp+height);
1559  } else {
1560  gVirtualX->DrawLine(id, fLineGC, xc, yp, xc, ylinep);
1561  }
1562 
1563  TGListTreeItem *p = item->fParent;
1564  while (p) {
1565  xc -= (fIndent + (Int_t)item->GetPicWidth());
1566  if (p->fNextsibling) {
1567  gVirtualX->DrawLine(id, fLineGC, xc, yp, xc, yp+height);
1568  }
1569  p = p->fParent;
1570  }
1571  gVirtualX->DrawLine(id, fLineGC, *xroot, ylinep, xpic1, ylinep);
1572  DrawNode(id, item, *xroot, yline);
1573  }
1574  if (item->IsOpen() && item->fFirstchild) {
1575  gVirtualX->DrawLine(id, fLineGC, xbranch, ybranchp, xbranch,
1576  yp+height);
1577  }
1578  if (pic1)
1579  pic1->Draw(id, fDrawGC, xpic1, ypicp);
1580  if (pic2)
1581  pic2->Draw(id, fDrawGC, xpic2, ypicp);
1582  }
1583 
1584  *xroot = xbranch;
1585  *retwidth = TextWidth(item->GetText()) + item->GetPicWidth();
1586  *retheight = height;
1587 }
1588 
1589 ////////////////////////////////////////////////////////////////////////////////
1590 /// Draw a outline of color 'col' around an item.
1591 
1593  Bool_t clear)
1594 {
1595  TGPosition pos = GetPagePosition();
1596  TGDimension dim = GetPageDimension();
1597 
1598  if (clear) {
1599  gVirtualX->SetForeground(fDrawGC, fCanvas->GetContainer()->GetBackground());
1600  //ClearViewPort(); // time consuming!!!
1601  }
1602  else
1603  gVirtualX->SetForeground(fDrawGC, col);
1604 
1605 #ifdef R__HAS_COCOA
1606  gVirtualX->DrawRectangle(id, fDrawGC, 1, item->fY - pos.fY, dim.fWidth-2, item->fHeight + 1);
1607 #else
1608  gVirtualX->DrawRectangle(id, fDrawGC, 1, item->fYtext-pos.fY-2,
1609  dim.fWidth-3, FontHeight()+4);
1610 #endif
1611  gVirtualX->SetForeground(fDrawGC, fgBlackPixel);
1612 }
1613 
1614 ////////////////////////////////////////////////////////////////////////////////
1615 /// Draw active item with its active color.
1616 
1618 {
1619  UInt_t width;
1620  TGPosition pos = GetPagePosition();
1621  TGDimension dim = GetPageDimension();
1622 
1623  width = dim.fWidth-2;
1624  gVirtualX->SetForeground(fDrawGC, item->GetActiveColor());
1625 
1626 #ifdef R__HAS_COCOA
1627  gVirtualX->FillRectangle(id, fDrawGC, 1, item->fY - pos.fY, width, item->fHeight + 1);
1628 #else
1629  gVirtualX->FillRectangle(id, fDrawGC, 1, item->fYtext-pos.fY-1, width,
1630  FontHeight()+3);
1631 #endif
1632  gVirtualX->SetForeground(fDrawGC, fgBlackPixel);
1633  gVirtualX->DrawString(id, fActiveGC, item->fXtext,
1634  item->fYtext - pos.fY + FontAscent(),
1635  item->GetText(), item->GetTextLength());
1636 }
1637 
1638 ////////////////////////////////////////////////////////////////////////////////
1639 /// Draw name of list tree item.
1640 
1642 {
1643  TGPosition pos = GetPagePosition();
1644  TGDimension dim = GetPageDimension();
1645 
1646  if (item->IsActive()) {
1647  DrawActive(id, item);
1648  }
1649  else { // if (!item->IsActive() && (item != fSelected)) {
1650  gVirtualX->FillRectangle(id, fHighlightGC, item->fXtext,
1651  item->fYtext-pos.fY, dim.fWidth-item->fXtext-2,
1652  FontHeight()+1);
1653  gVirtualX->DrawString(id, fDrawGC,
1654  item->fXtext, item->fYtext-pos.fY + FontAscent(),
1655  item->GetText(), item->GetTextLength());
1656  }
1657  if (item == fCurrent) {
1658  DrawOutline(id, item);
1659  }
1660 
1661  if (fColorMode != 0 && item->HasColor()) {
1662  UInt_t width = TextWidth(item->GetText());
1663  gVirtualX->SetForeground(fColorGC, TColor::Number2Pixel(item->GetColor()));
1664  if (fColorMode & kColorUnderline) {
1665  Int_t y = item->fYtext-pos.fY + FontAscent() + 2;
1666  gVirtualX->DrawLine(id, fColorGC, item->fXtext, y,
1667  item->fXtext + width, y);
1668  }
1669  if (fColorMode & kColorBox) {
1670  Int_t x = item->fXtext + width + 4;
1671  Int_t y = item->fYtext - pos.fY + 3;
1672  Int_t h = FontAscent() - 4;
1673  gVirtualX->FillRectangle(id, fColorGC, x, y, h, h);
1674  gVirtualX->DrawRectangle(id, fDrawGC, x, y, h, h);
1675  }
1676  }
1677 }
1678 
1679 ////////////////////////////////////////////////////////////////////////////////
1680 /// Draw node (little + in box).
1681 
1683 {
1684  TGPosition pos = GetPagePosition();
1685  Int_t yp = y - pos.fY;
1686 
1687  if (item->fFirstchild) {
1688  gVirtualX->DrawLine(id, fHighlightGC, x, yp-2, x, yp+2);
1689  gVirtualX->SetForeground(fHighlightGC, fgBlackPixel);
1690  gVirtualX->DrawLine(id, fHighlightGC, x-2, yp, x+2, yp);
1691  if (!item->IsOpen())
1692  gVirtualX->DrawLine(id, fHighlightGC, x, yp-2, x, yp+2);
1693  gVirtualX->SetForeground(fHighlightGC, fGrayPixel);
1694  gVirtualX->DrawLine(id, fHighlightGC, x-4, yp-4, x+4, yp-4);
1695  gVirtualX->DrawLine(id, fHighlightGC, x+4, yp-4, x+4, yp+4);
1696  gVirtualX->DrawLine(id, fHighlightGC, x-4, yp+4, x+4, yp+4);
1697  gVirtualX->DrawLine(id, fHighlightGC, x-4, yp-4, x-4, yp+4);
1698  gVirtualX->SetForeground(fHighlightGC, fgWhitePixel);
1699  }
1700 }
1701 
1702 ////////////////////////////////////////////////////////////////////////////////
1703 /// Set tool tip text associated with this item. The delay is in
1704 /// milliseconds (minimum 250). To remove tool tip call method with
1705 /// delayms = 0. To change delayms you first have to call this method
1706 /// with delayms=0.
1707 
1708 void TGListTree::SetToolTipText(const char *text, Int_t x, Int_t y, Long_t delayms)
1709 {
1710  if (delayms == 0) {
1711  delete fTip;
1712  fTip = 0;
1713  return;
1714  }
1715 
1716  if (text && strlen(text)) {
1717  if (!fTip)
1718  fTip = new TGToolTip(fClient->GetDefaultRoot(), this, text, delayms);
1719  else
1720  fTip->SetText(text);
1721  fTip->SetPosition(x, y);
1722  fTip->Reset();
1723  }
1724 }
1725 
1726 ////////////////////////////////////////////////////////////////////////////////
1727 /// This function removes the specified item from the linked list.
1728 /// It does not do anything with the data contained in the item, though.
1729 
1731 {
1732  ClearViewPort();
1733 
1734  // Disentangle from front (previous-sibling, parent's first child)
1735  if (item->fPrevsibling) {
1736  item->fPrevsibling->fNextsibling = item->fNextsibling;
1737  } else {
1738  if (item->fParent)
1739  item->fParent->fFirstchild = item->fNextsibling;
1740  else
1741  fFirst = item->fNextsibling;
1742  }
1743  // Disentangle from end (next-sibling, parent's last child)
1744  if (item->fNextsibling) {
1745  item->fNextsibling->fPrevsibling = item->fPrevsibling;
1746  } else {
1747  if (item->fParent)
1748  item->fParent->fLastchild = item->fPrevsibling;
1749  else
1750  fLast = item->fPrevsibling;
1751  }
1752 }
1753 
1754 ////////////////////////////////////////////////////////////////////////////////
1755 /// Delete given item. Takes care of list-tree state members
1756 /// fSelected, fCurrent and fBelowMouse.
1757 
1759 {
1760  if (fSelected == item) {
1761  fSelected = 0;
1762  }
1763  if (fCurrent == item) {
1764  DrawOutline(fId, fCurrent, 0xffffff, kTRUE);
1765  fCurrent = item->GetPrevSibling();
1766  if (! fCurrent) {
1767  fCurrent = item->GetNextSibling();
1768  if (! fCurrent)
1769  fCurrent = item->GetParent();
1770  }
1771  }
1772  if (fBelowMouse == item) {
1773  DrawOutline(fId, fBelowMouse, 0xffffff, kTRUE);
1774  fBelowMouse = 0;
1775  MouseOver(0);
1777  }
1778 
1779  delete item;
1780 }
1781 
1782 ////////////////////////////////////////////////////////////////////////////////
1783 /// Recursively delete all children of an item.
1784 
1786 {
1787  TGListTreeItem *child = item->fFirstchild;
1788 
1789  while (child) {
1790  TGListTreeItem *next = child->fNextsibling;
1791  PDeleteChildren(child);
1792  PDeleteItem(child);
1793  child = next;
1794  }
1795 
1796  item->fFirstchild = item->fLastchild = 0;
1797 }
1798 
1799 ////////////////////////////////////////////////////////////////////////////////
1800 /// Insert child in list.
1801 
1803 {
1804  TGListTreeItem *i;
1805 
1806  item->fParent = parent;
1807  item->fNextsibling = item->fPrevsibling = 0;
1808 
1809  if (parent) {
1810 
1811  if (parent->fFirstchild) {
1812  if (parent->fLastchild) {
1813  i = parent->fLastchild;
1814  }
1815  else {
1816  i = parent->fFirstchild;
1817  while (i->fNextsibling) i = i->fNextsibling;
1818  }
1819  i->fNextsibling = item;
1820  item->fPrevsibling = i;
1821  } else {
1822  parent->fFirstchild = item;
1823  }
1824  parent->fLastchild = item;
1825 
1826  } else { // if parent == 0, this is a top level entry
1827 
1828  if (fFirst) {
1829  if (fLast) {
1830  i = fLast;
1831  }
1832  else {
1833  i = fFirst;
1834  while (i->fNextsibling) i = i->fNextsibling;
1835  }
1836  i->fNextsibling = item;
1837  item->fPrevsibling = i;
1838  } else {
1839  fFirst = item;
1840  }
1841  fLast = item;
1842  }
1843  if (item->HasCheckBox())
1844  UpdateChecked(item);
1845 }
1846 
1847 ////////////////////////////////////////////////////////////////////////////////
1848 /// Insert a list of ALREADY LINKED children into another list
1849 
1851 {
1852  TGListTreeItem *next, *newnext;
1853 
1854  //while (item) {
1855  // next = item->fNextsibling;
1856  // InsertChild(parent, item);
1857  // item = next;
1858  //}
1859  //return;
1860 
1861  // Save the reference for the next item in the new list
1862  next = item->fNextsibling;
1863 
1864  // Insert the first item in the new list into the existing list
1865  InsertChild(parent, item);
1866 
1867  // The first item is inserted, with its prev and next siblings updated
1868  // to fit into the existing list. So, save the existing list reference
1869  newnext = item->fNextsibling;
1870 
1871  // Now, mark the first item's next sibling to point back to the new list
1872  item->fNextsibling = next;
1873 
1874  // Mark the parents of the new list to the new parent. The order of the
1875  // rest of the new list should be OK, and the second item should still
1876  // point to the first, even though the first was reparented.
1877  while (item->fNextsibling) {
1878  item->fParent = parent;
1879  item = item->fNextsibling;
1880  }
1881 
1882  // Fit the end of the new list back into the existing list
1883  item->fNextsibling = newnext;
1884  if (newnext)
1885  newnext->fPrevsibling = item;
1886 }
1887 
1888 ////////////////////////////////////////////////////////////////////////////////
1889 /// Search child item.
1890 
1892  TGListTreeItem **finditem)
1893 {
1894  UInt_t height;
1895  const TGPicture *pic;
1896 
1897  while (item) {
1898  // Select the pixmap to use
1899  pic = item->GetPicture();
1900 
1901  // Compute the height of this line
1902  height = FontHeight();
1903  if (pic && pic->GetHeight() > height)
1904  height = pic->GetHeight();
1905 
1906  if ((findy >= y) && (findy <= y + (Int_t)height)) {
1907  *finditem = item;
1908  return -1;
1909  }
1910 
1911  y += (Int_t)height + fVspacing;
1912  if (item->fFirstchild && item->IsOpen()) {
1913  y = SearchChildren(item->fFirstchild, y, findy, finditem);
1914  if (*finditem) return -1;
1915  }
1916 
1917  item = item->fNextsibling;
1918  }
1919 
1920  return y;
1921 }
1922 
1923 ////////////////////////////////////////////////////////////////////////////////
1924 /// Find item at postion findy.
1925 
1927 {
1928  Int_t y;
1929  UInt_t height;
1930  TGListTreeItem *item, *finditem;
1931  const TGPicture *pic;
1932  TGPosition pos = GetPagePosition();
1933 
1934  y = fMargin - pos.fY;
1935  item = fFirst;
1936  finditem = 0;
1937  while (item && !finditem) {
1938  // Select the pixmap to use
1939  pic = item->GetPicture();
1940 
1941  // Compute the height of this line
1942  height = FontHeight();
1943  if (pic && (pic->GetHeight() > height))
1944  height = pic->GetHeight();
1945 
1946  if ((findy >= y) && (findy <= y + (Int_t)height))
1947  return item;
1948 
1949  y += (Int_t)height + fVspacing;
1950  if ((item->fFirstchild) && (item->IsOpen())) {
1951  y = SearchChildren(item->fFirstchild, y, findy, &finditem);
1952  //if (finditem) return finditem;
1953  }
1954  item = item->fNextsibling;
1955  }
1956 
1957  return finditem;
1958 }
1959 
1960 //----- Public Functions
1961 
1962 ////////////////////////////////////////////////////////////////////////////////
1963 /// Add given item to list tree.
1964 
1966 {
1967  InsertChild(parent, item);
1968 
1969  if ((parent == 0) || (parent && parent->IsOpen()))
1970  ClearViewPort();
1971 }
1972 
1973 ////////////////////////////////////////////////////////////////////////////////
1974 /// Add item to list tree. Returns new item.
1975 
1977  const TGPicture *open, const TGPicture *closed,
1978  Bool_t checkbox)
1979 {
1980  TGListTreeItem *item;
1981 
1982  item = new TGListTreeItemStd(fClient, string, open, closed, checkbox);
1983  InsertChild(parent, item);
1984 
1985  if ((parent == 0) || (parent && parent->IsOpen()))
1986  ClearViewPort();
1987  return item;
1988 }
1989 
1990 ////////////////////////////////////////////////////////////////////////////////
1991 /// Add item to list tree. If item with same userData already exists
1992 /// don't add it. Returns new item.
1993 
1995  void *userData, const TGPicture *open,
1996  const TGPicture *closed,
1997  Bool_t checkbox)
1998 {
1999  TGListTreeItem *item = FindChildByData(parent, userData);
2000  if (!item) {
2001  item = AddItem(parent, string, open, closed, checkbox);
2002  if (item) item->SetUserData(userData);
2003  }
2004 
2005  return item;
2006 }
2007 
2008 ////////////////////////////////////////////////////////////////////////////////
2009 /// Rename item in list tree.
2010 
2011 void TGListTree::RenameItem(TGListTreeItem *item, const char *string)
2012 {
2013  if (item) {
2014  item->Rename(string);
2015  }
2016 
2017  DoRedraw();
2018 }
2019 
2020 ////////////////////////////////////////////////////////////////////////////////
2021 /// Delete item from list tree.
2022 
2024 {
2025  if (!fUserControlled)
2026  fCurrent = fBelowMouse = 0;
2027 
2028  PDeleteChildren(item);
2029  RemoveReference(item);
2030  PDeleteItem(item);
2031 
2032  fClient->NeedRedraw(this);
2033 
2034  return 1;
2035 }
2036 
2037 ////////////////////////////////////////////////////////////////////////////////
2038 /// Open item in list tree (i.e. show child items).
2039 
2041 {
2042  if (item) {
2043  item->SetOpen(kTRUE);
2044  DoRedraw(); // force layout
2045  AdjustPosition(item);
2046  }
2047 }
2048 
2049 ////////////////////////////////////////////////////////////////////////////////
2050 /// Close item in list tree (i.e. hide child items).
2051 
2053 {
2054  if (item) {
2055  item->SetOpen(kFALSE);
2056  DoRedraw(); // force layout
2057  AdjustPosition(item);
2058  }
2059 }
2060 
2061 ////////////////////////////////////////////////////////////////////////////////
2062 /// Delete item with fUserData == ptr. Search tree downwards starting
2063 /// at item.
2064 
2066 {
2067  if (item && ptr) {
2068  if (item->GetUserData() == ptr) {
2069  DeleteItem(item);
2070  } else {
2071  if (item->IsOpen() && item->fFirstchild) {
2072  RecursiveDeleteItem(item->fFirstchild, ptr);
2073  }
2074  RecursiveDeleteItem(item->fNextsibling, ptr);
2075  }
2076  }
2077  return 1;
2078 }
2079 
2080 ////////////////////////////////////////////////////////////////////////////////
2081 /// Set tooltip text for this item. By default an item for which the
2082 /// userData is a pointer to an TObject the TObject::GetTitle() will
2083 /// be used to get the tip text.
2084 
2085 void TGListTree::SetToolTipItem(TGListTreeItem *item, const char *string)
2086 {
2087  if (item) {
2088  item->SetTipText(string);
2089  }
2090 }
2091 
2092 ////////////////////////////////////////////////////////////////////////////////
2093 /// Delete children of item from list.
2094 
2096 {
2097  if (!fUserControlled)
2098  fCurrent = fBelowMouse = 0;
2099 
2100  PDeleteChildren(item);
2101 
2102  DoRedraw();
2103 
2104  return 1;
2105 }
2106 
2107 ////////////////////////////////////////////////////////////////////////////////
2108 /// Make newparent the new parent of item.
2109 
2111 {
2112  // Remove the item from its old location.
2113  RemoveReference(item);
2114 
2115  // The item is now unattached. Reparent it.
2116  InsertChild(newparent, item);
2117 
2118  DoRedraw();
2119 
2120  return 1;
2121 }
2122 
2123 ////////////////////////////////////////////////////////////////////////////////
2124 /// Make newparent the new parent of the children of item.
2125 
2127  TGListTreeItem *newparent)
2128 {
2130 
2131  if (item->fFirstchild) {
2132  first = item->fFirstchild;
2133  item->fFirstchild = 0;
2134 
2135  InsertChildren(newparent, first);
2136 
2137  DoRedraw();
2138  return 1;
2139  }
2140  return 0;
2141 }
2142 
2143 ////////////////////////////////////////////////////////////////////////////////
2144 
2145 extern "C"
2146 Int_t Compare(const void *item1, const void *item2)
2147 {
2148  return strcmp((*((TGListTreeItem **) item1))->GetText(),
2149  (*((TGListTreeItem **) item2))->GetText());
2150 }
2151 
2152 ////////////////////////////////////////////////////////////////////////////////
2153 /// Sort items starting with item.
2154 
2156 {
2157  TGListTreeItem *first, *parent, **list;
2158  size_t i, count;
2159 
2160  // Get first child in list;
2161  while (item->fPrevsibling) item = item->fPrevsibling;
2162 
2163  first = item;
2164  parent = first->fParent;
2165 
2166  // Count the children
2167  count = 1;
2168  while (item->fNextsibling) item = item->fNextsibling, count++;
2169  if (count <= 1) return 1;
2170 
2171  list = new TGListTreeItem* [count];
2172  list[0] = first;
2173  count = 1;
2174  while (first->fNextsibling) {
2175  list[count] = first->fNextsibling;
2176  count++;
2177  first = first->fNextsibling;
2178  }
2179 
2180  ::qsort(list, count, sizeof(TGListTreeItem*), ::Compare);
2181 
2182  list[0]->fPrevsibling = 0;
2183  for (i = 0; i < count; i++) {
2184  if (i < count - 1)
2185  list[i]->fNextsibling = list[i + 1];
2186  if (i > 0)
2187  list[i]->fPrevsibling = list[i - 1];
2188  }
2189  list[count - 1]->fNextsibling = 0;
2190  if (parent) {
2191  parent->fFirstchild = list[0];
2192  parent->fLastchild = list[count-1];
2193  }
2194  else {
2195  fFirst = list[0];
2196  fLast = list[count-1];
2197  }
2198 
2199  delete [] list;
2200 
2201  DoRedraw();
2202 
2203  return 1;
2204 }
2205 
2206 ////////////////////////////////////////////////////////////////////////////////
2207 /// Sort siblings of item.
2208 
2210 {
2211  return Sort(item);
2212 }
2213 
2214 ////////////////////////////////////////////////////////////////////////////////
2215 /// Sort children of item.
2216 
2218 {
2220 
2221  if (item) {
2222  first = item->fFirstchild;
2223  if (first) {
2225  }
2226  } else {
2227  if (fFirst) {
2229  if (first) {
2231  }
2232  }
2233  }
2234  DoRedraw();
2235  return 1;
2236 }
2237 
2238 ////////////////////////////////////////////////////////////////////////////////
2239 /// Find sibling of item by name.
2240 
2242 {
2243  // Get first child in list
2244  if (item) {
2245  while (item->fPrevsibling) {
2246  item = item->fPrevsibling;
2247  }
2248 
2249  while (item) {
2250  if (strcmp(item->GetText(), name) == 0) {
2251  return item;
2252  }
2253  item = item->fNextsibling;
2254  }
2255  return item;
2256  }
2257  return 0;
2258 }
2259 
2260 ////////////////////////////////////////////////////////////////////////////////
2261 /// Find sibling of item by userData.
2262 
2264 {
2265  // Get first child in list
2266  if (item) {
2267  while (item->fPrevsibling) {
2268  item = item->fPrevsibling;
2269  }
2270 
2271  while (item) {
2272  if (item->GetUserData() == userData) {
2273  return item;
2274  }
2275  item = item->fNextsibling;
2276  }
2277  return item;
2278  }
2279  return 0;
2280 }
2281 
2282 ////////////////////////////////////////////////////////////////////////////////
2283 /// Find child of item by name.
2284 
2286 {
2287  // Get first child in list
2288  if (item && item->fFirstchild) {
2289  item = item->fFirstchild;
2290  } else if (!item && fFirst) {
2291  item = fFirst;
2292  } else {
2293  item = 0;
2294  }
2295 
2296  while (item) {
2297  if (strcmp(item->GetText(), name) == 0) {
2298  return item;
2299  }
2300  item = item->fNextsibling;
2301  }
2302  return 0;
2303 }
2304 
2305 ////////////////////////////////////////////////////////////////////////////////
2306 /// Find child of item by userData.
2307 
2309 {
2310  // Get first child in list
2311  if (item && item->fFirstchild) {
2312  item = item->fFirstchild;
2313  } else if (!item && fFirst) {
2314  item = fFirst;
2315  } else {
2316  item = 0;
2317  }
2318 
2319  while (item) {
2320  if (item->GetUserData() == userData) {
2321  return item;
2322  }
2323  item = item->fNextsibling;
2324  }
2325  return 0;
2326 }
2327 
2328 ////////////////////////////////////////////////////////////////////////////////
2329 /// Find item by pathname. Pathname is in the form of /xx/yy/zz. If zz
2330 /// in path /xx/yy is found it returns item, 0 otherwise.
2331 
2333 {
2334  if (!path || !*path) return 0;
2335 
2336  const char *p = path, *s;
2337  char dirname[1024];
2338  TGListTreeItem *item = 0;
2339  item = FindChildByName(item, "/");
2340  if (!gVirtualX->InheritsFrom("TGX11")) {
2341  // on Windows, use the current drive instead of root (/)
2342  TList *curvol = gSystem->GetVolumes("cur");
2343  if (curvol) {
2344  TNamed *drive = (TNamed *)curvol->At(0);
2345  item = FindChildByName(0, TString::Format("%s\\", drive->GetName()));
2346  delete curvol;
2347  }
2348  }
2349  TGListTreeItem *diritem = 0;
2350  TString fulldir;
2351 
2352  while (1) {
2353  while (*p && *p == '/') p++;
2354  if (!*p) break;
2355 
2356  s = strchr(p, '/');
2357 
2358  if (!s) {
2359  strlcpy(dirname, p, 1024);
2360  } else {
2361  strlcpy(dirname, p, (s-p)+1);
2362  }
2363 
2364  item = FindChildByName(item, dirname);
2365 
2366  if (!diritem && dirname[0]) {
2367  fulldir += "/";
2368  fulldir += dirname;
2369 
2370  if ((diritem=FindChildByName(0, fulldir.Data()))) {
2371  if (!s || !s[0]) return diritem;
2372  p = ++s;
2373  item = diritem;
2374  continue;
2375  }
2376  }
2377 
2378  if (!s || !s[0]) return item;
2379  p = ++s;
2380  }
2381  return 0;
2382 }
2383 
2384 ////////////////////////////////////////////////////////////////////////////////
2385 /// Highlight item.
2386 
2388 {
2390  HighlightItem(item, kTRUE, kFALSE);
2391  AdjustPosition(item);
2392 }
2393 
2394 ////////////////////////////////////////////////////////////////////////////////
2395 /// Un highlight items.
2396 
2398 {
2400 }
2401 
2402 ////////////////////////////////////////////////////////////////////////////////
2403 /// Get pathname from item. Use depth to limit path name to last
2404 /// depth levels. By default depth is not limited.
2405 
2407 {
2408  char tmppath[1024];
2409 
2410  *path = '\0';
2411  while (item) {
2412  snprintf(tmppath, 1023, "/%s%s", item->GetText(), path);
2413  strlcpy(path, tmppath, 1024);
2414  item = item->fParent;
2415  if (--depth == 0 && item) {
2416  snprintf(tmppath, 1023, "...%s", path);
2417  strlcpy(path, tmppath, 1024);
2418  return;
2419  }
2420  }
2421 }
2422 
2423 ////////////////////////////////////////////////////////////////////////////////
2424 /// Return gray draw color in use.
2425 
2427 {
2428  static Bool_t init = kFALSE;
2429  if (!init) {
2430  if (!gClient->GetColorByName("#808080", fgGrayPixel))
2432  init = kTRUE;
2433  }
2434  return fgGrayPixel;
2435 }
2436 
2437 ////////////////////////////////////////////////////////////////////////////////
2438 /// Return default font structure in use.
2439 
2441 {
2442  if (!fgDefaultFont)
2443  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
2444  return fgDefaultFont->GetFontStruct();
2445 }
2446 
2447 ////////////////////////////////////////////////////////////////////////////////
2448 /// Return default graphics context in use.
2449 
2451 {
2452  if (!fgActiveGC) {
2453  GCValues_t gcv;
2454 
2457  gcv.fLineStyle = kLineSolid;
2458  gcv.fLineWidth = 0;
2459  gcv.fFillStyle = kFillSolid;
2462  const TGGC *selgc = gClient->GetResourcePool()->GetSelectedGC();
2463  if (selgc)
2464  gcv.fForeground = selgc->GetForeground();
2465  else
2466  gcv.fForeground = fgWhitePixel;
2467  fgActiveGC = gClient->GetGC(&gcv, kTRUE);
2468  }
2469  return *fgActiveGC;
2470 }
2471 
2472 ////////////////////////////////////////////////////////////////////////////////
2473 /// Return default graphics context in use.
2474 
2476 {
2477  if (!fgDrawGC) {
2478  GCValues_t gcv;
2479 
2482  gcv.fLineStyle = kLineSolid;
2483  gcv.fLineWidth = 0;
2484  gcv.fFillStyle = kFillSolid;
2486  gcv.fBackground = fgWhitePixel;
2487  gcv.fForeground = fgBlackPixel;
2488 
2489  fgDrawGC = gClient->GetGC(&gcv, kTRUE);
2490  }
2491  return *fgDrawGC;
2492 }
2493 
2494 ////////////////////////////////////////////////////////////////////////////////
2495 /// Return graphics context in use for line drawing.
2496 
2498 {
2499  if (!fgLineGC) {
2500  GCValues_t gcv;
2501 
2504  gcv.fLineStyle = kLineOnOffDash;
2505  gcv.fLineWidth = 0;
2506  gcv.fFillStyle = kFillSolid;
2508  gcv.fBackground = fgWhitePixel;
2509  gcv.fForeground = GetGrayPixel();
2510 
2511  fgLineGC = gClient->GetGC(&gcv, kTRUE);
2512  fgLineGC->SetDashOffset(0);
2513  fgLineGC->SetDashList("\x1\x1", 2);
2514  }
2515  return *fgLineGC;
2516 }
2517 
2518 ////////////////////////////////////////////////////////////////////////////////
2519 /// Return graphics context for highlighted frame background.
2520 
2522 {
2523  if (!fgHighlightGC) {
2524  GCValues_t gcv;
2525 
2528  gcv.fLineStyle = kLineSolid;
2529  gcv.fLineWidth = 0;
2530  gcv.fFillStyle = kFillSolid;
2533  gcv.fForeground = fgWhitePixel;
2534 
2535  fgHighlightGC = gClient->GetGC(&gcv, kTRUE);
2536  }
2537  return *fgHighlightGC;
2538 }
2539 
2540 ////////////////////////////////////////////////////////////////////////////////
2541 /// Return graphics context for highlighted frame background.
2542 
2544 {
2545  if (!fgColorGC) {
2546  GCValues_t gcv;
2547 
2550  gcv.fLineStyle = kLineSolid;
2551  gcv.fLineWidth = 1;
2552  gcv.fFillStyle = kFillSolid;
2554  gcv.fForeground = fgWhitePixel;
2555 
2556  fgColorGC = gClient->GetGC(&gcv, kTRUE);
2557  }
2558  return *fgColorGC;
2559 }
2560 
2561 ////////////////////////////////////////////////////////////////////////////////
2562 /// Returns the icon used by items in open state.
2563 
2565 {
2566  if (!fgOpenPic)
2567  fgOpenPic = gClient->GetPicture("ofolder_t.xpm");
2568  ((TGPicture *)fgOpenPic)->AddReference();
2569  return fgOpenPic;
2570 }
2571 
2572 ////////////////////////////////////////////////////////////////////////////////
2573 /// Returns the icon used by items in closed state.
2574 
2576 {
2577  if (!fgClosedPic)
2578  fgClosedPic = gClient->GetPicture("folder_t.xpm");
2579  ((TGPicture *)fgClosedPic)->AddReference();
2580  return fgClosedPic;
2581 }
2582 
2583 ////////////////////////////////////////////////////////////////////////////////
2584 /// Returns the icon used for checked checkbox.
2585 
2587 {
2588  if (!fgCheckedPic)
2589  fgCheckedPic = gClient->GetPicture("checked_t.xpm");
2590  ((TGPicture *)fgCheckedPic)->AddReference();
2591  return fgCheckedPic;
2592 }
2593 
2594 ////////////////////////////////////////////////////////////////////////////////
2595 /// Returns the icon used for unchecked checkbox.
2596 
2598 {
2599  if (!fgUncheckedPic)
2600  fgUncheckedPic = gClient->GetPicture("unchecked_t.xpm");
2601  ((TGPicture *)fgUncheckedPic)->AddReference();
2602  return fgUncheckedPic;
2603 }
2604 
2605 ////////////////////////////////////////////////////////////////////////////////
2606 /// Save a list tree widget as a C++ statements on output stream out.
2607 
2608 void TGListTree::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
2609 {
2610  if (fBackground != GetWhitePixel()) SaveUserColor(out, option);
2611 
2612  out << std::endl << " // list tree" << std::endl;
2613  out << " TGListTree *";
2614 
2615  if ((fParent->GetParent())->InheritsFrom(TGCanvas::Class())) {
2616  out << GetName() << " = new TGListTree(" << GetCanvas()->GetName();
2617  } else {
2618  out << GetName() << " = new TGListTree(" << fParent->GetName();
2619  out << "," << GetWidth() << "," << GetHeight();
2620  }
2621 
2622  if (fBackground == GetWhitePixel()) {
2623  if (GetOptions() == kSunkenFrame) {
2624  out <<");" << std::endl;
2625  } else {
2626  out << "," << GetOptionString() <<");" << std::endl;
2627  }
2628  } else {
2629  out << "," << GetOptionString() << ",ucolor);" << std::endl;
2630  }
2631  if (option && strstr(option, "keep_names"))
2632  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
2633 
2634  out << std::endl;
2635 
2636  static Int_t n = 0;
2637 
2638  TGListTreeItem *current;
2639  current = GetFirstItem();
2640 
2641  out << " const TGPicture *popen; //used for list tree items" << std::endl;
2642  out << " const TGPicture *pclose; //used for list tree items" << std::endl;
2643  out << std::endl;
2644 
2645  while (current) {
2646  out << " TGListTreeItem *item" << n << " = " << GetName() << "->AddItem(";
2647  current->SavePrimitive(out, TString::Format("%d",n), n);
2648  if (current->IsOpen())
2649  out << " " << GetName() << "->OpenItem(item" << n << ");" << std::endl;
2650  else
2651  out << " " << GetName() << "->CloseItem(item" << n << ");" << std::endl;
2652 
2653  if (current == fSelected)
2654  out << " " << GetName() << "->SetSelected(item" << n << ");" << std::endl;
2655 
2656  n++;
2657  if (current->fFirstchild) {
2658  SaveChildren(out, current->fFirstchild, n);
2659  }
2660  current = current->fNextsibling;
2661  }
2662 
2663  out << std::endl;
2664 }
2665 
2666 ////////////////////////////////////////////////////////////////////////////////
2667 /// Save child items as a C++ statements on output stream out.
2668 
2669 void TGListTree::SaveChildren(std::ostream &out, TGListTreeItem *item, Int_t &n)
2670 {
2671  Int_t p = n-1;
2672  while (item) {
2673  out << " TGListTreeItem *item" << n << " = " << GetName() << "->AddItem(";
2674  item->SavePrimitive(out, TString::Format("%d",p),n);
2675  n++;
2676  if (item->fFirstchild) {
2677  SaveChildren(out, item->fFirstchild, n);
2678  }
2679  item = item->fNextsibling;
2680  }
2681 }
2682 
2683 ////////////////////////////////////////////////////////////////////////////////
2684 /// Save a list tree item attributes as a C++ statements on output stream.
2685 
2686 void TGListTreeItemStd::SavePrimitive(std::ostream &out, Option_t *option, Int_t n)
2687 {
2688  static const TGPicture *oldopen = nullptr;
2689  static const TGPicture *oldclose = nullptr;
2690  static const TGPicture *oldcheck = nullptr;
2691  static const TGPicture *olduncheck = nullptr;
2692  static Bool_t makecheck = kTRUE;
2693  static Bool_t makeuncheck = kTRUE;
2694  static Color_t oldcolor = -1;
2695 
2696  char quote = '"';
2697  TString s = TString::Format("%d", n);
2698 
2699  if (!fParent)
2700  out << "NULL,";
2701  else
2702  out << "item" << option << ",";
2703  TString text = GetText();
2704  text.ReplaceAll('\\', "\\\\");
2705  text.ReplaceAll("\"", "\\\"");
2706  out << quote << text << quote;
2707  out << ");" << std::endl;
2708 
2709  if (oldopen != fOpenPic) {
2710  oldopen = fOpenPic;
2711  TString picname = gSystem->UnixPathName(fOpenPic->GetName());
2712  gSystem->ExpandPathName(picname);
2713  out << " popen = gClient->GetPicture(" << quote << picname << quote << ");" << std::endl;
2714  }
2715  if (oldclose != fClosedPic) {
2716  oldclose = fClosedPic;
2718  gSystem->ExpandPathName(picname);
2719  out << " pclose = gClient->GetPicture(" << quote << picname << quote << ");" << std::endl;
2720  }
2721  out << " item" << s.Data() << "->SetPictures(popen, pclose);" << std::endl;
2722  if (HasCheckBox()) {
2723  if (fCheckedPic && makecheck) {
2724  out << " const TGPicture *pcheck; //used for checked items" << std::endl;
2725  makecheck = kFALSE;
2726  }
2727  if (fUncheckedPic && makeuncheck) {
2728  out << " const TGPicture *puncheck; //used for unchecked items" << std::endl;
2729  makeuncheck = kFALSE;
2730  }
2731  out << " item" << s.Data() << "->CheckItem();" << std::endl;
2732  if (fCheckedPic && oldcheck != fCheckedPic) {
2733  oldcheck = fCheckedPic;
2735  gSystem->ExpandPathName(picname);
2736  out << " pcheck = gClient->GetPicture(" << quote << picname << quote << ");" << std::endl;
2737  }
2738  if (fUncheckedPic && olduncheck != fUncheckedPic) {
2739  olduncheck = fUncheckedPic;
2741  gSystem->ExpandPathName(picname);
2742  out << " puncheck = gClient->GetPicture(" << quote << picname << quote << ");" << std::endl;
2743  }
2744  out << " item" << s.Data() << "->SetCheckBoxPictures(pcheck, puncheck);" << std::endl;
2745  out << " item" << s.Data() << "->SetCheckBox(kTRUE);" << std::endl;
2746  }
2747  if (fHasColor) {
2748  if (oldcolor != fColor) {
2749  oldcolor = fColor;
2750  out << " item" << s.Data() << "->SetColor(" << fColor << ");" << std::endl;
2751  }
2752  }
2753  if (fTipText.Length() > 0) {
2754  TString tiptext = GetTipText();
2755  tiptext.ReplaceAll('\\', "\\\\");
2756  tiptext.ReplaceAll("\n", "\\n");
2757  tiptext.ReplaceAll("\"", "\\\"");
2758  out << " item" << s.Data() << "->SetTipText(" << quote
2759  << tiptext << quote << ");" << std::endl;
2760  }
2761 
2762 }
2763 
2764 ////////////////////////////////////////////////////////////////////////////////
2765 /// Set check button state for the node 'item'.
2766 
2768 {
2769  item->CheckItem(check);
2770 }
2771 
2772 ////////////////////////////////////////////////////////////////////////////////
2773 /// Set check button state for the node 'item'.
2774 
2776 {
2777  item->SetCheckBox(on);
2778 }
2779 
2780 ////////////////////////////////////////////////////////////////////////////////
2781 /// Toggle check button state of the node 'item'.
2782 
2784 {
2785  item->Toggle();
2786 }
2787 
2788 ////////////////////////////////////////////////////////////////////////////////
2789 /// Update the state of the node 'item' according to the children states.
2790 
2792 {
2793  if (fAutoCheckBoxPic == kFALSE) return;
2794 
2795  TGListTreeItem *parent;
2796  TGListTreeItem *current;
2797  current = item->GetFirstChild();
2798  parent = current ? current : item;
2799  // recursively check parent/children status
2800  while (parent && parent->HasCheckBox()) {
2801  if ((!parent->IsChecked() && parent->HasCheckedChild(kTRUE)) ||
2802  (parent->IsChecked() && parent->HasUnCheckedChild(kTRUE))) {
2803  parent->SetCheckBoxPictures(fClient->GetPicture("checked_dis_t.xpm"),
2804  fClient->GetPicture("unchecked_dis_t.xpm"));
2805  }
2806  else {
2807  parent->SetCheckBoxPictures(fClient->GetPicture("checked_t.xpm"),
2808  fClient->GetPicture("unchecked_t.xpm"));
2809  }
2810  parent = parent->GetParent();
2811  if (parent && fCheckMode == kRecursive) {
2812  if (!parent->IsChecked() && parent->GetFirstChild() &&
2813  !parent->GetFirstChild()->HasUnCheckedChild()) {
2814  parent->SetCheckBoxPictures(fClient->GetPicture("checked_t.xpm"),
2815  fClient->GetPicture("unchecked_t.xpm"));
2816  parent->CheckItem(kTRUE);
2817  }
2818  else if (parent->IsChecked() && parent->GetFirstChild() &&
2819  !parent->GetFirstChild()->HasCheckedChild()) {
2820  parent->SetCheckBoxPictures(fClient->GetPicture("checked_t.xpm"),
2821  fClient->GetPicture("unchecked_t.xpm"));
2822  parent->CheckItem(kFALSE);
2823  }
2824  }
2825  }
2826  if (redraw) {
2827  ClearViewPort();
2828  }
2829 }
2830 
2831 ////////////////////////////////////////////////////////////////////////////////
2832 /// Find item with fUserData == ptr. Search tree downwards starting
2833 /// at item.
2834 
2836 {
2837  TGListTreeItem *fitem;
2838  if (item && ptr) {
2839  if (item->GetUserData() == ptr)
2840  return item;
2841  else {
2842  if (item->fFirstchild) {
2843  fitem = FindItemByObj(item->fFirstchild, ptr);
2844  if (fitem) return fitem;
2845  }
2846  return FindItemByObj(item->fNextsibling, ptr);
2847  }
2848  }
2849  return 0;
2850 }
2851 
2852 ////////////////////////////////////////////////////////////////////////////////
2853 /// Add all checked list tree items of this list tree into
2854 /// the list 'checked'. This list is not adopted and must
2855 /// be deleted by the user later.
2856 
2858 {
2859  if (!checked || !fFirst) return;
2860  TGListTreeItem *current = fFirst;
2861  if (current->IsChecked()) {
2862  checked->Add(new TObjString(current->GetText()));
2863  }
2864  while(current) {
2865  if (current->GetFirstChild())
2866  GetCheckedChildren(checked, current->GetFirstChild());
2867  current = current->GetNextSibling();
2868  }
2869 }
2870 
2871 ////////////////////////////////////////////////////////////////////////////////
2872 /// Add all child items of 'item' into the list 'checked'.
2873 
2875 {
2876  if (!checked || !item) return;
2877 
2878  while (item) {
2879  if (item->IsChecked()) {
2880  checked->Add(new TObjString(item->GetText()));
2881  }
2882  if (item->GetFirstChild()) {
2883  GetCheckedChildren(checked, item->GetFirstChild());
2884  }
2885  item = item->GetNextSibling();
2886  }
2887 }
2888 
2889 ////////////////////////////////////////////////////////////////////////////////
2890 /// Check all child items of 'item' and 'item' itself according
2891 /// to the state value: kTRUE means check all, kFALSE - uncheck all.
2892 
2894 {
2895  if (item)
2896  item->CheckAllChildren(state);
2897 }
2898 
TGWindow::SetWindowName
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118
TGListTree::HighlightChildren
void HighlightChildren(TGListTreeItem *item, Bool_t state, Bool_t draw)
Higlight item children.
Definition: TGListTree.cxx:542
TGListTree::SortChildren
Int_t SortChildren(TGListTreeItem *item)
Sort children of item.
Definition: TGListTree.cxx:2217
kKey_Down
@ kKey_Down
Definition: KeySymbols.h:49
c
#define c(i)
Definition: RSha256.hxx:119
TGListTree::kSimple
@ kSimple
Definition: TGListTree.h:220
TGListTree::InsertChild
void InsertChild(TGListTreeItem *parent, TGListTreeItem *item)
Insert child in list.
Definition: TGListTree.cxx:1802
Event_t::fType
EGEventType fType
Definition: GuiTypes.h:174
TGClient::GetDefaultRoot
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:235
m
auto * m
Definition: textangle.C:8
n
const Int_t n
Definition: legend1.C:16
TGListTree::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a list tree widget as a C++ statements on output stream out.
Definition: TGListTree.cxx:2608
Event_t::fState
UInt_t fState
Definition: GuiTypes.h:180
TGListTreeItemStd::fOpenPic
const TGPicture * fOpenPic
Definition: TGListTree.h:150
TGContainer::DoRedraw
virtual void DoRedraw()
Redraw content of container in the viewport region.
Definition: TGCanvas.cxx:796
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:250
TGListTree::FindSiblingByData
TGListTreeItem * FindSiblingByData(TGListTreeItem *item, void *userData)
Find sibling of item by userData.
Definition: TGListTree.cxx:2263
TGListTreeItemStd::fUncheckedPic
const TGPicture * fUncheckedPic
Definition: TGListTree.h:153
FontMetrics_t
Definition: TGFont.h:61
first
Definition: first.py:1
TGListTree::HandleKey
virtual Bool_t HandleKey(Event_t *event)
The key press event handler converts a key press to some line editor action.
Definition: TGListTree.cxx:933
Event_t::fY
Int_t fY
Definition: GuiTypes.h:177
Event_t::fX
Int_t fX
Definition: GuiTypes.h:177
TGWindow
Definition: TGWindow.h:31
TBufferIO::WriteObject
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
Definition: TBufferIO.cxx:530
TGListTree::RemoveReference
void RemoveReference(TGListTreeItem *item)
This function removes the specified item from the linked list.
Definition: TGListTree.cxx:1730
TGListTree::FindChildByName
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
Definition: TGListTree.cxx:2285
TGPosition::fY
Int_t fY
Definition: TGDimension.h:48
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
Pixmap_t
Handle_t Pixmap_t
Definition: GuiTypes.h:29
TGListTreeItem::SetCheckBox
virtual void SetCheckBox(Bool_t=kTRUE)
Definition: TGListTree.h:103
TGListTree::fActiveGC
GContext_t fActiveGC
Definition: TGListTree.h:235
TGListTreeItem::GetTipText
virtual const char * GetTipText() const =0
TGFrame::fgBlackPixel
static Pixel_t fgBlackPixel
Definition: TGFrame.h:129
TGListTree::fHighlightGC
GContext_t fHighlightGC
Definition: TGListTree.h:238
TGListTree::kColorUnderline
@ kColorUnderline
Definition: TGListTree.h:216
snprintf
#define snprintf
Definition: civetweb.c:1540
TGListTree::InsertChildren
void InsertChildren(TGListTreeItem *parent, TGListTreeItem *item)
Insert a list of ALREADY LINKED children into another list.
Definition: TGListTree.cxx:1850
TDNDData::fDataLength
Int_t fDataLength
Definition: TGDNDManager.h:78
TGContainer::fCanvas
TGCanvas * fCanvas
Definition: TGCanvas.h:51
kC_LISTTREE
@ kC_LISTTREE
Definition: WidgetMessageTypes.h:73
TGListTree::~TGListTree
virtual ~TGListTree()
Delete list tree widget.
Definition: TGListTree.cxx:471
TGListTreeItemStd::HasCheckedChild
virtual Bool_t HasCheckedChild(Bool_t first=kFALSE)
Add all child items of 'item' into the list 'checked'.
Definition: TGListTree.cxx:177
TGListTree::fIndent
Int_t fIndent
Definition: TGListTree.h:232
TGListTree::UpdateChecked
virtual void UpdateChecked(TGListTreeItem *item, Bool_t redraw=kFALSE)
Update the state of the node 'item' according to the children states.
Definition: TGListTree.cxx:2791
Warning
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition: TError.cxx:231
TGPicture
Definition: TGPicture.h:36
TGListTreeItem::GetCheckBoxPicture
virtual const TGPicture * GetCheckBoxPicture() const =0
TGListTreeItem::GetPicture
virtual const TGPicture * GetPicture() const =0
kAnyModifier
const Mask_t kAnyModifier
Definition: GuiTypes.h:209
TGListTree::GetLineGC
static const TGGC & GetLineGC()
Return graphics context in use for line drawing.
Definition: TGListTree.cxx:2497
TGGC::GetForeground
Pixel_t GetForeground() const
Definition: TGGC.h:82
TGDimension
Definition: TGDimension.h:27
TGListTreeItem::fNextsibling
TGListTreeItem * fNextsibling
Definition: TGListTree.h:57
TGListTree::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event.
Definition: TGListTree.cxx:805
TGListTreeItem::GetPicWidth
virtual UInt_t GetPicWidth() const
Return width of item's icon.
Definition: TGListTree.cxx:101
TGListTree::DrawItemName
void DrawItemName(Handle_t id, TGListTreeItem *item)
Draw name of list tree item.
Definition: TGListTree.cxx:1641
TGListTreeItemStd::CheckAllChildren
virtual void CheckAllChildren(Bool_t state=kTRUE)
Set all child items of this one checked if state=kTRUE, unchecked if state=kFALSE.
Definition: TGListTree.cxx:240
TMath::Max
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
TGPicture::GetWidth
UInt_t GetWidth() const
Definition: TGPicture.h:63
kLeaveNotify
@ kLeaveNotify
Definition: GuiTypes.h:60
kPointerMotionMask
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
Compare
Int_t Compare(const void *item1, const void *item2)
Definition: TGListTree.cxx:2146
kLineSolid
@ kLineSolid
Definition: GuiTypes.h:47
TGListTree::PDeleteChildren
void PDeleteChildren(TGListTreeItem *item)
Recursively delete all children of an item.
Definition: TGListTree.cxx:1785
kKey_F3
@ kKey_F3
Definition: KeySymbols.h:65
TGListTreeItemStd::fActive
Bool_t fActive
Definition: TGListTree.h:144
TObject::Compare
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
Definition: TObject.cxx:161
TGToolTip::SetPosition
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
Definition: TGToolTip.cxx:406
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
kAnyButton
@ kAnyButton
Definition: GuiTypes.h:213
TString::Data
const char * Data() const
Definition: TString.h:369
kKey_Up
@ kKey_Up
Definition: KeySymbols.h:47
TGListTree::GetActiveGC
static const TGGC & GetActiveGC()
Return default graphics context in use.
Definition: TGListTree.cxx:2450
Pixel_t
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGListTree::FontAscent
Int_t FontAscent()
Returns ascent of currently used font.
Definition: TGListTree.cxx:502
TGListTree::fLastEventState
UInt_t fLastEventState
Definition: TGListTree.h:255
TGListTree::DrawOutline
virtual void DrawOutline(Handle_t id, TGListTreeItem *item, Pixel_t col=0xbbbbbb, Bool_t clear=kFALSE)
Draw a outline of color 'col' around an item.
Definition: TGListTree.cxx:1592
TGListTreeItem::GetPrevSibling
TGListTreeItem * GetPrevSibling() const
Definition: TGListTree.h:76
TGListTree::SearchChildren
Int_t SearchChildren(TGListTreeItem *item, Int_t y, Int_t findy, TGListTreeItem **finditem)
Search child item.
Definition: TGListTree.cxx:1891
TGListTree::ClearHighlighted
void ClearHighlighted()
Un highlight items.
Definition: TGListTree.cxx:2397
TGListTree::fgActiveGC
static TGGC * fgActiveGC
Definition: TGListTree.h:263
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGListTree::DrawChildren
Int_t DrawChildren(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y, Int_t xroot)
Draw children of item in list tree.
Definition: TGListTree.cxx:1452
EKeySym
EKeySym
Definition: KeySymbols.h:25
TGTextEditDialogs.h
TGDNDManager::StartDrag
Bool_t StartDrag(TGFrame *src, Int_t x_root, Int_t y_root, Window_t grabWin=kNone)
Start dragging.
Definition: TGDNDManager.cxx:902
TGListTreeItemStd::SetPictures
virtual void SetPictures(const TGPicture *opened, const TGPicture *closed)
Change list tree item icons.
Definition: TGListTree.cxx:313
TObjString.h
TGPicture.h
TGListTree::fDrawGC
GContext_t fDrawGC
Definition: TGListTree.h:236
TGListTree::Reparent
Int_t Reparent(TGListTreeItem *item, TGListTreeItem *newparent)
Make newparent the new parent of item.
Definition: TGListTree.cxx:2110
TGListTree::DrawItem
void DrawItem(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y, Int_t *xroot, UInt_t *retwidth, UInt_t *retheight)
Draw list tree item.
Definition: TGListTree.cxx:1481
TGListTree::Sort
Int_t Sort(TGListTreeItem *item)
Sort items starting with item.
Definition: TGListTree.cxx:2155
TGCanvas::GetContainer
TGFrame * GetContainer() const
Definition: TGCanvas.h:226
TGMsgBox
Definition: TGMsgBox.h:63
TGListTree::fDefw
UInt_t fDefw
Definition: TGListTree.h:240
FontStruct_t
Handle_t FontStruct_t
Definition: GuiTypes.h:38
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TGListTree::fColorGC
GContext_t fColorGC
Definition: TGListTree.h:259
TGListTree::GetGrayPixel
static Pixel_t GetGrayPixel()
Return gray draw color in use.
Definition: TGListTree.cxx:2426
TGListTree::fDNDTypeList
Atom_t * fDNDTypeList
Definition: TGListTree.h:248
TGListTree::ReturnPressed
void ReturnPressed(TGFrame *)
Signal emitted when Return/Enter key pressed.
Definition: TGListTree.h:310
TGListTree::HighlightItem
void HighlightItem(TGListTreeItem *item)
Highlight item.
Definition: TGListTree.cxx:2387
TGListTree::FindChildByData
TGListTreeItem * FindChildByData(TGListTreeItem *item, void *userData)
Find child of item by userData.
Definition: TGListTree.cxx:2308
TGSearchType::fBuffer
char * fBuffer
Definition: TGTextEditDialogs.h:40
kButton4
@ kButton4
Definition: GuiTypes.h:214
GCValues_t
Definition: GuiTypes.h:223
TGListTree::Home
void Home(Bool_t select=kFALSE)
Move content to the top.
Definition: TGListTree.cxx:1190
BatchHelpers::init
EvaluateInfo init(std::vector< RooRealProxy > parameters, std::vector< ArrayWrapper * > wrappers, std::vector< double * > arrays, size_t begin, size_t batchSize)
TGWindow::kEditDisable
@ kEditDisable
Definition: TGWindow.h:58
TGListTreeItem::GetText
virtual const char * GetText() const =0
TGListTree::fCheckMode
ECheckMode fCheckMode
Definition: TGListTree.h:258
TGListTreeItemStd::fText
TString fText
Definition: TGListTree.h:148
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TGListTreeItemStd::fUserData
void * fUserData
Definition: TGListTree.h:154
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
kKey_F
@ kKey_F
Definition: KeySymbols.h:137
kFillSolid
@ kFillSolid
Definition: GuiTypes.h:50
Int_t
int Int_t
Definition: RtypesCore.h:45
TGListTree::DeleteChildren
Int_t DeleteChildren(TGListTreeItem *item)
Delete children of item from list.
Definition: TGListTree.cxx:2095
GCValues_t::fFillStyle
Int_t fFillStyle
Definition: GuiTypes.h:233
TGListTreeItem::SavePrimitive
virtual void SavePrimitive(std::ostream &, Option_t *, Int_t)
Definition: TGListTree.h:135
TGListTree::fEventHandled
Bool_t fEventHandled
Definition: TGListTree.h:254
TGListTreeItemStd::fColor
Color_t fColor
Definition: TGListTree.h:157
TGListTree::End
void End(Bool_t select=kFALSE)
Move content to the bottom.
Definition: TGListTree.cxx:1198
TGListTree::GetCheckedPic
static const TGPicture * GetCheckedPic()
Returns the icon used for checked checkbox.
Definition: TGListTree.cxx:2586
TGListTree
Definition: TGListTree.h:210
TBuffer::Buffer
char * Buffer() const
Definition: TBuffer.h:96
TGListTree::SortSiblings
Int_t SortSiblings(TGListTreeItem *item)
Sort siblings of item.
Definition: TGListTree.cxx:2209
TString::EndsWith
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2177
TGContainer::GetPageDimension
virtual TGDimension GetPageDimension() const
Returns page dimension.
Definition: TGCanvas.cxx:747
TGListTree::kColorBox
@ kColorBox
Definition: TGListTree.h:217
TGPicture::Draw
void Draw(Option_t *="")
Default Draw method for all objects.
Definition: TGPicture.h:57
TGFont::TextWidth
Int_t TextWidth(const char *string, Int_t numChars=-1) const
A wrapper function for the more complicated interface of MeasureChars.
Definition: TGFont.cxx:565
x
Double_t x[n]
Definition: legend1.C:17
TGToolTip::SetText
void SetText(const char *new_text)
Set new tool tip text.
Definition: TGToolTip.cxx:387
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGCanvas::Layout
virtual void Layout()
Create layout for canvas.
Definition: TGCanvas.cxx:2225
TGListTreeItem::HasCheckBox
virtual Bool_t HasCheckBox() const =0
TBufferIO::Reset
void Reset() override
Reset buffer object. Resets map and buffer offset.
Definition: TBufferIO.cxx:305
TClass.h
TGFrame::fgWhitePixel
static Pixel_t fgWhitePixel
Definition: TGFrame.h:128
TGToolTip
Definition: TGToolTip.h:35
kButton1
@ kButton1
Definition: GuiTypes.h:213
TGListTree::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle button events in the list tree.
Definition: TGListTree.cxx:564
TGListTree::FindItemByPathname
TGListTreeItem * FindItemByPathname(const char *path)
Find item by pathname.
Definition: TGListTree.cxx:2332
TColor.h
TGListTree::fAutoTips
Bool_t fAutoTips
Definition: TGListTree.h:250
TGCanvas::GetVScrollbar
TGVScrollBar * GetVScrollbar() const
Definition: TGCanvas.h:229
TVirtualX.h
TGListTree::fGrayPixel
Pixel_t fGrayPixel
Definition: TGListTree.h:234
TGClient::FreePicture
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:309
TColor::Number2Pixel
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2013
TGFrame::GetBackground
virtual Pixel_t GetBackground() const
Definition: TGFrame.h:217
TGListTree::fHspacing
Int_t fHspacing
Definition: TGListTree.h:230
TGListTree::fgColorGC
static TGGC * fgColorGC
Definition: TGListTree.h:267
TGListTree::FindItemByObj
TGListTreeItem * FindItemByObj(TGListTreeItem *item, void *ptr)
Find item with fUserData == ptr.
Definition: TGListTree.cxx:2835
TGListTree::AddItem
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
Definition: TGListTree.cxx:1965
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TObject::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403
kKey_Home
@ kKey_Home
Definition: KeySymbols.h:44
TGListTree::DeleteItem
Int_t DeleteItem(TGListTreeItem *item)
Delete item from list tree.
Definition: TGListTree.cxx:2023
TGListTree::DrawNode
void DrawNode(Handle_t id, TGListTreeItem *item, Int_t x, Int_t y)
Draw node (little + in box).
Definition: TGListTree.cxx:1682
TGListTreeItem::CheckItem
virtual void CheckItem(Bool_t=kTRUE)=0
TGDNDManager.h
TGListTree::fLast
TGListTreeItem * fLast
Definition: TGListTree.h:226
TGListTree::fgOpenPic
static const TGPicture * fgOpenPic
Definition: TGListTree.h:268
TString
Definition: TString.h:136
TGGC::SetDashOffset
void SetDashOffset(Int_t v)
Patterned/dashed line offset.
Definition: TGGC.cxx:476
ROOT::Math::detail::open
@ open
Definition: GenVectorIO.h:55
TGListTree::fFirst
TGListTreeItem * fFirst
Definition: TGListTree.h:225
kButtonPressMask
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
TGListTree::Layout
virtual void Layout()
Layout container entries.
Definition: TGListTree.h:305
TGListTree::fDNDData
TDNDData fDNDData
Definition: TGListTree.h:247
TGListTreeItemStd::HasUnCheckedChild
virtual Bool_t HasUnCheckedChild(Bool_t first=kFALSE)
Add all child items of 'item' into the list 'checked'.
Definition: TGListTree.cxx:200
TGCanvas::GetVsbPosition
virtual Int_t GetVsbPosition() const
Get position of vertical scrollbar.
Definition: TGCanvas.cxx:2380
TGListTreeItemStd::fCheckedPic
const TGPicture * fCheckedPic
Definition: TGListTree.h:152
Color_t
short Color_t
Definition: RtypesCore.h:83
kCT_ITEMDBLCLICK
@ kCT_ITEMDBLCLICK
Definition: WidgetMessageTypes.h:63
v
@ v
Definition: rootcling_impl.cxx:3635
text
TText * text
Definition: entrylist_figure1.C:10
TString.h
TGListTree::GetChecked
void GetChecked(TList *checked)
Add all checked list tree items of this list tree into the list 'checked'.
Definition: TGListTree.cxx:2857
TGCanvas::SetVsbPosition
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Definition: TGCanvas.cxx:2404
TGListTree::KeyPressed
void KeyPressed(TGFrame *, UInt_t, UInt_t)
Signal emitted when keyboard key pressed.
Definition: TGListTree.h:315
TGListTree::GetFirstItem
TGListTreeItem * GetFirstItem() const
Definition: TGListTree.h:396
bool
TSystem::WorkingDirectory
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:870
kLeaveWindowMask
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:167
kGCLineStyle
const Mask_t kGCLineStyle
Definition: GuiTypes.h:290
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:249
TGFont::GetFontMetrics
void GetFontMetrics(FontMetrics_t *m) const
Get font metrics.
Definition: TGFont.cxx:276
TGListTreeItemStd::TGListTreeItemStd
TGListTreeItemStd(const TGListTreeItemStd &)
TGListTreeItemStd::GetText
virtual const char * GetText() const
Definition: TGListTree.h:172
kKey_G
@ kKey_G
Definition: KeySymbols.h:138
TGListTree::Search
void Search(Bool_t close=kTRUE)
Invokes search dialog. Looks for item with the entered name.
Definition: TGListTree.cxx:1329
TObjString::String
TString & String()
Definition: TObjString.h:54
TGWindow::kEditDisableBtnEnable
@ kEditDisableBtnEnable
Definition: TGWindow.h:65
kKey_Right
@ kKey_Right
Definition: KeySymbols.h:48
TGListTreeItem::fXtext
Int_t fXtext
Definition: TGListTree.h:65
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2465
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:222
TGListTree::PageUp
void PageUp(Bool_t select=kFALSE)
Move content one page up.
Definition: TGListTree.cxx:1206
TGListTree::ReparentChildren
Int_t ReparentChildren(TGListTreeItem *item, TGListTreeItem *newparent)
Make newparent the new parent of the children of item.
Definition: TGListTree.cxx:2126
kCT_KEY
@ kCT_KEY
Definition: WidgetMessageTypes.h:65
TGListTreeItemStd::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option, Int_t n)
Save a list tree item attributes as a C++ statements on output stream.
Definition: TGListTree.cxx:2686
GContext_t
Handle_t GContext_t
Definition: GuiTypes.h:37
TGListTreeItem::GetTipTextLength
virtual Int_t GetTipTextLength() const =0
TGListTree::CloseItem
void CloseItem(TGListTreeItem *item)
Close item in list tree (i.e. hide child items).
Definition: TGListTree.cxx:2052
TObjString
Definition: TObjString.h:28
TGContainer::fYDND
Int_t fYDND
Definition: TGCanvas.h:70
gClient
#define gClient
Definition: TGClient.h:166
TDNDData::fDataType
Atom_t fDataType
Definition: TGDNDManager.h:75
TGListTreeItem::IsActive
virtual Bool_t IsActive() const =0
TGContainer::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGCanvas.h:52
TGListTreeItemStd::HasCheckBox
virtual Bool_t HasCheckBox() const
Definition: TGListTree.h:188
TRefCnt::AddReference
void AddReference()
Definition: TRefCnt.h:46
TGListTree::fgLineGC
static TGGC * fgLineGC
Definition: TGListTree.h:265
TGFrame::AddInput
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:324
TBuffer::Length
Int_t Length() const
Definition: TBuffer.h:100
kNone
const Handle_t kNone
Definition: GuiTypes.h:87
TList::At
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
TGListTree::GetDrawGC
static const TGGC & GetDrawGC()
Return default graphics context in use.
Definition: TGListTree.cxx:2475
TGContainer::GetVScrollbar
virtual TGVScrollBar * GetVScrollbar() const
returns pointer to vert. scroll bar
Definition: TGCanvas.cxx:1749
TGToolTip::Reset
void Reset()
Reset tool tip popup delay timer.
Definition: TGToolTip.cxx:260
TGScrollBar::GetPosition
virtual Int_t GetPosition() const
Definition: TGScrollBar.h:132
TGDNDManager::GetDNDActionCopy
static Atom_t GetDNDActionCopy()
Definition: TGDNDManager.cxx:281
TGContainer::GetPagePosition
virtual TGPosition GetPagePosition() const
Returns page position.
Definition: TGCanvas.cxx:733
TGListTreeItem::fPrevsibling
TGListTreeItem * fPrevsibling
Definition: TGListTree.h:56
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGListTree::fTip
TGToolTip * fTip
Definition: TGListTree.h:244
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGScrollBar::SetSmallIncrement
virtual void SetSmallIncrement(Int_t increment)
Definition: TGScrollBar.h:153
kLineOnOffDash
@ kLineOnOffDash
Definition: GuiTypes.h:47
TGListTree::UnselectAll
void UnselectAll(Bool_t draw)
Unselect all items.
Definition: TGListTree.cxx:555
TGListTreeItem::TGListTreeItem
TGListTreeItem(const TGListTreeItem &)
TDNDData::fData
void * fData
Definition: TGDNDManager.h:77
TGListTreeItemStd::UpdateState
virtual void UpdateState()
Update the state of the node 'item' according to the children states.
Definition: TGListTree.cxx:223
TGWindow::kEditDisableGrab
@ kEditDisableGrab
Definition: TGWindow.h:60
TGListTree::TGListTree
TGListTree(const TGListTree &)
TGListTreeItemStd
Definition: TGListTree.h:141
TGListTree::kDefault
@ kDefault
Definition: TGListTree.h:215
TSystem.h
TGPosition::fX
Int_t fX
Definition: TGDimension.h:47
TGListTree::Clicked
void Clicked(TGFrame *, Int_t)
Emit Clicked() signal.
Definition: TGListTree.h:311
TGListTree::PDeleteItem
void PDeleteItem(TGListTreeItem *item)
Delete given item.
Definition: TGListTree.cxx:1758
TGListTree::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition: TGListTree.cxx:2440
kGCFillStyle
const Mask_t kGCFillStyle
Definition: GuiTypes.h:293
TGDimension::fHeight
UInt_t fHeight
Definition: TGDimension.h:36
TGFont::TextHeight
Int_t TextHeight() const
Definition: TGFont.h:201
TGListTree::fFont
FontStruct_t fFont
Definition: TGListTree.h:239
h
#define h(i)
Definition: RSha256.hxx:124
kGKeyPress
@ kGKeyPress
Definition: GuiTypes.h:59
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:317
TGListTree::GetCheckedChildren
void GetCheckedChildren(TList *checked, TGListTreeItem *item)
Add all child items of 'item' into the list 'checked'.
Definition: TGListTree.cxx:2874
TGListTreeItem::fClient
TGClient * fClient
Definition: TGListTree.h:52
TGListTreeItem::GetActiveColor
virtual Pixel_t GetActiveColor() const =0
TGListTree::GetColorGC
static const TGGC & GetColorGC()
Return graphics context for highlighted frame background.
Definition: TGListTree.cxx:2543
TGGC
Definition: TGGC.h:31
TGListTreeItem::SetUserData
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition: TGListTree.h:94
TGListTreeItem::Toggle
virtual void Toggle()
Definition: TGListTree.h:106
TGListTree::FindSiblingByName
TGListTreeItem * FindSiblingByName(TGListTreeItem *item, const char *name)
Find sibling of item by name.
Definition: TGListTree.cxx:2241
TGObject::fId
Handle_t fId
Definition: TGObject.h:36
TGContainer::fXDND
Int_t fXDND
Definition: TGCanvas.h:70
TGListTree::PageDown
void PageDown(Bool_t select=kFALSE)
Move content one page down.
Definition: TGListTree.cxx:1221
Atom_t
Handle_t Atom_t
Definition: GuiTypes.h:36
TGListTree::CheckItem
void CheckItem(TGListTreeItem *item, Bool_t check=kTRUE)
Set check button state for the node 'item'.
Definition: TGListTree.cxx:2767
kMBIconExclamation
@ kMBIconExclamation
Definition: TGMsgBox.h:41
TNamed
Definition: TNamed.h:29
Event_t::fCode
UInt_t fCode
Definition: GuiTypes.h:179
TGDNDManager::IsDragging
Bool_t IsDragging() const
Definition: TGDNDManager.h:175
TGFrame::SendMessage
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:630
TGListTree::fCurrent
TGListTreeItem * fCurrent
Definition: TGListTree.h:228
TGListTreeItem::HasColor
virtual Bool_t HasColor() const =0
TGListTree::AdjustPosition
void AdjustPosition()
Move content to position of highlighted/activated frame.
Definition: TGListTree.h:370
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
kKey_PageUp
@ kKey_PageUp
Definition: KeySymbols.h:51
TGListTree::fExposeBottom
Int_t fExposeBottom
Definition: TGListTree.h:243
GCValues_t::fLineStyle
Int_t fLineStyle
Definition: GuiTypes.h:229
kGCForeground
const Mask_t kGCForeground
Definition: GuiTypes.h:287
TGListTreeItem::fLastchild
TGListTreeItem * fLastchild
Definition: TGListTree.h:55
TGListTreeItemStd::Toggle
virtual void Toggle()
Definition: TGListTree.h:190
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:59
Long_t
long Long_t
Definition: RtypesCore.h:54
kGCGraphicsExposures
const Mask_t kGCGraphicsExposures
Definition: GuiTypes.h:301
TGListTreeItemStd::SetCheckBox
virtual void SetCheckBox(Bool_t on=kTRUE)
Set a check box on the tree node.
Definition: TGListTree.cxx:280
TGListTree::FindItem
TGListTreeItem * FindItem(Int_t findy)
Find item at postion findy.
Definition: TGListTree.cxx:1926
TGListTreeItem::fY
Int_t fY
Definition: TGListTree.h:64
GCValues_t::fFont
FontH_t fFont
Definition: GuiTypes.h:241
kButtonReleaseMask
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
TGFont::GetFontHandle
FontH_t GetFontHandle() const
Definition: TGFont.h:192
TGDimension::fWidth
UInt_t fWidth
Definition: TGDimension.h:35
kButtonRelease
@ kButtonRelease
Definition: GuiTypes.h:59
TGListTree::fUserControlled
Bool_t fUserControlled
Definition: TGListTree.h:253
TGListTreeItem::SetCheckBoxPictures
virtual void SetCheckBoxPictures(const TGPicture *, const TGPicture *)
Definition: TGListTree.h:100
TGListTree::SetToolTipText
void SetToolTipText(const char *text, Int_t x, Int_t y, Long_t delayms)
Set tool tip text associated with this item.
Definition: TGListTree.cxx:1708
TGListTreeItem::IsOpen
virtual Bool_t IsOpen() const
Definition: TGListTree.h:79
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2438
StrDup
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2490
TGListTree::fgCheckedPic
static const TGPicture * fgCheckedPic
Definition: TGListTree.h:270
kGCFont
const Mask_t kGCFont
Definition: GuiTypes.h:299
kKey_F7
@ kKey_F7
Definition: KeySymbols.h:69
TGClient::GetPicture
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:290
TGListTreeItem::IsDNDTarget
Bool_t IsDNDTarget() const
Definition: TGListTree.h:128
GCValues_t::fBackground
ULong_t fBackground
Definition: GuiTypes.h:227
TGListTree::HandleCrossing
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Definition: TGListTree.cxx:704
TGListTree::LineDown
void LineDown(Bool_t select=kFALSE)
Move content one item-size down.
Definition: TGListTree.cxx:1261
kGCLineWidth
const Mask_t kGCLineWidth
Definition: GuiTypes.h:289
TGListTree::HandleDNDLeave
Bool_t HandleDNDLeave()
Handle drag leave events.
Definition: TGListTree.cxx:772
TString::BeginsWith
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
TGContainer::ClearViewPort
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition: TGCanvas.cxx:887
TGListTree::kRecursive
@ kRecursive
Definition: TGListTree.h:221
TGContainer::GetCanvas
TGCanvas * GetCanvas() const
Definition: TGCanvas.h:109
y
Double_t y[n]
Definition: legend1.C:17
TGListTree::HandleDNDPosition
Atom_t HandleDNDPosition(Int_t x, Int_t y, Atom_t action, Int_t xroot, Int_t yroot)
Handle dragging position events.
Definition: TGListTree.cxx:731
TGListTreeItem::HasUnCheckedChild
virtual Bool_t HasUnCheckedChild(Bool_t=kFALSE)
Definition: TGListTree.h:113
TGListTree::fColorMode
EColorMarkupMode fColorMode
Definition: TGListTree.h:257
kKey_Escape
@ kKey_Escape
Definition: KeySymbols.h:32
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TDNDData
Definition: TGDNDManager.h:65
TSystem::ExpandPathName
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1272
TGGC::SetDashList
void SetDashList(const char v[], Int_t len)
Set dash pattern. First use SetDashOffset() if not 0.
Definition: TGGC.cxx:487
GCValues_t::fGraphicsExposures
Bool_t fGraphicsExposures
Definition: GuiTypes.h:243
KeySymbols.h
TGListTreeItemStd::GetTipText
virtual const char * GetTipText() const
Definition: TGListTree.h:174
Event_t::fXRoot
Int_t fXRoot
Definition: GuiTypes.h:178
TGListTree::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGListTree.h:262
kGCBackground
const Mask_t kGCBackground
Definition: GuiTypes.h:288
TGListTreeItem::CheckAllChildren
virtual void CheckAllChildren(Bool_t=kTRUE)
Definition: TGListTree.h:110
TGListTreeItem::GetFirstChild
TGListTreeItem * GetFirstChild() const
Definition: TGListTree.h:74
kKey_F5
@ kKey_F5
Definition: KeySymbols.h:67
TGListTree::HandleDNDEnter
Atom_t HandleDNDEnter(Atom_t *typelist)
Handle drag enter events.
Definition: TGListTree.cxx:757
kPointer
@ kPointer
Definition: GuiTypes.h:374
kKeyPressMask
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
gDNDManager
R__EXTERN TGDNDManager * gDNDManager
Definition: TGDNDManager.h:203
Event_t::fYRoot
Int_t fYRoot
Definition: GuiTypes.h:178
TGListTree::CheckAllChildren
void CheckAllChildren(TGListTreeItem *item, Bool_t state)
Check all child items of 'item' and 'item' itself according to the state value: kTRUE means check all...
Definition: TGListTree.cxx:2893
TGListTreeItemStd::CheckItem
virtual void CheckItem(Bool_t checked=kTRUE)
Definition: TGListTree.h:189
TMath::Min
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
TGListTreeItem::IsChecked
virtual Bool_t IsChecked() const =0
kHand
@ kHand
Definition: GuiTypes.h:373
TGListTreeItem::SetTipText
virtual void SetTipText(const char *)
Definition: TGListTree.h:92
TGListTreeItem::fParent
TGListTreeItem * fParent
Definition: TGListTree.h:53
unsigned int
TGListTreeItem::GetTextLength
virtual Int_t GetTextLength() const =0
TGListTree::fgClosedPic
static const TGPicture * fgClosedPic
Definition: TGListTree.h:269
kMBOk
@ kMBOk
Definition: TGMsgBox.h:44
kKey_Return
@ kKey_Return
Definition: KeySymbols.h:36
TGListTreeItemStd::fCheckBox
Bool_t fCheckBox
Definition: TGListTree.h:145
ROOT::Math::detail::close
@ close
Definition: GenVectorIO.h:55
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
kKeyControlMask
const Mask_t kKeyControlMask
Definition: GuiTypes.h:196
TGListTree::GetPathnameFromItem
void GetPathnameFromItem(TGListTreeItem *item, char *path, Int_t depth=0)
Get pathname from item.
Definition: TGListTree.cxx:2406
TGListTreeItem::fHeight
UInt_t fHeight
Definition: TGListTree.h:67
kKey_Left
@ kKey_Left
Definition: KeySymbols.h:46
TGWindow::GetParent
const TGWindow * GetParent() const
Definition: TGWindow.h:84
kKey_Enter
@ kKey_Enter
Definition: KeySymbols.h:37
TGContainer::SetDragPixmap
virtual void SetDragPixmap(const TGPicture *pic)
Set drag window pixmaps and hotpoint.
Definition: TGCanvas.cxx:1076
TGListTree::fMargin
Int_t fMargin
Definition: TGListTree.h:233
TGListTree::TextWidth
Int_t TextWidth(const char *c)
Returns text width relative to currently used font.
Definition: TGListTree.cxx:514
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:373
TGListTree::Draw
void Draw(Handle_t id, Int_t yevent, Int_t hevent)
Draw list tree widget.
Definition: TGListTree.cxx:1406
TString::IsNull
Bool_t IsNull() const
Definition: TString.h:407
TGListTree::SetToolTipItem
void SetToolTipItem(TGListTreeItem *item, const char *string)
Set tooltip text for this item.
Definition: TGListTree.cxx:2085
TGListTree::fDisableOpen
Bool_t fDisableOpen
Definition: TGListTree.h:252
TGContainer
Definition: TGCanvas.h:41
TGListTree::fTipItem
TGListTreeItem * fTipItem
Definition: TGListTree.h:245
TGListTreeItemStd::SetCheckBoxPictures
virtual void SetCheckBoxPictures(const TGPicture *checked, const TGPicture *unchecked)
Change list tree check item icons.
Definition: TGListTree.cxx:288
TGListTreeItemStd::GetActiveColor
virtual Pixel_t GetActiveColor() const
Return color for marking items that are active or selected.
Definition: TGListTree.cxx:169
TGListTreeItem::SetActive
virtual void SetActive(Bool_t)
Definition: TGListTree.h:84
TGListTree::fSelected
TGListTreeItem * fSelected
Definition: TGListTree.h:227
TSystem::UnixPathName
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition: TSystem.cxx:1061
TGListTree::SetCheckBox
void SetCheckBox(TGListTreeItem *item, Bool_t on=kTRUE)
Set check button state for the node 'item'.
Definition: TGListTree.cxx:2775
TGMsgBox.h
TGListTree::FontHeight
Int_t FontHeight()
Returns height of currently used font.
Definition: TGListTree.cxx:492
GCValues_t::fMask
Mask_t fMask
Definition: GuiTypes.h:250
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
TGListTree::SaveChildren
void SaveChildren(std::ostream &out, TGListTreeItem *item, Int_t &n)
Save child items as a C++ statements on output stream out.
Definition: TGListTree.cxx:2669
TGListTreeItem::GetColor
virtual Color_t GetColor() const =0
TGListTree::ToggleItem
void ToggleItem(TGListTreeItem *item)
Toggle check button state of the node 'item'.
Definition: TGListTree.cxx:2783
TGListTreeItem::GetUserData
virtual void * GetUserData() const =0
TGListTree::fAutoCheckBoxPic
Bool_t fAutoCheckBoxPic
Definition: TGListTree.h:251
TGListTree::HandleDNDDrop
Bool_t HandleDNDDrop(TDNDData *data)
Handle drop events.
Definition: TGListTree.cxx:780
TGListTreeItemStd::fOwnsData
Bool_t fOwnsData
Definition: TGListTree.h:147
Event_t::fTime
Time_t fTime
Definition: GuiTypes.h:176
TGListTree::fgUncheckedPic
static const TGPicture * fgUncheckedPic
Definition: TGListTree.h:271
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TGListTree::fDefh
UInt_t fDefh
Definition: TGListTree.h:241
TObject
Definition: TObject.h:37
Handle_t
ULong_t Handle_t
Definition: GuiTypes.h:25
TBufferFile.h
TGToolTip.h
kKey_Space
@ kKey_Space
Definition: KeySymbols.h:99
TGListTreeItem::SetOpen
virtual void SetOpen(Bool_t o)
Definition: TGListTree.h:80
TGListTree.h
TGDNDManager::EndDrag
Bool_t EndDrag()
End dragging.
Definition: TGDNDManager.cxx:969
TGFrame::SetDNDTarget
void SetDNDTarget(Bool_t onoff)
Definition: TGFrame.h:295
TGListTree::RenameItem
void RenameItem(TGListTreeItem *item, const char *string)
Rename item in list tree.
Definition: TGListTree.cxx:2011
Event_t
Definition: GuiTypes.h:173
TGListTree::DrawActive
virtual void DrawActive(Handle_t id, TGListTreeItem *item)
Draw active item with its active color.
Definition: TGListTree.cxx:1617
TGListTree::DataDropped
virtual void DataDropped(TGListTreeItem *item, TDNDData *data)
Emit DataDropped() signal.
Definition: TGListTree.cxx:791
name
char name[80]
Definition: TGX11.cxx:110
GCValues_t::fForeground
ULong_t fForeground
Definition: GuiTypes.h:226
TGPicture::GetName
const char * GetName() const
Returns name of object.
Definition: TGPicture.h:62
kButton5
@ kButton5
Definition: GuiTypes.h:214
TGCanvas.h
TGListTreeItem::GetNextSibling
TGListTreeItem * GetNextSibling() const
Definition: TGListTree.h:77
TGFrame::GetWhitePixel
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:694
TGListTree::GetUncheckedPic
static const TGPicture * GetUncheckedPic()
Returns the icon used for unchecked checkbox.
Definition: TGListTree.cxx:2597
TGContainer::fViewPort
TGViewPort * fViewPort
Definition: TGCanvas.h:50
TGListTree::DoubleClicked
void DoubleClicked(TGFrame *, Int_t)
Emit DoubleClicked() signal.
Definition: TGListTree.h:313
kKey_End
@ kKey_End
Definition: KeySymbols.h:45
TGListTree::fBelowMouse
TGListTreeItem * fBelowMouse
Definition: TGListTree.h:229
TGListTreeItem::UpdateState
virtual void UpdateState()
Definition: TGListTree.h:114
TGListTree::fgHighlightGC
static TGGC * fgHighlightGC
Definition: TGListTree.h:266
TGFrame::GetDefaultSelectedBackground
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition: TGFrame.cxx:681
kCT_ITEMCLICK
@ kCT_ITEMCLICK
Definition: WidgetMessageTypes.h:62
TGListTree::LineUp
void LineUp(Bool_t select=kFALSE)
Move content one item-size up.
Definition: TGListTree.cxx:1235
TGListTreeItemStd::fTipText
TString fTipText
Definition: TGListTree.h:149
TGResourcePool.h
TGFont::GetFontStruct
FontStruct_t GetFontStruct() const
Definition: TGFont.h:193
TGListTree::fVspacing
Int_t fVspacing
Definition: TGListTree.h:231
TGListTree::Checked
virtual void Checked(TObject *obj, Bool_t check)
Emit Checked() signal.
Definition: TGListTree.cxx:1105
TGFrame::fHeight
UInt_t fHeight
Definition: TGFrame.h:113
TGListTree::fLineGC
GContext_t fLineGC
Definition: TGListTree.h:237
TGListTreeItemStd::CheckChildren
virtual void CheckChildren(TGListTreeItem *item, Bool_t state)
Set all child items of 'item' checked if state=kTRUE; unchecked if state=kFALSE.
Definition: TGListTree.cxx:257
TGListTreeItemStd::fClosedPic
const TGPicture * fClosedPic
Definition: TGListTree.h:151
TGFrame::fBackground
Pixel_t fBackground
Definition: TGFrame.h:120
TGListTreeItem::IsDNDSource
Bool_t IsDNDSource() const
Definition: TGListTree.h:127
TGListTree::fgDrawGC
static TGGC * fgDrawGC
Definition: TGListTree.h:264
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:53
kEnterWindowMask
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:166
TGListTree::GetHighlightGC
static const TGGC & GetHighlightGC()
Return graphics context for highlighted frame background.
Definition: TGListTree.cxx:2521
TGFont
Definition: TGFont.h:149
TGWindow::fEditDisabled
UInt_t fEditDisabled
Definition: TGWindow.h:40
TGDNDManager::Drag
Bool_t Drag(Int_t x_root, Int_t y_root, Atom_t action, Time_t timestamp)
Process drag event.
Definition: TGDNDManager.cxx:991
TGSearchDialog
Definition: TGTextEditDialogs.h:49
TGCanvas::GetViewPort
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:227
TGFrame::fgDefaultSelectedBackground
static Pixel_t fgDefaultSelectedBackground
Definition: TGFrame.h:127
Class
void Class()
Definition: Class.C:29
TGPosition
Definition: TGDimension.h:45
TGListTree::fDropItem
TGListTreeItem * fDropItem
Definition: TGListTree.h:249
TGListTree::fgGrayPixel
static Pixel_t fgGrayPixel
Definition: TGListTree.h:261
TGCanvas
Definition: TGCanvas.h:202
TGListTreeItemStd::fHasColor
Bool_t fHasColor
Definition: TGListTree.h:156
TGListTreeItem::fYtext
Int_t fYtext
Definition: TGListTree.h:66
TGPicture::GetHeight
UInt_t GetHeight() const
Definition: TGPicture.h:64
TGListTreeItem
Definition: TGListTree.h:43
TGToolTip::Hide
void Hide()
Hide tool tip window.
Definition: TGToolTip.cxx:247
TGListTree::HandleDoubleClick
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click event in the list tree (only for kButton1).
Definition: TGListTree.cxx:662
TGListTreeItemStd::IsChecked
virtual Bool_t IsChecked() const
Definition: TGListTree.h:191
TGListTreeItem::fFirstchild
TGListTreeItem * fFirstchild
Definition: TGListTree.h:54
TGListTree::RecursiveDeleteItem
Int_t RecursiveDeleteItem(TGListTreeItem *item, void *userData)
Delete item with fUserData == ptr.
Definition: TGListTree.cxx:2065
TGScrollBar.h
kKey_PageDown
@ kKey_PageDown
Definition: KeySymbols.h:53
TGListTreeItemStd::fChecked
Bool_t fChecked
Definition: TGListTree.h:146
TBufferFile
Definition: TBufferFile.h:47
TGClient
Definition: TGClient.h:46
TGListTree::OpenItem
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
Definition: TGListTree.cxx:2040
TGListTree::DrawRegion
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Redraw list tree.
Definition: TGListTree.cxx:1364
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:110
TGListTreeItem::GetParent
TGListTreeItem * GetParent() const
Definition: TGListTree.h:73
TGListTreeItem::fDNDState
Int_t fDNDState
Definition: TGListTree.h:61
TGListTreeItem::Rename
void Rename(const char *new_name)
Definition: TGListTree.h:86
TGWindow::fParent
const TGWindow * fParent
Definition: TGWindow.h:36
TGListTreeItemStd::~TGListTreeItemStd
virtual ~TGListTreeItemStd()
Delete list tree item.
Definition: TGListTree.cxx:154
kKeyShiftMask
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:194
TGListTree::GetOpenPic
static const TGPicture * GetOpenPic()
Returns the icon used by items in open state.
Definition: TGListTree.cxx:2564
TList
Definition: TList.h:44
TBuffer::kWrite
@ kWrite
Definition: TBuffer.h:73
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TGListTree::GetClosedPic
static const TGPicture * GetClosedPic()
Returns the icon used by items in closed state.
Definition: TGListTree.cxx:2575
TGListTreeItem::HasCheckedChild
virtual Bool_t HasCheckedChild(Bool_t=kFALSE)
Definition: TGListTree.h:112
TGSearchType
Definition: TGTextEditDialogs.h:30
GCValues_t::fLineWidth
Int_t fLineWidth
Definition: GuiTypes.h:228
int
TGListTree::fBuf
TBufferFile * fBuf
Definition: TGListTree.h:246
TGListTree::fExposeTop
Int_t fExposeTop
Definition: TGListTree.h:242
TError.h
TGListTree::MouseOver
virtual void MouseOver(TGListTreeItem *entry)
Signal emitted when pointer is over entry.
Definition: TGListTree.cxx:1050
TGContainer::fBdown
Bool_t fBdown
Definition: TGCanvas.h:71
TSystem::GetVolumes
virtual TList * GetVolumes(Option_t *) const
Definition: TSystem.h:453
TGWindow::IsMapped
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:276