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