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