/usr/include/root/TGFSContainer.h is in libroot-gui-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | // @(#)root/gui:$Id$
// Author: Fons Rademakers 19/01/98
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGFSContainer
#define ROOT_TGFSContainer
//////////////////////////////////////////////////////////////////////////
// //
// TGFileIcon, TGFileEntry, TGFSContainer //
// //
// Utility classes used by the file selection dialog (TGFileDialog). //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TGListView
#include "TGListView.h"
#endif
#ifndef ROOT_TDNDManager
#include "TGDNDManager.h"
#endif
#ifndef ROOT_TBufferFile
#include "TBufferFile.h"
#endif
#include <stdlib.h>
//----- file sort mode
enum EFSSortMode {
kSortByName,
kSortByType,
kSortBySize,
kSortByDate,
kSortByOwner,
kSortByGroup
};
class TRegexp;
class TGPicture;
class TGFileContainer;
class TViewUpdateTimer;
class TGFileIcon;
class TGFileItem;
class TTimer;
class TString;
struct FileStat_t;
class TGFileItem : public TGLVEntry {
protected:
const TGPicture *fBlpic; // big icon
const TGPicture *fSlpic; // small icon
const TGPicture *fLcurrent; // current icon
Int_t fType; // file type
Int_t fUid, fGid; // file uid and gid
Bool_t fIsLink; // true if symbolic link
Long_t fModTime; // modification time
Long64_t fSize; // file size
TBufferFile *fBuf; // buffer used for Drag and Drop
TDNDData fDNDData; // Drag and Drop data
void Init(const TGPicture *blpic, const TGPicture *slpic,
FileStat_t &stat, EListViewMode viewMode);
virtual void DoRedraw();
public:
TGFileItem(const TGWindow *p = 0,
const TGPicture *bpic = 0, const TGPicture *blpic = 0,
const TGPicture *spic = 0, const TGPicture *slpic = 0,
TGString *name = 0, 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());
TGFileItem(const TGWindow *p,
const TGPicture *bpic, const TGPicture *blpic,
const TGPicture *spic, const TGPicture *slpic,
TGString *name, FileStat_t &stat,
EListViewMode viewMode = kLVList, UInt_t options = kVerticalFrame,
Pixel_t back = GetWhitePixel());
virtual ~TGFileItem();
virtual void SetViewMode(EListViewMode viewMode);
Bool_t IsActive() const { return fActive; }
Bool_t IsSymLink() const { return fIsLink; }
Int_t GetType() const { return fType; }
Long64_t GetSize() const { return fSize; }
Long_t GetModTime() const { return fModTime; }
Int_t GetUid() const { return fUid; }
Int_t GetGid() const { return fGid; }
virtual TDNDData *GetDNDdata(Atom_t) {
return &fDNDData;
}
virtual Atom_t HandleDNDEnter(Atom_t *) {
if (!IsDNDTarget()) return kNone;
return gVirtualX->InternAtom("application/root", kFALSE);
}
virtual Bool_t HandleDNDLeave() {
return kTRUE;
}
virtual Atom_t HandleDNDPosition(int, int, Atom_t action, int, int) {
if (action == TGDNDManager::GetDNDActionCopy()) return action;
return kNone;
}
virtual Bool_t HandleDNDFinished() {
return ((TGFrame *)(const_cast<TGWindow*>(GetParent())))->HandleDNDFinished();
}
void SetDNDData(TDNDData *data) {
if (fDNDData.fDataLength > 0)
free(fDNDData.fData);
fDNDData.fData = calloc(sizeof(unsigned char), data->fDataLength);
if (fDNDData.fData)
memcpy(fDNDData.fData, data->fData, data->fDataLength);
fDNDData.fDataLength = data->fDataLength;
fDNDData.fDataType = data->fDataType;
}
void SetDNDObject(TObject *obj) {
if (fDNDData.fDataLength)
free(fDNDData.fData);
fBuf->WriteObject(obj);
fDNDData.fData = fBuf->Buffer();
fDNDData.fDataLength = fBuf->Length();
fDNDData.fDataType = gVirtualX->InternAtom("application/root", kFALSE);
}
ClassDef(TGFileItem,0) // Class representing file system object
};
class TGFileContainer : public TGLVContainer {
friend class TGFSFrameElement;
protected:
EFSSortMode fSortType; // sorting mode of contents
TRegexp *fFilter; // file filter
TViewUpdateTimer *fRefresh; // refresh timer
ULong_t fMtime; // directory modification time
TString fDirectory; // current directory
TList *fCleanups; // list of pictures to cleanup
const TGPicture *fFolder_t; // small folder icon
const TGPicture *fFolder_s; // big folder icon
const TGPicture *fApp_t; // small application icon
const TGPicture *fApp_s; // big application icon
const TGPicture *fDoc_t; // small document icon
const TGPicture *fDoc_s; // big document icon
const TGPicture *fSlink_t; // small symbolic link icon
const TGPicture *fSlink_s; // big symbolic link icon
Bool_t fCachePictures; // kTRUE use caching
Bool_t fDisplayStat; // kFALSE to interrupt display directory
// contents in case of many files inside
void CreateFileList();
public:
TGFileContainer(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1,
UInt_t options = kSunkenFrame,
Pixel_t back = GetDefaultFrameBackground());
TGFileContainer(TGCanvas *p, UInt_t options = kSunkenFrame,
Pixel_t back = GetDefaultFrameBackground());
virtual ~TGFileContainer();
virtual Bool_t HandleTimer(TTimer *t);
void StopRefreshTimer();
void StartRefreshTimer(ULong_t msec=1000);
virtual TGFileItem *AddFile(const char *name, const TGPicture *pic = 0, const TGPicture *lpic = 0);
virtual TGFileItem *AddRemoteFile(TObject *obj, const TGPicture *ipic = 0, const TGPicture *ilpic = 0);
virtual void AddFrame(TGFrame *f, TGLayoutHints *l = 0);
virtual void Sort(EFSSortMode sortType);
virtual void SetFilter(const char *filter);
virtual void ChangeDirectory(const char *path);
virtual void DisplayDirectory();
virtual void SetDisplayStat(Bool_t stat = kTRUE) { fDisplayStat = stat; }
Bool_t GetDisplayStat() { return fDisplayStat; }
const char *GetDirectory() const { return fDirectory.Data(); }
virtual void GetFilePictures(const TGPicture **pic, const TGPicture **lpic,
Int_t file_type, Bool_t is_link, const char *ext,
Bool_t small);
virtual void SavePrimitive(ostream &out, Option_t *option = "");
ClassDef(TGFileContainer,0) // Container containing file system objects
};
#endif
|