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