Logo ROOT  
Reference Guide
TGListView.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 17/01/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 // TGListView, TGLVContainer and TGLVEntry //
26 // //
27 // A list view is a widget that can contain a number of items //
28 // arranged in a grid or list. The items can be represented either //
29 // by a string or by an icon. //
30 // //
31 // The TGListView is user callable. The other classes are service //
32 // classes of the list view. //
33 // //
34 // A list view can generate the following events: //
35 // kC_CONTAINER, kCT_SELCHANGED, total items, selected items. //
36 // kC_CONTAINER, kCT_ITEMCLICK, which button, location (y<<16|x). //
37 // kC_CONTAINER, kCT_ITEMDBLCLICK, which button, location (y<<16|x). //
38 // //
39 //////////////////////////////////////////////////////////////////////////
40 
41 #include "TGListView.h"
42 #include "TGPicture.h"
43 #include "TGButton.h"
44 #include "TGScrollBar.h"
45 #include "TGResourcePool.h"
46 #include "TList.h"
47 #include "TSystem.h"
48 #include "TGMimeTypes.h"
49 #include "TObjString.h"
50 #include "TVirtualX.h"
51 
52 #include <iostream>
53 
54 const TGFont *TGLVEntry::fgDefaultFont = nullptr;
55 TGGC *TGLVEntry::fgDefaultGC = nullptr;
56 
57 const TGFont *TGListView::fgDefaultFont = nullptr;
58 TGGC *TGListView::fgDefaultGC = nullptr;
59 
60 
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// Create a list view item.
67 
68 TGLVEntry::TGLVEntry(const TGWindow *p, const TGPicture *bigpic,
69  const TGPicture *smallpic, TGString *name,
70  TGString **subnames, EListViewMode viewMode,
71  UInt_t options, ULong_t back) :
72  TGFrame(p, 10, 10, options, back)
73 {
74  fSelPic = 0;
75 
76  fCurrent =
77  fBigPic = bigpic;
78  fSmallPic = smallpic;
79 
80  fCheckMark = fClient->GetPicture("checkmark_t.xpm");
81  fChecked = kFALSE;
82 
83  fItemName = name;
84  fSubnames = subnames;
85  fUserData = 0;
86 
87  fCpos =
88  fJmode = 0;
89 
90  fActive = kFALSE;
91 
93  fNormGC = GetDefaultGC()();
94 
95  Int_t max_ascent, max_descent;
96  fTWidth = gVirtualX->TextWidth(fFontStruct,
97  fItemName ? fItemName->GetString() : "",
98  fItemName ? fItemName->GetLength() : 0);
99  gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
100  fTHeight = max_ascent + max_descent;
101 
102  if (fSubnames) {
103  Int_t i;
104  for (i = 0; fSubnames[i] != 0; ++i)
105  ;
106  fCtw = new int[i+1];
107  fCtw[i] = 0;
108  for (i = 0; fSubnames[i] != 0; ++i) {
109  fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
110  fSubnames[i]->GetLength());
111  }
112  } else {
113  fCtw = 0;
114  }
115 
116  fViewMode = (EListViewMode)-1;
117  SetViewMode(viewMode);
118 }
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 /// Create a list view item.
122 ///
123 /// name - is name of item.
124 /// cname - is name of icon. In most cases this is class name of object
125 /// associated with this item.
126 
128  const TString& cname, TGString **subnames,
129  UInt_t options, Pixel_t back) :
130  TGFrame(p, 10, 10, options, back)
131 {
132  fSelPic = 0;
133 
134  fCurrent =
136  fCheckMark = fClient->GetPicture("checkmark_t.xpm");
137  fChecked = kFALSE;
138 
139  if (!fBigPic) {
140  fBigPic = fClient->GetPicture("doc_s.xpm");
141  }
143  if (!fSmallPic) {
144  fSmallPic = fClient->GetPicture("doc_t.xpm");
145  }
146 
147  fItemName = new TGString(name);
148  fSubnames = subnames;
149  fUserData = 0;
150 
151  fCpos =
152  fJmode = 0;
153 
154  fActive = kFALSE;
155 
157  fNormGC = GetDefaultGC()();
158 
159  Int_t max_ascent, max_descent;
161  gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
162  fTHeight = max_ascent + max_descent;
163 
164  if (fSubnames) {
165  Int_t i;
166  for (i = 0; fSubnames[i] != 0; ++i)
167  ;
168  fCtw = new int[i+1];
169  fCtw[i] = 0;
170  for (i = 0; fSubnames[i] != 0; ++i) {
171  fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
172  fSubnames[i]->GetLength());
173  }
174  } else {
175  fCtw = 0;
176  }
177 
178  fViewMode = (EListViewMode)-1;
180 }
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Delete a list view item.
184 
186 {
187  if (fItemName) delete fItemName;
188  if (fSelPic) delete fSelPic;
189  if (fSubnames) {
190  for (Int_t i = 0; fSubnames[i] != 0; ++i) delete fSubnames[i];
191  delete [] fSubnames;
192  delete [] fCtw;
193  }
194 }
195 
196 ////////////////////////////////////////////////////////////////////////////////
197 /// Sets new subnames.
198 
199 void TGLVEntry::SetSubnames(const char* n1,const char* n2,const char* n3,
200  const char* n4,const char* n5,const char* n6,
201  const char* n7,const char* n8,const char* n9,
202  const char* n10,const char* n11,const char* n12)
203 {
204  if (fSubnames) {
205  for (Int_t i = 0; fSubnames[i] != 0; ++i) delete fSubnames[i];
206  delete [] fSubnames;
207  delete [] fCtw;
208  }
209 
210  Int_t ncol = 0;
211  fSubnames = 0;
212 
213  if (n12 && strlen(n12)) ncol=12;
214  else if (n11 && strlen(n11)) ncol=11;
215  else if (n10 && strlen(n10)) ncol=10;
216  else if (n9 && strlen(n9)) ncol=9;
217  else if (n8 && strlen(n8)) ncol=8;
218  else if (n7 && strlen(n7)) ncol=7;
219  else if (n6 && strlen(n6)) ncol=6;
220  else if (n5 && strlen(n5)) ncol=5;
221  else if (n4 && strlen(n4)) ncol=4;
222  else if (n3 && strlen(n3)) ncol=3;
223  else if (n2 && strlen(n2)) ncol=2;
224  else if (n1 && strlen(n1)) ncol=1;
225 
226  if (!ncol) return;
227 
228  fSubnames = new TGString* [ncol+1];
229 
230  if (ncol>11) fSubnames[11] = new TGString(n12);
231  if (ncol>10) fSubnames[10] = new TGString(n11);
232  if (ncol>9) fSubnames[9] = new TGString(n10);
233  if (ncol>8) fSubnames[8] = new TGString(n9);
234  if (ncol>7) fSubnames[7] = new TGString(n8);
235  if (ncol>6) fSubnames[6] = new TGString(n7);
236  if (ncol>5) fSubnames[5] = new TGString(n6);
237  if (ncol>4) fSubnames[4] = new TGString(n5);
238  if (ncol>3) fSubnames[3] = new TGString(n4);
239  if (ncol>2) fSubnames[2] = new TGString(n3);
240  if (ncol>1) fSubnames[1] = new TGString(n2);
241  if (ncol>0) fSubnames[0] = new TGString(n1);
242  fSubnames[ncol] = 0;
243 
244  fCtw = new int[ncol];
245  fCtw[ncol-1] = 0;
246 
247  for (int i = 0; i<ncol; i++) {
248  fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
249  fSubnames[i]->GetLength());
250  }
251 }
252 
253 ////////////////////////////////////////////////////////////////////////////////
254 /// Make list view item active.
255 
257 {
258  if (fActive == a) return;
259  fActive = a;
260 
261  if (fActive) {
263  } else {
264  if (fSelPic) delete fSelPic;
265  fSelPic = 0;
266  }
267  DoRedraw();
268 }
269 
270 ////////////////////////////////////////////////////////////////////////////////
271 /// Set the view mode for this list item.
272 
274 {
275  if (viewMode != fViewMode) {
276  fViewMode = viewMode;
277  if (viewMode == kLVLargeIcons)
278  fCurrent = fBigPic;
279  else
281  if (fActive) {
282  if (fSelPic) delete fSelPic;
284  }
285  gVirtualX->ClearWindow(fId);
287  fClient->NeedRedraw(this);
288  }
289 }
290 
291 ////////////////////////////////////////////////////////////////////////////////
292 /// change pictures
293 
294 void TGLVEntry::SetPictures(const TGPicture *bigpic, const TGPicture *smallpic)
295 {
296  if (!bigpic || !smallpic) return;
297 
298  gVirtualX->ClearWindow(fId);
299 
300  fBigPic = bigpic;
301  fSmallPic = smallpic;
303 
304  if (fSelPic) delete fSelPic;
306 
307  Resize();
308  gVirtualX->ClearWindow(fId);
309 }
310 
311 ////////////////////////////////////////////////////////////////////////////////
312 /// Redraw list view item.
313 /// List view item is placed and layouted in the container frame,
314 /// but is drawn in viewport.
315 
317 {
318  DrawCopy(fId, 0, 0);
319 }
320 
321 ////////////////////////////////////////////////////////////////////////////////
322 /// Draw list view item in other window.
323 /// List view item is placed and layout in the container frame,
324 /// but is drawn in viewport.
325 
327 {
328  Int_t ix, iy, lx, ly;
329  Int_t max_ascent, max_descent;
330 
331  gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
333  fTHeight = max_ascent + max_descent;
334 
335  if (fViewMode == kLVLargeIcons) {
336  ix = (fWidth - fCurrent->GetWidth()) >> 1;
337  iy = 0;
338  lx = (fWidth - fTWidth) >> 1;
339  ly = fHeight - (fTHeight + 1) - 2;
340  } else {
341  ix = 0;
342  iy = (fHeight - fCurrent->GetHeight()) >> 1;
343  lx = fCurrent->GetWidth() + 2;
344  ly = (fHeight - (fTHeight + 1)) >> 1;
345  }
346 
347  if ((fChecked) && (fCheckMark)) {
348  if (fViewMode == kLVLargeIcons) {
349  fCheckMark->Draw(id, fNormGC, x + ix + 8, y + iy + 8);
350  gVirtualX->SetForeground(fNormGC, fgWhitePixel);
351  gVirtualX->FillRectangle(id, fNormGC, x + lx, y + ly, fTWidth, fTHeight + 1);
352  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
353  }
354  else {
355  fCheckMark->Draw(id, fNormGC, x + ix, y + iy);
356  gVirtualX->SetForeground(fNormGC, fgWhitePixel);
357  gVirtualX->FillRectangle(id, fNormGC, x + lx, y, fWidth-lx, fHeight);
358  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
359  }
360  }
361  // This if tries to print the elements with ... appened at the end if
362  // the widht of the string is longer than that of the column
363  if (fViewMode == kLVDetails && fSubnames && fCpos && fJmode && fCtw) {
364  TString tmpString = *fItemName;
365  Int_t ftmpWidth = gVirtualX->TextWidth(fFontStruct, tmpString,
366  tmpString.Length());
367  if ( ftmpWidth > (fCpos[0] - lx) ) {
368  for (Int_t j = fItemName->Length() - 1 ; j > 0; j--) {
369  tmpString = (*fItemName)(0,j) + "...";
370  ftmpWidth = gVirtualX->TextWidth(GetDefaultFontStruct(), tmpString,
371  tmpString.Length());
372  if ( ftmpWidth <= (fCpos[0] - lx) ) {
373  break;
374  }
375  }
376  }
377  if (fActive) {
378  if (fSelPic) fSelPic->Draw(id, fNormGC, x + ix, y + iy);
380  gVirtualX->FillRectangle(id, fNormGC, x + lx, y, fWidth-(lx+4), fHeight);
382  } else {
383  fCurrent->Draw(id, fNormGC, x + ix, y + iy);
384  gVirtualX->SetForeground(fNormGC, fgWhitePixel);
385  gVirtualX->FillRectangle(id, fNormGC, x + lx, y, fWidth-(lx+4), fHeight);
386  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
387  }
388 
389  TGString tmpTGString(tmpString);
390  tmpTGString.Draw(id, fNormGC, x+lx, y+ly + max_ascent);
391  } else if (fViewMode == kLVLargeIcons) {
392  if (fActive) {
393  if (fSelPic) fSelPic->Draw(id, fNormGC, x + ix, y + iy);
395  gVirtualX->FillRectangle(id, fNormGC, x + lx, y + ly, fTWidth, fTHeight + 1);
397  } else {
398  fCurrent->Draw(id, fNormGC, x + ix, y + iy);
399  gVirtualX->SetForeground(fNormGC, fgWhitePixel);
400  gVirtualX->FillRectangle(id, fNormGC, x + lx, y + ly, fTWidth, fTHeight + 1);
401  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
402  }
403  fItemName->Draw(id, fNormGC, x+lx, y+ly + max_ascent);
404  } else {
405  if (fActive) {
407  gVirtualX->FillRectangle(id, fNormGC, x + lx, y, fWidth-lx, fHeight);
409  if (fSelPic) fSelPic->Draw(id, fNormGC, x + ix, y + iy);
410  } else {
411  gVirtualX->SetForeground(fNormGC, fgWhitePixel);
412  gVirtualX->FillRectangle(id, fNormGC, x + lx, y, fWidth-lx, fHeight);
413  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
414  fCurrent->Draw(id, fNormGC, x + ix, y + iy);
415  }
416  fItemName->Draw(id, fNormGC, x+lx, y+ly + max_ascent);
417  }
418 
419  if (fViewMode == kLVDetails) {
420  if (fSubnames && fCpos && fJmode && fCtw) {
421  int i;
422 
423  if (fActive) {
425  } else {
426  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
427  }
428  // Again fixes the size of the strings
429  for (i = 0; fSubnames[i] != 0; ++i) {
430  TString tmpString = *fSubnames[i];
431  Int_t ftmpWidth = gVirtualX->TextWidth(fFontStruct, tmpString,
432  tmpString.Length());
433  if ( ftmpWidth > (fCpos[i+1] - fCpos[i]) ) {
434  for (int j = fSubnames[i]->Length() - 1 ; j > 0; j--) {
435  tmpString = (*fSubnames[i])(0,j) + "...";
436  ftmpWidth = gVirtualX->TextWidth(GetDefaultFontStruct(),
437  tmpString,
438  tmpString.Length());
439  if ( ftmpWidth <= (fCpos[i+1] - fCpos[i]) ) {
440  break;
441  }
442  }
443  }
444  if (fCpos[i] == 0)
445  break;
446  if (fJmode[i] == kTextRight)
447  lx = fCpos[i+1] - ftmpWidth - 2;
448  else if (fJmode[i] == kTextCenterX)
449  lx = (fCpos[i] + fCpos[i+1] - ftmpWidth) >> 1;
450  else // default to TEXT_LEFT
451  lx = fCpos[i] + 2;
452 
453  //if (x + lx < 0) continue; // out of left boundary or mess in name
454  TGString tmpTGString(tmpString);
455  tmpTGString.Draw(id, fNormGC, x + lx, y + ly + max_ascent);
456  }
457  }
458  }
459  gVirtualX->SetForeground(fNormGC, fgBlackPixel);
460 }
461 
462 ////////////////////////////////////////////////////////////////////////////////
463 /// Get default size of list item.
464 
466 {
467  TGDimension size;
468  TGDimension isize(fCurrent ? fCurrent->GetWidth() : 0,
469  fCurrent ? fCurrent->GetHeight() : 0);
470  TGDimension lsize(fTWidth, fTHeight+1);
471 
472  switch (fViewMode) {
473  default:
474  case kLVLargeIcons:
475  size.fWidth = TMath::Max(isize.fWidth, lsize.fWidth);
476  size.fHeight = isize.fHeight + lsize.fHeight + 6;
477  break;
478 
479  case kLVSmallIcons:
480  case kLVList:
481  case kLVDetails:
482  size.fWidth = isize.fWidth + lsize.fWidth + 4;
483  size.fHeight = TMath::Max(isize.fHeight, lsize.fHeight);
484  break;
485  }
486  return size;
487 }
488 
489 ////////////////////////////////////////////////////////////////////////////////
490 /// Return the default font structure in use.
491 
493 {
494  if (!fgDefaultFont)
495  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
496  return fgDefaultFont->GetFontStruct();
497 }
498 
499 ////////////////////////////////////////////////////////////////////////////////
500 /// Return the default graphics context in use.
501 
503 {
504  if (!fgDefaultGC) {
505  fgDefaultGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
507  }
508  return *fgDefaultGC;
509 }
510 
511 
512 ////////////////////////////////////////////////////////////////////////////////
513 /// Create a list view container. This is the (large) frame that contains
514 /// all the list items. It will be shown through a TGViewPort (which is
515 /// created by the TGCanvas derived TGListView).
516 
518  UInt_t options, ULong_t back) :
519  TGContainer(p, w, h, options, back)
520 {
521  fListView = 0;
522  fLastActive = 0;
523  fCpos = fJmode = 0;
525 
528 
529  SetLayoutManager(new TGTileLayout(this, 8));
530 }
531 
532 ////////////////////////////////////////////////////////////////////////////////
533 /// Create a list view container. This is the (large) frame that contains
534 /// all the list items. It will be shown through a TGViewPort (which is
535 /// created by the TGCanvas derived TGListView).
536 
538  TGContainer(p,options, back)
539 {
540  fListView = 0;
541  fLastActive = 0;
542  fCpos = fJmode = 0;
544 
547 
548  SetLayoutManager(new TGTileLayout(this, 8));
549 
551 }
552 
553 ////////////////////////////////////////////////////////////////////////////////
554 /// Delete list view container.
555 
557 {
558  if (!MustCleanup()) {
559  RemoveAll();
560  delete fItemLayout;
561  }
562 }
563 
564 ////////////////////////////////////////////////////////////////////////////////
565 /// set columns headers
566 
567 void TGLVContainer::SetColHeaders(const char* n1,const char* n2,const char* n3,
568  const char* n4,const char* n5,const char* n6,
569  const char* n7,const char* n8,const char* n9,
570  const char* n10,const char* n11,const char* n12)
571 {
572  if (!fListView) return;
573 
574  Int_t ncol = -1;
575  if (n12 && strlen(n12)) ncol=12;
576  else if (n11 && strlen(n11)) ncol=11;
577  else if (n10 && strlen(n10)) ncol=10;
578  else if (n9 && strlen(n9)) ncol=9;
579  else if (n8 && strlen(n8)) ncol=8;
580  else if (n7 && strlen(n7)) ncol=7;
581  else if (n6 && strlen(n6)) ncol=6;
582  else if (n5 && strlen(n5)) ncol=5;
583  else if (n4 && strlen(n4)) ncol=4;
584  else if (n3 && strlen(n3)) ncol=3;
585  else if (n2 && strlen(n2)) ncol=2;
586  else if (n1 && strlen(n1)) ncol=1;
587 
588  if (ncol<0) return;
589 
590  fListView->SetHeaders(ncol);
591  if (ncol>0) fListView->SetHeader(n1, kTextCenterX, kTextLeft , 0);
592  if (ncol>1) fListView->SetHeader(n2, kTextCenterX, kTextLeft , 1);
593  if (ncol>2) fListView->SetHeader(n3, kTextCenterX, kTextLeft , 2);
594  if (ncol>3) fListView->SetHeader(n4, kTextCenterX, kTextLeft , 3);
595  if (ncol>4) fListView->SetHeader(n5, kTextCenterX, kTextLeft , 4);
596  if (ncol>5) fListView->SetHeader(n6, kTextCenterX, kTextLeft , 5);
597  if (ncol>6) fListView->SetHeader(n7, kTextCenterX, kTextLeft , 6);
598  if (ncol>7) fListView->SetHeader(n8, kTextCenterX, kTextLeft , 7);
599  if (ncol>8) fListView->SetHeader(n9, kTextCenterX, kTextLeft , 8);
600  if (ncol>9) fListView->SetHeader(n10, kTextCenterX, kTextLeft , 9);
601  if (ncol>10) fListView->SetHeader(n11, kTextCenterX, kTextLeft , 10);
602  if (ncol>11) fListView->SetHeader(n12, kTextCenterX, kTextLeft , 11);
603 
604  fListView->Layout();
605 }
606 
607 ////////////////////////////////////////////////////////////////////////////////
608 /// Set list view mode for container.
609 
611 {
612  if (fViewMode != viewMode) {
613  TGLayoutHints *oldLayout = fItemLayout;
614 
615  EListViewMode old = fViewMode;
616  fViewMode = viewMode;
617  if (fListView) fListView->SetViewMode(viewMode);
618 
619  if (viewMode == kLVLargeIcons)
621  else
623 
624  TGFrameElement *el;
625  TIter next(fList);
626  while ((el = (TGFrameElement *) next())) {
627  el->fLayout = fItemLayout;
628  ((TGLVEntry *) el->fFrame)->SetViewMode(viewMode);
629  }
630  delete oldLayout;
631 
632  switch (viewMode) {
633  default:
634  case kLVLargeIcons:
635  SetLayoutManager(new TGTileLayout(this, 8));
636  break;
637 
638  case kLVSmallIcons:
639  SetLayoutManager(new TGTileLayout(this, 2));
640  break;
641 
642  case kLVList:
643  SetLayoutManager(new TGListLayout(this, 2));
644  break;
645 
646  case kLVDetails:
648  break;
649  }
650 
651  TGCanvas *canvas = (TGCanvas *) this->GetParent()->GetParent();
652 
653  // layout and adjust position after layout
654  UInt_t height = fHeight;
655  UInt_t width = fWidth;
656  TGPosition pos = GetPagePosition();
657  canvas->Layout();
658  pos.fX = (pos.fX*fWidth)/width;
659  pos.fY = (pos.fY*fHeight)/height;
660 
661  if (old == kLVList) { // switch x <-> y
662  SetVsbPosition(pos.fX);
663  SetHsbPosition(0);
664  } else if (fViewMode == kLVList) {
665  SetHsbPosition(pos.fY);
666  } else {
667  SetVsbPosition(pos.fY);
668  SetHsbPosition(pos.fX);
669  }
670  }
671 }
672 
673 ////////////////////////////////////////////////////////////////////////////////
674 /// Set column information for list items.
675 
677 {
678  fCpos = cpos;
679  fJmode = jmode;
680 
681  TGFrameElement *el;
682  TIter next(fList);
683  while ((el = (TGFrameElement *) next())) {
684  ((TGLVEntry *) el->fFrame)->SetColumns(fCpos, fJmode);
685  }
686  Layout();
687 }
688 
689 ////////////////////////////////////////////////////////////////////////////////
690 /// Get size of largest item in container.
691 
693 {
694  TGDimension csize, maxsize(0,0);
695 
696  TGFrameElement *el;
697  TIter next(fList);
698  while ((el = (TGFrameElement *) next())) {
699  csize = el->fFrame->GetDefaultSize();
700  maxsize.fWidth = TMath::Max(maxsize.fWidth, csize.fWidth);
701  maxsize.fHeight = TMath::Max(maxsize.fHeight, csize.fHeight);
702  }
703  if (fViewMode == kLVLargeIcons) {
704  maxsize.fWidth += 8;
705  maxsize.fHeight += 8;
706  } else {
707  maxsize.fWidth += 2;
708  maxsize.fHeight += 2;
709  }
710  return maxsize;
711 }
712 
713 ////////////////////////////////////////////////////////////////////////////////
714 /// Get width of largest subname in container.
715 
717 {
718  if (idx == 0) {
719  return GetMaxItemSize().fWidth;
720  }
721 
722  Int_t width, maxwidth = 0;
723 
724  TGFrameElement *el;
725  TIter next(fList);
726  while ((el = (TGFrameElement *) next())) {
727  TGLVEntry *entry = (TGLVEntry *) el->fFrame;
728  width = entry->GetSubnameWidth(idx-1);
729  maxwidth = TMath::Max(maxwidth, width);
730  }
731  return maxwidth;
732 }
733 
734 ////////////////////////////////////////////////////////////////////////////////
735 /// Remove item with fUserData == userData from container.
736 
738 {
739  TGFrameElement *el;
740  TIter next(fList);
741  while ((el = (TGFrameElement *) next())) {
742  TGLVEntry *f = (TGLVEntry *) el->fFrame;
743  if (f->GetUserData() == userData) {
744  RemoveItem(f);
745  break;
746  }
747  }
748 }
749 
750 ////////////////////////////////////////////////////////////////////////////////
751 /// Select/activate item.
752 
754 {
756  fLastActive = (TGLVEntry*)el->fFrame;
757 }
758 
759 ////////////////////////////////////////////////////////////////////////////////
760 /// Unselect/deactivate item.
761 
763 {
765  fLastActive = (TGLVEntry*)el->fFrame;
766 }
767 
768 ////////////////////////////////////////////////////////////////////////////////
769 /// Handle mouse button event in container.
770 
772 {
773  if ( !fMultiSelect ) {
774  return TGContainer::HandleButton(event);
775  }
776 
777  Int_t total = 0, selected = fSelected, page = 0;
778 
779  TGPosition pos = GetPagePosition();
781  Int_t newpos;
782  page = dim.fHeight/4;
783 
784  if (event->fCode == kButton4) {
785  //scroll up
786  newpos = pos.fY - page;
787  if (newpos < 0) newpos = 0;
788  fCanvas->SetVsbPosition(newpos);
789  return kTRUE;
790  }
791  if (event->fCode == kButton5) {
792  // scroll down
793  newpos = fCanvas->GetVsbPosition() + page;
794  fCanvas->SetVsbPosition(newpos);
795  return kTRUE;
796  }
797 
798  Int_t xx = pos.fX + event->fX; // translate coordinates
799  Int_t yy = pos.fY + event->fY;
800 
801  if (event->fType == kButtonPress) {
802  gVirtualX->SetInputFocus(fId);
803 
804  fXp = pos.fX + event->fX;
805  fYp = pos.fY + event->fY;
806 
807  TGFrameElement *el;
808  TIter next(fList);
809  Bool_t select_frame = kFALSE;
810 
811  if (event->fState & kKeyShiftMask) {
812  Bool_t inSelection = kFALSE;
813  TGLVEntry* last = fLastActive;
814 
815  while ((el = (TGFrameElement *) next())) {
816  select_frame = kFALSE;
817 
818  if (!fMapSubwindows) {
819  if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > yy ) &&
820  (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > xx ) &&
821  (Int_t(el->fFrame->GetY()) < yy) &&
822  (Int_t(el->fFrame->GetX()) < xx)) {
823  select_frame = kTRUE;
824  }
825  } else {
826  if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
827  select_frame = kTRUE;
828  }
829  }
830 
831  if (select_frame || last==el->fFrame)
832  inSelection = !inSelection;
833  if (inSelection || select_frame) {
834  if ( !el->fFrame->IsActive() ) {
835  selected++;
836  ActivateItem(el);
837  }
838  Clicked(el->fFrame, event->fCode);
839  Clicked(el->fFrame, event->fCode, event->fXRoot, event->fYRoot);
840  }
841  total++;
842  }
843  } else if (event->fState & kKeyControlMask) {
844  // DO NOTHING!
845  } else {
846  UnSelectAll();
847  total = selected = 0;
848  }
849 
850  select_frame = kFALSE;
851  while ((el = (TGFrameElement *) next())) {
852  select_frame = kFALSE;
853 
854  if (!fMapSubwindows) {
855  if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > yy ) &&
856  (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > xx ) &&
857  (Int_t(el->fFrame->GetY()) < yy) &&
858  (Int_t(el->fFrame->GetX()) < xx)) {
859  select_frame = kTRUE;
860  }
861  } else {
862  if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
863  select_frame = kTRUE;
864  }
865  }
866 
867  if (select_frame) {
868  if ( el->fFrame->IsActive() ) {
869  selected--;
870  DeActivateItem(el);
871  } else {
872  selected++;
873  ActivateItem(el);
874  }
875  Clicked(el->fFrame, event->fCode);
876  Clicked(el->fFrame, event->fCode, event->fXRoot, event->fYRoot);
877  }
878  total++;
879  }
880 
881  if (fTotal != total || fSelected != selected) {
882  fTotal = total;
883  fSelected = selected;
885  fTotal, fSelected);
886  }
887 
888  if ( selected == 0 ) {
889  fDragging = kTRUE;
890  fX0 = fXf = fXp;
891  fY0 = fYf = fYp;
892  //if (fMapSubwindows)
893  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0, fY0, fXf-fX0,
894  fYf-fY0);
895  }
896  }
897 
898  if (event->fType == kButtonRelease) {
899  gVirtualX->SetInputFocus(fId);
900 
901  if (fDragging) {
902  fDragging = kFALSE;
903  fScrolling = kFALSE;
904 
906  //if (fMapSubwindows)
907  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0, fY0, fXf-fX0,
908  fYf-fY0);
909  } else {
911  event->fCode, (event->fYRoot << 16) | event->fXRoot);
912  }
913  }
914  fClient->NeedRedraw(this);
915  return kTRUE;
916 }
917 
918 ////////////////////////////////////////////////////////////////////////////////
919 /// Get list of selected items in container.
920 /// Returned TList object should be deleted by the user
921 
923 {
924  TGFrameElement *el;
925  TIter next(fList);
926  TList *ret = new TList();
927 
928  while ((el = (TGFrameElement *) next())) {
929  if (el->fFrame->IsActive()) {
930  ret->Add((TGLVEntry *)el->fFrame);
931  }
932  }
933  return ret;
934 }
935 
936 ////////////////////////////////////////////////////////////////////////////////
937 /// Get list of selected items in container.
938 /// Returned TList object and its content should be deleted
939 // lst->Delete(); delete lst;
940 
942 {
943  TGFrameElement *el;
944  TIter next(fList);
945  TList *ret = new TList();
946 
947  while ((el = (TGFrameElement *) next())) {
948  if (el->fFrame->IsActive()) {
949  ret->Add(new TObjString(((TGLVEntry*)el->fFrame)->GetItemName()->GetString()));
950  }
951  }
952  return ret;
953 }
954 
955 ////////////////////////////////////////////////////////////////////////////////
956 /// Move current position one column left.
957 
959 {
960  // in details mode just move one line up
961  if (fViewMode == kLVDetails) return LineUp(select);
962 
963  TGPosition pos = GetPagePosition();
965 
967  if (!fe) return; // empty list
968 
970 
971  if (fViewMode == kLVSmallIcons && fe == old) return;
972 
973  if (old) DeActivateItem(old); //
974  else fLastActiveEl = fe;
975 
977  Int_t dx = ms.fWidth;
978  Int_t dy = ms.fHeight;
979 
981  Int_t x = fLastActiveEl->fFrame->GetX() - dx + 2;
982 
983  Int_t hw = pos.fX + dim.fWidth;
984 
985  TGHScrollBar *hb = GetHScrollbar();
986  if (hb && hb->IsMapped()) {
987  Int_t pg = (hb->GetPageSize()*GetWidth())/fViewPort->GetWidth();
988  hw += pg;
989  }
990  if (x <= 0) { // move one line up
991  x = hw;
992  y = y - dy;
993  }
994 
995  fe = FindFrame(x, y);
996  if (fe && fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) {
997  // cannot go down with the left key
998  x = hw;
999  y = y - dy;
1000  fe = FindFrame(x, y);
1001  }
1002  if (fViewMode == kLVList) {
1003  if (fe && fe->fFrame->GetY() <= fLastActiveEl->fFrame->GetY() - (2 * dy)) {
1004  // avoid jumping more than one line up
1005  x = fe->fFrame->GetX() - dx;
1006  fe = FindFrame(x, y);
1007  }
1008  // cannot go down and/or right with the left key
1009  if (fe && fe->fFrame->GetY() >= fLastActiveEl->fFrame->GetY() &&
1010  fe->fFrame->GetX() >= fLastActiveEl->fFrame->GetX())
1011  fe = fLastActiveEl;
1012  }
1013  if (!fe || fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY())
1014  fe = (TGFrameElement*)fList->First();
1015  if (!select) fSelected=1;
1016 
1017  ActivateItem(fe);
1018  AdjustPosition();
1019 }
1020 
1021 ////////////////////////////////////////////////////////////////////////////////
1022 /// Move current position one column right.
1023 
1025 {
1026  // in details mode just move one line down
1027  if (fViewMode == kLVDetails) return LineDown(select);
1028 
1029  TGPosition pos = GetPagePosition();
1030  TGDimension dim = GetPageDimension();
1031 
1033  if (!fe) return;
1034 
1036 
1037  if (fViewMode == kLVSmallIcons && fe == old) return;
1038 
1039  if (old) DeActivateItem(old);
1041 
1043  Int_t dx = ms.fWidth;
1044  Int_t dy = ms.fHeight;
1045 
1047  Int_t x = fLastActiveEl->fFrame->GetX() + dx - 2;
1048 
1049  Int_t hw = pos.fX + dim.fWidth - dx;
1050 
1051  TGHScrollBar *hb = GetHScrollbar();
1052  if (x > hw && (hb && !hb->IsMapped())) { // move one line down
1053  x = 0;
1054  y = y + dy;
1055  }
1056 
1057  fe = FindFrame(x, y);
1058  if (fe && fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) {
1059  // cannot go up with the right key
1060  x = 0;
1061  y = y + dy;
1062  fe = FindFrame(x, y);
1063  }
1064  if (fViewMode == kLVList) {
1065  // cannot go up and/or left with the right key
1066  if (fe && fe->fFrame->GetY() <= fLastActiveEl->fFrame->GetY() &&
1067  fe->fFrame->GetX() <= fLastActiveEl->fFrame->GetX())
1068  fe = fLastActiveEl;
1069  }
1070  if (!fe || fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY())
1071  fe = (TGFrameElement*)fList->Last();
1072  if (!select) fSelected = 1;
1073 
1074  ActivateItem(fe);
1075  AdjustPosition();
1076 }
1077 
1078 ////////////////////////////////////////////////////////////////////////////////
1079 /// Make current position first line in window by scrolling up.
1080 
1082 {
1084  if (!fe) return;
1085 
1087 
1088  if (old) {
1089  DeActivateItem(old);
1090  } else {
1092  }
1093 
1095  Int_t dy = ms.fHeight;
1096 
1097  Int_t y = fLastActiveEl->fFrame->GetY() - dy;
1099 
1100  fe = FindFrame(x, y);
1101  if (!fe) fe = (TGFrameElement*)fList->First();
1102  if (fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1103  if (!select) fSelected = 1;
1104 
1105  ActivateItem(fe);
1106  AdjustPosition();
1107 }
1108 
1109 ////////////////////////////////////////////////////////////////////////////////
1110 /// Move one line down.
1111 
1113 {
1115  if (!fe) return;
1116 
1118 
1119  if (old) DeActivateItem(old);
1121 
1123  Int_t dy = ms.fHeight;
1124 
1125  Int_t y = fLastActiveEl->fFrame->GetY() + dy;
1127 
1128  fe = FindFrame(x, y);
1129  if (!fe) fe = (TGFrameElement*)fList->Last();
1130  if (fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1131  if (!select) fSelected = 1;
1132 
1133  ActivateItem(fe);
1134  AdjustPosition();
1135 }
1136 
1137 
1138 ////////////////////////////////////////////////////////////////////////////////
1139 /// Returns page dimension.
1140 
1142 {
1143  TGDimension ret;
1144  if (!fViewPort) return ret;
1145 
1146  ret.fWidth = fViewPort->GetWidth();
1147  ret.fHeight = fViewPort->GetHeight();
1148  return ret;
1149 }
1150 
1151 ////////////////////////////////////////////////////////////////////////////////
1152 /// Select the TGLVEntry given as argument and de-select the previous one if
1153 /// the container is not in multi-selection mode.
1154 
1156 {
1157  // select (activate) the item passed as argument and deactivate the currently
1158  // active one if not in multi-select mode
1159 
1160  if ( !fMultiSelect ) {
1162  if (old)
1163  DeActivateItem(old);
1164  }
1165  ActivateItem(item->GetFrameElement());
1166 }
1167 
1168 ////////////////////////////////////////////////////////////////////////////////
1169 /// Create a list view widget.
1170 
1172  UInt_t options, ULong_t back) :
1173  TGCanvas(p, w, h, options, back)
1174 {
1176  fNColumns = 0;
1177  fColumns = 0;
1178  fJmode = 0;
1179  fColHeader = 0;
1180  fColNames = 0;
1181  fSplitHeader = 0;
1182  fJustChanged = kFALSE;
1183  fMinColumnSize = 25;
1185  fNormGC = GetDefaultGC()();
1186  if (fHScrollbar)
1187  fHScrollbar->Connect("PositionChanged(Int_t)", "TGListView",
1188  this, "ScrollHeader(Int_t)");
1190 
1192 }
1193 
1194 ////////////////////////////////////////////////////////////////////////////////
1195 /// Delete a list view widget.
1196 
1198 {
1199  if (fNColumns) {
1200  delete [] fColumns;
1201  delete [] fJmode;
1202  for (int i = 0; i < fNColumns; i++) {
1203  delete fColHeader[i];
1204  delete fSplitHeader[i];
1205  }
1206  delete [] fColHeader;
1207  delete [] fColNames;
1208  delete [] fSplitHeader;
1209  delete fHeader;
1210  }
1211 }
1212 
1213 ////////////////////////////////////////////////////////////////////////////////
1214 /// Scroll header buttons with horizontal scrollbar
1215 
1217 {
1218  Int_t i, xl = - pos;
1219  if (fViewMode == kLVDetails) {
1220  for (i = 0; i < fNColumns-1; ++i) {
1221  fColHeader[i]->Move(xl, 0);
1222  xl += fColHeader[i]->GetWidth();
1223  fSplitHeader[i]->Move(xl,fSplitHeader[i]->GetHeight());
1224  }
1225  fColHeader[i]->Move(xl, 0);
1226  xl += fColHeader[i]->GetWidth();
1227  fSplitHeader[i]->Move(xl,fSplitHeader[i]->GetHeight());
1228  }
1229 }
1230 
1231 ////////////////////////////////////////////////////////////////////////////////
1232 /// Set number of headers, i.e. columns that will be shown in detailed view.
1233 /// This method must be followed by exactly ncolumns SetHeader() calls,
1234 /// making sure that every header (i.e. idx) is set (for and example see
1235 /// SetDefaultHeaders()).
1236 
1238 {
1239  if (ncolumns <= 0) {
1240  Error("SetHeaders", "number of columns must be > 0");
1241  return;
1242  }
1243 
1244  if (fNColumns) {
1245  delete [] fColumns;
1246  delete [] fJmode;
1247  for (int i = 0; i < fNColumns; i++) {
1248  if (fColHeader[i]) fColHeader[i]->DestroyWindow();
1249  delete fColHeader[i];
1250  delete fSplitHeader[i];
1251  }
1252  delete [] fColHeader;
1253  delete [] fSplitHeader;
1254  delete [] fColNames;
1255  }
1256 
1257  fNColumns = ncolumns+1; // one extra for the blank filler header
1258  fColumns = new int[fNColumns];
1259  fJmode = new int[fNColumns];
1261  fColNames = new TString [fNColumns];
1263 
1264  for (int i = 0; i < fNColumns; i++) {
1265  fColHeader[i] = 0;
1266  fJmode[i] = kTextLeft;
1267  fSplitHeader[i] = new TGVFileSplitter(fHeader, 10);
1268  fSplitHeader[i]->Connect("LayoutListView()", "TGListView",
1269  this, "Layout()");
1270  fSplitHeader[i]->Connect("LayoutHeader(TGFrame *)", "TGListView",
1271  this, "LayoutHeader(TGFrame *)");
1272  fSplitHeader[i]->Connect("DoubleClicked(TGVFileSplitter*)", "TGListView",
1273  this, "SetDefaultColumnWidth(TGVFileSplitter*)");
1274  }
1275 
1276  // create blank filler header
1277  fColNames[fNColumns-1] = "";
1278  fColHeader[fNColumns-1] = new TGTextButton(fHeader, new TGHotString(""), -1,
1281  fColHeader[fNColumns-1]->Associate(this);
1284  fColHeader[fNColumns-1]->SetStyle(gClient->GetStyle());
1286  fColumns[fNColumns-1] = 0;
1289  fJustChanged = kTRUE;
1290 }
1291 
1292 ////////////////////////////////////////////////////////////////////////////////
1293 /// Set header button idx [0-fNColumns>, hmode is the x text alignmode
1294 /// (ETextJustification) for the header text and cmode is the x text
1295 /// alignmode for the item text.
1296 
1297 void TGListView::SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
1298 {
1299  if (idx < 0 || idx >= fNColumns-1) {
1300  Error("SetHeader", "header index must be [0 - %d>", fNColumns-1);
1301  return;
1302  }
1303  delete fColHeader[idx];
1304 
1305  fColNames[idx] = s;
1306  fColHeader[idx] = new TGTextButton(fHeader, new TGHotString(s), idx,
1309  TString txt = s;
1310  txt.ToLower();
1311  if (txt.Contains("modified")) txt += " date";
1312  if (txt.Contains("attributes")) txt = "type";
1313  fColHeader[idx]->SetToolTipText(Form("Click to sort by %s", txt.Data()));
1314  fColHeader[idx]->Associate(this);
1315  fColHeader[idx]->SetTextJustify(hmode | kTextCenterY);
1316  fSplitHeader[idx]->SetFrame(fColHeader[idx], kTRUE);
1317 
1318  fColHeader[idx]->SetStyle(gClient->GetStyle());
1319 
1320  // fJmode and fColumns contain values for columns idx > 0. idx==0 is
1321  // the small icon with the object name
1322  if (idx > 0)
1323  fJmode[idx-1] = cmode;
1324 
1325  if (!fColHeader[0]) return;
1326  int xl = fColHeader[0]->GetDefaultWidth() + 10 + fSplitHeader[0]->GetDefaultWidth();
1327  for (int i = 1; i < fNColumns; i++) {
1328  fColumns[i-1] = xl;
1329  if (!fColHeader[i]) break;
1331  }
1332 }
1333 
1334 ////////////////////////////////////////////////////////////////////////////////
1335 /// Returns name of header idx. If illegal idx or header not set for idx
1336 /// 0 is returned.
1337 
1338 const char *TGListView::GetHeader(Int_t idx) const
1339 {
1340  if (idx >= 0 && idx < fNColumns-1 && fColHeader[idx])
1341  return (const char*) fColNames[idx];
1342  return 0;
1343 }
1344 
1345 ////////////////////////////////////////////////////////////////////////////////
1346 /// Default headers are: Name, Attributes, Size, Owner, Group, Modified.
1347 /// The default is good for file system items.
1348 
1350 {
1351  SetHeaders(6);
1352  SetHeader("Name", kTextLeft, kTextLeft, 0);
1353  SetHeader("Attributes", kTextCenterX, kTextCenterX, 1);
1354  SetHeader("Size", kTextRight, kTextRight, 2);
1355  SetHeader("Owner", kTextCenterX, kTextCenterX, 3);
1356  SetHeader("Group", kTextCenterX, kTextCenterX, 4);
1357  SetHeader("Modified", kTextCenterX, kTextCenterX, 5);
1358 }
1359 
1360 ////////////////////////////////////////////////////////////////////////////////
1361 /// Set list view mode.
1362 
1364 {
1365  TGLVContainer *container;
1366 
1367  if (fViewMode != viewMode) {
1368  fJustChanged = kTRUE;
1369  fViewMode = viewMode;
1370  container = (TGLVContainer *) fVport->GetContainer();
1371  if (container) container->SetViewMode(viewMode);
1372  Layout();
1373  }
1374 }
1375 
1376 ////////////////////////////////////////////////////////////////////////////////
1377 /// Set list view container. Container must be at least of type
1378 /// TGLVContainer.
1379 
1381 {
1382  if (f->InheritsFrom(TGLVContainer::Class())) {
1384  ((TGLVContainer *) f)->SetColumns(fColumns, fJmode);
1385  ((TGLVContainer *) f)->SetListView(this);
1386  } else
1387  Error("SetContainer", "frame must inherit from TGLVContainer");
1388 }
1389 
1390 ////////////////////////////////////////////////////////////////////////////////
1391 /// Set horizontal and vertical scrollbar increments.
1392 
1394 {
1397 }
1398 
1399 ////////////////////////////////////////////////////////////////////////////////
1400 /// Set default column width of the columns headers.
1401 
1403 {
1404  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1405 
1406  if (!container) {
1407  Error("SetDefaultColumnWidth", "no listview container set yet");
1408  return;
1409  }
1410  container->ClearViewPort();
1411 
1412  for (int i = 0; i < fNColumns; ++i) {
1413  if ( fSplitHeader[i] == splitter ) {
1414  TString dt = fColHeader[i]->GetString();
1415  UInt_t bsize = gVirtualX->TextWidth(fColHeader[i]->GetFontStruct(),
1416  dt.Data(), dt.Length());
1417  UInt_t w = TMath::Max(fColHeader[i]->GetDefaultWidth(), bsize + 20);
1418  if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1419  if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1420  fColHeader[i]->Resize(w, fColHeader[i]->GetHeight());
1421  Layout();
1422  }
1423  }
1424 }
1425 
1426 ////////////////////////////////////////////////////////////////////////////////
1427 /// Resize column headers to show whole item names.
1428 
1430 {
1431  for (int i = 0; i < fNColumns; ++i) {
1432  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1433  if (!container) {
1434  Error("ResizeColumns", "no listview container set yet");
1435  return;
1436  }
1437  fMaxSize = container->GetMaxItemSize();
1439  }
1440 }
1441 
1442 ////////////////////////////////////////////////////////////////////////////////
1443 /// Layout list view components (container and contents of container).
1444 
1446 {
1447  Int_t i, xl = 0;
1448  UInt_t w, h = 0;
1449 
1450  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1451 
1452  if (!container) {
1453  Error("Layout", "no listview container set yet");
1454  return;
1455  }
1456 
1457  fMaxSize = container->GetMaxItemSize();
1458 
1459  if (fViewMode == kLVDetails) {
1460  h = fColHeader[0]->GetDefaultHeight()-4;
1461  fHeader->MoveResize(0, 0, fWidth, h);
1462  fHeader->MapWindow();
1463  for (i = 0; i < fNColumns-1; ++i) {
1464  fColHeader[i]->SetText(fColNames[i]);
1465 
1466  if ( fJustChanged ) {
1468  if (w < fMinColumnSize) w = fColHeader[i]->GetDefaultWidth();
1469  if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1470  if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1471  } else {
1472  w = fColHeader[i]->GetWidth();
1473  }
1474  w = TMath::Max(fMinColumnSize, w);
1475  if ( fColHeader[i]->GetDefaultWidth() > w ) {
1476  for (int j = fColNames[i].Length() - 1 ; j > 0; j--) {
1477  fColHeader[i]->SetText( fColNames[i](0,j) + "..." );
1478  if ( fColHeader[i]->GetDefaultWidth() < w )
1479  break;
1480  }
1481  }
1482 
1483  fColHeader[i]->MoveResize(xl, 0, w, h);
1484  fColHeader[i]->MapWindow();
1485  xl += w;
1486  fSplitHeader[i]->Move(xl, 0);
1487  fSplitHeader[i]->MapWindow();
1488  fColumns[i] = xl-2; // -2 is fSep in the layout routine
1489  }
1490  fColHeader[i]->MoveResize(xl, 0, fVport->GetWidth()-xl, h);
1491  fColHeader[i]->MapWindow();
1493  fSplitHeader[i]->MapWindow();
1495 
1496  container->SetColumns(fColumns, fJmode);
1497 
1498  } else {
1499  for (i = 0; i < fNColumns; ++i) {
1500  fColHeader[i]->UnmapWindow();
1501  fSplitHeader[i]->UnmapWindow();
1502  }
1503  fHeader->UnmapWindow();
1504  }
1505  // coverity[returned_null]
1506  // coverity[dereference]
1507  TGLayoutManager *lm = container->GetLayoutManager();
1508  lm->SetDefaultWidth(xl);
1509  TGCanvas::Layout();
1510 
1511  if (fViewMode == kLVDetails) {
1512  container->Resize(container->GetWidth(), container->GetHeight()+h);
1513  fVScrollbar->SetRange((Int_t)container->GetHeight(),
1514  (Int_t)fVport->GetHeight());
1515  if (fJustChanged) {
1517  fVport->GetHeight());
1518  container->Move(0, h);
1519  } else {
1520  container->DrawRegion(0, 0, fVport->GetWidth(), fVport->GetHeight());
1521  }
1522  fColHeader[i]->MoveResize(xl, 0, fVport->GetWidth()-xl, h);
1523  fColHeader[i]->MapWindow();
1524  } else {
1526  fVport->GetHeight());
1527  container->Move(0, 0);
1528  }
1529 
1530  fJustChanged = kFALSE;
1531 }
1532 
1533 ////////////////////////////////////////////////////////////////////////////////
1534 /// Layout list view components (container and contents of container).
1535 
1537 {
1538  Int_t i, xl = 0;
1539  UInt_t w, h = 0;
1540  static Int_t oldPos = 0;
1541  if (head == 0) oldPos = 0;
1542 
1543  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1544 
1545  if (!container) {
1546  Error("Layout", "no listview container set yet");
1547  return;
1548  }
1549  fMaxSize = container->GetMaxItemSize();
1550  Int_t posx = container->GetPagePosition().fX;
1551 
1552  if (fViewMode == kLVDetails) {
1553  h = fColHeader[0]->GetDefaultHeight()-4;
1554  fHeader->MoveResize(0, 0, fWidth, h);
1555  fHeader->MapWindow();
1556  for (i = 0; i < fNColumns-1; ++i) {
1557  fColHeader[i]->SetText(fColNames[i]);
1558 
1559  if ( fJustChanged ) {
1561  if (w < fMinColumnSize) w = fColHeader[i]->GetDefaultWidth();
1562  if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1563  if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1564  } else {
1565  w = fColHeader[i]->GetWidth();
1566  }
1567  w = TMath::Max(fMinColumnSize, w);
1568  if ( fColHeader[i]->GetDefaultWidth() > w ) {
1569  for (int j = fColNames[i].Length() - 1 ; j > 0; j--) {
1570  fColHeader[i]->SetText( fColNames[i](0,j) + "..." );
1571  if ( fColHeader[i]->GetDefaultWidth() < w )
1572  break;
1573  }
1574  }
1575 
1576  if ((TGFrame *)fColHeader[i] == head) {
1577  if (oldPos > 0) {
1578  gVirtualX->DrawLine(container->GetId(), container->GetLineGC()(),
1579  oldPos - posx, 0, oldPos - posx, fVport->GetHeight());
1580  }
1581  gVirtualX->DrawLine(container->GetId(), container->GetLineGC()(),
1582  xl + w - posx, 0, xl + w - posx, fVport->GetHeight());
1583  oldPos = xl + w;
1584  }
1585 
1586  fColHeader[i]->MoveResize(xl - posx, 0, w, h);
1587  fColHeader[i]->MapWindow();
1588  xl += w;
1589  fSplitHeader[i]->Move(xl, 0);
1590  fSplitHeader[i]->MapWindow();
1591  fColumns[i] = xl-2; // -2 is fSep in the layout routine
1592  }
1593  fColHeader[i]->MoveResize(xl - posx, 0, fVport->GetWidth()-xl, h);
1594  fColHeader[i]->MapWindow();
1596  fSplitHeader[i]->MapWindow();
1598  }
1599  fJustChanged = kFALSE;
1600 }
1601 
1602 ////////////////////////////////////////////////////////////////////////////////
1603 /// Handle messages generated by the list view components.
1604 
1606 {
1608 
1609  const TGLVEntry *entry;
1610  void *p = 0;
1611 
1612  entry = (TGLVEntry *) cnt->GetNextSelected(&p);
1613 
1614  switch (GET_SUBMSG(msg)) {
1615  case kCT_ITEMCLICK:
1616  if ((cnt->NumSelected() == 1) && (entry != 0)) {
1617  Int_t x = (Int_t)(parm2 & 0xffff);
1618  Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1619  Clicked((TGLVEntry*)entry, (Int_t)parm1);
1620  Clicked((TGLVEntry*)entry, (Int_t)parm1, x, y);
1621  }
1622  break;
1623  case kCT_ITEMDBLCLICK:
1624  if ((cnt->NumSelected() == 1) && (entry!=0)) {
1625  Int_t x = (Int_t)(parm2 & 0xffff);
1626  Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1627  DoubleClicked((TGLVEntry*)entry, (Int_t)parm1);
1628  DoubleClicked((TGLVEntry*)entry, (Int_t)parm1, x, y);
1629  }
1630  break;
1631  case kCT_SELCHANGED:
1632  SelectionChanged();
1633  break;
1634  default:
1635  break;
1636  }
1637  return TGCanvas::ProcessMessage(msg, parm1, parm2);
1638 }
1639 
1640 ////////////////////////////////////////////////////////////////////////////////
1641 /// Emit Clicked() signal.
1642 
1644 {
1645  Long_t args[2];
1646 
1647  args[0] = (Long_t)entry;
1648  args[1] = btn;
1649 
1650  Emit("Clicked(TGLVEntry*,Int_t)", args);
1651 }
1652 
1653 ////////////////////////////////////////////////////////////////////////////////
1654 /// Emit Clicked() signal.
1655 
1657 {
1658  Long_t args[4];
1659 
1660  args[0] = (Long_t)entry;
1661  args[1] = btn;
1662  args[2] = x;
1663  args[3] = y;
1664 
1665  Emit("Clicked(TGLVEntry*,Int_t,Int_t,Int_t)", args);
1666 }
1667 
1668 ////////////////////////////////////////////////////////////////////////////////
1669 /// Emit DoubleClicked() signal.
1670 
1672 {
1673  Long_t args[2];
1674 
1675  args[0] = (Long_t)entry;
1676  args[1] = btn;
1677 
1678  Emit("DoubleClicked(TGLVEntry*,Int_t)", args);
1679 }
1680 
1681 ////////////////////////////////////////////////////////////////////////////////
1682 /// Emit DoubleClicked() signal.
1683 
1685 {
1686  Long_t args[4];
1687 
1688  args[0] = (Long_t)entry;
1689  args[1] = btn;
1690  args[2] = x;
1691  args[3] = y;
1692 
1693  Emit("DoubleClicked(TGLVEntry*,Int_t,Int_t,Int_t)", args);
1694 }
1695 
1696 ////////////////////////////////////////////////////////////////////////////////
1697 /// Return the default font structure in use.
1698 
1700 {
1701  if (!fgDefaultFont)
1702  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
1703  return fgDefaultFont->GetFontStruct();
1704 }
1705 
1706 ////////////////////////////////////////////////////////////////////////////////
1707 /// Return the default graphics context in use.
1708 
1710 {
1711  if (!fgDefaultGC) {
1712  fgDefaultGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
1714  }
1715  return *fgDefaultGC;
1716 }
1717 
1718 ////////////////////////////////////////////////////////////////////////////////
1719 /// Save a list view widget as a C++ statement(s) on output stream out.
1720 
1721 void TGListView::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1722 {
1723  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
1724 
1725  out << std::endl << " // list view" << std::endl;
1726  out <<" TGListView *";
1727  out << GetName() << " = new TGListView(" << fParent->GetName()
1728  << "," << GetWidth() << "," << GetHeight();
1729 
1731  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1732  out <<");" << std::endl;
1733  } else {
1734  out << "," << GetOptionString() <<");" << std::endl;
1735  }
1736  } else {
1737  out << "," << GetOptionString() << ",ucolor);" << std::endl;
1738  }
1739  if (option && strstr(option, "keep_names"))
1740  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1741 
1742  GetContainer()->SavePrimitive(out, option);
1743 
1744  out << std::endl;
1745  out << " " << GetName() << "->SetContainer(" << GetContainer()->GetName()
1746  << ");" << std::endl;
1747  out << " " << GetName() << "->SetViewMode(";
1748  switch (fViewMode) {
1749  case kLVLargeIcons:
1750  out << "kLVLargeIcons";
1751  break;
1752  case kLVSmallIcons:
1753  out << "kLVSmallIcons";
1754  break;
1755  case kLVList:
1756  out << "kLVList";
1757  break;
1758  case kLVDetails:
1759  out << "kLVDetails";
1760  break;
1761  }
1762  out << ");" << std::endl;
1763 
1764  out << " " << GetContainer()->GetName() << "->Resize();" << std::endl;
1765 
1766  if (fHScrollbar && fHScrollbar->IsMapped()) {
1767  out << " " << GetName() << "->SetHsbPosition(" << GetHsbPosition()
1768  << ");" << std::endl;
1769  }
1770 
1771  if (fVScrollbar && fVScrollbar->IsMapped()) {
1772  out << " " << GetName() << "->SetVsbPosition(" << GetVsbPosition()
1773  << ");" << std::endl;
1774  }
1775 }
1776 
1777 ////////////////////////////////////////////////////////////////////////////////
1778 /// Save a list view container as a C++ statement(s) on output stream out.
1779 
1780 void TGLVContainer::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1781 {
1782  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
1783 
1784  out << std::endl << " // list view container" << std::endl;
1785  out << " TGLVContainer *";
1786 
1787  if ((fParent->GetParent())->InheritsFrom(TGCanvas::Class())) {
1788  out << GetName() << " = new TGLVContainer(" << GetCanvas()->GetName();
1789  } else {
1790  out << GetName() << " = new TGLVContainer(" << fParent->GetName();
1791  out << "," << GetWidth() << "," << GetHeight();
1792  }
1794  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1795  out <<");" << std::endl;
1796  } else {
1797  out << "," << GetOptionString() <<");" << std::endl;
1798  }
1799  } else {
1800  out << "," << GetOptionString() << ",ucolor);" << std::endl;
1801  }
1802  if (option && strstr(option, "keep_names"))
1803  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1804 }
TGButton::SetToolTipText
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:398
TGLVEntry::~TGLVEntry
virtual ~TGLVEntry()
Delete a list view item.
Definition: TGListView.cxx:185
EListViewMode
EListViewMode
Definition: TGListView.h:39
Event_t::fType
EGEventType fType
of event (see EGEventType)
Definition: GuiTypes.h:175
TGLVContainer::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a list view container as a C++ statement(s) on output stream out.
Definition: TGListView.cxx:1780
TGContainer::fSelected
Int_t fSelected
Definition: TGCanvas.h:59
TGCanvas::GetHsbPosition
virtual Int_t GetHsbPosition() const
Get position of horizontal scrollbar.
Definition: TGCanvas.cxx:2370
TGCanvas::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle message generated by the canvas scrollbars.
Definition: TGCanvas.cxx:2340
Event_t::fState
UInt_t fState
key or button mask
Definition: GuiTypes.h:181
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:249
TGContainer::Clicked
virtual void Clicked(TGFrame *f, Int_t btn)
Emit Clicked() signal.
Definition: TGCanvas.cxx:506
TGVScrollBar::SetRange
virtual void SetRange(Int_t range, Int_t page_size)
Set range of vertical scrollbar.
Definition: TGScrollBar.cxx:884
TGLVEntry::fTWidth
UInt_t fTWidth
Definition: TGListView.h:66
TGFrameElement::fLayout
TGLayoutHints * fLayout
Definition: TGLayout.h:121
TGLVEntry::SetPictures
virtual void SetPictures(const TGPicture *bigpic=0, const TGPicture *smallpic=0)
change pictures
Definition: TGListView.cxx:294
TGLVEntry::fViewMode
EListViewMode fViewMode
Definition: TGListView.h:70
TGWindow
Definition: TGWindow.h:31
kLHintsCenterX
@ kLHintsCenterX
Definition: TGLayout.h:32
TGPosition::fY
Int_t fY
Definition: TGDimension.h:48
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
kFixedWidth
@ kFixedWidth
Definition: GuiTypes.h:387
TGLVEntry::fActive
Bool_t fActive
Definition: TGListView.h:68
TGLVEntry::fFontStruct
FontStruct_t fFontStruct
Definition: TGListView.h:77
TGFrame::fgBlackPixel
static Pixel_t fgBlackPixel
Definition: TGFrame.h:128
TGListView::~TGListView
virtual ~TGListView()
Delete a list view widget.
Definition: TGListView.cxx:1197
TGContainer::fCanvas
TGCanvas * fCanvas
Definition: TGCanvas.h:51
TGCompositeFrame::GetLayoutManager
virtual TGLayoutManager * GetLayoutManager() const
Definition: TGFrame.h:374
TGPicture
Definition: TGPicture.h:36
f
#define f(i)
Definition: RSha256.hxx:104
TGDimension
Definition: TGDimension.h:27
TGCanvas::fHScrollbar
TGHScrollBar * fHScrollbar
Definition: TGCanvas.h:206
Option_t
const char Option_t
Definition: RtypesCore.h:66
TMath::Max
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
TGListView::fColNames
TString * fColNames
Definition: TGListView.h:146
TGScrollBar::GetPageSize
virtual Int_t GetPageSize() const
Definition: TGScrollBar.h:133
TGPicture::GetWidth
UInt_t GetWidth() const
Definition: TGPicture.h:63
TGListView::fColHeader
TGTextButton ** fColHeader
Definition: TGListView.h:145
TGLVEntry::fChecked
Bool_t fChecked
Definition: TGListView.h:69
TGWindow::RaiseWindow
virtual void RaiseWindow()
raise window
Definition: TGWindow.cxx:207
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGContainer::GetLineGC
static const TGGC & GetLineGC()
Get graphics context for line drawing.
Definition: TGCanvas.cxx:2101
TGLVContainer::SelectEntry
virtual void SelectEntry(TGLVEntry *item)
Select the TGLVEntry given as argument and de-select the previous one if the container is not in mult...
Definition: TGListView.cxx:1155
kLVLargeIcons
@ kLVLargeIcons
Definition: TGListView.h:40
TSystem::RemoveTimer
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
Definition: TSystem.cxx:482
TString::Data
const char * Data() const
Definition: TString.h:369
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGLVContainer::GetSelectedItems
TList * GetSelectedItems()
Get list of selected items in container.
Definition: TGListView.cxx:941
TGContainer::fScrolling
Bool_t fScrolling
Definition: TGCanvas.h:69
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
Form
char * Form(const char *fmt,...)
TGLVContainer::fViewMode
EListViewMode fViewMode
Definition: TGListView.h:204
TObjString.h
TGPicture.h
TGFrame::fWidth
UInt_t fWidth
Definition: TGFrame.h:111
TGContainer::FindFrame
virtual TGFrameElement * FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE)
Find frame located int container at position x,y.
Definition: TGCanvas.cxx:1653
TGLVContainer::~TGLVContainer
virtual ~TGLVContainer()
Delete list view container.
Definition: TGListView.cxx:556
TGCanvas::GetContainer
TGFrame * GetContainer() const
Definition: TGCanvas.h:226
FontStruct_t
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
TGHotString
Definition: TGString.h:52
TGLVContainer::LineUp
virtual void LineUp(Bool_t select=kFALSE)
Make current position first line in window by scrolling up.
Definition: TGListView.cxx:1081
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TGListView::fMaxSize
TGDimension fMaxSize
Definition: TGListView.h:144
TGListView::fFontStruct
FontStruct_t fFontStruct
Definition: TGListView.h:149
TGListView::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return the default font structure in use.
Definition: TGListView.cxx:1699
TGFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:215
kButton4
@ kButton4
Definition: GuiTypes.h:215
TGFrame::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a frame widget as a C++ statement(s) on output stream out.
Definition: TGFrame.cxx:3192
TGVSplitter::SetFrame
virtual void SetFrame(TGFrame *frame, Bool_t left)
Set frame to be resized.
Definition: TGSplitter.cxx:142
TGVFileSplitter
Definition: TGSplitter.h:136
TGLVEntry::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return the default font structure in use.
Definition: TGListView.cxx:492
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TGTextButton
Definition: TGButton.h:142
TGListView::fJustChanged
Bool_t fJustChanged
Definition: TGListView.h:151
TGLVEntry::GetSubnameWidth
virtual Int_t GetSubnameWidth(Int_t idx) const
Definition: TGListView.h:125
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TGLVContainer::fJmode
Int_t * fJmode
Definition: TGListView.h:206
TGLVEntry
Definition: TGListView.h:54
Int_t
int Int_t
Definition: RtypesCore.h:45
TGLVContainer::LineRight
virtual void LineRight(Bool_t select=kFALSE)
Move current position one column right.
Definition: TGListView.cxx:1024
TGListView::SetHeaders
virtual void SetHeaders(Int_t ncolumns)
Set number of headers, i.e.
Definition: TGListView.cxx:1237
TGListView::ResizeColumns
virtual void ResizeColumns()
Resize column headers to show whole item names.
Definition: TGListView.cxx:1429
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
kCT_SELCHANGED
@ kCT_SELCHANGED
Definition: WidgetMessageTypes.h:58
TGLVContainer::fCpos
Int_t * fCpos
Definition: TGListView.h:205
TGListView::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGListView.h:154
kTextCenterX
@ kTextCenterX
Definition: TGWidget.h:35
TGPicture::Draw
void Draw(Option_t *="")
Default Draw method for all objects.
Definition: TGPicture.h:57
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGCanvas::Layout
virtual void Layout()
Create layout for canvas.
Definition: TGCanvas.cxx:2225
TGMimeTypes.h
TGFrame::fgWhitePixel
static Pixel_t fgWhitePixel
Definition: TGFrame.h:127
TList.h
TList::Last
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:693
TGSelectedPicture
Definition: TGPicture.h:78
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:668
TGListView::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle messages generated by the list view components.
Definition: TGListView.cxx:1605
TVirtualX.h
TGLVEntry::fBigPic
const TGPicture * fBigPic
Definition: TGListView.h:71
kTextCenterY
@ kTextCenterY
Definition: TGWidget.h:38
TGClient::GetResourcePool
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:133
TGListView::fJmode
Int_t * fJmode
Definition: TGListView.h:142
TGFrame::GetDefaultSize
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.cxx:569
TString
Basic string class.
Definition: TString.h:136
TGFrame
Definition: TGFrame.h:104
TGLVContainer::SetColumns
virtual void SetColumns(Int_t *cpos, Int_t *jmode)
Set column information for list items.
Definition: TGListView.cxx:676
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:47
TGTextButton::SetTextJustify
virtual void SetTextJustify(Int_t tmode)
Set text justification.
Definition: TGButton.cxx:648
TGCanvas::GetVsbPosition
virtual Int_t GetVsbPosition() const
Get position of vertical scrollbar.
Definition: TGCanvas.cxx:2380
kDoubleBorder
@ kDoubleBorder
Definition: GuiTypes.h:385
TGListView
Definition: TGListView.h:133
kCT_ITEMDBLCLICK
@ kCT_ITEMDBLCLICK
Definition: WidgetMessageTypes.h:57
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
TGListView::fgDefaultGC
static TGGC * fgDefaultGC
Definition: TGListView.h:155
TGLVContainer::fLastActive
TGLVEntry * fLastActive
Definition: TGListView.h:209
TGLVEntry::GetDefaultSize
virtual TGDimension GetDefaultSize() const
Get default size of list item.
Definition: TGListView.cxx:465
TGCanvas::SetVsbPosition
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Definition: TGCanvas.cxx:2404
TGFrame::MapWindow
virtual void MapWindow()
map window
Definition: TGFrame.h:228
TGListView::GetMaxItemSize
TGDimension GetMaxItemSize() const
Definition: TGListView.h:184
bool
TGLVContainer::GetMaxSubnameWidth
virtual Int_t GetMaxSubnameWidth(Int_t idx) const
Get width of largest subname in container.
Definition: TGListView.cxx:716
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:248
TGContainer::fYp
Int_t fYp
Definition: TGCanvas.h:54
TGCompositeFrame::fList
TList * fList
Definition: TGFrame.h:328
TGContainer::AdjustPosition
virtual void AdjustPosition()
Move content to position of highlighted/activated frame.
Definition: TGCanvas.cxx:1789
TGFrameElement::fFrame
TGFrame * fFrame
Definition: TGLayout.h:119
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2465
TGLayoutManager
Definition: TGLayout.h:142
TGListView::TGListView
TGListView(const TGListView &)=delete
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:221
TGLVEntry::DrawCopy
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Draw list view item in other window.
Definition: TGListView.cxx:326
TGLVEntry::fTHeight
UInt_t fTHeight
Definition: TGListView.h:67
TGLayoutManager::SetDefaultWidth
virtual void SetDefaultWidth(UInt_t)
Definition: TGLayout.h:151
TGWindow::DestroyWindow
virtual void DestroyWindow()
destroy window
Definition: TGWindow.cxx:191
TGContainer::RemoveItem
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition: TGCanvas.cxx:656
TObjString
Collectable string class.
Definition: TObjString.h:28
TGLVContainer::GetMaxItemSize
virtual TGDimension GetMaxItemSize() const
Get size of largest item in container.
Definition: TGListView.cxx:692
gClient
#define gClient
Definition: TGClient.h:166
kTextLeft
@ kTextLeft
Definition: TGWidget.h:33
TGLVEntry::Activate
virtual void Activate(Bool_t a)
Make list view item active.
Definition: TGListView.cxx:256
TGContainer::fMsgWindow
const TGWindow * fMsgWindow
Definition: TGCanvas.h:52
TList::First
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:659
total
static unsigned int total
Definition: TGWin32ProxyDefs.h:40
TGListView::fNColumns
Int_t fNColumns
Definition: TGListView.h:140
TGString::GetLength
Int_t GetLength() const
Definition: TGString.h:39
TGListView::SetHeader
virtual void SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
Set header button idx [0-fNColumns>, hmode is the x text alignmode (ETextJustification) for the heade...
Definition: TGListView.cxx:1297
TGContainer::fY0
Int_t fY0
Definition: TGCanvas.h:55
TGLVContainer::GetPageDimension
virtual TGDimension GetPageDimension() const
Returns page dimension.
Definition: TGListView.cxx:1141
TGLVContainer::GetSelectedEntries
TList * GetSelectedEntries()
Get list of selected items in container.
Definition: TGListView.cxx:922
TGContainer::GetPagePosition
virtual TGPosition GetPagePosition() const
Returns page position.
Definition: TGCanvas.cxx:733
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGScrollBar::SetSmallIncrement
virtual void SetSmallIncrement(Int_t increment)
Definition: TGScrollBar.h:153
TGContainer::GetHScrollbar
virtual TGHScrollBar * GetHScrollbar() const
returns pointer to hor. scroll bar
Definition: TGCanvas.cxx:1741
TSystem.h
TGPosition::fX
Int_t fX
Definition: TGDimension.h:47
kLHintsCenterY
@ kLHintsCenterY
Definition: TGLayout.h:35
TGDimension::fHeight
UInt_t fHeight
Definition: TGDimension.h:30
TGLVEntry::fSelPic
TGSelectedPicture * fSelPic
Definition: TGListView.h:75
h
#define h(i)
Definition: RSha256.hxx:106
TGTextButton::SetText
virtual void SetText(TGHotString *new_label)
Set new button text.
Definition: TGButton.cxx:597
TGContainer::SetHsbPosition
virtual void SetHsbPosition(Int_t newPos)
set new hor. position
Definition: TGCanvas.cxx:1773
TGContainer::Layout
virtual void Layout()
Layout container entries.
Definition: TGCanvas.cxx:418
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:335
TGCanvas::fVScrollbar
TGVScrollBar * fVScrollbar
Definition: TGCanvas.h:207
TGLVContainer::fMultiSelect
Bool_t fMultiSelect
Definition: TGListView.h:207
TGContainer::fLastActiveEl
TGFrameElement * fLastActiveEl
Definition: TGCanvas.h:53
TGGC
Definition: TGGC.h:31
kLVDetails
@ kLVDetails
Definition: TGListView.h:43
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:82
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:590
TGHScrollBar
Definition: TGScrollBar.h:160
TGContainer::fXp
Int_t fXp
Definition: TGCanvas.h:54
TGObject::fId
Handle_t fId
Definition: TGObject.h:36
a
auto * a
Definition: textangle.C:12
TGLVContainer::ActivateItem
virtual void ActivateItem(TGFrameElement *el)
Select/activate item.
Definition: TGListView.cxx:753
Event_t::fCode
UInt_t fCode
key or button code
Definition: GuiTypes.h:180
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
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGListView::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a list view widget as a C++ statement(s) on output stream out.
Definition: TGListView.cxx:1721
TGFrame::fBorderWidth
Int_t fBorderWidth
Definition: TGFrame.h:117
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:60
Long_t
long Long_t
Definition: RtypesCore.h:54
kLVSmallIcons
@ kLVSmallIcons
Definition: TGListView.h:41
TGFont::GetFontHandle
FontH_t GetFontHandle() const
Definition: TGFont.h:192
TGDimension::fWidth
UInt_t fWidth
Definition: TGDimension.h:29
kButtonRelease
@ kButtonRelease
Definition: GuiTypes.h:60
TGContainer::fScrollTimer
TTimer * fScrollTimer
Definition: TGCanvas.h:60
TGHeaderFrame
Definition: TGFrame.h:652
TGLayoutHints
Definition: TGLayout.h:57
TGLVContainer::fItemLayout
TGLayoutHints * fItemLayout
Definition: TGListView.h:203
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
TGCanvas::fVport
TGViewPort * fVport
Definition: TGCanvas.h:205
kC_CONTAINER
@ kC_CONTAINER
Definition: WidgetMessageTypes.h:55
TGClient::GetPicture
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:290
TGLVEntry::fSubnames
TGString ** fSubnames
Definition: TGListView.h:62
TGListView::SetContainer
virtual void SetContainer(TGFrame *f)
Set list view container.
Definition: TGListView.cxx:1380
TGListView::LayoutHeader
virtual void LayoutHeader(TGFrame *head)
Layout list view components (container and contents of container).
Definition: TGListView.cxx:1536
Window_t
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
TGContainer::ClearViewPort
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition: TGCanvas.cxx:887
TGListView::SetViewMode
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode.
Definition: TGListView.cxx:1363
TGContainer::GetCanvas
TGCanvas * GetCanvas() const
Definition: TGCanvas.h:109
y
Double_t y[n]
Definition: legend1.C:17
TGLVEntry::fJmode
Int_t * fJmode
Definition: TGListView.h:64
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGLVEntry::SetViewMode
virtual void SetViewMode(EListViewMode viewMode)
Set the view mode for this list item.
Definition: TGListView.cxx:273
kLHintsExpandY
@ kLHintsExpandY
Definition: TGLayout.h:38
TGFrame::IsActive
virtual Bool_t IsActive() const
Definition: TGFrame.h:235
TGCompositeFrame::MustCleanup
virtual Int_t MustCleanup() const
Definition: TGFrame.h:397
Event_t::fXRoot
Int_t fXRoot
Definition: GuiTypes.h:179
TGContainer::fX0
Int_t fX0
Definition: TGCanvas.h:55
TGLVEntry::TGLVEntry
TGLVEntry(const TGLVEntry &)=delete
TGFrame::GetX
Int_t GetX() const
Definition: TGFrame.h:255
TGListView::Clicked
virtual void Clicked(TGLVEntry *entry, Int_t btn)
Emit Clicked() signal.
Definition: TGListView.cxx:1643
TGListView::fHeader
TGHeaderFrame * fHeader
Definition: TGListView.h:150
TGContainer::DrawRegion
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a region of container in viewport.
Definition: TGCanvas.cxx:815
TGContainer::fXf
Int_t fXf
Definition: TGCanvas.h:56
TGListView::fSplitHeader
TGVFileSplitter ** fSplitHeader
Definition: TGListView.h:147
TGLVContainer::LineLeft
virtual void LineLeft(Bool_t select=kFALSE)
Move current position one column left.
Definition: TGListView.cxx:958
TGLVContainer::RemoveItemWithData
virtual void RemoveItemWithData(void *userData)
Remove item with fUserData == userData from container.
Definition: TGListView.cxx:737
TGCompositeFrame::SetLayoutManager
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:985
Event_t::fYRoot
Int_t fYRoot
coordinates relative to root
Definition: GuiTypes.h:179
kRaisedFrame
@ kRaisedFrame
Definition: GuiTypes.h:384
TGTileLayout
Definition: TGLayout.h:276
TMath::Min
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
TGButton::SetStyle
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition: TGButton.cxx:224
TGLVContainer::LineDown
virtual void LineDown(Bool_t select=kFALSE)
Move one line down.
Definition: TGListView.cxx:1112
unsigned int
TGListView::fViewMode
EListViewMode fViewMode
Definition: TGListView.h:143
TGButton::SetState
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:188
TGClient::GetMimeTypeList
TGMimeTypes * GetMimeTypeList() const
Definition: TGClient.h:155
TGLVEntry::fgDefaultGC
static TGGC * fgDefaultGC
Definition: TGListView.h:81
TGViewPort::GetContainer
TGFrame * GetContainer() const
Definition: TGCanvas.h:183
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
kKeyControlMask
const Mask_t kKeyControlMask
Definition: GuiTypes.h:197
TGContainer::UnSelectAll
virtual void UnSelectAll()
Unselect all items in the container.
Definition: TGCanvas.cxx:585
TGLVContainer::DeActivateItem
virtual void DeActivateItem(TGFrameElement *el)
Unselect/deactivate item.
Definition: TGListView.cxx:762
TGCompositeFrame::fMapSubwindows
Bool_t fMapSubwindows
Definition: TGFrame.h:331
TGListView::SetDefaultHeaders
virtual void SetDefaultHeaders()
Default headers are: Name, Attributes, Size, Owner, Group, Modified.
Definition: TGListView.cxx:1349
TGWindow::GetParent
const TGWindow * GetParent() const
Definition: TGWindow.h:84
TGLVContainer::GetViewMode
EListViewMode GetViewMode() const
Definition: TGListView.h:232
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:373
TGListView::Layout
virtual void Layout()
Layout list view components (container and contents of container).
Definition: TGListView.cxx:1445
TGLVContainer::fListView
TGListView * fListView
Definition: TGListView.h:208
TQObject::Connect
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:866
TGContainer
Definition: TGCanvas.h:41
TGFrame::UnmapWindow
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:230
TGLVContainer
Definition: TGListView.h:196
TGLVContainer::SetColHeaders
virtual void SetColHeaders(const char *n1="", const char *n2="", const char *n3="", const char *n4="", const char *n5="", const char *n6="", const char *n7="", const char *n8="", const char *n9="", const char *n10="", const char *n11="", const char *n12="")
set columns headers
Definition: TGListView.cxx:567
TGObject::fClient
TGClient * fClient
Definition: TGObject.h:37
TGFrame::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:614
TGListView::SetDefaultColumnWidth
virtual void SetDefaultColumnWidth(TGVFileSplitter *splitter)
Set default column width of the columns headers.
Definition: TGListView.cxx:1402
TGListView::fColumns
Int_t * fColumns
Definition: TGListView.h:141
TGFrame::Move
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition: TGFrame.cxx:578
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TGContainer::DeActivateItem
virtual void DeActivateItem(TGFrameElement *el)
DeActivate item.
Definition: TGCanvas.cxx:720
TGLVContainer::SetViewMode
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode for container.
Definition: TGListView.cxx:610
Handle_t
ULong_t Handle_t
Generic resource handle.
Definition: GuiTypes.h:26
TGLVEntry::SetSubnames
virtual void SetSubnames(const char *n1="", const char *n2="", const char *n3="", const char *n4="", const char *n5="", const char *n6="", const char *n7="", const char *n8="", const char *n9="", const char *n10="", const char *n11="", const char *n12="")
Sets new subnames.
Definition: TGListView.cxx:199
TGButton.h
TGContainer::ActivateItem
virtual void ActivateItem(TGFrameElement *el)
Activate item.
Definition: TGCanvas.cxx:697
Event_t
Event structure.
Definition: GuiTypes.h:174
TGListView::fNormGC
GContext_t fNormGC
Definition: TGListView.h:148
GET_SUBMSG
Int_t GET_SUBMSG(Long_t val)
Definition: WidgetMessageTypes.h:113
TGLVEntry::fCheckMark
const TGPicture * fCheckMark
Definition: TGListView.h:74
TGLVContainer::TGLVContainer
TGLVContainer(const TGLVContainer &)=delete
name
char name[80]
Definition: TGX11.cxx:110
TGLVEntry::fUserData
void * fUserData
Definition: TGListView.h:78
kButton5
@ kButton5
Definition: GuiTypes.h:215
TGString::Draw
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition: TGString.cxx:51
TGHeaderFrame::SetColumnsInfo
void SetColumnsInfo(Int_t nColumns, TGTextButton **colHeader, TGVFileSplitter **splitHeader)
Set columns information in the header frame.
Definition: TGFrame.cxx:2338
TGCanvas::SetContainer
virtual void SetContainer(TGFrame *f)
Definition: TGCanvas.h:232
TGContainer::fDragging
Bool_t fDragging
Definition: TGCanvas.h:57
TGListView::GetHeader
virtual const char * GetHeader(Int_t idx) const
Returns name of header idx.
Definition: TGListView.cxx:1338
TGFrameElement
Definition: TGLayout.h:112
TGFrame::GetY
Int_t GetY() const
Definition: TGFrame.h:256
TGContainer::fViewPort
TGViewPort * fViewPort
Definition: TGCanvas.h:50
TGString::GetString
const char * GetString() const
Definition: TGString.h:40
TGListView::GetDefaultGC
static const TGGC & GetDefaultGC()
Return the default graphics context in use.
Definition: TGListView.cxx:1709
TIter
Definition: TCollection.h:233
kCT_ITEMCLICK
@ kCT_ITEMCLICK
Definition: WidgetMessageTypes.h:56
TGLVEntry::fCtw
Int_t * fCtw
Definition: TGListView.h:65
TGLVContainer::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in container.
Definition: TGListView.cxx:771
kLHintsExpandX
@ kLHintsExpandX
Definition: TGLayout.h:37
TGResourcePool.h
TGFont::GetFontStruct
FontStruct_t GetFontStruct() const
Definition: TGFont.h:193
TGeant4Unit::ms
static constexpr double ms
Definition: TGeant4SystemOfUnits.h:163
kTextRight
@ kTextRight
Definition: TGWidget.h:34
TGFrame::fHeight
UInt_t fHeight
Definition: TGFrame.h:112
TGListView::DoubleClicked
virtual void DoubleClicked(TGLVEntry *entry, Int_t btn)
Emit DoubleClicked() signal.
Definition: TGListView.cxx:1671
xmlio::cnt
const char * cnt
Definition: TXMLSetup.cxx:75
TGLVEntry::fCurrent
const TGPicture * fCurrent
Definition: TGListView.h:73
TGFrame::fBackground
Pixel_t fBackground
Definition: TGFrame.h:119
TGListDetailsLayout
Definition: TGLayout.h:312
TGContainer::SetVsbPosition
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Definition: TGCanvas.cxx:1757
TGFont
Definition: TGFont.h:149
TGFrame::fgDefaultSelectedBackground
static Pixel_t fgDefaultSelectedBackground
Definition: TGFrame.h:126
Class
void Class()
Definition: Class.C:29
TString::ToLower
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1145
TGListView::SelectionChanged
virtual void SelectionChanged()
Definition: TGListView.h:186
TGPosition
Definition: TGDimension.h:45
TGListView.h
kLVList
@ kLVList
Definition: TGListView.h:42
TGCanvas
Definition: TGCanvas.h:202
TGPicture::GetHeight
UInt_t GetHeight() const
Definition: TGPicture.h:64
TGContainer::RemoveAll
virtual void RemoveAll()
Remove all items from the container.
Definition: TGCanvas.cxx:637
TGContainer::fTotal
Int_t fTotal
Definition: TGCanvas.h:58
TGListView::SetIncrements
virtual void SetIncrements(Int_t hInc, Int_t vInc)
Set horizontal and vertical scrollbar increments.
Definition: TGListView.cxx:1393
TGListView::ScrollHeader
virtual void ScrollHeader(Int_t pos)
Scroll header buttons with horizontal scrollbar.
Definition: TGListView.cxx:1216
TGLVEntry::fItemName
TGString * fItemName
Definition: TGListView.h:61
splitter
REAL splitter
Definition: triangle.c:616
TGFrame::GetDefaultWidth
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:214
Event_t::fUser
Long_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Definition: GuiTypes.h:187
TGString
Definition: TGString.h:30
TGScrollBar.h
TGLVEntry::fNormGC
GContext_t fNormGC
Definition: TGListView.h:76
TGContainer::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in container.
Definition: TGCanvas.cxx:925
TGGC::SetFont
void SetFont(FontH_t v)
Set font.
Definition: TGGC.cxx:410
TGResourcePool::GetSelectedFgndColor
Pixel_t GetSelectedFgndColor() const
Definition: TGResourcePool.h:122
TGLVEntry::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGListView.h:80
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:110
TGListLayout
Definition: TGLayout.h:300
TGListView::fMinColumnSize
UInt_t fMinColumnSize
Definition: TGListView.h:152
TGWindow::fParent
const TGWindow * fParent
Definition: TGWindow.h:36
TGMimeTypes::GetIcon
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
Definition: TGMimeTypes.cxx:203
TGTextButton::GetString
TString GetString() const
Definition: TGButton.h:191
kKeyShiftMask
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:195
kButtonDisabled
@ kButtonDisabled
Definition: TGButton.h:56
TGLVEntry::DoRedraw
virtual void DoRedraw()
Redraw list view item.
Definition: TGListView.cxx:316
TList
A doubly linked list.
Definition: TList.h:44
TGContainer::fYf
Int_t fYf
Definition: TGCanvas.h:56
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TGLVEntry::GetDefaultGC
static const TGGC & GetDefaultGC()
Return the default graphics context in use.
Definition: TGListView.cxx:502
TGLVEntry::fCpos
Int_t * fCpos
Definition: TGListView.h:63
TGFrame::GetFrameElement
TGFrameElement * GetFrameElement() const
Definition: TGFrame.h:259
kChildFrame
@ kChildFrame
Definition: GuiTypes.h:379
int
TGLVEntry::fSmallPic
const TGPicture * fSmallPic
Definition: TGListView.h:72
TGWindow::IsMapped
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:294