TGFileBrowser.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGFileBrowser.h 33618 2010-05-27 06:51:26Z bellenot $
00002 // Author: Bertrand Bellenot   26/09/2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGFileBrowser
00013 #define ROOT_TGFileBrowser
00014 
00015 #ifndef ROOT_TGFrame
00016 #include "TGFrame.h"
00017 #endif
00018 
00019 #ifndef ROOT_TBrowserImp
00020 #include "TBrowserImp.h"
00021 #endif
00022 
00023 #include <list>
00024 
00025 class TGCanvas;
00026 class TGListTree;
00027 class TGListTreeItem;
00028 class TGPicture;
00029 class TGComboBox;
00030 class TContextMenu;
00031 class TRegexp;
00032 class TString;
00033 class TRootBrowser;
00034 class TSystemDirectory;
00035 class TSystemFile;
00036 
00037 class TGFileBrowser : public TGMainFrame, public TBrowserImp {
00038 
00039 public:
00040    typedef std::list<TGListTreeItem*> sLTI_t;
00041    typedef sLTI_t::iterator           sLTI_i;
00042    typedef sLTI_t::reverse_iterator   sLTI_ri;
00043 
00044 protected:
00045    TRootBrowser      *fNewBrowser;        // Pointer back to the Browser
00046    TGHorizontalFrame *fTopFrame;          // Top horizontal frame
00047    TGHorizontalFrame *fBotFrame;          // Bottom horizontal frame
00048    TGCanvas          *fCanvas;            // Canvas for the list tree
00049    TGListTree        *fListTree;          // Main list tree
00050    TGListTreeItem    *fListLevel;         // Current list tree level
00051    TGListTreeItem    *fCurrentDir;        // Current (list tree) directory
00052    TGListTreeItem    *fRootDir;           // Root (list tree) directory
00053    TGComboBox        *fDrawOption;        // Draw options combobox
00054    TGComboBox        *fFileType;          // File type combobox
00055    TContextMenu      *fContextMenu;       // pointer to context menu
00056    TGPictureButton   *fSortButton;        // "Sort" button 
00057    TGPictureButton   *fRefreshButton;     // "Refresh" button 
00058    const TGPicture   *fRootIcon;          // Root files icon
00059    const TGPicture   *fFileIcon;          // System files icon
00060    const TGPicture   *fCachedPic;         // Cached picture
00061    TString            fCachedPicName;     // Cached picture name
00062    TRegexp           *fFilter;            // Regular expression used to filter files
00063    TSystemDirectory  *fDir;               // Actual (selected) system directory
00064    TSystemFile       *fFile;              // Actual (selected) system file
00065    Int_t              fGroupSize;         // total number of items when icon box switched to "global view" mode
00066    Long_t             fNKeys, fCnt;       // Counters for keys inside a Root file
00067    Bool_t             fGrouped;           // kTRUE if Root file content (keys) is grouped
00068    Bool_t             fShowHidden;        // kTRUE to display hidden files
00069    Bool_t             fDblClick;          // kTRUE if user double-clicked on a list tree item
00070 
00071    sLTI_t             fSortedItems;       // List of sorted list-tree items.
00072 
00073    void CreateBrowser();
00074 
00075 public:
00076    TGFileBrowser(const TGWindow *p, TBrowser* b=0, UInt_t w=200, UInt_t h=400);
00077    virtual ~TGFileBrowser();
00078 
00079    virtual void Add(TObject *obj, const char *name = 0, Int_t check = -1);
00080    virtual void BrowseObj(TObject *obj);
00081    virtual void RecursiveRemove(TObject *obj);
00082    virtual void Refresh(Bool_t force = kFALSE);
00083    virtual void Show() { MapRaised(); }
00084    Option_t    *GetDrawOption() const;
00085 
00086    TRootBrowser *GetNewBrowser() const          { return fNewBrowser; }
00087    void          SetNewBrowser(TRootBrowser* b) { fNewBrowser = b;    }
00088 
00089    void        AddFSDirectory(const char* entry, const char* path=0, Option_t *opt="");
00090    void        AddKey(TGListTreeItem *itm, TObject *obj, const char *name = 0);
00091    void        AddRemoteFile(TObject *obj);
00092    void        ApplyFilter(Int_t id);
00093    void        Chdir(TGListTreeItem *item);
00094    void        Checked(TObject *obj, Bool_t check);
00095    void        CheckRemote(TGListTreeItem *item);
00096    Bool_t      CheckSorted(TGListTreeItem *item, Bool_t but = kFALSE);
00097    void        Clicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y);
00098    TString     DirName(TGListTreeItem* item);
00099    TString     FullPathName(TGListTreeItem* item);
00100    void        DoubleClicked(TGListTreeItem *item, Int_t btn);
00101    Long_t      XXExecuteDefaultAction(TObject *obj);
00102    char       *FormatFileInfo(const char *fname, Long64_t size, Long_t modtime);
00103    void        GetFilePictures(const TGPicture **pic, Int_t file_type, Bool_t is_link, const char *name);
00104    void        GetObjPicture(const TGPicture **pic, TObject *obj);
00105    void        GotoDir(const char *path);
00106    void        PadModified();
00107    void        Selected(char *);
00108    void        ToggleSort();
00109    void        Update();
00110 
00111    ClassDef(TGFileBrowser, 0) // File browser.
00112 };
00113 
00114 #endif

Generated on Tue Jul 5 14:19:55 2011 for ROOT_528-00b_version by  doxygen 1.5.1