Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 main()
Definition Prototype.cxx:12
long Longptr_t
Definition RtypesCore.h:82
const Bool_t kFALSE
Definition RtypesCore.h:101
#define ClassDef(name, id)
Definition Rtypes.h:325
EFileDialogMode
@ kFDOpen
@ kDOpen
@ kDSave
@ kFDSave
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.
This class creates a file selection dialog.
const TGPicture * fPcdup
picture for fCdup
const TGPicture * fPdetails
picture for fDetails
TGFileContainer * fFc
file list view container (containing the files)
TGFileDialog & operator=(const TGFileDialog &)=delete
TGPictureButton * fDetails
top toolbar button
TGPictureButton * fNewf
top toolbar button
EFileDialogMode fDlgType
the dialog type passed
TGTextBuffer * fTbfname
text buffer of file name
TGTextButton * fCancel
cancel button
TGFSComboBox * fTreeLB
file system path combo box
virtual void CloseWindow()
Close file dialog.
TGFileInfo * fFileInfo
file info passed to this dialog
TGTextEntry * fName
file name text entry
const TGPicture * fPnewf
picture for fNewf
TGPictureButton * fList
top toolbar button
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
TGListView * fFv
file list view
const TGPicture * fPlist
picture for fList
virtual ~TGFileDialog()
Delete file dialog.
TGTextButton * fOk
ok button
TGCheckButton * fCheckB
set on/off file overwriting for Open dialog OR set on/off multiple file selection for SaveAs dialog
TGFileDialog(const TGFileDialog &)=delete
TGComboBox * fTypes
file type combo box
TList * fFileNamesList
list of selected file names
TGFileInfo & operator=(const TGFileInfo &)=delete
char * fFilename
selected file name
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
Int_t fFileTypeIdx
selected file type, index in fFileTypes
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
~TGFileInfo()
TGFileInfo Destructor.
TGFileInfo(const TGFileInfo &)=delete
Bool_t fOverwrite
if true overwrite the file with existing name on save
void DeleteFileNamesList()
Delete file names list.
void SetFilename(const char *fname)
Set file name.
Bool_t fMultipleSelection
if true, allow multiple file selection
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.
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:38