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 void DoRedraw() override;
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 void SetViewMode(EListViewMode viewMode) override;
79
80 Bool_t IsActive() const override { 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 Atom_t HandleDNDEnter(Atom_t *) override;
93
95 return kTRUE;
96 }
97
98 Atom_t HandleDNDPosition(int, int, Atom_t action, int, int) override {
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 ClassDefOverride(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 Bool_t HandleTimer(TTimer *t) override;
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 void AddFrame(TGFrame *f, TGLayoutHints *l = nullptr) override;
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 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
170
171 ClassDefOverride(TGFileContainer,0) // Container containing file system objects
172};
173
174#endif
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
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
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
unsigned long ULong_t
Definition RtypesCore.h:55
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
EFSSortMode
@ kSortByDate
@ kSortByOwner
@ kSortByName
@ kSortByGroup
@ kSortByType
@ kSortBySize
EListViewMode
Definition TGListView.h:21
@ kLVList
Definition TGListView.h:24
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 data
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 ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
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
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a file container widget as a C++ statement(s) on output stream out.
Bool_t HandleTimer(TTimer *t) override
Refresh container contents.
TList * fCleanups
list of pictures to cleanup
TString fDirectory
current directory
TViewUpdateTimer * fRefresh
refresh timer
void StopRefreshTimer()
stop refresh timer
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
void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr) override
Add frame to the composite frame.
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.
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
const char * GetDirectory() const
Utility class used by the file selection dialog (TGFSDialog).
Int_t fGid
file uid and gid
void DoRedraw() override
Draw list view container item.
Int_t GetUid() const
Long64_t fSize
file size
const TGPicture * fLcurrent
current icon
void SetViewMode(EListViewMode viewMode) override
Set container item view mode.
Int_t GetGid() const
TBufferFile * fBuf
buffer used for Drag and Drop
const TGPicture * fBlpic
big icon
Atom_t HandleDNDEnter(Atom_t *) override
Handle drag and drop enter.
void Init(const TGPicture *blpic, const TGPicture *slpic, FileStat_t &stat, EListViewMode viewMode)
Common initializer for file list view item.
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.
Atom_t HandleDNDPosition(int, int, Atom_t action, int, int) override
Bool_t HandleDNDFinished() override
Long_t GetModTime() const
Int_t fType
file type
Int_t GetType() const
void SetDNDData(TDNDData *data)
Set drag and drop data.
virtual TDNDData * GetDNDdata(Atom_t)
Bool_t HandleDNDLeave() override
Bool_t IsSymLink() const
Bool_t fIsLink
true if symbolic link
Bool_t IsActive() const override
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:83
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:139
const char * Data() const
Definition TString.h:380
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
TLine l
Definition textangle.C:4