Logo ROOT   6.10/09
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 
90  fFontStruct = GetDefaultFontStruct();
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 
920 {
921  TGFrameElement *el;
922  TIter next(fList);
923  TList *ret = new TList();
924 
925  while ((el = (TGFrameElement *) next())) {
926  if (el->fFrame->IsActive()) {
927  ret->Add((TGLVEntry *)el->fFrame);
928  }
929  }
930  return ret;
931 }
932 
933 ////////////////////////////////////////////////////////////////////////////////
934 /// Get list of selected items in container.
935 
937 {
938  TGFrameElement *el;
939  TIter next(fList);
940  TList *ret = new TList();
941 
942  while ((el = (TGFrameElement *) next())) {
943  if (el->fFrame->IsActive()) {
944  ret->Add(new TObjString(((TGLVEntry*)el->fFrame)->GetItemName()->GetString()));
945  }
946  }
947  return ret;
948 }
949 
950 ////////////////////////////////////////////////////////////////////////////////
951 /// Move current position one column left.
952 
954 {
955  // in details mode just move one line up
956  if (fViewMode == kLVDetails) return LineUp(select);
957 
958  TGPosition pos = GetPagePosition();
960 
962  if (!fe) return; // empty list
963 
965 
966  if (fViewMode == kLVSmallIcons && fe == old) return;
967 
968  if (old) DeActivateItem(old); //
969  else fLastActiveEl = fe;
970 
972  Int_t dx = ms.fWidth;
973  Int_t dy = ms.fHeight;
974 
976  Int_t x = fLastActiveEl->fFrame->GetX() - dx + 2;
977 
978  Int_t hw = pos.fX + dim.fWidth;
979 
980  TGHScrollBar *hb = GetHScrollbar();
981  if (hb && hb->IsMapped()) {
982  Int_t pg = (hb->GetPageSize()*GetWidth())/fViewPort->GetWidth();
983  hw += pg;
984  }
985  if (x <= 0) { // move one line up
986  x = hw;
987  y = y - dy;
988  }
989 
990  fe = FindFrame(x, y);
991  if (fe && fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) {
992  // cannot go down with the left key
993  x = hw;
994  y = y - dy;
995  fe = FindFrame(x, y);
996  }
997  if (fViewMode == kLVList) {
998  if (fe && fe->fFrame->GetY() <= fLastActiveEl->fFrame->GetY() - (2 * dy)) {
999  // avoid jumping more than one line up
1000  x = fe->fFrame->GetX() - dx;
1001  fe = FindFrame(x, y);
1002  }
1003  // cannot go down and/or right with the left key
1004  if (fe && fe->fFrame->GetY() >= fLastActiveEl->fFrame->GetY() &&
1005  fe->fFrame->GetX() >= fLastActiveEl->fFrame->GetX())
1006  fe = fLastActiveEl;
1007  }
1008  if (!fe || fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY())
1009  fe = (TGFrameElement*)fList->First();
1010  if (!select) fSelected=1;
1011 
1012  ActivateItem(fe);
1013  AdjustPosition();
1014 }
1015 
1016 ////////////////////////////////////////////////////////////////////////////////
1017 /// Move current position one column right.
1018 
1020 {
1021  // in details mode just move one line down
1022  if (fViewMode == kLVDetails) return LineDown(select);
1023 
1024  TGPosition pos = GetPagePosition();
1025  TGDimension dim = GetPageDimension();
1026 
1028  if (!fe) return;
1029 
1031 
1032  if (fViewMode == kLVSmallIcons && fe == old) return;
1033 
1034  if (old) DeActivateItem(old);
1036 
1038  Int_t dx = ms.fWidth;
1039  Int_t dy = ms.fHeight;
1040 
1042  Int_t x = fLastActiveEl->fFrame->GetX() + dx - 2;
1043 
1044  Int_t hw = pos.fX + dim.fWidth - dx;
1045 
1046  TGHScrollBar *hb = GetHScrollbar();
1047  if (x > hw && (hb && !hb->IsMapped())) { // move one line down
1048  x = 0;
1049  y = y + dy;
1050  }
1051 
1052  fe = FindFrame(x, y);
1053  if (fe && fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) {
1054  // cannot go up with the right key
1055  x = 0;
1056  y = y + dy;
1057  fe = FindFrame(x, y);
1058  }
1059  if (fViewMode == kLVList) {
1060  // cannot go up and/or left with the right key
1061  if (fe && fe->fFrame->GetY() <= fLastActiveEl->fFrame->GetY() &&
1062  fe->fFrame->GetX() <= fLastActiveEl->fFrame->GetX())
1063  fe = fLastActiveEl;
1064  }
1065  if (!fe || fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY())
1066  fe = (TGFrameElement*)fList->Last();
1067  if (!select) fSelected = 1;
1068 
1069  ActivateItem(fe);
1070  AdjustPosition();
1071 }
1072 
1073 ////////////////////////////////////////////////////////////////////////////////
1074 /// Make current position first line in window by scrolling up.
1075 
1077 {
1079  if (!fe) return;
1080 
1082 
1083  if (old) {
1084  DeActivateItem(old);
1085  } else {
1087  }
1088 
1090  Int_t dy = ms.fHeight;
1091 
1092  Int_t y = fLastActiveEl->fFrame->GetY() - dy;
1094 
1095  fe = FindFrame(x, y);
1096  if (!fe) fe = (TGFrameElement*)fList->First();
1097  if (fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1098  if (!select) fSelected = 1;
1099 
1100  ActivateItem(fe);
1101  AdjustPosition();
1102 }
1103 
1104 ////////////////////////////////////////////////////////////////////////////////
1105 /// Move one line down.
1106 
1108 {
1110  if (!fe) return;
1111 
1113 
1114  if (old) DeActivateItem(old);
1116 
1118  Int_t dy = ms.fHeight;
1119 
1120  Int_t y = fLastActiveEl->fFrame->GetY() + dy;
1122 
1123  fe = FindFrame(x, y);
1124  if (!fe) fe = (TGFrameElement*)fList->Last();
1125  if (fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1126  if (!select) fSelected = 1;
1127 
1128  ActivateItem(fe);
1129  AdjustPosition();
1130 }
1131 
1132 
1133 ////////////////////////////////////////////////////////////////////////////////
1134 /// Returns page dimension.
1135 
1137 {
1138  TGDimension ret;
1139  if (!fViewPort) return ret;
1140 
1141  ret.fWidth = fViewPort->GetWidth();
1142  ret.fHeight = fViewPort->GetHeight();
1143  return ret;
1144 }
1145 
1146 ////////////////////////////////////////////////////////////////////////////////
1147 /// Create a list view widget.
1148 
1150  UInt_t options, ULong_t back) :
1151  TGCanvas(p, w, h, options, back)
1152 {
1154  fNColumns = 0;
1155  fColumns = 0;
1156  fJmode = 0;
1157  fColHeader = 0;
1158  fColNames = 0;
1159  fSplitHeader = 0;
1160  fJustChanged = kFALSE;
1161  fMinColumnSize = 25;
1163  fNormGC = GetDefaultGC()();
1164  if (fHScrollbar)
1165  fHScrollbar->Connect("PositionChanged(Int_t)", "TGListView",
1166  this, "ScrollHeader(Int_t)");
1168 
1170 }
1171 
1172 ////////////////////////////////////////////////////////////////////////////////
1173 /// Delete a list view widget.
1174 
1176 {
1177  if (fNColumns) {
1178  delete [] fColumns;
1179  delete [] fJmode;
1180  for (int i = 0; i < fNColumns; i++) {
1181  delete fColHeader[i];
1182  delete fSplitHeader[i];
1183  }
1184  delete [] fColHeader;
1185  delete [] fColNames;
1186  delete [] fSplitHeader;
1187  delete fHeader;
1188  }
1189 }
1190 
1191 ////////////////////////////////////////////////////////////////////////////////
1192 /// Scroll header buttons with horizontal scrollbar
1193 
1195 {
1196  Int_t i, xl = - pos;
1197  if (fViewMode == kLVDetails) {
1198  for (i = 0; i < fNColumns-1; ++i) {
1199  fColHeader[i]->Move(xl, 0);
1200  xl += fColHeader[i]->GetWidth();
1201  fSplitHeader[i]->Move(xl,fSplitHeader[i]->GetHeight());
1202  }
1203  fColHeader[i]->Move(xl, 0);
1204  xl += fColHeader[i]->GetWidth();
1205  fSplitHeader[i]->Move(xl,fSplitHeader[i]->GetHeight());
1206  }
1207 }
1208 
1209 ////////////////////////////////////////////////////////////////////////////////
1210 /// Set number of headers, i.e. columns that will be shown in detailed view.
1211 /// This method must be followed by exactly ncolumns SetHeader() calls,
1212 /// making sure that every header (i.e. idx) is set (for and example see
1213 /// SetDefaultHeaders()).
1214 
1216 {
1217  if (ncolumns <= 0) {
1218  Error("SetHeaders", "number of columns must be > 0");
1219  return;
1220  }
1221 
1222  if (fNColumns) {
1223  delete [] fColumns;
1224  delete [] fJmode;
1225  for (int i = 0; i < fNColumns; i++) {
1226  if (fColHeader[i]) fColHeader[i]->DestroyWindow();
1227  delete fColHeader[i];
1228  delete fSplitHeader[i];
1229  }
1230  delete [] fColHeader;
1231  delete [] fSplitHeader;
1232  delete [] fColNames;
1233  }
1234 
1235  fNColumns = ncolumns+1; // one extra for the blank filler header
1236  fColumns = new int[fNColumns];
1237  fJmode = new int[fNColumns];
1239  fColNames = new TString [fNColumns];
1241 
1242  for (int i = 0; i < fNColumns; i++) {
1243  fColHeader[i] = 0;
1244  fJmode[i] = kTextLeft;
1245  fSplitHeader[i] = new TGVFileSplitter(fHeader, 10);
1246  fSplitHeader[i]->Connect("LayoutListView()", "TGListView",
1247  this, "Layout()");
1248  fSplitHeader[i]->Connect("LayoutHeader(TGFrame *)", "TGListView",
1249  this, "LayoutHeader(TGFrame *)");
1250  fSplitHeader[i]->Connect("DoubleClicked(TGVFileSplitter*)", "TGListView",
1251  this, "SetDefaultColumnWidth(TGVFileSplitter*)");
1252  }
1253 
1254  // create blank filler header
1255  fColNames[fNColumns-1] = "";
1256  fColHeader[fNColumns-1] = new TGTextButton(fHeader, new TGHotString(""), -1,
1259  fColHeader[fNColumns-1]->Associate(this);
1261  fColHeader[fNColumns-1]->SetState(kButtonDisabled);
1262  fColHeader[fNColumns-1]->SetStyle(gClient->GetStyle());
1263  fJmode[fNColumns-1] = kTextCenterX;
1264  fColumns[fNColumns-1] = 0;
1265  fSplitHeader[fNColumns-1]->SetFrame(fColHeader[fNColumns-1], kTRUE);
1267  fJustChanged = kTRUE;
1268 }
1269 
1270 ////////////////////////////////////////////////////////////////////////////////
1271 /// Set header button idx [0-fNColumns>, hmode is the x text alignmode
1272 /// (ETextJustification) for the header text and cmode is the x text
1273 /// alignmode for the item text.
1274 
1275 void TGListView::SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
1276 {
1277  if (idx < 0 || idx >= fNColumns-1) {
1278  Error("SetHeader", "header index must be [0 - %d>", fNColumns-1);
1279  return;
1280  }
1281  delete fColHeader[idx];
1282 
1283  fColNames[idx] = s;
1284  fColHeader[idx] = new TGTextButton(fHeader, new TGHotString(s), idx,
1287  TString txt = s;
1288  txt.ToLower();
1289  if (txt.Contains("modified")) txt += " date";
1290  if (txt.Contains("attributes")) txt = "type";
1291  fColHeader[idx]->SetToolTipText(Form("Click to sort by %s", txt.Data()));
1292  fColHeader[idx]->Associate(this);
1293  fColHeader[idx]->SetTextJustify(hmode | kTextCenterY);
1294  fSplitHeader[idx]->SetFrame(fColHeader[idx], kTRUE);
1295 
1296  fColHeader[idx]->SetStyle(gClient->GetStyle());
1297 
1298  // fJmode and fColumns contain values for columns idx > 0. idx==0 is
1299  // the small icon with the object name
1300  if (idx > 0)
1301  fJmode[idx-1] = cmode;
1302 
1303  if (!fColHeader[0]) return;
1304  int xl = fColHeader[0]->GetDefaultWidth() + 10 + fSplitHeader[0]->GetDefaultWidth();
1305  for (int i = 1; i < fNColumns; i++) {
1306  fColumns[i-1] = xl;
1307  if (!fColHeader[i]) break;
1309  }
1310 }
1311 
1312 ////////////////////////////////////////////////////////////////////////////////
1313 /// Returns name of header idx. If illegal idx or header not set for idx
1314 /// 0 is returned.
1315 
1316 const char *TGListView::GetHeader(Int_t idx) const
1317 {
1318  if (idx >= 0 && idx < fNColumns-1 && fColHeader[idx])
1319  return (const char*) fColNames[idx];
1320  return 0;
1321 }
1322 
1323 ////////////////////////////////////////////////////////////////////////////////
1324 /// Default headers are: Name, Attributes, Size, Owner, Group, Modified.
1325 /// The default is good for file system items.
1326 
1328 {
1329  SetHeaders(6);
1330  SetHeader("Name", kTextLeft, kTextLeft, 0);
1331  SetHeader("Attributes", kTextCenterX, kTextCenterX, 1);
1332  SetHeader("Size", kTextRight, kTextRight, 2);
1333  SetHeader("Owner", kTextCenterX, kTextCenterX, 3);
1334  SetHeader("Group", kTextCenterX, kTextCenterX, 4);
1335  SetHeader("Modified", kTextCenterX, kTextCenterX, 5);
1336 }
1337 
1338 ////////////////////////////////////////////////////////////////////////////////
1339 /// Set list view mode.
1340 
1342 {
1343  TGLVContainer *container;
1344 
1345  if (fViewMode != viewMode) {
1346  fJustChanged = kTRUE;
1347  fViewMode = viewMode;
1348  container = (TGLVContainer *) fVport->GetContainer();
1349  if (container) container->SetViewMode(viewMode);
1350  Layout();
1351  }
1352 }
1353 
1354 ////////////////////////////////////////////////////////////////////////////////
1355 /// Set list view container. Container must be at least of type
1356 /// TGLVContainer.
1357 
1359 {
1360  if (f->InheritsFrom(TGLVContainer::Class())) {
1362  ((TGLVContainer *) f)->SetColumns(fColumns, fJmode);
1363  ((TGLVContainer *) f)->SetListView(this);
1364  } else
1365  Error("SetContainer", "frame must inherit from TGLVContainer");
1366 }
1367 
1368 ////////////////////////////////////////////////////////////////////////////////
1369 /// Set horizontal and vertical scrollbar increments.
1370 
1372 {
1375 }
1376 
1377 ////////////////////////////////////////////////////////////////////////////////
1378 /// Set default column width of the columns headers.
1379 
1381 {
1382  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1383 
1384  if (!container) {
1385  Error("SetDefaultColumnWidth", "no listview container set yet");
1386  return;
1387  }
1388  container->ClearViewPort();
1389 
1390  for (int i = 0; i < fNColumns; ++i) {
1391  if ( fSplitHeader[i] == splitter ) {
1392  TString dt = fColHeader[i]->GetString();
1393  UInt_t bsize = gVirtualX->TextWidth(fColHeader[i]->GetFontStruct(),
1394  dt.Data(), dt.Length());
1395  UInt_t w = TMath::Max(fColHeader[i]->GetDefaultWidth(), bsize + 20);
1396  if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1397  if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1398  fColHeader[i]->Resize(w, fColHeader[i]->GetHeight());
1399  Layout();
1400  }
1401  }
1402 }
1403 
1404 ////////////////////////////////////////////////////////////////////////////////
1405 /// Resize column headers to show whole item names.
1406 
1408 {
1409  for (int i = 0; i < fNColumns; ++i) {
1410  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1411  if (!container) {
1412  Error("ResizeColumns", "no listview container set yet");
1413  return;
1414  }
1415  fMaxSize = container->GetMaxItemSize();
1417  }
1418 }
1419 
1420 ////////////////////////////////////////////////////////////////////////////////
1421 /// Layout list view components (container and contents of container).
1422 
1424 {
1425  Int_t i, xl = 0;
1426  UInt_t w, h = 0;
1427 
1428  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1429 
1430  if (!container) {
1431  Error("Layout", "no listview container set yet");
1432  return;
1433  }
1434 
1435  fMaxSize = container->GetMaxItemSize();
1436 
1437  if (fViewMode == kLVDetails) {
1438  h = fColHeader[0]->GetDefaultHeight()-4;
1439  fHeader->MoveResize(0, 0, fWidth, h);
1440  fHeader->MapWindow();
1441  for (i = 0; i < fNColumns-1; ++i) {
1442  fColHeader[i]->SetText(fColNames[i]);
1443 
1444  if ( fJustChanged ) {
1446  if (w < fMinColumnSize) w = fColHeader[i]->GetDefaultWidth();
1447  if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1448  if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1449  } else {
1450  w = fColHeader[i]->GetWidth();
1451  }
1452  w = TMath::Max(fMinColumnSize, w);
1453  if ( fColHeader[i]->GetDefaultWidth() > w ) {
1454  for (int j = fColNames[i].Length() - 1 ; j > 0; j--) {
1455  fColHeader[i]->SetText( fColNames[i](0,j) + "..." );
1456  if ( fColHeader[i]->GetDefaultWidth() < w )
1457  break;
1458  }
1459  }
1460 
1461  fColHeader[i]->MoveResize(xl, 0, w, h);
1462  fColHeader[i]->MapWindow();
1463  xl += w;
1464  fSplitHeader[i]->Move(xl, 0);
1465  fSplitHeader[i]->MapWindow();
1466  fColumns[i] = xl-2; // -2 is fSep in the layout routine
1467  }
1468  fColHeader[i]->MoveResize(xl, 0, fVport->GetWidth()-xl, h);
1469  fColHeader[i]->MapWindow();
1471  fSplitHeader[i]->MapWindow();
1473 
1474  container->SetColumns(fColumns, fJmode);
1475 
1476  } else {
1477  for (i = 0; i < fNColumns; ++i) {
1478  fColHeader[i]->UnmapWindow();
1479  fSplitHeader[i]->UnmapWindow();
1480  }
1481  fHeader->UnmapWindow();
1482  }
1483  // coverity[returned_null]
1484  // coverity[dereference]
1485  TGLayoutManager *lm = container->GetLayoutManager();
1486  lm->SetDefaultWidth(xl);
1487  TGCanvas::Layout();
1488 
1489  if (fViewMode == kLVDetails) {
1490  container->Resize(container->GetWidth(), container->GetHeight()+h);
1491  fVScrollbar->SetRange((Int_t)container->GetHeight(),
1492  (Int_t)fVport->GetHeight());
1493  if (fJustChanged) {
1495  fVport->GetHeight());
1496  container->Move(0, h);
1497  } else {
1498  container->DrawRegion(0, 0, fVport->GetWidth(), fVport->GetHeight());
1499  }
1500  fColHeader[i]->MoveResize(xl, 0, fVport->GetWidth()-xl, h);
1501  fColHeader[i]->MapWindow();
1502  } else {
1504  fVport->GetHeight());
1505  container->Move(0, 0);
1506  }
1507 
1508  fJustChanged = kFALSE;
1509 }
1510 
1511 ////////////////////////////////////////////////////////////////////////////////
1512 /// Layout list view components (container and contents of container).
1513 
1515 {
1516  Int_t i, xl = 0;
1517  UInt_t w, h = 0;
1518  static Int_t oldPos = 0;
1519  if (head == 0) oldPos = 0;
1520 
1521  TGLVContainer *container = (TGLVContainer *) fVport->GetContainer();
1522 
1523  if (!container) {
1524  Error("Layout", "no listview container set yet");
1525  return;
1526  }
1527  fMaxSize = container->GetMaxItemSize();
1528  Int_t posx = container->GetPagePosition().fX;
1529 
1530  if (fViewMode == kLVDetails) {
1531  h = fColHeader[0]->GetDefaultHeight()-4;
1532  fHeader->MoveResize(0, 0, fWidth, h);
1533  fHeader->MapWindow();
1534  for (i = 0; i < fNColumns-1; ++i) {
1535  fColHeader[i]->SetText(fColNames[i]);
1536 
1537  if ( fJustChanged ) {
1539  if (w < fMinColumnSize) w = fColHeader[i]->GetDefaultWidth();
1540  if (i == 0) w = TMath::Max(fMaxSize.fWidth + 10, w);
1541  if (i > 0) w = TMath::Max(container->GetMaxSubnameWidth(i) + 40, (Int_t)w);
1542  } else {
1543  w = fColHeader[i]->GetWidth();
1544  }
1545  w = TMath::Max(fMinColumnSize, w);
1546  if ( fColHeader[i]->GetDefaultWidth() > w ) {
1547  for (int j = fColNames[i].Length() - 1 ; j > 0; j--) {
1548  fColHeader[i]->SetText( fColNames[i](0,j) + "..." );
1549  if ( fColHeader[i]->GetDefaultWidth() < w )
1550  break;
1551  }
1552  }
1553 
1554  if ((TGFrame *)fColHeader[i] == head) {
1555  if (oldPos > 0) {
1556  gVirtualX->DrawLine(container->GetId(), container->GetLineGC()(),
1557  oldPos - posx, 0, oldPos - posx, fVport->GetHeight());
1558  }
1559  gVirtualX->DrawLine(container->GetId(), container->GetLineGC()(),
1560  xl + w - posx, 0, xl + w - posx, fVport->GetHeight());
1561  oldPos = xl + w;
1562  }
1563 
1564  fColHeader[i]->MoveResize(xl - posx, 0, w, h);
1565  fColHeader[i]->MapWindow();
1566  xl += w;
1567  fSplitHeader[i]->Move(xl, 0);
1568  fSplitHeader[i]->MapWindow();
1569  fColumns[i] = xl-2; // -2 is fSep in the layout routine
1570  }
1571  fColHeader[i]->MoveResize(xl - posx, 0, fVport->GetWidth()-xl, h);
1572  fColHeader[i]->MapWindow();
1574  fSplitHeader[i]->MapWindow();
1576  }
1577  fJustChanged = kFALSE;
1578 }
1579 
1580 ////////////////////////////////////////////////////////////////////////////////
1581 /// Handle messages generated by the list view components.
1582 
1584 {
1586 
1587  const TGLVEntry *entry;
1588  void *p = 0;
1589 
1590  entry = (TGLVEntry *) cnt->GetNextSelected(&p);
1591 
1592  switch (GET_SUBMSG(msg)) {
1593  case kCT_ITEMCLICK:
1594  if ((cnt->NumSelected() == 1) && (entry != 0)) {
1595  Int_t x = (Int_t)(parm2 & 0xffff);
1596  Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1597  Clicked((TGLVEntry*)entry, (Int_t)parm1);
1598  Clicked((TGLVEntry*)entry, (Int_t)parm1, x, y);
1599  }
1600  break;
1601  case kCT_ITEMDBLCLICK:
1602  if ((cnt->NumSelected() == 1) && (entry!=0)) {
1603  Int_t x = (Int_t)(parm2 & 0xffff);
1604  Int_t y = (Int_t)((parm2 >> 16) & 0xffff);
1605  DoubleClicked((TGLVEntry*)entry, (Int_t)parm1);
1606  DoubleClicked((TGLVEntry*)entry, (Int_t)parm1, x, y);
1607  }
1608  break;
1609  case kCT_SELCHANGED:
1610  SelectionChanged();
1611  break;
1612  default:
1613  break;
1614  }
1615  return TGCanvas::ProcessMessage(msg, parm1, parm2);
1616 }
1617 
1618 ////////////////////////////////////////////////////////////////////////////////
1619 /// Emit Clicked() signal.
1620 
1622 {
1623  Long_t args[2];
1624 
1625  args[0] = (Long_t)entry;
1626  args[1] = btn;
1627 
1628  Emit("Clicked(TGLVEntry*,Int_t)", args);
1629 }
1630 
1631 ////////////////////////////////////////////////////////////////////////////////
1632 /// Emit Clicked() signal.
1633 
1635 {
1636  Long_t args[4];
1637 
1638  args[0] = (Long_t)entry;
1639  args[1] = btn;
1640  args[2] = x;
1641  args[3] = y;
1642 
1643  Emit("Clicked(TGLVEntry*,Int_t,Int_t,Int_t)", args);
1644 }
1645 
1646 ////////////////////////////////////////////////////////////////////////////////
1647 /// Emit DoubleClicked() signal.
1648 
1650 {
1651  Long_t args[2];
1652 
1653  args[0] = (Long_t)entry;
1654  args[1] = btn;
1655 
1656  Emit("DoubleClicked(TGLVEntry*,Int_t)", args);
1657 }
1658 
1659 ////////////////////////////////////////////////////////////////////////////////
1660 /// Emit DoubleClicked() signal.
1661 
1663 {
1664  Long_t args[4];
1665 
1666  args[0] = (Long_t)entry;
1667  args[1] = btn;
1668  args[2] = x;
1669  args[3] = y;
1670 
1671  Emit("DoubleClicked(TGLVEntry*,Int_t,Int_t,Int_t)", args);
1672 }
1673 
1674 ////////////////////////////////////////////////////////////////////////////////
1675 /// Return the default font structure in use.
1676 
1678 {
1679  if (!fgDefaultFont)
1680  fgDefaultFont = gClient->GetResourcePool()->GetIconFont();
1681  return fgDefaultFont->GetFontStruct();
1682 }
1683 
1684 ////////////////////////////////////////////////////////////////////////////////
1685 /// Return the default graphics context in use.
1686 
1688 {
1689  if (!fgDefaultGC) {
1690  fgDefaultGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
1692  }
1693  return *fgDefaultGC;
1694 }
1695 
1696 ////////////////////////////////////////////////////////////////////////////////
1697 /// Save a list view widget as a C++ statement(s) on output stream out.
1698 
1699 void TGListView::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1700 {
1701  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
1702 
1703  out << std::endl << " // list view" << std::endl;
1704  out <<" TGListView *";
1705  out << GetName() << " = new TGListView(" << fParent->GetName()
1706  << "," << GetWidth() << "," << GetHeight();
1707 
1709  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1710  out <<");" << std::endl;
1711  } else {
1712  out << "," << GetOptionString() <<");" << std::endl;
1713  }
1714  } else {
1715  out << "," << GetOptionString() << ",ucolor);" << std::endl;
1716  }
1717  if (option && strstr(option, "keep_names"))
1718  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1719 
1720  GetContainer()->SavePrimitive(out, option);
1721 
1722  out << std::endl;
1723  out << " " << GetName() << "->SetContainer(" << GetContainer()->GetName()
1724  << ");" << std::endl;
1725  out << " " << GetName() << "->SetViewMode(";
1726  switch (fViewMode) {
1727  case kLVLargeIcons:
1728  out << "kLVLargeIcons";
1729  break;
1730  case kLVSmallIcons:
1731  out << "kLVSmallIcons";
1732  break;
1733  case kLVList:
1734  out << "kLVList";
1735  break;
1736  case kLVDetails:
1737  out << "kLVDetails";
1738  break;
1739  }
1740  out << ");" << std::endl;
1741 
1742  out << " " << GetContainer()->GetName() << "->Resize();" << std::endl;
1743 
1744  if (fHScrollbar && fHScrollbar->IsMapped()) {
1745  out << " " << GetName() << "->SetHsbPosition(" << GetHsbPosition()
1746  << ");" << std::endl;
1747  }
1748 
1749  if (fVScrollbar && fVScrollbar->IsMapped()) {
1750  out << " " << GetName() << "->SetVsbPosition(" << GetVsbPosition()
1751  << ");" << std::endl;
1752  }
1753 }
1754 
1755 ////////////////////////////////////////////////////////////////////////////////
1756 /// Save a list view container as a C++ statement(s) on output stream out.
1757 
1758 void TGLVContainer::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1759 {
1760  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
1761 
1762  out << std::endl << " // list view container" << std::endl;
1763  out << " TGLVContainer *";
1764 
1766  out << GetName() << " = new TGLVContainer(" << GetCanvas()->GetName();
1767  } else {
1768  out << GetName() << " = new TGLVContainer(" << fParent->GetName();
1769  out << "," << GetWidth() << "," << GetHeight();
1770  }
1772  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1773  out <<");" << std::endl;
1774  } else {
1775  out << "," << GetOptionString() <<");" << std::endl;
1776  }
1777  } else {
1778  out << "," << GetOptionString() << ",ucolor);" << std::endl;
1779  }
1780  if (option && strstr(option, "keep_names"))
1781  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1782 }
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
virtual Int_t NumSelected() const
Definition: TGCanvas.h:114
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition: TGCanvas.cxx:678
EListViewMode GetViewMode() const
Definition: TGListView.h:233
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:638
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:51
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:2405
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:953
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
TH1 * h
Definition: legend2.C:5
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:585
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:2102
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:129
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
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:168
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1099
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:488
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
TArc * a
Definition: textangle.C:12
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:1790
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:2371
Int_t * fJmode
Definition: TGListView.h:64
Handle_t GetId() const
Definition: TGObject.h:48
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:734
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:1654
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:919
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:1774
Int_t bsize[]
Definition: SparseFit4.cxx:31
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
const int maxsize
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.
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:657
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:43
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:3187
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:561
TGLVEntry(const TGLVEntry &)
FontStruct_t fFontStruct
Definition: TGListView.h:149
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
EGEventType fType
Definition: GuiTypes.h:174
void * GetUserData() const
Definition: TGListView.h:113
Int_t GET_SUBMSG(Long_t val)
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Draw list view item in other window.
Definition: TGListView.cxx:324
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
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:436
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:816
Int_t * fCpos
Definition: TGListView.h:205
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:873
char * Form(const char *fmt,...)
Int_t fXf
Definition: TGCanvas.h:56
Ssiz_t Length() const
Definition: TString.h:388
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:2341
virtual ~TGListView()
Delete a list view widget.
Int_t fX
Definition: TGDimension.h:50
virtual TGHScrollBar * GetHScrollbar() const
returns pointer to hor. scroll bar
Definition: TGCanvas.cxx:1742
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:350
TGViewPort * fVport
Definition: TGCanvas.h:205
TList * GetSelectedItems()
Get list of selected items in container.
Definition: TGListView.cxx:936
UInt_t fWidth
Definition: TGFrame.h:134
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition: TGCanvas.cxx:888
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:92
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
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:336
double f(double x)
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:90
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:287
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Definition: TGCanvas.cxx:1758
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:572
UInt_t GetWidth() const
Definition: TGPicture.h:63
virtual void UnSelectAll()
Unselect all items in the container.
Definition: TGCanvas.cxx:585
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:2333
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:81
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:2226
TGLVEntry * fLastActive
Definition: TGListView.h:209
virtual void Add(TObject *obj)
Definition: TList.h:77
GContext_t fNormGC
Definition: TGListView.h:76
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:200
virtual void ActivateItem(TGFrameElement *el)
Activate item.
Definition: TGCanvas.cxx:698
EListViewMode fViewMode
Definition: TGListView.h:204
Int_t fTotal
Definition: TGCanvas.h:58
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:370
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:2433
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:2460
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:91
virtual void DeActivateItem(TGFrameElement *el)
DeActivate item.
Definition: TGCanvas.cxx:721
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:2381
Definition: TGGC.h:31
virtual void SetContainer(TGFrame *f)
Set list view container.
virtual void SetDefaultWidth(UInt_t)
Definition: TGLayout.h:151
virtual void DestroyWindow()
Definition: TGWindow.h:88
const char * cnt
Definition: TXMLSetup.cxx:75
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:926
Bool_t fScrolling
Definition: TGCanvas.h:69
const char * Data() const
Definition: TString.h:347
FontH_t GetFontHandle() const
Definition: TGFont.h:192
ULong_t Handle_t
Definition: GuiTypes.h:25