File indexing completed on 2025-01-18 10:11:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGFileBrowser
0013 #define ROOT_TGFileBrowser
0014
0015 #include "TGFrame.h"
0016
0017 #include "TBrowserImp.h"
0018
0019 #include <list>
0020 #include <map>
0021 #include <string>
0022
0023 class TGCanvas;
0024 class TGListTree;
0025 class TGListTreeItem;
0026 class TGPicture;
0027 class TGComboBox;
0028 class TContextMenu;
0029 class TRegexp;
0030 class TString;
0031 class TRootBrowser;
0032 class TSystemDirectory;
0033 class TSystemFile;
0034 class TGPictureButton;
0035
0036 class TGFileBrowser : public TGMainFrame, public TBrowserImp {
0037
0038 public:
0039 typedef std::list<TGListTreeItem*> sLTI_t;
0040 typedef sLTI_t::iterator sLTI_i;
0041 typedef sLTI_t::reverse_iterator sLTI_ri;
0042 typedef std::map<TGListTreeItem*, std::string> mFiltered_t;
0043
0044 protected:
0045 TRootBrowser *fNewBrowser;
0046 TGHorizontalFrame *fTopFrame;
0047 TGHorizontalFrame *fBotFrame;
0048 TGCanvas *fCanvas;
0049 TGListTree *fListTree;
0050 TGListTreeItem *fListLevel;
0051 TGListTreeItem *fCurrentDir;
0052 TGListTreeItem *fRootDir;
0053 TGComboBox *fDrawOption;
0054 TGComboBox *fFileType;
0055 TContextMenu *fContextMenu;
0056 TGPictureButton *fSortButton;
0057 TGPictureButton *fRefreshButton;
0058 TGPictureButton *fFilterButton;
0059 const TGPicture *fRootIcon;
0060 const TGPicture *fFileIcon;
0061 const TGPicture *fCachedPic;
0062 TString fCachedPicName;
0063 TRegexp *fFilter;
0064 TSystemDirectory *fDir;
0065 TSystemFile *fFile;
0066 Int_t fGroupSize;
0067 Long_t fNKeys, fCnt;
0068 Bool_t fGrouped;
0069 Bool_t fShowHidden;
0070 Bool_t fDblClick;
0071
0072 sLTI_t fSortedItems;
0073 mFiltered_t fFilteredItems;
0074 TString fFilterStr;
0075
0076 void CreateBrowser();
0077
0078 public:
0079 TGFileBrowser(const TGWindow *p, TBrowser *b = nullptr, UInt_t w = 200, UInt_t h = 400);
0080 ~TGFileBrowser() override;
0081
0082 void Add(TObject *obj, const char *name = nullptr, Int_t check = -1) override;
0083 void BrowseObj(TObject *obj) override;
0084 void RecursiveRemove(TObject *obj) override;
0085 void Refresh(Bool_t force = kFALSE) override;
0086 void Show() override { MapRaised(); }
0087 Option_t *GetDrawOption() const override;
0088
0089 TRootBrowser *GetNewBrowser() const { return fNewBrowser; }
0090 void SetNewBrowser(TRootBrowser* b) { fNewBrowser = b; }
0091
0092 void AddFSDirectory(const char* entry, const char* path = nullptr, Option_t *opt = "");
0093 void AddKey(TGListTreeItem *itm, TObject *obj, const char *name = nullptr);
0094 void AddRemoteFile(TObject *obj);
0095 void ApplyFilter(Int_t id);
0096 void Chdir(TGListTreeItem *item);
0097 void Checked(TObject *obj, Bool_t check);
0098 Bool_t CheckFiltered(TGListTreeItem *item, Bool_t but = kFALSE);
0099 void CheckRemote(TGListTreeItem *item);
0100 Bool_t CheckSorted(TGListTreeItem *item, Bool_t but = kFALSE);
0101 void Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y);
0102 TString DirName(TGListTreeItem* item);
0103 TString FullPathName(TGListTreeItem* item);
0104 void DoubleClicked(TGListTreeItem *item, Int_t btn);
0105 Long_t XXExecuteDefaultAction(TObject *obj);
0106 char *FormatFileInfo(const char *fname, Long64_t size, Long_t modtime);
0107 void GetFilePictures(const TGPicture **pic, Int_t file_type, Bool_t is_link, const char *name);
0108 void GetObjPicture(const TGPicture **pic, TObject *obj);
0109 void GotoDir(const char *path);
0110 void PadModified();
0111 void RequestFilter();
0112 void Selected(char *);
0113 void ToggleSort();
0114 void Update();
0115
0116 TGListTree *GetListTree() const { return fListTree; }
0117 TGListTreeItem *GetRootDir() const { return fRootDir; }
0118
0119 ClassDefOverride(TGFileBrowser, 0)
0120 };
0121
0122 #endif