59 "ROOT files",
"*.root",
138 Connect(
"CloseWindow()",
"TGFileDialog",
this,
"CloseWindow()");
148 Error(
"TGFileDialog",
"file_info argument not set");
166 ?
"S&ave in:" :
"&Look in:"));
176 Error(
"TGFileDialog",
"missing toolbar pixmap(s).\n");
188 fCdup->SetToolTipText(
"Up One Level");
189 fNewf->SetToolTipText(
"Create New Folder");
190 fList->SetToolTipText(
"List");
191 fDetails->SetToolTipText(
"Details");
193 fCdup->Associate(
this);
194 fNewf->Associate(
this);
195 fList->Associate(
this);
212 fCheckB->SetToolTipText(
"Overwrite a file without displaying a message if selected");
213 }
else if (dlg_type ==
kFDOpen) {
215 fCheckB->SetToolTipText(
"Allows multiple file selection when SHIFT is pressed");
216 fCheckB->Connect(
"Toggled(Bool_t)",
"TGFileInfo",
fFileInfo,
"SetMultipleSelection(Bool_t)");
230 fFc->Associate(
this);
235 fFv->SetIncrements(1, 19);
239 buttons[0]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByName)");
240 buttons[1]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByType)");
241 buttons[2]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortBySize)");
242 buttons[3]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByOwner)");
243 buttons[4]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByGroup)");
244 buttons[5]->
Connect(
"Clicked()",
"TGFileContainer",
fFc,
"Sort(=kSortByDate)");
250 fFc->SetMultipleSelection(
fFileInfo->fMultipleSelection);
258 fCheckB->Connect(
"Toggled(Bool_t)",
"TGFileContainer",
fFc,
"SetMultipleSelection(Bool_t)");
259 fCheckB->Connect(
"Toggled(Bool_t)",
"TGFileContainer",
fFc,
"UnSelectAll()");
271 (dlg_type ==
kDOpen || dlg_type ==
kDSave ) ?
"Folder &name:" :
"File &name:"));
274 fName->Resize(230,
fName->GetDefaultHeight());
275 fName->Associate(
this);
317 fTypes->GetListBox()->Resize(230, 120);
334 ?
"&Save" :
"&Open"),
kIDF_OK);
337 fOk->Associate(
this);
366 const char *wname = (dlg_type ==
kFDSave || dlg_type ==
kDSave) ?
"Save As..." :
"Open";
378 fFc->DisplayDirectory();
391 if (str.Contains(
"Multiple") &&
fCheckB)
392 fCheckB->Disconnect(
"Toggled(Bool_t)");
415 static inline void pExpandUnixPathName(
TGFileInfo &file_info) {
427 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?",
484 if (
fFc->GetDisplayStat())
492 fFc->ChangeDirectory(
"..");
495 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
502 strlcpy(answer,
"(empty)",
sizeof(answer));
504 "Enter directory name:",
507 while ( strcmp(answer,
"(empty)") == 0 ) {
509 "Please enter a valid directory name.",
512 "Enter directory name:",
515 if ( strcmp(answer,
"") == 0 )
518 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
521 if (
gSystem->MakeDirectory(answer) != 0 )
526 fFc->DisplayDirectory();
549 fFc->ChangeDirectory(
e->GetPath()->GetString());
552 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
565 fFc->DisplayDirectory();
581 if (
fFc->NumSelected() > 0) {
605 TList *tmp =
fFc->GetSelectedItems();
614 char *s =
gSystem->ConcatFileName(
fFc->GetDirectory(),
616 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?",
694 if (
fTbfname->GetTextLength() == 0) {
695 const char *txt2 =
"Please provide file name or use \"Cancel\"";
706 if (strcmp(
gSystem->WorkingDirectory(),
fFc->GetDirectory())) {
712 else if (!strcmp(
fOk->GetTitle(),
"Save") &&
fCheckB &&
715 txt =
TString::Format(
"File name %s already exists, OK to overwrite it?",
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
static const char * gDefTypes[]
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetMWMHints
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t SetWMSizeHints
char * StrDup(const char *str)
Duplicate the string str.
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
int main(int argc, char *argv[])
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.
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)
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.
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
Collectable string class.
const TString & GetString() const
R__ALWAYS_INLINE Bool_t IsZombie() 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.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.