Logo ROOT  
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-2021, 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 #include "TGFrame.h"
18 
19 
24  kDSave
25 };
26 
27 
28 class TGTextBuffer;
29 class TGTextEntry;
30 class TGComboBox;
31 class TGPictureButton;
32 class TGTextButton;
33 class TGCheckButton;
34 class TGListView;
35 class TGFileContainer;
36 class TGFSComboBox;
37 
38 
39 class TGFileInfo {
40 
41 private:
42  TGFileInfo(const TGFileInfo&) = delete;
43  TGFileInfo& operator=(const TGFileInfo&) = delete;
44 
45 public:
46  char *fFilename{nullptr}; ///< selected file name
47  char *fIniDir{nullptr}; ///< on input: initial directory, on output: new directory
48  const char **fFileTypes{nullptr}; ///< file types used to filter selectable files
49  Int_t fFileTypeIdx{0}; ///< selected file type, index in fFileTypes
50  Bool_t fOverwrite{kFALSE}; ///< if true overwrite the file with existing name on save
51  Bool_t fMultipleSelection{kFALSE}; ///< if true, allow multiple file selection
52  TList *fFileNamesList{nullptr}; ///< list of selected file names
53 
54  TGFileInfo() = default;
55  ~TGFileInfo();
56 
57  void SetFilename(const char *fname);
58  void SetIniDir(const char *inidir);
59  void DeleteFileNamesList();
60 
61  void SetMultipleSelection(Bool_t option);
62 };
63 
64 
66 
67 protected:
68  TGTextBuffer *fTbfname; ///< text buffer of file name
69  TGTextEntry *fName; ///< file name text entry
70  TGComboBox *fTypes; ///< file type combo box
71  TGFSComboBox *fTreeLB; ///< file system path combo box
72  TGPictureButton *fCdup; ///< top toolbar button
73  TGPictureButton *fNewf; ///< top toolbar button
74  TGPictureButton *fList; ///< top toolbar button
75  TGPictureButton *fDetails; ///< top toolbar button
76  TGCheckButton *fCheckB; ///< set on/off file overwriting for Open dialog
77  ///< OR set on/off multiple file selection for SaveAs dialog
78  const TGPicture *fPcdup; ///< picture for fCdup
79  const TGPicture *fPnewf; ///< picture for fNewf
80  const TGPicture *fPlist; ///< picture for fList
81  const TGPicture *fPdetails; ///< picture for fDetails
82  TGTextButton *fOk; ///< ok button
83  TGTextButton *fCancel; ///< cancel button
84  TGListView *fFv; ///< file list view
85  TGFileContainer *fFc; ///< file list view container (containing the files)
86  TGFileInfo *fFileInfo; ///< file info passed to this dialog
87  EFileDialogMode fDlgType; ///< the dialog type passed
88 
89 private:
90  TGFileDialog(const TGFileDialog&) = delete;
91  TGFileDialog& operator=(const TGFileDialog&) = delete;
92 
93 public:
94  TGFileDialog(const TGWindow *p = nullptr, const TGWindow *main = nullptr,
95  EFileDialogMode dlg_type = kFDOpen, TGFileInfo *file_info = nullptr);
96  virtual ~TGFileDialog();
97 
98  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
99  virtual void CloseWindow();
100 
101  ClassDef(TGFileDialog,0) //File selection dialog
102 };
103 
104 #endif
TGFileDialog::fDlgType
EFileDialogMode fDlgType
the dialog type passed
Definition: TGFileDialog.h:87
TGTransientFrame
Defines transient windows that typically are used for dialogs windows.
Definition: TGFrame.h:498
TGFileInfo::TGFileInfo
TGFileInfo()=default
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
TGFileContainer
Definition: TGFSContainer.h:115
TGFileDialog::fCheckB
TGCheckButton * fCheckB
set on/off file overwriting for Open dialog OR set on/off multiple file selection for SaveAs dialog
Definition: TGFileDialog.h:76
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
kDOpen
@ kDOpen
Definition: TGFileDialog.h:23
TGFileDialog::fPnewf
const TGPicture * fPnewf
picture for fNewf
Definition: TGFileDialog.h:79
TGFileInfo::fMultipleSelection
Bool_t fMultipleSelection
if true, allow multiple file selection
Definition: TGFileDialog.h:51
TGFileDialog::fTbfname
TGTextBuffer * fTbfname
text buffer of file name
Definition: TGFileDialog.h:68
TGTextButton
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
TGFileInfo::SetIniDir
void SetIniDir(const char *inidir)
Set directory name.
Definition: TGFileDialog.cxx:116
kDSave
@ kDSave
Definition: TGFileDialog.h:24
TGListView
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition: TGListView.h:115
TGFileInfo::TGFileInfo
TGFileInfo(const TGFileInfo &)=delete
bool
TGTextBuffer
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Definition: TGTextBuffer.h:19
TGFileInfo::fFileTypeIdx
Int_t fFileTypeIdx
selected file type, index in fFileTypes
Definition: TGFileDialog.h:49
TGFileDialog::fTypes
TGComboBox * fTypes
file type combo box
Definition: TGFileDialog.h:70
TGFileDialog::fPdetails
const TGPicture * fPdetails
picture for fDetails
Definition: TGFileDialog.h:81
TGFileDialog::fTreeLB
TGFSComboBox * fTreeLB
file system path combo box
Definition: TGFileDialog.h:71
TGCheckButton
Selects different options.
Definition: TGButton.h:264
TGFileDialog::fPcdup
const TGPicture * fPcdup
picture for fCdup
Definition: TGFileDialog.h:78
TGFileDialog::fName
TGTextEntry * fName
file name text entry
Definition: TGFileDialog.h:69
TGFileDialog::fCancel
TGTextButton * fCancel
cancel button
Definition: TGFileDialog.h:83
TGFileInfo::fOverwrite
Bool_t fOverwrite
if true overwrite the file with existing name on save
Definition: TGFileDialog.h:50
TGFileInfo::SetFilename
void SetFilename(const char *fname)
Set file name.
Definition: TGFileDialog.cxx:107
TGFileInfo::DeleteFileNamesList
void DeleteFileNamesList()
Delete file names list.
Definition: TGFileDialog.cxx:82
TGFileInfo::operator=
TGFileInfo & operator=(const TGFileInfo &)=delete
TGFileDialog::TGFileDialog
TGFileDialog(const TGFileDialog &)=delete
TGTextEntry
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
EFileDialogMode
EFileDialogMode
Definition: TGFileDialog.h:20
TGFileDialog::operator=
TGFileDialog & operator=(const TGFileDialog &)=delete
TGFileInfo::SetMultipleSelection
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
Definition: TGFileDialog.cxx:94
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGFileDialog::~TGFileDialog
virtual ~TGFileDialog()
Delete file dialog.
Definition: TGFileDialog.cxx:387
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TGFileInfo
Definition: TGFileDialog.h:39
TGFileDialog::fList
TGPictureButton * fList
top toolbar button
Definition: TGFileDialog.h:74
kFDSave
@ kFDSave
Definition: TGFileDialog.h:22
TGFileDialog::fCdup
TGPictureButton * fCdup
top toolbar button
Definition: TGFileDialog.h:72
TGFileDialog::fFv
TGListView * fFv
file list view
Definition: TGFileDialog.h:84
TGComboBox
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
TGFileInfo::~TGFileInfo
~TGFileInfo()
TGFileInfo Destructor.
Definition: TGFileDialog.cxx:71
TGFileDialog::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by the user input in the file dialog.
Definition: TGFileDialog.cxx:425
TGFSComboBox
This is a combo box that is used in the File Selection dialog box.
Definition: TGFSComboBox.h:67
TGFileInfo::fIniDir
char * fIniDir
on input: initial directory, on output: new directory
Definition: TGFileDialog.h:47
TGFileInfo::fFileTypes
const char ** fFileTypes
file types used to filter selectable files
Definition: TGFileDialog.h:48
TGFileDialog::CloseWindow
virtual void CloseWindow()
Close file dialog.
Definition: TGFileDialog.cxx:403
TGPictureButton
Yield an action as soon as it is clicked.
Definition: TGButton.h:228
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGFileDialog::fFc
TGFileContainer * fFc
file list view container (containing the files)
Definition: TGFileDialog.h:85
TGFileDialog::fOk
TGTextButton * fOk
ok button
Definition: TGFileDialog.h:82
TGFileInfo::fFileNamesList
TList * fFileNamesList
list of selected file names
Definition: TGFileDialog.h:52
TGFileDialog::fFileInfo
TGFileInfo * fFileInfo
file info passed to this dialog
Definition: TGFileDialog.h:86
TGFileDialog::fDetails
TGPictureButton * fDetails
top toolbar button
Definition: TGFileDialog.h:75
TGFileDialog::fPlist
const TGPicture * fPlist
picture for fList
Definition: TGFileDialog.h:80
TList
A doubly linked list.
Definition: TList.h:44
main
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
TGFileDialog
This class creates a file selection dialog.
Definition: TGFileDialog.h:65
kFDOpen
@ kFDOpen
Definition: TGFileDialog.h:21
int
TGFileDialog::fNewf
TGPictureButton * fNewf
top toolbar button
Definition: TGFileDialog.h:73
TGFileInfo::fFilename
char * fFilename
selected file name
Definition: TGFileDialog.h:46