Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGFSContainer.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 19/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, 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#ifndef ROOT_TGFSContainer
13#define ROOT_TGFSContainer
14
15
16#include "TGListView.h"
17#include "TGDNDManager.h"
18
19//----- file sort mode
27};
28
29
30class TRegexp;
31class TGPicture;
32class TGFileContainer;
34class TGFileIcon;
35class TGFileItem;
36class TTimer;
37class TString;
38class TBufferFile;
39struct FileStat_t;
40
41
42class TGFileItem : public TGLVEntry {
43
44protected:
45 const TGPicture *fBlpic; ///< big icon
46 const TGPicture *fSlpic; ///< small icon
47 const TGPicture *fLcurrent; ///< current icon
48 Int_t fType; ///< file type
49 Int_t fUid, fGid; ///< file uid and gid
50 Bool_t fIsLink; ///< true if symbolic link
51 Long_t fModTime; ///< modification time
52 Long64_t fSize; ///< file size
53 TBufferFile *fBuf; ///< buffer used for Drag and Drop
54 TDNDData fDNDData; ///< Drag and Drop data
55
56 void Init(const TGPicture *blpic, const TGPicture *slpic,
57 FileStat_t &stat, EListViewMode viewMode);
58 virtual void DoRedraw();
59
60public:
61 TGFileItem(const TGWindow *p = nullptr,
62 const TGPicture *bpic = nullptr, const TGPicture *blpic = nullptr,
63 const TGPicture *spic = nullptr, const TGPicture *slpic = nullptr,
64 TGString *name = nullptr, Int_t type = 0, Long64_t size = 1,
65 Int_t uid = 0, Int_t gid = 0, Long_t modtime = 0,
66 EListViewMode viewMode = kLVList, UInt_t options = kVerticalFrame,
67 Pixel_t back = GetWhitePixel());
68
69 TGFileItem(const TGWindow *p,
70 const TGPicture *bpic, const TGPicture *blpic,
71 const TGPicture *spic, const TGPicture *slpic,
72 TGString *name, FileStat_t &stat,
73 EListViewMode viewMode = kLVList, UInt_t options = kVerticalFrame,
74 Pixel_t back = GetWhitePixel());
75
76 virtual ~TGFileItem();
77
78 virtual void SetViewMode(EListViewMode viewMode);
79
80 Bool_t IsActive() const { return fActive; }
81 Bool_t IsSymLink() const { return fIsLink; }
82 Int_t GetType() const { return fType; }
83 Long64_t GetSize() const { return fSize; }
84 Long_t GetModTime() const { return fModTime; }
85 Int_t GetUid() const { return fUid; }
86 Int_t GetGid() const { return fGid; }
87
89 return &fDNDData;
90 }
91
92 virtual Atom_t HandleDNDEnter(Atom_t *);
93
95 return kTRUE;
96 }
97
98 virtual Atom_t HandleDNDPosition(int, int, Atom_t action, int, int) {
99 if (action == TGDNDManager::GetDNDActionCopy()) return action;
100 return kNone;
101 }
102
104 return ((TGFrame *)(const_cast<TGWindow*>(GetParent())))->HandleDNDFinished();
105 }
106
107 void SetDNDData(TDNDData *data);
108
109 void SetDNDObject(TObject *obj);
110
111 ClassDef(TGFileItem,0) // Class representing file system object
112};
113
114
116
117friend class TGFSFrameElement;
118
119protected:
120 EFSSortMode fSortType; ///< sorting mode of contents
121 TRegexp *fFilter; ///< file filter
122 TViewUpdateTimer *fRefresh; ///< refresh timer
123 ULong_t fMtime; ///< directory modification time
124 TString fDirectory; ///< current directory
125 TList *fCleanups; ///< list of pictures to cleanup
126 const TGPicture *fFolder_t; ///< small folder icon
127 const TGPicture *fFolder_s; ///< big folder icon
128 const TGPicture *fApp_t; ///< small application icon
129 const TGPicture *fApp_s; ///< big application icon
130 const TGPicture *fDoc_t; ///< small document icon
131 const TGPicture *fDoc_s; ///< big document icon
132 const TGPicture *fSlink_t; ///< small symbolic link icon
133 const TGPicture *fSlink_s; ///< big symbolic link icon
134 Bool_t fCachePictures; ///< kTRUE use caching
135 Bool_t fDisplayStat; ///< kFALSE to interrupt display directory
136 ///< contents in case of many files inside
137
138 void CreateFileList();
139
140public:
141 TGFileContainer(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
142 UInt_t options = kSunkenFrame,
146
147 virtual ~TGFileContainer();
148
149 virtual Bool_t HandleTimer(TTimer *t);
150 void StopRefreshTimer();
151 void StartRefreshTimer(ULong_t msec=1000);
152
153 virtual TGFileItem *AddFile(const char *name, const TGPicture *pic = nullptr, const TGPicture *lpic = nullptr);
154 virtual TGFileItem *AddRemoteFile(TObject *obj, const TGPicture *ipic = nullptr, const TGPicture *ilpic = nullptr);
155 virtual void AddFrame(TGFrame *f, TGLayoutHints *l = nullptr);
156 virtual void Sort(EFSSortMode sortType);
157 virtual void SetFilter(const char *filter);
158 virtual void ChangeDirectory(const char *path);
159 virtual void DisplayDirectory();
160 virtual void SetDisplayStat(Bool_t stat = kTRUE) { fDisplayStat = stat; }
162
163 const char *GetDirectory() const { return fDirectory.Data(); }
164
165 virtual void GetFilePictures(const TGPicture **pic, const TGPicture **lpic,
166 Int_t file_type, Bool_t is_link, const char *ext,
167 Bool_t small);
168
169 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
170
171 ClassDef(TGFileContainer,0) // Container containing file system objects
172};
173
174#endif
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
const Handle_t kNone
Definition GuiTypes.h:88
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define f(i)
Definition RSha256.hxx:104
#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
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:80
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
EFSSortMode
@ kSortByDate
@ kSortByOwner
@ kSortByName
@ kSortByGroup
@ kSortByType
@ kSortBySize
EListViewMode
Definition TGListView.h:21
@ kLVList
Definition TGListView.h:24
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
Definition TBufferFile.h:47
Drag and drop data container.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
static Atom_t GetDNDActionCopy()
const TGPicture * fSlink_s
big symbolic link icon
void CreateFileList()
This function creates the file list from current dir.
const TGPicture * fFolder_s
big folder icon
TList * fCleanups
list of pictures to cleanup
TString fDirectory
current directory
TViewUpdateTimer * fRefresh
refresh timer
void StopRefreshTimer()
stop refresh timer
virtual Bool_t HandleTimer(TTimer *t)
Refresh container contents.
virtual void SetDisplayStat(Bool_t stat=kTRUE)
const TGPicture * fDoc_t
small document icon
const TGPicture * fApp_t
small application icon
const TGPicture * fApp_s
big application icon
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
const TGPicture * fDoc_s
big document icon
Bool_t fCachePictures
kTRUE use caching
virtual void ChangeDirectory(const char *path)
Change current directory.
const TGPicture * fSlink_t
small symbolic link icon
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
ULong_t fMtime
directory modification time
virtual TGFileItem * AddFile(const char *name, const TGPicture *pic=nullptr, const TGPicture *lpic=nullptr)
Add file in container.
virtual TGFileItem * AddRemoteFile(TObject *obj, const TGPicture *ipic=nullptr, const TGPicture *ilpic=nullptr)
Add remote file in container.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a file container widget as a C++ statement(s) on output stream out.
void StartRefreshTimer(ULong_t msec=1000)
start refreshing
const TGPicture * fFolder_t
small folder icon
TRegexp * fFilter
file filter
Bool_t fDisplayStat
kFALSE to interrupt display directory contents in case of many files inside
virtual ~TGFileContainer()
Delete list view file container.
virtual void SetFilter(const char *filter)
Set file selection filter.
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.
Bool_t GetDisplayStat()
EFSSortMode fSortType
sorting mode of contents
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame.
const char * GetDirectory() const
Utility class used by the file selection dialog (TGFSDialog).
Int_t fGid
file uid and gid
Int_t GetUid() const
Long64_t fSize
file size
const TGPicture * fLcurrent
current icon
Int_t GetGid() const
TBufferFile * fBuf
buffer used for Drag and Drop
Bool_t IsActive() const
const TGPicture * fBlpic
big icon
void Init(const TGPicture *blpic, const TGPicture *slpic, FileStat_t &stat, EListViewMode viewMode)
Common initializer for file list view item.
virtual Atom_t HandleDNDPosition(int, int, Atom_t action, int, int)
Long_t fModTime
modification time
const TGPicture * fSlpic
small icon
Long64_t GetSize() const
void SetDNDObject(TObject *obj)
Set drag and drop object.
TDNDData fDNDData
Drag and Drop data.
Long_t GetModTime() const
Int_t fType
file type
Int_t GetType() const
virtual void DoRedraw()
Draw list view container item.
void SetDNDData(TDNDData *data)
Set drag and drop data.
virtual TDNDData * GetDNDdata(Atom_t)
virtual void SetViewMode(EListViewMode viewMode)
Set container item view mode.
virtual Atom_t HandleDNDEnter(Atom_t *)
Handle drag and drop enter.
virtual Bool_t HandleDNDFinished()
virtual Bool_t HandleDNDLeave()
Bool_t IsSymLink() const
Bool_t fIsLink
true if symbolic link
virtual ~TGFileItem()
Destructor.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
Bool_t fActive
true if item is active
Definition TGListView.h:50
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
ROOT GUI Window base class.
Definition TGWindow.h:23
const TGWindow * GetParent() const
Definition TGWindow.h:76
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
Regular expression class.
Definition TRegexp.h:31
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
auto * l
Definition textangle.C:4