ROOT logo
// @(#)root/gui:$Id$
// Author: Fons Rademakers   20/01/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


#ifndef ROOT_TGFileDialog
#define ROOT_TGFileDialog

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGFileDialog                                                         //
//                                                                      //
// This class creates a file selection dialog. It contains a combo box  //
// to select the desired directory. A listview with the different       //
// files in the current directory and a combo box with which you can    //
// select a filter (on file extensions).                                //
// When creating a file dialog one passes a pointer to a TGFileInfo     //
// object. In this object you can set the fFileTypes and fIniDir to     //
// specify the list of file types for the filter combo box and the      //
// initial directory. When the TGFileDialog ctor returns the selected   //
// file name can be found in the TGFileInfo::fFilename field and the    //
// selected directory in TGFileInfo::fIniDir. The fFilename and         //
// fIniDir are deleted by the TGFileInfo dtor.                          //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif


enum EFileDialogMode {
   kFDOpen,
   kFDSave
};


class TGTextBuffer;
class TGTextEntry;
class TGComboBox;
class TGPictureButton;
class TGTextButton;
class TGCheckButton;
class TGListView;
class TGFileContainer;
class TGFSComboBox;


class TGFileInfo {

private:
   TGFileInfo(const TGFileInfo&);              // not implemented
   TGFileInfo& operator=(const TGFileInfo&);   // not implemented

public:
   char         *fFilename;            // selected file name
   char         *fIniDir;              // on input: initial directory, on output: new directory
   const char  **fFileTypes;           // file types used to filter selectable files
   Int_t         fFileTypeIdx;         // selected file type, index in fFileTypes
   Bool_t        fOverwrite;           // if true overwrite the file with existing name on save
   Bool_t        fMultipleSelection;   // if true, allow multiple file selection
   TList        *fFileNamesList;       // list of selected file names

   TGFileInfo() : fFilename(0), fIniDir(0), fFileTypes(0), fFileTypeIdx(0),
                  fOverwrite(kFALSE), fMultipleSelection(0), fFileNamesList(0) { }
   ~TGFileInfo();

   void SetMultipleSelection(Bool_t option);
};


class TGFileDialog : public TGTransientFrame {

protected:
   TGTextBuffer      *fTbfname;  // text buffer of file name
   TGTextEntry       *fName;     // file name text entry
   TGComboBox        *fTypes;    // file type combo box
   TGFSComboBox      *fTreeLB;   // file system path combo box
   TGPictureButton   *fCdup;     // top toolbar button
   TGPictureButton   *fNewf;     // top toolbar button
   TGPictureButton   *fList;     // top toolbar button
   TGPictureButton   *fDetails;  // top toolbar button
   TGCheckButton     *fCheckB;   // set on/off file overwriting for Open dialog
                                 // OR set on/off multiple file selection for SaveAs dialog
   const TGPicture   *fPcdup;    // picture for fCdup
   const TGPicture   *fPnewf;    // picture for fNewf
   const TGPicture   *fPlist;    // picture for fList
   const TGPicture   *fPdetails; // picture for fDetails
   TGTextButton      *fOk;       // ok button
   TGTextButton      *fCancel;   // cancel button
   TGListView        *fFv;       // file list view
   TGFileContainer   *fFc;       // file list view container (containing the files)
   TGFileInfo        *fFileInfo; // file info passed to this dialog

private:
   TGFileDialog(const TGFileDialog&);              // not implemented
   TGFileDialog& operator=(const TGFileDialog&);   // not implemented

public:
   TGFileDialog(const TGWindow *p = 0, const TGWindow *main = 0,
                EFileDialogMode dlg_type = kFDOpen, TGFileInfo *file_info = 0);
   virtual ~TGFileDialog();

   virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
   virtual void CloseWindow();

   ClassDef(TGFileDialog,0)  //File selection dialog
};

#endif
 TGFileDialog.h:1
 TGFileDialog.h:2
 TGFileDialog.h:3
 TGFileDialog.h:4
 TGFileDialog.h:5
 TGFileDialog.h:6
 TGFileDialog.h:7
 TGFileDialog.h:8
 TGFileDialog.h:9
 TGFileDialog.h:10
 TGFileDialog.h:11
 TGFileDialog.h:12
 TGFileDialog.h:13
 TGFileDialog.h:14
 TGFileDialog.h:15
 TGFileDialog.h:16
 TGFileDialog.h:17
 TGFileDialog.h:18
 TGFileDialog.h:19
 TGFileDialog.h:20
 TGFileDialog.h:21
 TGFileDialog.h:22
 TGFileDialog.h:23
 TGFileDialog.h:24
 TGFileDialog.h:25
 TGFileDialog.h:26
 TGFileDialog.h:27
 TGFileDialog.h:28
 TGFileDialog.h:29
 TGFileDialog.h:30
 TGFileDialog.h:31
 TGFileDialog.h:32
 TGFileDialog.h:33
 TGFileDialog.h:34
 TGFileDialog.h:35
 TGFileDialog.h:36
 TGFileDialog.h:37
 TGFileDialog.h:38
 TGFileDialog.h:39
 TGFileDialog.h:40
 TGFileDialog.h:41
 TGFileDialog.h:42
 TGFileDialog.h:43
 TGFileDialog.h:44
 TGFileDialog.h:45
 TGFileDialog.h:46
 TGFileDialog.h:47
 TGFileDialog.h:48
 TGFileDialog.h:49
 TGFileDialog.h:50
 TGFileDialog.h:51
 TGFileDialog.h:52
 TGFileDialog.h:53
 TGFileDialog.h:54
 TGFileDialog.h:55
 TGFileDialog.h:56
 TGFileDialog.h:57
 TGFileDialog.h:58
 TGFileDialog.h:59
 TGFileDialog.h:60
 TGFileDialog.h:61
 TGFileDialog.h:62
 TGFileDialog.h:63
 TGFileDialog.h:64
 TGFileDialog.h:65
 TGFileDialog.h:66
 TGFileDialog.h:67
 TGFileDialog.h:68
 TGFileDialog.h:69
 TGFileDialog.h:70
 TGFileDialog.h:71
 TGFileDialog.h:72
 TGFileDialog.h:73
 TGFileDialog.h:74
 TGFileDialog.h:75
 TGFileDialog.h:76
 TGFileDialog.h:77
 TGFileDialog.h:78
 TGFileDialog.h:79
 TGFileDialog.h:80
 TGFileDialog.h:81
 TGFileDialog.h:82
 TGFileDialog.h:83
 TGFileDialog.h:84
 TGFileDialog.h:85
 TGFileDialog.h:86
 TGFileDialog.h:87
 TGFileDialog.h:88
 TGFileDialog.h:89
 TGFileDialog.h:90
 TGFileDialog.h:91
 TGFileDialog.h:92
 TGFileDialog.h:93
 TGFileDialog.h:94
 TGFileDialog.h:95
 TGFileDialog.h:96
 TGFileDialog.h:97
 TGFileDialog.h:98
 TGFileDialog.h:99
 TGFileDialog.h:100
 TGFileDialog.h:101
 TGFileDialog.h:102
 TGFileDialog.h:103
 TGFileDialog.h:104
 TGFileDialog.h:105
 TGFileDialog.h:106
 TGFileDialog.h:107
 TGFileDialog.h:108
 TGFileDialog.h:109
 TGFileDialog.h:110
 TGFileDialog.h:111
 TGFileDialog.h:112
 TGFileDialog.h:113
 TGFileDialog.h:114
 TGFileDialog.h:115
 TGFileDialog.h:116
 TGFileDialog.h:117