TGFileDialog.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGFileDialog.h 23115 2008-04-10 13:35:37Z rdm $
00002 // Author: Fons Rademakers   20/01/98
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, 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 
00013 #ifndef ROOT_TGFileDialog
00014 #define ROOT_TGFileDialog
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGFileDialog                                                         //
00019 //                                                                      //
00020 // This class creates a file selection dialog. It contains a combo box  //
00021 // to select the desired directory. A listview with the different       //
00022 // files in the current directory and a combo box with which you can    //
00023 // select a filter (on file extensions).                                //
00024 // When creating a file dialog one passes a pointer to a TGFileInfo     //
00025 // object. In this object you can set the fFileTypes and fIniDir to     //
00026 // specify the list of file types for the filter combo box and the      //
00027 // initial directory. When the TGFileDialog ctor returns the selected   //
00028 // file name can be found in the TGFileInfo::fFilename field and the    //
00029 // selected directory in TGFileInfo::fIniDir. The fFilename and         //
00030 // fIniDir are deleted by the TGFileInfo dtor.                          //
00031 //                                                                      //
00032 //////////////////////////////////////////////////////////////////////////
00033 
00034 #ifndef ROOT_TGFrame
00035 #include "TGFrame.h"
00036 #endif
00037 
00038 
00039 enum EFileDialogMode {
00040    kFDOpen,
00041    kFDSave
00042 };
00043 
00044 
00045 class TGTextBuffer;
00046 class TGTextEntry;
00047 class TGComboBox;
00048 class TGPictureButton;
00049 class TGTextButton;
00050 class TGCheckButton;
00051 class TGListView;
00052 class TGFileContainer;
00053 class TGFSComboBox;
00054 
00055 
00056 class TGFileInfo {
00057 
00058 private:
00059    TGFileInfo(const TGFileInfo&);              // not implemented
00060    TGFileInfo& operator=(const TGFileInfo&);   // not implemented
00061 
00062 public:
00063    char         *fFilename;            // selected file name
00064    char         *fIniDir;              // on input: initial directory, on output: new directory
00065    const char  **fFileTypes;           // file types used to filter selectable files
00066    Int_t         fFileTypeIdx;         // selected file type, index in fFileTypes
00067    Bool_t        fOverwrite;           // if true overwrite the file with existing name on save
00068    Bool_t        fMultipleSelection;   // if true, allow multiple file selection
00069    TList        *fFileNamesList;       // list of selected file names
00070 
00071    TGFileInfo() : fFilename(0), fIniDir(0), fFileTypes(0), fFileTypeIdx(0),
00072                   fOverwrite(kFALSE), fMultipleSelection(0), fFileNamesList(0) { }
00073    ~TGFileInfo();
00074 
00075    void SetMultipleSelection(Bool_t option);
00076 };
00077 
00078 
00079 class TGFileDialog : public TGTransientFrame {
00080 
00081 protected:
00082    TGTextBuffer      *fTbfname;  // text buffer of file name
00083    TGTextEntry       *fName;     // file name text entry
00084    TGComboBox        *fTypes;    // file type combo box
00085    TGFSComboBox      *fTreeLB;   // file system path combo box
00086    TGPictureButton   *fCdup;     // top toolbar button
00087    TGPictureButton   *fNewf;     // top toolbar button
00088    TGPictureButton   *fList;     // top toolbar button
00089    TGPictureButton   *fDetails;  // top toolbar button
00090    TGCheckButton     *fCheckB;   // set on/off file overwriting for Open dialog
00091                                  // OR set on/off multiple file selection for SaveAs dialog
00092    const TGPicture   *fPcdup;    // picture for fCdup
00093    const TGPicture   *fPnewf;    // picture for fNewf
00094    const TGPicture   *fPlist;    // picture for fList
00095    const TGPicture   *fPdetails; // picture for fDetails
00096    TGTextButton      *fOk;       // ok button
00097    TGTextButton      *fCancel;   // cancel button
00098    TGListView        *fFv;       // file list view
00099    TGFileContainer   *fFc;       // file list view container (containing the files)
00100    TGFileInfo        *fFileInfo; // file info passed to this dialog
00101 
00102 private:
00103    TGFileDialog(const TGFileDialog&);              // not implemented
00104    TGFileDialog& operator=(const TGFileDialog&);   // not implemented
00105 
00106 public:
00107    TGFileDialog(const TGWindow *p = 0, const TGWindow *main = 0,
00108                 EFileDialogMode dlg_type = kFDOpen, TGFileInfo *file_info = 0);
00109    virtual ~TGFileDialog();
00110 
00111    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00112    virtual void CloseWindow();
00113 
00114    ClassDef(TGFileDialog,0)  //File selection dialog
00115 };
00116 
00117 #endif

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