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