Logo ROOT  
Reference Guide
TGFSContainer.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 19/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 TGFileIcon
25  \ingroup guiwidgets
26 
27 Utility class used by the file selection dialog (TGFSDialog).
28 
29 */
30 
31 /** \class TGFileEntry
32  \ingroup guiwidgets
33 
34 Utility class used by the file selection dialog (TGFSDialog).
35 
36 */
37 
38 /** \class TGFSContainer
39  \ingroup guiwidgets
40 
41 Utility class used by the file selection dialog (TGFSDialog).
42 
43 */
44 
45 #include "TGFSContainer.h"
46 #include "TGIcon.h"
47 #include "TGMsgBox.h"
48 #include "TGMimeTypes.h"
49 #include "TRegexp.h"
50 #include "TList.h"
51 #include "TSystem.h"
52 #include "TVirtualX.h"
53 #include "TGDNDManager.h"
54 #include "TRemoteObject.h"
55 #include "TBufferFile.h"
56 #include "TImage.h"
57 #include "snprintf.h"
58 
59 #include <ctime>
60 #include <cstdlib>
61 #include <iostream>
62 
65 
66 class TViewUpdateTimer : public TTimer {
67 
68 private:
70 
71 public:
73  Bool_t Notify();
74 };
75 
76 
77 
78 class TGFileIcon : public TGIcon {
79 
80 protected:
81  const TGPicture *fLpic; // icon picture
82 
83  virtual void DoRedraw();
84 
85 public:
86  TGFileIcon(const TGWindow *p, const TGPicture *pic, const TGPicture *lpic,
87  UInt_t options = kChildFrame, Pixel_t back = GetWhitePixel()) :
88  TGIcon(p, pic, 0, 0, options, back) { fLpic = lpic; }
89 };
90 
91 
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 
96 public:
97  TGFileContainer *fContainer; // file container
98 
99  Bool_t IsSortable() const { return kTRUE; }
100  Int_t Compare(const TObject *obj) const;
101 };
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 /// Sort frame elements in file selection list view container.
105 
107 {
108  Int_t type1, type2;
109 
111  TGFileItem *f2 = (TGFileItem *) ((TGFrameElement *) obj)->fFrame;
112 
113  switch (fContainer->fSortType) {
114  default:
115  case kSortByName:
116  //--- this is not exactly what I want...
117  type1 = f1->GetType();
118  type2 = f2->GetType();
119 
120  //--- use posix macros
121  if (R_ISDIR(type1)) type1 = 1;
122  else type1 = 6;
123 
124  if (R_ISDIR(type2)) type2 = 1;
125  else type2 = 6;
126 
127  if (type1 < type2) return -1;
128  if (type1 > type2) return 1;
129  return strcmp(f1->GetItemName()->GetString(),
130  f2->GetItemName()->GetString());
131 
132  case kSortByOwner:
133  if (f1->GetUid() != f2->GetUid()) {
134  if (f1->GetUid() < f2->GetUid())
135  return -1;
136  else
137  return +1;
138  }
139 
140  // else sort by name
141  type1 = f1->GetType();
142  type2 = f2->GetType();
143 
144  //--- use posix macros
145  if (R_ISDIR(type1)) type1 = 1;
146  else type1 = 6;
147 
148  if (R_ISDIR(type2)) type2 = 1;
149  else type2 = 6;
150 
151  if (type1 < type2) return -1;
152  if (type1 > type2) return 1;
153  return strcmp(f1->GetItemName()->GetString(),
154  f2->GetItemName()->GetString());
155 
156  case kSortByGroup:
157  if (f1->GetGid() != f2->GetGid()) {
158  if (f1->GetGid() < f2->GetGid())
159  return -1;
160  else
161  return +1;
162  }
163 
164  // else sort by name
165  type1 = f1->GetType();
166  type2 = f2->GetType();
167 
168  //--- use posix macros
169  if (R_ISDIR(type1)) type1 = 1;
170  else type1 = 6;
171 
172  if (R_ISDIR(type2)) type2 = 1;
173  else type2 = 6;
174 
175  if (type1 < type2) return -1;
176  if (type1 > type2) return 1;
177  return strcmp(f1->GetItemName()->GetString(),
178  f2->GetItemName()->GetString());
179 
180  case kSortByType:
181  //--- this is not exactly what I want...
182 
183  type1 = f1->GetType();
184  type2 = f2->GetType();
185 
186  //--- use posix macros
187 
188  if (R_ISDIR(type1)) type1 = 1;
189  else if (R_ISLNK(type1)) type1 = 2;
190  else if (R_ISSOCK(type1)) type1 = 3;
191  else if (R_ISFIFO(type1)) type1 = 4;
192  else if (R_ISREG(type1) && (type1 & kS_IXUSR)) type1 = 5;
193  else type1 = 6;
194 
195  if (R_ISDIR(type2)) type2 = 1;
196  else if (R_ISLNK(type2)) type2 = 2;
197  else if (R_ISSOCK(type2)) type2 = 3;
198  else if (R_ISFIFO(type2)) type2 = 4;
199  else if (R_ISREG(type2) && (type2 & kS_IXUSR)) type2 = 5;
200  else type2 = 6;
201 
202  if (type1 < type2) return -1;
203  if (type1 > type2) return 1;
204  return strcmp(f1->GetItemName()->GetString(),
205  f2->GetItemName()->GetString());
206 
207  case kSortBySize:
208  if (f1->GetSize() < f2->GetSize()) return -1;
209  if (f1->GetSize() > f2->GetSize()) return 1;
210  return strcmp(f1->GetItemName()->GetString(),
211  f2->GetItemName()->GetString());
212 
213  case kSortByDate:
214  time_t loctimeF1 = (time_t) f1->GetModTime();
215  // coverity[returned_null]
216  struct tm tmF1 = *localtime(&loctimeF1);
217 
218  time_t loctimeF2 = (time_t) f2->GetModTime();
219  // coverity[returned_null]
220  struct tm tmF2 = *localtime(&loctimeF2);
221 
222  if ( tmF1.tm_year != tmF2.tm_year )
223  return (tmF1.tm_year < tmF2.tm_year) ? +1 : -1;
224  else if ( tmF1.tm_mon != tmF2.tm_mon )
225  return (tmF1.tm_mon < tmF2.tm_mon) ? +1 : -1;
226  else if ( tmF1.tm_mday != tmF2.tm_mday )
227  return (tmF1.tm_mday < tmF2.tm_mday) ? +1 : -1;
228  else if ( tmF1.tm_hour != tmF2.tm_hour )
229  return (tmF1.tm_hour < tmF2.tm_hour) ? +1 : -1;
230  else if ( tmF1.tm_min != tmF2.tm_min )
231  return (tmF1.tm_min < tmF2.tm_min) ? +1 : -1;
232  else if ( tmF1.tm_sec != tmF2.tm_sec )
233  return (tmF1.tm_sec < tmF2.tm_sec) ? +1 : -1;
234  else
235  return 0;
236  }
237 }
238 
239 
240 ////////////////////////////////////////////////////////////////////////////////
241 /// Reset the timer.
242 
244 {
246  Reset();
247  return kFALSE;
248 }
249 
250 
251 ////////////////////////////////////////////////////////////////////////////////
252 /// Draw icon.
253 
255 {
257  if (fLpic) fLpic->Draw(fId, GetBckgndGC()(), 0, 0);
258 }
259 
260 
261 ////////////////////////////////////////////////////////////////////////////////
262 /// Create a list view item.
263 
265  const TGPicture *bpic, const TGPicture *blpic,
266  const TGPicture *spic, const TGPicture *slpic,
268  Int_t gid, Long_t modtime, EListViewMode viewMode,
269  UInt_t options, ULong_t back) :
270  TGLVEntry(p, bpic, spic, name, 0, viewMode, options, back)
271 {
272  FileStat_t buf;
273 
274  buf.fMode = type;
275  buf.fSize = size;
276  buf.fUid = uid;
277  buf.fGid = gid;
278  buf.fMtime = modtime;
279  buf.fIsLink = (blpic != 0); // FIXME: hack...
280 
281  Init(blpic, slpic, buf, viewMode);
282 }
283 
284 ////////////////////////////////////////////////////////////////////////////////
285 /// Create a list view item.
286 
288  const TGPicture *bpic, const TGPicture *blpic,
289  const TGPicture *spic, const TGPicture *slpic,
290  TGString *name, FileStat_t &stat, EListViewMode viewMode,
291  UInt_t options, ULong_t back) :
292  TGLVEntry(p, bpic, spic, name, 0, viewMode, options, back)
293 {
294  Init(blpic, slpic, stat, viewMode);
295 }
296 
297 ////////////////////////////////////////////////////////////////////////////////
298 /// Common initializer for file list view item.
299 
300 void TGFileItem::Init(const TGPicture *blpic, const TGPicture *slpic,
301  FileStat_t &stat, EListViewMode viewMode)
302 {
303  char tmp[256];
304  Long64_t fsize, bsize;
305 
306  fBuf = 0;
307  fDNDData.fData = 0;
308  fDNDData.fDataLength = 0;
309  fDNDData.fDataType = 0;
310  fLcurrent =
311  fBlpic = blpic;
312  fSlpic = slpic;
313 
314  fViewMode = (EListViewMode) -1;
315  SetViewMode(viewMode);
316 
317  fType = stat.fMode;
318  fSize = stat.fSize;
319  fUid = stat.fUid;
320  fGid = stat.fGid;
321  fModTime = stat.fMtime;
322  fIsLink = stat.fIsLink;
323 
324  fSubnames = new TGString* [6];
325 
326  // file type
327  snprintf(tmp, sizeof(tmp), "%c%c%c%c%c%c%c%c%c%c",
328  (fIsLink ?
329  'l' :
330  R_ISREG(fType) ?
331  '-' :
332  (R_ISDIR(fType) ?
333  'd' :
334  (R_ISCHR(fType) ?
335  'c' :
336  (R_ISBLK(fType) ?
337  'b' :
338  (R_ISFIFO(fType) ?
339  'p' :
340  (R_ISSOCK(fType) ?
341  's' : '?' )))))),
342  ((fType & kS_IRUSR) ? 'r' : '-'),
343  ((fType & kS_IWUSR) ? 'w' : '-'),
344  ((fType & kS_ISUID) ? 's' : ((fType & kS_IXUSR) ? 'x' : '-')),
345  ((fType & kS_IRGRP) ? 'r' : '-'),
346  ((fType & kS_IWGRP) ? 'w' : '-'),
347  ((fType & kS_ISGID) ? 's' : ((fType & kS_IXGRP) ? 'x' : '-')),
348  ((fType & kS_IROTH) ? 'r' : '-'),
349  ((fType & kS_IWOTH) ? 'w' : '-'),
350  ((fType & kS_ISVTX) ? 't' : ((fType & kS_IXOTH) ? 'x' : '-')));
351  fSubnames[0] = new TGString(tmp);
352 
353  // file size
354  fsize = bsize = fSize;
355  if (fsize > 1024) {
356  fsize /= 1024;
357  if (fsize > 1024) {
358  // 3.7MB is more informative than just 3MB
359  snprintf(tmp, sizeof(tmp), "%lld.%lldM", fsize/1024, (fsize%1024)/103);
360  } else {
361  snprintf(tmp, sizeof(tmp), "%lld.%lldK", bsize/1024, (bsize%1024)/103);
362  }
363  } else {
364  snprintf(tmp, sizeof(tmp), "%lld", bsize);
365  }
366  fSubnames[1] = new TGString(tmp);
367 
368  {
369  struct UserGroup_t *user_group;
370 
371  user_group = gSystem->GetUserInfo(fUid);
372  if (user_group) {
373  fSubnames[2] = new TGString(user_group->fUser);
374  fSubnames[3] = new TGString(user_group->fGroup);
375  delete user_group;
376  } else {
377  fSubnames[2] = new TGString(TString::Format("%d", fUid));
378  fSubnames[3] = new TGString(TString::Format("%d", fGid));
379  }
380  }
381 
382  struct tm *newtime;
383  time_t loctime = (time_t) fModTime;
384  newtime = localtime(&loctime);
385  if (newtime) {
386  snprintf(tmp, sizeof(tmp), "%d-%02d-%02d %02d:%02d", newtime->tm_year + 1900,
387  newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour,
388  newtime->tm_min);
389  fSubnames[4] = new TGString(tmp);
390  }
391  else
392  fSubnames[4] = new TGString("1901-01-01 00:00");
393 
394  fSubnames[5] = 0;
395 
396  int i;
397  for (i = 0; fSubnames[i] != 0; ++i)
398  ;
399  fCtw = new int[i+1];
400  fCtw[i] = 0;
401  for (i = 0; fSubnames[i] != 0; ++i)
402  fCtw[i] = gVirtualX->TextWidth(fFontStruct, fSubnames[i]->GetString(),
403  fSubnames[i]->GetLength());
404 
405  SetWindowName();
406 }
407 
408 ////////////////////////////////////////////////////////////////////////////////
409 /// Destructor.
410 
412 {
413  delete fBuf;
414 }
415 
416 ////////////////////////////////////////////////////////////////////////////////
417 /// Set container item view mode.
418 
420 {
421  TGLVEntry::SetViewMode(viewMode);
422 
423  if (viewMode == kLVLargeIcons)
424  fLcurrent = fBlpic;
425  else
426  fLcurrent = fSlpic;
427 
428  if (fClient) fClient->NeedRedraw(this);
429 }
430 
431 ////////////////////////////////////////////////////////////////////////////////
432 /// Draw list view container item.
433 
435 {
436  int ix, iy;
437 
439  if (!fLcurrent) return;
440 
441  if (fViewMode == kLVLargeIcons) {
442  ix = (fWidth - fLcurrent->GetWidth()) >> 1;
443  iy = 0;
444  } else {
445  ix = 0;
446  iy = (fHeight - fLcurrent->GetHeight()) >> 1;
447  }
448 
449  fLcurrent->Draw(fId, fNormGC, ix, iy);
450 }
451 
452 ////////////////////////////////////////////////////////////////////////////////
453 /// Handle drag and drop enter
454 
456 {
457  if (!IsDNDTarget()) return kNone;
458  return gVirtualX->InternAtom("application/root", kFALSE);
459 }
460 
461 ////////////////////////////////////////////////////////////////////////////////
462 /// Set drag and drop data
463 
465 {
466  if (fDNDData.fDataLength > 0)
468  fDNDData.fData = calloc(sizeof(unsigned char), data->fDataLength);
469  if (fDNDData.fData)
470  memcpy(fDNDData.fData, data->fData, data->fDataLength);
472  fDNDData.fDataType = data->fDataType;
473 }
474 
475 ////////////////////////////////////////////////////////////////////////////////
476 /// Set drag and drop object
477 
479 {
480  if (fDNDData.fDataLength)
482  fBuf->WriteObject(obj);
483  fDNDData.fData = fBuf->Buffer();
485  fDNDData.fDataType = gVirtualX->InternAtom("application/root", kFALSE);
486 }
487 
488 
489 
490 ////////////////////////////////////////////////////////////////////////////////
491 /// Create a list view container which will hold the contents of
492 /// the current directory.
493 
495  UInt_t options, ULong_t back) :
496  TGLVContainer(p, w, h, options, back)
497 {
499  fFilter = 0;
500  fMtime = 0;
502  fRefresh = new TViewUpdateTimer(this, 1000);
506  fCleanups = new TList;
507 
508  fFolder_s = fClient->GetPicture("folder_s.xpm");
509  fFolder_t = fClient->GetPicture("folder_t.xpm");
510  fApp_s = fClient->GetPicture("app_s.xpm");
511  fApp_t = fClient->GetPicture("app_t.xpm");
512  fDoc_s = fClient->GetPicture("doc_s.xpm");
513  fDoc_t = fClient->GetPicture("doc_t.xpm");
514  fSlink_s = fClient->GetPicture("slink_s.xpm");
515  fSlink_t = fClient->GetPicture("slink_t.xpm");
516 
517  if (!fFolder_s || !fFolder_t ||
518  !fApp_s || !fApp_t ||
519  !fDoc_s || !fDoc_t ||
520  !fSlink_s || !fSlink_t)
521  Error("TGFileContainer", "required pixmap(s) missing\n");
522 
523  SetWindowName();
524 }
525 
526 ////////////////////////////////////////////////////////////////////////////////
527 /// Create a list view container which will hold the contents of
528 /// the current directory.
529 
531  TGLVContainer(p,options, back)
532 {
534  fFilter = 0;
535  fMtime = 0;
537  fRefresh = new TViewUpdateTimer(this, 1000);
541  fCleanups = new TList;
542 
543  fFolder_s = fClient->GetPicture("folder_s.xpm");
544  fFolder_t = fClient->GetPicture("folder_t.xpm");
545  fApp_s = fClient->GetPicture("app_s.xpm");
546  fApp_t = fClient->GetPicture("app_t.xpm");
547  fDoc_s = fClient->GetPicture("doc_s.xpm");
548  fDoc_t = fClient->GetPicture("doc_t.xpm");
549  fSlink_s = fClient->GetPicture("slink_s.xpm");
550  fSlink_t = fClient->GetPicture("slink_t.xpm");
551 
552  if (!fFolder_s || !fFolder_t ||
553  !fApp_s || !fApp_t ||
554  !fDoc_s || !fDoc_t ||
555  !fSlink_s || !fSlink_t)
556  Error("TGFileContainer", "required pixmap(s) missing\n");
557 
558  SetWindowName();
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 /// Delete list view file container.
563 
565 {
566  if (fRefresh) delete fRefresh;
567  if (fFilter) delete fFilter;
576  if (fCleanups) {
577  TGPicture *pic;
578  TIter nextp(fCleanups);
579  while ((pic = (TGPicture *)nextp())) {
581  }
582  fCleanups->Clear();
583  delete fCleanups;
584  }
585 }
586 
587 ////////////////////////////////////////////////////////////////////////////////
588 /// Add frame to the composite frame.
589 
591 {
592  TGFSFrameElement *nw;
593 
594  nw = new TGFSFrameElement;
595  nw->fFrame = f;
596  nw->fLayout = l ? l : fgDefaultHints;
597  nw->fState = 1;
598  nw->fContainer = this;
599  fList->Add(nw);
600 }
601 
602 ////////////////////////////////////////////////////////////////////////////////
603 /// Refresh container contents. Check every 5 seconds to see if the
604 /// directory modification date has changed.
605 
607 {
608  FileStat_t sbuf;
609 
610  if (gSystem->GetPathInfo(fDirectory, sbuf) == 0)
611  if (fMtime != (ULong_t)sbuf.fMtime) DisplayDirectory();
612 
613  return kTRUE;
614 }
615 
616 ////////////////////////////////////////////////////////////////////////////////
617 /// Set file selection filter.
618 
619 void TGFileContainer::SetFilter(const char *filter)
620 {
621  if (fFilter) delete fFilter;
622  fFilter = new TRegexp(filter, kTRUE);
623 }
624 
625 ////////////////////////////////////////////////////////////////////////////////
626 /// Sort file system list view container according to sortType.
627 
629 {
630  fSortType = sortType;
631 
632  fList->Sort();
633 
634  TGCanvas *canvas = (TGCanvas *) this->GetParent()->GetParent();
635  canvas->Layout();
636 }
637 
638 ////////////////////////////////////////////////////////////////////////////////
639 /// Determine the file picture for the given file type.
640 
642  const TGPicture **lpic, Int_t file_type, Bool_t is_link,
643  const char *name, Bool_t /*small*/)
644 {
645  static TString cached_ext;
646  static const TGPicture *cached_spic = 0;
647  static const TGPicture *cached_lpic = 0;
648  const char *ext = name ? strrchr(name, '.') : 0;
649  *pic = 0;
650  *lpic = 0;
651 
652  if (fCachePictures && ext && cached_spic && cached_lpic && (cached_ext == ext)) {
653  *pic = cached_spic;
654  *lpic = cached_lpic;
655  if (!is_link) return;
656  }
657 
658  if (R_ISREG(file_type)) {
659  TString fname(name);
660  if (is_link && fname.EndsWith(".lnk")) {
661  fname.Remove(fname.Length()-4);
662  }
663  *pic = fClient->GetMimeTypeList()->GetIcon(fname.Data(), kTRUE);
664  *lpic = fClient->GetMimeTypeList()->GetIcon(fname.Data(), kFALSE);
665 
666  if (*pic) {
667  if (!*lpic) *lpic = *pic;
668  if (ext) {
669  cached_ext = ext;
670  cached_spic = *pic;
671  cached_lpic = *lpic;
672  if (!is_link) return;
673  }
674  }
675  } else {
676  *pic = 0;
677  }
678 
679  if (*pic == 0) {
680  *pic = fDoc_t;
681  *lpic = fDoc_s;
682 
683  if (R_ISREG(file_type) && (file_type) & kS_IXUSR) {
684  *pic = fApp_t;
685  *lpic = fApp_s;
686  }
687  if (R_ISDIR(file_type)) {
688  *pic = fFolder_t;
689  *lpic = fFolder_s;
690  }
691  }
692  if (is_link) {
693  TImage *img1, *img2;
694  if (*pic && *lpic) {
695  TString lnk_name;
696  img1 = TImage::Create();
697  if (img1) {
698  img1->SetImage(((const TGPicture *)*pic)->GetPicture(),
699  ((const TGPicture *)*pic)->GetMask());
700  img2 = TImage::Open("slink_t.xpm");
701  if (img2) img1->Merge(img2);
702  lnk_name = ((const TGPicture *)*pic)->GetName();
703  lnk_name.Prepend("lnk_");
704  *pic = fClient->GetPicturePool()->GetPicture(lnk_name.Data(),
705  img1->GetPixmap(), img1->GetMask());
706  fCleanups->Add(((TObject *)*pic));
707  if (img2) delete img2;
708  delete img1;
709  }
710  img1 = TImage::Create();
711  if (img1) {
712  img1->SetImage(((const TGPicture *)*lpic)->GetPicture(),
713  ((const TGPicture *)*lpic)->GetMask());
714  img2 = TImage::Open("slink_s.xpm");
715  if (img2) img1->Merge(img2);
716  lnk_name = ((const TGPicture *)*lpic)->GetName();
717  lnk_name.Prepend("lnk_");
718  *lpic = fClient->GetPicturePool()->GetPicture(lnk_name.Data(),
719  img1->GetPixmap(), img1->GetMask());
720  fCleanups->Add(((TObject *)*lpic));
721  if (img2) delete img2;
722  delete img1;
723  }
724  }
725  else {
726  *pic = fSlink_t;
727  *lpic = fSlink_s;
728  }
729  }
730 
731  cached_lpic = 0;
732  cached_spic = 0;
733  cached_ext = "";
734 }
735 
736 ////////////////////////////////////////////////////////////////////////////////
737 /// Change current directory.
738 
739 void TGFileContainer::ChangeDirectory(const char *path)
740 {
741  TString savdir = gSystem->WorkingDirectory();
742  gSystem->ChangeDirectory(fDirectory.Data()); // so path of ".." will work
743  char *exppath = gSystem->ExpandPathName(path);
744  if (gSystem->ChangeDirectory(exppath)) {
746  gSystem->ChangeDirectory(savdir.Data());
748  }
749  delete[] exppath;
750 }
751 
752 ////////////////////////////////////////////////////////////////////////////////
753 /// Display the contents of the current directory in the container.
754 /// This can be used to refresh the contents of the window.
755 
757 {
758  RemoveAll();
759  CreateFileList();
760 
761  // This automatically calls layout
762  Sort(fSortType);
763 
764  // Make TGExplorerMainFrame display total objects in status bar
766  fTotal, fSelected);
767 
768  MapSubwindows();
769 }
770 
771 ////////////////////////////////////////////////////////////////////////////////
772 /// This function creates the file list from current dir.
773 
775 {
776  TString savdir = gSystem->WorkingDirectory();
777  if (!gSystem->ChangeDirectory(fDirectory.Data())) return;
778 
779  FileStat_t sbuf;
780  if (gSystem->GetPathInfo(".", sbuf) == 0)
781  fMtime = sbuf.fMtime;
782 
783  void *dirp;
784  if ((dirp = gSystem->OpenDirectory(".")) == 0) {
785  gSystem->ChangeDirectory(savdir.Data());
786  return;
787  }
788 
789  const char *name;
790  while ((name = gSystem->GetDirEntry(dirp)) != 0 && fDisplayStat) {
791  if (strcmp(name, ".") && strcmp(name, ".."))
792  AddFile(name);
794  }
795  gSystem->FreeDirectory(dirp);
796 
797  gSystem->ChangeDirectory(savdir.Data());
798 }
799 
800 ////////////////////////////////////////////////////////////////////////////////
801 /// Add file in container.
802 
804  const TGPicture *ilpic)
805 {
806  TString filename;
807  TGFileItem *item = 0;
808  const TGPicture *spic, *slpic;
809  TGPicture *pic, *lpic;
810 
811  FileStat_t sbuf;
812 
813  if (gSystem->GetPathInfo(name, sbuf)) {
814  if (sbuf.fIsLink) {
815  Info("AddFile", "Broken symlink of %s.", name);
816  } else {
817  TString msg;
818  msg.Form("Can't read file attributes of \"%s\": %s.",
819  name, gSystem->GetError());
821  "Error", msg.Data(), kMBIconStop, kMBOk);
822  }
823  return item;
824  }
825 
826  filename = name;
827  if (R_ISDIR(sbuf.fMode) || fFilter == 0 ||
828  (fFilter && filename.Index(*fFilter) != kNPOS)) {
829 
830  if (ipic && ilpic) { // dynamic icons
831  spic = ipic;
832  slpic = ilpic;
833  } else {
834  GetFilePictures(&spic, &slpic, sbuf.fMode, sbuf.fIsLink, name, kTRUE);
835  }
836 
837  pic = (TGPicture*)spic; pic->AddReference();
838  lpic = (TGPicture*)slpic; lpic->AddReference();
839 
840  item = new TGFileItem(this, lpic, slpic, spic, pic,
841  new TGString(gSystem->BaseName(name)),
842  sbuf, fViewMode);
843  AddItem(item);
844  }
845 
846  return item;
847 }
848 
849 ////////////////////////////////////////////////////////////////////////////////
850 /// Add remote file in container.
851 
853  const TGPicture *ilpic)
854 {
855  TString filename;
856  TGFileItem *item = 0;
857  const TGPicture *spic, *slpic;
858  TGPicture *pic, *lpic;
859 
860  FileStat_t sbuf;
861 
862  TRemoteObject *robj = (TRemoteObject *)obj;
863 
864  robj->GetFileStat(&sbuf);
865  filename = robj->GetName();
866 
867  if (R_ISDIR(sbuf.fMode) || fFilter == 0 ||
868  (fFilter && filename.Index(*fFilter) != kNPOS)) {
869 
870  if (ipic && ilpic) { // dynamic icons
871  spic = ipic;
872  slpic = ilpic;
873  } else {
874  GetFilePictures(&spic, &slpic, sbuf.fMode, sbuf.fIsLink, filename, kTRUE);
875  }
876 
877  pic = (TGPicture*)spic; pic->AddReference();
878  lpic = (TGPicture*)slpic; lpic->AddReference();
879 
880  item = new TGFileItem(this, lpic, slpic, spic, pic, new TGString(filename),
881  sbuf, fViewMode);
882  AddItem(item);
883  }
884  return item;
885 }
886 
887 ////////////////////////////////////////////////////////////////////////////////
888 /// stop refresh timer
889 
891 {
892  if (fRefresh) delete fRefresh;
893  fRefresh = 0;
894 }
895 
896 ////////////////////////////////////////////////////////////////////////////////
897 /// start refreshing
898 
900 {
901  fRefresh = new TViewUpdateTimer(this, msec);
903 }
904 
905 ////////////////////////////////////////////////////////////////////////////////
906 /// Save a file container widget as a C++ statement(s) on output stream out.
907 
908 void TGFileContainer::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
909 {
910  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
911 
912  char quote = '"';
913  out << std::endl << " // container frame" << std::endl;
914  out << " TGFileContainer *";
915 
916  if ((fParent->GetParent())->InheritsFrom(TGCanvas::Class())) {
917  out << GetName() << " = new TGFileContainer(" << GetCanvas()->GetName();
918  } else {
919  out << GetName() << " = new TGFileContainer(" << fParent->GetName();
920  out << "," << GetWidth() << "," << GetHeight();
921  }
922 
924  if (GetOptions() == kSunkenFrame) {
925  out <<");" << std::endl;
926  } else {
927  out << "," << GetOptionString() <<");" << std::endl;
928  }
929  } else {
930  out << "," << GetOptionString() << ",ucolor);" << std::endl;
931  }
932  if (option && strstr(option, "keep_names"))
933  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
934  out << " " << GetCanvas()->GetName() << "->SetContainer("
935  << GetName() << ");" << std::endl;
936  out << " " << GetName() << "->DisplayDirectory();" << std::endl;
937  out << " " << GetName() << "->AddFile("<< quote << ".." << quote << ");" << std::endl;
938  out << " " << GetName() << "->StopRefreshTimer();" << std::endl;
939 }
TGWindow::SetWindowName
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:129
l
auto * l
Definition: textangle.C:4
EListViewMode
EListViewMode
Definition: TGListView.h:21
TGContainer::fSelected
Int_t fSelected
number of selected items
Definition: TGCanvas.h:49
TGClient::GetDefaultRoot
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:236
TGFileItem::GetModTime
Long_t GetModTime() const
Definition: TGFSContainer.h:84
TSystem::GetPathInfo
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1397
TGFSFrameElement::IsSortable
Bool_t IsSortable() const
Definition: TGFSContainer.cxx:99
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:225
TViewUpdateTimer::Notify
Bool_t Notify()
Reset the timer.
Definition: TGFSContainer.cxx:243
TGFrameElement::fLayout
TGLayoutHints * fLayout
Definition: TGLayout.h:114
TGLVEntry::fViewMode
EListViewMode fViewMode
list view viewing mode
Definition: TGListView.h:52
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
TBufferIO::WriteObject
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
Definition: TBufferIO.cxx:530
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
R_ISSOCK
Bool_t R_ISSOCK(Int_t mode)
Definition: TSystem.h:121
TGFileContainer::fCachePictures
Bool_t fCachePictures
kTRUE use caching
Definition: TGFSContainer.h:134
TGLVEntry::fFontStruct
FontStruct_t fFontStruct
text font
Definition: TGListView.h:59
TGFileContainer::fFilter
TRegexp * fFilter
file filter
Definition: TGFSContainer.h:121
snprintf
#define snprintf
Definition: civetweb.c:1540
TGFileContainer
Definition: TGFSContainer.h:115
TDNDData::fDataLength
Int_t fDataLength
Length of data.
Definition: TGDNDManager.h:77
TGFileContainer::fDirectory
TString fDirectory
current directory
Definition: TGFSContainer.h:124
kS_ISVTX
@ kS_ISVTX
Definition: TSystem.h:100
TGFileIcon::TGFileIcon
TGFileIcon(const TGWindow *p, const TGPicture *pic, const TGPicture *lpic, UInt_t options=kChildFrame, Pixel_t back=GetWhitePixel())
Definition: TGFSContainer.cxx:86
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
TGFileItem
Definition: TGFSContainer.h:42
f
#define f(i)
Definition: RSha256.hxx:104
TImage::Merge
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition: TImage.h:172
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGFileContainer::fFolder_t
const TGPicture * fFolder_t
small folder icon
Definition: TGFSContainer.h:126
UserGroup_t::fUser
TString fUser
Definition: TSystem.h:141
TSystem::ChangeDirectory
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:862
TGFileContainer::DisplayDirectory
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
Definition: TGFSContainer.cxx:756
TGPicture::GetWidth
UInt_t GetWidth() const
Definition: TGPicture.h:52
R_ISLNK
Bool_t R_ISLNK(Int_t mode)
Definition: TSystem.h:119
kNPOS
const Ssiz_t kNPOS
Definition: RtypesCore.h:124
TImage::Create
static TImage * Create()
Create an image.
Definition: TImage.cxx:35
TString::Prepend
TString & Prepend(const char *cs)
Definition: TString.h:661
TGFileContainer::ChangeDirectory
virtual void ChangeDirectory(const char *path)
Change current directory.
Definition: TGFSContainer.cxx:739
TGFileContainer::CreateFileList
void CreateFileList()
This function creates the file list from current dir.
Definition: TGFSContainer.cxx:774
TSystem::BaseName
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:934
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGFileItem::GetUid
Int_t GetUid() const
Definition: TGFSContainer.h:85
kS_IROTH
@ kS_IROTH
Definition: TSystem.h:110
kLVLargeIcons
@ kLVLargeIcons
Definition: TGListView.h:22
TString::Data
const char * Data() const
Definition: TString.h:369
TSystem::FreeDirectory
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition: TSystem.cxx:845
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGFrameElement::fState
Int_t fState
Definition: TGLayout.h:113
TGFileItem::SetDNDData
void SetDNDData(TDNDData *data)
Set drag and drop data.
Definition: TGFSContainer.cxx:464
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGFileContainer::fRefresh
TViewUpdateTimer * fRefresh
refresh timer
Definition: TGFSContainer.h:122
TGLVContainer::fViewMode
EListViewMode fViewMode
list view viewing mode
Definition: TGListView.h:186
FileStat_t
Definition: TSystem.h:124
TGFrame::fWidth
UInt_t fWidth
frame width
Definition: TGFrame.h:87
FileStat_t::fMtime
Long_t fMtime
Definition: TSystem.h:131
TGMsgBox
Definition: TGMsgBox.h:52
TGFileItem::~TGFileItem
virtual ~TGFileItem()
Destructor.
Definition: TGFSContainer.cxx:411
TGFileContainer::TGFSFrameElement
friend class TGFSFrameElement
Definition: TGFSContainer.h:117
TGIcon.h
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:867
Long64_t
long long Long64_t
Definition: RtypesCore.h:80
TGFileItem::fSize
Long64_t fSize
file size
Definition: TGFSContainer.h:52
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
TGFileItem::DoRedraw
virtual void DoRedraw()
Draw list view container item.
Definition: TGFSContainer.cxx:434
TGFileContainer::fApp_s
const TGPicture * fApp_s
big application icon
Definition: TGFSContainer.h:129
UserGroup_t::fGroup
TString fGroup
Definition: TSystem.h:142
kSortByDate
@ kSortByDate
Definition: TGFSContainer.h:24
kS_ISGID
@ kS_ISGID
Definition: TSystem.h:99
R_ISCHR
Bool_t R_ISCHR(Int_t mode)
Definition: TSystem.h:116
TGFileContainer::fDisplayStat
Bool_t fDisplayStat
kFALSE to interrupt display directory contents in case of many files inside
Definition: TGFSContainer.h:135
TGFileContainer::AddFile
virtual TGFileItem * AddFile(const char *name, const TGPicture *pic=nullptr, const TGPicture *lpic=nullptr)
Add file in container.
Definition: TGFSContainer.cxx:803
TGFileItem::fUid
Int_t fUid
Definition: TGFSContainer.h:49
TGFileItem::fIsLink
Bool_t fIsLink
true if symbolic link
Definition: TGFSContainer.h:50
kS_IXUSR
@ kS_IXUSR
Definition: TSystem.h:104
TGLVEntry
Definition: TGListView.h:36
Int_t
int Int_t
Definition: RtypesCore.h:45
TBuffer::Buffer
char * Buffer() const
Definition: TBuffer.h:96
TImage
An abstract interface to image processing library.
Definition: TImage.h:29
TString::EndsWith
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2202
TSystem::GetError
virtual const char * GetError()
Return system error string.
Definition: TSystem.cxx:252
kCT_SELCHANGED
@ kCT_SELCHANGED
Definition: WidgetMessageTypes.h:56
TGFileItem::HandleDNDEnter
virtual Atom_t HandleDNDEnter(Atom_t *)
Handle drag and drop enter.
Definition: TGFSContainer.cxx:455
TGPicture::Draw
void Draw(Option_t *="")
Default Draw method for all objects.
Definition: TGPicture.h:46
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGCanvas::Layout
virtual void Layout()
Create layout for canvas.
Definition: TGCanvas.cxx:2229
TGFSContainer.h
TGMimeTypes.h
TGFileContainer::fDoc_s
const TGPicture * fDoc_s
big document icon
Definition: TGFSContainer.h:131
TList.h
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
TGFileItem::GetSize
Long64_t GetSize() const
Definition: TGFSContainer.h:83
TVirtualX.h
TGFileContainer::GetFilePictures
virtual void GetFilePictures(const TGPicture **pic, const TGPicture **lpic, Int_t file_type, Bool_t is_link, const char *ext, Bool_t small)
Determine the file picture for the given file type.
Definition: TGFSContainer.cxx:641
TGClient::FreePicture
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:310
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2336
TSystem::GetUserInfo
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
Definition: TSystem.cxx:1598
TGFileItem::fBuf
TBufferFile * fBuf
buffer used for Drag and Drop
Definition: TGFSContainer.h:53
TImage::Open
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
Definition: TImage.cxx:118
TGFileIcon::DoRedraw
virtual void DoRedraw()
Draw icon.
Definition: TGFSContainer.cxx:254
TGDNDManager.h
TGFileContainer::fSlink_s
const TGPicture * fSlink_s
big symbolic link icon
Definition: TGFSContainer.h:133
TGFSFrameElement::Compare
Int_t Compare(const TObject *obj) const
Sort frame elements in file selection list view container.
Definition: TGFSContainer.cxx:106
TString
Basic string class.
Definition: TString.h:136
TGFrame
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
R_ISREG
Bool_t R_ISREG(Int_t mode)
Definition: TSystem.h:118
FileStat_t::fUid
Int_t fUid
Definition: TSystem.h:128
TGFileContainer::~TGFileContainer
virtual ~TGFileContainer()
Delete list view file container.
Definition: TGFSContainer.cxx:564
TGClient::GetPicturePool
TGPicturePool * GetPicturePool() const
Definition: TGClient.h:126
TSystem::AddTimer
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition: TSystem.cxx:473
kS_IWGRP
@ kS_IWGRP
Definition: TSystem.h:107
TRemoteObject.h
bool
TSystem::WorkingDirectory
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:871
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:224
TGCompositeFrame::fList
TList * fList
container of frame elements
Definition: TGFrame.h:292
TGFileItem::GetGid
Int_t GetGid() const
Definition: TGFSContainer.h:86
TGFSFrameElement
Definition: TGFSContainer.cxx:95
TGFrameElement::fFrame
TGFrame * fFrame
Definition: TGLayout.h:112
kSortByOwner
@ kSortByOwner
Definition: TGFSContainer.h:25
TImage.h
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2480
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:197
TList::Sort
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
Definition: TList.cxx:937
TGFileItem::Init
void Init(const TGPicture *blpic, const TGPicture *slpic, FileStat_t &stat, EListViewMode viewMode)
Common initializer for file list view item.
Definition: TGFSContainer.cxx:300
TGIcon
This class handles GUI icons.
Definition: TGIcon.h:22
TDNDData::fDataType
Atom_t fDataType
Data type description.
Definition: TGDNDManager.h:74
TGContainer::fMsgWindow
const TGWindow * fMsgWindow
window handling container messages
Definition: TGCanvas.h:42
TRefCnt::AddReference
void AddReference()
Definition: TRefCnt.h:40
TGString::GetLength
Int_t GetLength() const
Definition: TGString.h:29
TBuffer::Length
Int_t Length() const
Definition: TBuffer.h:100
TRegexp.h
kNone
const Handle_t kNone
Definition: GuiTypes.h:88
TRemoteObject
The TRemoteObject class provides protocol for browsing ROOT objects from a remote ROOT session.
Definition: TRemoteObject.h:34
TString::Form
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2314
calloc
#define calloc
Definition: civetweb.c:1537
TTimer
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
kSortByType
@ kSortByType
Definition: TGFSContainer.h:22
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGFileItem::GetType
Int_t GetType() const
Definition: TGFSContainer.h:82
TGPicturePool::GetPicture
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition: TGPicture.cxx:82
TDNDData::fData
void * fData
Actual data.
Definition: TGDNDManager.h:76
TGFileItem::fType
Int_t fType
file type
Definition: TGFSContainer.h:48
TGFileContainer::SetFilter
virtual void SetFilter(const char *filter)
Set file selection filter.
Definition: TGFSContainer.cxx:619
TSystem.h
h
#define h(i)
Definition: RSha256.hxx:106
size
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
FileStat_t::fMode
Int_t fMode
Definition: TSystem.h:127
TGCompositeFrame::MapSubwindows
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1164
FileStat_t::fGid
Int_t fGid
Definition: TSystem.h:129
FileStat_t::fIsLink
Bool_t fIsLink
Definition: TSystem.h:132
FileStat_t::fSize
Long64_t fSize
Definition: TSystem.h:130
TGObject::fId
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:26
kSortByName
@ kSortByName
Definition: TGFSContainer.h:21
TString::Remove
TString & Remove(Ssiz_t pos)
Definition: TString.h:673
Atom_t
Handle_t Atom_t
WM token.
Definition: GuiTypes.h:37
TGFrame::SendMessage
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:645
TViewUpdateTimer::fContainer
TGFileContainer * fContainer
Definition: TGFSContainer.cxx:69
kS_IWUSR
@ kS_IWUSR
Definition: TSystem.h:103
TGFileContainer::AddRemoteFile
virtual TGFileItem * AddRemoteFile(TObject *obj, const TGPicture *ipic=nullptr, const TGPicture *ilpic=nullptr)
Add remote file in container.
Definition: TGFSContainer.cxx:852
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGFileItem::SetDNDObject
void SetDNDObject(TObject *obj)
Set drag and drop object.
Definition: TGFSContainer.cxx:478
TImage::GetMask
virtual Pixmap_t GetMask()
Definition: TImage.h:236
Long_t
long Long_t
Definition: RtypesCore.h:54
TGFileIcon::fLpic
const TGPicture * fLpic
Definition: TGFSContainer.cxx:81
kS_IXOTH
@ kS_IXOTH
Definition: TSystem.h:112
TGFileContainer::StartRefreshTimer
void StartRefreshTimer(ULong_t msec=1000)
start refreshing
Definition: TGFSContainer.cxx:899
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2453
TGFileContainer::fCleanups
TList * fCleanups
list of pictures to cleanup
Definition: TGFSContainer.h:125
kC_CONTAINER
@ kC_CONTAINER
Definition: WidgetMessageTypes.h:53
TGClient::GetPicture
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:291
TGLVEntry::fSubnames
TGString ** fSubnames
sub names of item (details)
Definition: TGListView.h:44
kS_ISUID
@ kS_ISUID
Definition: TSystem.h:98
TGContainer::GetCanvas
TGCanvas * GetCanvas() const
Definition: TGCanvas.h:99
TGFileItem::fDNDData
TDNDData fDNDData
Drag and Drop data.
Definition: TGFSContainer.h:54
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGLVEntry::SetViewMode
virtual void SetViewMode(EListViewMode viewMode)
Set the view mode for this list item.
Definition: TGListView.cxx:277
TDNDData
Drag and drop data container.
Definition: TGDNDManager.h:64
kS_IRGRP
@ kS_IRGRP
Definition: TSystem.h:106
TSystem::ExpandPathName
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1273
TGFileContainer::fApp_t
const TGPicture * fApp_t
small application icon
Definition: TGFSContainer.h:128
TGFileItem::fSlpic
const TGPicture * fSlpic
small icon
Definition: TGFSContainer.h:46
TGFrame::GetBckgndGC
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:775
unsigned int
kMBOk
@ kMBOk
Definition: TGMsgBox.h:33
TGClient::GetMimeTypeList
TGMimeTypes * GetMimeTypeList() const
Definition: TGClient.h:146
TRegexp
Regular expression class.
Definition: TRegexp.h:31
TViewUpdateTimer
Definition: TGFSContainer.cxx:66
TString::Index
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:639
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
TGFileIcon
Utility class used by the file selection dialog (TGFSDialog).
Definition: TGFSContainer.cxx:78
TGLVEntry::GetItemName
TGString * GetItemName() const
Definition: TGListView.h:88
TGWindow::GetParent
const TGWindow * GetParent() const
Definition: TGWindow.h:76
TViewUpdateTimer::TViewUpdateTimer
TViewUpdateTimer(TGFileContainer *t, Long_t ms)
Definition: TGFSContainer.cxx:72
f1
TF1 * f1
Definition: legend1.C:11
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:374
TGFileContainer::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame.
Definition: TGFSContainer.cxx:590
kS_IWOTH
@ kS_IWOTH
Definition: TSystem.h:111
TSystem::OpenDirectory
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:836
TGFileItem::fLcurrent
const TGPicture * fLcurrent
current icon
Definition: TGFSContainer.h:47
TGFileContainer::fFolder_s
const TGPicture * fFolder_s
big folder icon
Definition: TGFSContainer.h:127
TGLVContainer
Definition: TGListView.h:178
TGCompositeFrame::fgDefaultHints
static TGLayoutHints * fgDefaultHints
Definition: TGFrame.h:297
TGFileContainer::Sort
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
Definition: TGFSContainer.cxx:628
TGMsgBox.h
kSortByGroup
@ kSortByGroup
Definition: TGFSContainer.h:26
TGObject::fClient
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
TGWindow::GetMainFrame
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:152
R_ISDIR
Bool_t R_ISDIR(Int_t mode)
Definition: TSystem.h:115
TGFileContainer::TGFileContainer
TGFileContainer(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=kSunkenFrame, Pixel_t back=GetDefaultFrameBackground())
Create a list view container which will hold the contents of the current directory.
Definition: TGFSContainer.cxx:494
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TSystem::GetDirEntry
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition: TSystem.cxx:853
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TBufferFile.h
TGFileItem::TGFileItem
TGFileItem(const TGWindow *p=nullptr, const TGPicture *bpic=nullptr, const TGPicture *blpic=nullptr, const TGPicture *spic=nullptr, const TGPicture *slpic=nullptr, TGString *name=nullptr, Int_t type=0, Long64_t size=1, Int_t uid=0, Int_t gid=0, Long_t modtime=0, EListViewMode viewMode=kLVList, UInt_t options=kVerticalFrame, Pixel_t back=GetWhitePixel())
Create a list view item.
Definition: TGFSContainer.cxx:264
UserGroup_t
Definition: TSystem.h:138
TImage::GetPixmap
virtual Pixmap_t GetPixmap()
Definition: TImage.h:235
TList::Clear
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:402
name
char name[80]
Definition: TGX11.cxx:110
kS_IXGRP
@ kS_IXGRP
Definition: TSystem.h:108
R_ISBLK
Bool_t R_ISBLK(Int_t mode)
Definition: TSystem.h:117
TGFrame::GetWhitePixel
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
TGFrameElement
Definition: TGLayout.h:105
TGFileItem::SetViewMode
virtual void SetViewMode(EListViewMode viewMode)
Set container item view mode.
Definition: TGFSContainer.cxx:419
TGString::GetString
const char * GetString() const
Definition: TGString.h:30
TIter
Definition: TCollection.h:233
TGFileItem::fBlpic
const TGPicture * fBlpic
big icon
Definition: TGFSContainer.h:45
TGLVEntry::fCtw
Int_t * fCtw
width of sub names
Definition: TGListView.h:47
TGFileContainer::fSortType
EFSSortMode fSortType
sorting mode of contents
Definition: TGFSContainer.h:120
EFSSortMode
EFSSortMode
Definition: TGFSContainer.h:20
TImage::SetImage
virtual void SetImage(const Double_t *, UInt_t, UInt_t, TImagePalette *=0)
Definition: TImage.h:116
TGFileContainer::fDoc_t
const TGPicture * fDoc_t
small document icon
Definition: TGFSContainer.h:130
kSortBySize
@ kSortBySize
Definition: TGFSContainer.h:23
TGFileContainer::fMtime
ULong_t fMtime
directory modification time
Definition: TGFSContainer.h:123
TGFileContainer::HandleTimer
virtual Bool_t HandleTimer(TTimer *t)
Refresh container contents.
Definition: TGFSContainer.cxx:606
TGeant4Unit::ms
static constexpr double ms
Definition: TGeant4SystemOfUnits.h:163
TGFrame::fHeight
UInt_t fHeight
frame height
Definition: TGFrame.h:88
R_ISFIFO
Bool_t R_ISFIFO(Int_t mode)
Definition: TSystem.h:120
TGFrame::fBackground
Pixel_t fBackground
frame background color
Definition: TGFrame.h:95
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
type
int type
Definition: TGX11.cxx:121
TGFSFrameElement::fContainer
TGFileContainer * fContainer
Definition: TGFSContainer.cxx:97
free
#define free
Definition: civetweb.c:1539
Class
void Class()
Definition: Class.C:29
TGFileContainer::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a file container widget as a C++ statement(s) on output stream out.
Definition: TGFSContainer.cxx:908
TGPicturePool::FreePicture
void FreePicture(const TGPicture *pic)
Remove picture from cache if nobody is using it anymore.
Definition: TGPicture.cxx:277
TGCanvas
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
TTimer::Reset
void Reset()
Reset the timer.
Definition: TTimer.cxx:157
TGPicture::GetHeight
UInt_t GetHeight() const
Definition: TGPicture.h:53
TGContainer::RemoveAll
virtual void RemoveAll()
Remove all items from the container.
Definition: TGCanvas.cxx:641
TGContainer::fTotal
Int_t fTotal
total items
Definition: TGCanvas.h:48
kMBIconStop
@ kMBIconStop
Definition: TGMsgBox.h:22
TGLVContainer::AddItem
virtual void AddItem(TGLVEntry *item)
Definition: TGListView.h:207
kS_IRUSR
@ kS_IRUSR
Definition: TSystem.h:102
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TGLVEntry::fNormGC
GContext_t fNormGC
drawing graphics context
Definition: TGListView.h:58
TSystem::ProcessEvents
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:418
TGFileItem::fGid
Int_t fGid
file uid and gid
Definition: TGFSContainer.h:49
TGFileContainer::StopRefreshTimer
void StopRefreshTimer()
stop refresh timer
Definition: TGFSContainer.cxx:890
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:108
TGWindow::fParent
const TGWindow * fParent
Parent window.
Definition: TGWindow.h:28
TGMimeTypes::GetIcon
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
Definition: TGMimeTypes.cxx:203
TGLVEntry::DoRedraw
virtual void DoRedraw()
Redraw list view item.
Definition: TGListView.cxx:320
TList
A doubly linked list.
Definition: TList.h:44
TGFileContainer::fSlink_t
const TGPicture * fSlink_t
small symbolic link icon
Definition: TGFSContainer.h:132
TGFileItem::fModTime
Long_t fModTime
modification time
Definition: TGFSContainer.h:51
TRemoteObject::GetFileStat
Bool_t GetFileStat(FileStat_t *sbuf)
Get remote file status.
Definition: TRemoteObject.cxx:194
kChildFrame
@ kChildFrame
Definition: GuiTypes.h:379
int
TGFrame::IsDNDTarget
Bool_t IsDNDTarget() const
Definition: TGFrame.h:273
TGIcon::DoRedraw
virtual void DoRedraw()
Redraw picture.
Definition: TGIcon.cxx:126