Logo ROOT   6.08/07
Reference Guide
TGFileDialog.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 20/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 
13 #ifndef ROOT_TGFileDialog
14 #define ROOT_TGFileDialog
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGFileDialog //
19 // //
20 // This class creates a file selection dialog. It contains a combo box //
21 // to select the desired directory. A listview with the different //
22 // files in the current directory and a combo box with which you can //
23 // select a filter (on file extensions). //
24 // When creating a file dialog one passes a pointer to a TGFileInfo //
25 // object. In this object you can set the fFileTypes and fIniDir to //
26 // specify the list of file types for the filter combo box and the //
27 // initial directory. When the TGFileDialog ctor returns the selected //
28 // file name can be found in the TGFileInfo::fFilename field and the //
29 // selected directory in TGFileInfo::fIniDir. The fFilename and //
30 // fIniDir are deleted by the TGFileInfo dtor. //
31 // //
32 //////////////////////////////////////////////////////////////////////////
33 
34 #ifndef ROOT_TGFrame
35 #include "TGFrame.h"
36 #endif
37 
38 
42 };
43 
44 
45 class TGTextBuffer;
46 class TGTextEntry;
47 class TGComboBox;
48 class TGPictureButton;
49 class TGTextButton;
50 class TGCheckButton;
51 class TGListView;
52 class TGFileContainer;
53 class TGFSComboBox;
54 
55 
56 class TGFileInfo {
57 
58 private:
59  TGFileInfo(const TGFileInfo&); // not implemented
60  TGFileInfo& operator=(const TGFileInfo&); // not implemented
61 
62 public:
63  char *fFilename; // selected file name
64  char *fIniDir; // on input: initial directory, on output: new directory
65  const char **fFileTypes; // file types used to filter selectable files
66  Int_t fFileTypeIdx; // selected file type, index in fFileTypes
67  Bool_t fOverwrite; // if true overwrite the file with existing name on save
68  Bool_t fMultipleSelection; // if true, allow multiple file selection
69  TList *fFileNamesList; // list of selected file names
70 
71  TGFileInfo() : fFilename(0), fIniDir(0), fFileTypes(0), fFileTypeIdx(0),
72  fOverwrite(kFALSE), fMultipleSelection(0), fFileNamesList(0) { }
73  ~TGFileInfo();
74 
75  void SetMultipleSelection(Bool_t option);
76 };
77 
78 
80 
81 protected:
82  TGTextBuffer *fTbfname; // text buffer of file name
83  TGTextEntry *fName; // file name text entry
84  TGComboBox *fTypes; // file type combo box
85  TGFSComboBox *fTreeLB; // file system path combo box
86  TGPictureButton *fCdup; // top toolbar button
87  TGPictureButton *fNewf; // top toolbar button
88  TGPictureButton *fList; // top toolbar button
89  TGPictureButton *fDetails; // top toolbar button
90  TGCheckButton *fCheckB; // set on/off file overwriting for Open dialog
91  // OR set on/off multiple file selection for SaveAs dialog
92  const TGPicture *fPcdup; // picture for fCdup
93  const TGPicture *fPnewf; // picture for fNewf
94  const TGPicture *fPlist; // picture for fList
95  const TGPicture *fPdetails; // picture for fDetails
96  TGTextButton *fOk; // ok button
97  TGTextButton *fCancel; // cancel button
98  TGListView *fFv; // file list view
99  TGFileContainer *fFc; // file list view container (containing the files)
100  TGFileInfo *fFileInfo; // file info passed to this dialog
101 
102 private:
103  TGFileDialog(const TGFileDialog&); // not implemented
104  TGFileDialog& operator=(const TGFileDialog&); // not implemented
105 
106 public:
107  TGFileDialog(const TGWindow *p = 0, const TGWindow *main = 0,
108  EFileDialogMode dlg_type = kFDOpen, TGFileInfo *file_info = 0);
109  virtual ~TGFileDialog();
110 
111  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
112  virtual void CloseWindow();
113 
114  ClassDef(TGFileDialog,0) //File selection dialog
115 };
116 
117 #endif
TGTextBuffer * fTbfname
Definition: TGFileDialog.h:82
const TGPicture * fPnewf
Definition: TGFileDialog.h:93
TGFileInfo * fFileInfo
Definition: TGFileDialog.h:100
TGTextButton * fOk
Definition: TGFileDialog.h:96
TGFileInfo & operator=(const TGFileInfo &)
Bool_t fOverwrite
Definition: TGFileDialog.h:67
TGComboBox * fTypes
Definition: TGFileDialog.h:84
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
TGPictureButton * fNewf
Definition: TGFileDialog.h:87
TGFSComboBox * fTreeLB
Definition: TGFileDialog.h:85
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TGTextButton * fCancel
Definition: TGFileDialog.h:97
const TGPicture * fPdetails
Definition: TGFileDialog.h:95
const TGPicture * fPcdup
Definition: TGFileDialog.h:92
~TGFileInfo()
TGFileInfo Destructor.
#define ClassDef(name, id)
Definition: Rtypes.h:254
const char ** fFileTypes
Definition: TGFileDialog.h:65
TGPictureButton * fList
Definition: TGFileDialog.h:88
TGListView * fFv
Definition: TGFileDialog.h:98
A doubly linked list.
Definition: TList.h:47
Bool_t fMultipleSelection
Definition: TGFileDialog.h:68
TList * fFileNamesList
Definition: TGFileDialog.h:69
TGTextEntry * fName
Definition: TGFileDialog.h:83
TGFileContainer * fFc
Definition: TGFileDialog.h:99
long Long_t
Definition: RtypesCore.h:50
Int_t fFileTypeIdx
Definition: TGFileDialog.h:66
char * fFilename
Definition: TGFileDialog.h:63
const TGPicture * fPlist
Definition: TGFileDialog.h:94
TGPictureButton * fDetails
Definition: TGFileDialog.h:89
TGPictureButton * fCdup
Definition: TGFileDialog.h:86
EFileDialogMode
Definition: TGFileDialog.h:39
TGCheckButton * fCheckB
Definition: TGFileDialog.h:90
int main(int argc, char **argv)
char * fIniDir
Definition: TGFileDialog.h:64