59 "ROOT files",
"*.root",
137 Connect(
"CloseWindow()",
"TGFileDialog",
this,
"CloseWindow()");
147 Error(
"TGFileDialog",
"file_info argument not set");
165 ?
"S&ave in:" :
"&Look in:"));
175 Error(
"TGFileDialog",
"missing toolbar pixmap(s).\n");
187 fCdup->SetToolTipText(
"Up One Level");
188 fNewf->SetToolTipText(
"Create New Folder");
189 fList->SetToolTipText(
"List");
190 fDetails->SetToolTipText(
"Details");
192 fCdup->Associate(
this);
193 fNewf->Associate(
this);
194 fList->Associate(
this);
211 fCheckB->SetToolTipText(
"Overwrite a file without displaying a message if selected");
212 }
else if (dlg_type ==
kFDOpen) {
214 fCheckB->SetToolTipText(
"Allows multiple file selection when SHIFT is pressed");
215 fCheckB->Connect(
"Toggled(Bool_t)",
"TGFileInfo",
fFileInfo,
"SetMultipleSelection(Bool_t)");
229 fFc->Associate(
this);
234 fFv->SetIncrements(1, 19);
238 buttons[0]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByName)");
239 buttons[1]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByType)");
240 buttons[2]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortBySize)");
241 buttons[3]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByOwner)");
242 buttons[4]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByGroup)");
243 buttons[5]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByDate)");
249 fFc->SetMultipleSelection(
fFileInfo->fMultipleSelection);
257 fCheckB->Connect(
"Toggled(Bool_t)",
"TGFileContainer",
fFc,
"SetMultipleSelection(Bool_t)");
258 fCheckB->Connect(
"Toggled(Bool_t)",
"TGFileContainer",
fFc,
"UnSelectAll()");
270 (dlg_type ==
kDOpen || dlg_type ==
kDSave ) ?
"Folder &name:" :
"File &name:"));
273 fName->Resize(230,
fName->GetDefaultHeight());
274 fName->Associate(
this);
289 for (i = 0;
fFileInfo->fFileTypes[i] != 0; i += 2) {
316 fTypes->GetListBox()->Resize(230, 120);
333 ?
"&Save" :
"&Open"),
kIDF_OK);
336 fOk->Associate(
this);
342 UInt_t width = std::max(
fOk->GetDefaultWidth(),
fCancel->GetDefaultWidth()) + 20;
365 const char *wname = (dlg_type ==
kFDSave || dlg_type ==
kDSave) ?
"Save As..." :
"Open";
377 fFc->DisplayDirectory();
390 if (str.Contains(
"Multiple") &&
fCheckB)
391 fCheckB->Disconnect(
"Toggled(Bool_t)");
414 static inline void pExpandUnixPathName(
TGFileInfo &file_info) {
426 if (!
fFc->GetDisplayStat())
return kTRUE;
443 if (
fTbfname->GetTextLength() == 0) {
444 txt =
"Please provide file name or use \"Cancel\"";
450 !strcmp(
fOk->GetTitle(),
"Save") &&
fCheckB &&
453 txt =
TString::Format(
"File name %s already exists, OK to overwrite it?",
485 if (
fFc->GetDisplayStat())
493 fFc->ChangeDirectory(
"..");
496 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
503 strlcpy(answer,
"(empty)",
sizeof(answer));
505 "Enter directory name:",
508 while ( strcmp(answer,
"(empty)") == 0 ) {
510 "Please enter a valid directory name.",
513 "Enter directory name:",
516 if ( strcmp(answer,
"") == 0 )
519 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
522 if (
gSystem->MakeDirectory(answer) != 0 )
527 fFc->DisplayDirectory();
550 fFc->ChangeDirectory(
e->GetPath()->GetString());
553 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
566 fFc->DisplayDirectory();
582 if (
fFc->NumSelected() > 0) {
606 TList *tmp =
fFc->GetSelectedItems();
616 const char *s =
gSystem->PrependPathName(
fFc->GetDirectory(), temp);
617 tmpString +=
"\"" + el->
GetString() +
"\" ";
633 if (
fFc->NumSelected() == 1) {
636 fFc->ChangeDirectory(
f->GetItemName()->GetString());
639 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
648 if (!strcmp(
fOk->GetTitle(),
"Save") &&
fCheckB &&
652 txt =
TString::Format(
"File name %s already exists, OK to overwrite it?",
695 if (
fTbfname->GetTextLength() == 0) {
696 const char *txt2 =
"Please provide file name or use \"Cancel\"";
707 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
713 else if (!strcmp(
fOk->GetTitle(),
"Save") &&
fCheckB &&
716 txt =
TString::Format(
"File name %s already exists, OK to overwrite it?",
727 temp_string =
fTbfname->GetString();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
static const char * gDefTypes[]
char * StrDup(const char *str)
Duplicate the string str.
Bool_t R_ISDIR(Int_t mode)
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
UInt_t GetDefaultHeight() const override
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
This is a combo box that is used in the File Selection dialog box.
const TGPicture * fPcdup
picture for fCdup
const TGPicture * fPdetails
picture for fDetails
TGFileContainer * fFc
file list view container (containing the files)
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
TGFileInfo * fFileInfo
file info passed to this dialog
~TGFileDialog() override
Delete file dialog.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages generated by the user input in the file dialog.
TGTextEntry * fName
file name text entry
const TGPicture * fPnewf
picture for fNewf
TGPictureButton * fList
top toolbar button
void CloseWindow() override
Close file dialog.
TGPictureButton * fCdup
top toolbar button
TGListView * fFv
file list view
const TGPicture * fPlist
picture for fList
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
char * fFilename
selected file name
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
char * fIniDir
on input: initial directory, on output: new directory
~TGFileInfo()
TGFileInfo Destructor.
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.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
void MapWindow() override
map window
virtual void DeleteWindow()
Delete window.
static Pixel_t fgWhitePixel
A composite frame that layout their children in horizontal way.
TGHotString is a string with a "hot" character underlined.
TGString * GetItemName() const
This class handles GUI labels.
This class describes layout hints used by the layout classes.
A list view is a widget that can contain a number of items arranged in a grid or list.
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
TGClient * fClient
Connection to display server.
const char * GetString() const
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
Text string listbox entries.
TGTransientFrame(const TGTransientFrame &)=delete
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
A composite frame that layout their children in vertical way.
ROOT GUI Window base class.
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
@ kEditDisable
disable edit of this window
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Collectable string class.
const TString & GetString() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
int main(int argc, char **argv)