Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGFileDialog.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: f3cd439bd51d763ffd53693e89c42b2eaa27c520 $
2// Author: Fons Rademakers 20/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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/** \class TGFileDialog
14 \ingroup guiwidgets
15
16This class creates a file selection dialog. It contains a combo box
17to select the desired directory. A listview with the different
18files in the current directory and a combo box with which you can
19select a filter (on file extensions).
20When creating a file dialog one passes a pointer to a TGFileInfo
21object. In this object you can set the fFileTypes and fIniDir to
22specify the list of file types for the filter combo box and the
23initial directory. When the TGFileDialog ctor returns the selected
24file name can be found in the TGFileInfo::fFilename field and the
25selected directory in TGFileInfo::fIniDir. The fFilename and
26fIniDir are deleted by the TGFileInfo dtor.
27
28*/
29
30
31#include "TGFileDialog.h"
32#include "TGLabel.h"
33#include "TGTextEntry.h"
34#include "TGComboBox.h"
35#include "TGListView.h"
36#include "TGFSContainer.h"
37#include "TGFSComboBox.h"
38#include "TGMsgBox.h"
39#include "TGInputDialog.h"
40#include "TSystem.h"
41#include "TObjString.h"
42#include "strlcpy.h"
43
44#include <sys/stat.h>
45
57
58static const char *gDefTypes[] = { "All files", "*",
59 "ROOT files", "*.root",
60 "ROOT macros", "*.C",
61 nullptr, nullptr };
62
64
65
66
67////////////////////////////////////////////////////////////////////////////////
68/// TGFileInfo Destructor.
69
71{
72 delete [] fFilename;
73 delete [] fIniDir;
75}
76
77
78////////////////////////////////////////////////////////////////////////////////
79/// Delete file names list
80
82{
83 if (fFileNamesList) {
85 delete fFileNamesList;
86 fFileNamesList = nullptr;
87 }
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Turn on/off multiple selection.
92
102
103////////////////////////////////////////////////////////////////////////////////
104/// Set file name
105
107{
108 delete [] fFilename;
109 fFilename = fname ? StrDup(fname) : nullptr;
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Set directory name
114
116{
117 delete [] fIniDir;
118 fIniDir = inidir ? StrDup(inidir) : nullptr;
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Create a file selection dialog. Depending on the dlg_type it can be
123/// used for opening or saving a file.
124/// About the first two arguments, p is the parent Window, usually the
125/// desktop (root) window, and main is the main (TGMainFrame) application
126/// window (the one opening the dialog), onto which the dialog is
127/// usually centered, and which is waiting for it to close.
128
131 TGTransientFrame(p, main, 10, 10, kVerticalFrame), fTbfname(0), fName(0),
132 fTypes(0), fTreeLB(0), fCdup(0), fNewf(0), fList(0), fDetails(0), fCheckB(0),
133 fPcdup(0), fPnewf(0), fPlist(0), fPdetails(0), fOk(0), fCancel(0), fFv(0),
134 fFc(0), fFileInfo(0), fDlgType(dlg_type)
135{
137 Connect("CloseWindow()", "TGFileDialog", this, "CloseWindow()");
139
140 int i;
141
142 if (!p && !main) {
143 MakeZombie();
144 return;
145 }
146 if (!file_info) {
147 Error("TGFileDialog", "file_info argument not set");
148 fFileInfo = &gInfo;
149 fFileInfo->SetIniDir(nullptr);
150 fFileInfo->SetFilename(nullptr);
152 } else
154
155 if (!fFileInfo->fFileTypes)
157
158 if (!fFileInfo->fIniDir)
159 fFileInfo->SetIniDir(".");
160
161 TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
162
163 //--- top toolbar elements
165 ? "S&ave in:" : "&Look in:"));
167 fTreeLB->Associate(this);
168
169 fPcdup = fClient->GetPicture("tb_uplevel.xpm");
170 fPnewf = fClient->GetPicture("tb_newfolder.xpm");
171 fPlist = fClient->GetPicture("tb_list.xpm");
172 fPdetails = fClient->GetPicture("tb_details.xpm");
173
174 if (!(fPcdup && fPnewf && fPlist && fPdetails))
175 Error("TGFileDialog", "missing toolbar pixmap(s).\n");
176
181
182 fCdup->SetStyle(gClient->GetStyle());
183 fNewf->SetStyle(gClient->GetStyle());
184 fList->SetStyle(gClient->GetStyle());
185 fDetails->SetStyle(gClient->GetStyle());
186
187 fCdup->SetToolTipText("Up One Level");
188 fNewf->SetToolTipText("Create New Folder");
189 fList->SetToolTipText("List");
190 fDetails->SetToolTipText("Details");
191
192 fCdup->Associate(this);
193 fNewf->Associate(this);
194 fList->Associate(this);
195 fDetails->Associate(this);
196
199
201
202 fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
203 fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
204 fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
205 fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
206 fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
207 fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));
208
209 if (dlg_type == kFDSave) {
210 fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
211 fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
212 } else if (dlg_type == kFDOpen) {
213 fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
214 fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
215 fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
216 }
217 if (fCheckB) {
220 }
222
223 //--- file view
224
225 fFv = new TGListView(this, 400, 161);
226
229 fFc->Associate(this);
230
234 fFv->SetIncrements(1, 19); // set vertical scroll one line height at a time
235
237 if (buttons) {
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)");
244 }
245
251
253
255
256 if (dlg_type == kFDOpen) {
257 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"SetMultipleSelection(Bool_t)");
258 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"UnSelectAll()");
259 }
260
261 //--- file name and types
262
263 TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 10, 10);
264
265 TGVerticalFrame *fVf = new TGVerticalFrame(fHf, 10, 10);
266
267 TGHorizontalFrame *fHfname = new TGHorizontalFrame(fVf, 10, 10);
268
270 (dlg_type == kDOpen || dlg_type == kDSave ) ? "Folder &name:" : "File &name:"));
271 fTbfname = new TGTextBuffer(1034);
274 fName->Associate(this);
275
276 fHfname->AddFrame(fLfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
277 fHfname->AddFrame(fName, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
278
280
281 TGHorizontalFrame *fHftype = new TGHorizontalFrame(fVf, 10, 10);
282
283 TGLabel *fLftypes = new TGLabel(fHftype, new TGHotString("Files of &type:"));
285 fTypes->Associate(this);
287
288 TString s;
289 for (i = 0; fFileInfo->fFileTypes[i] != 0; i += 2) {
290 s.Form("%s (%s)", fFileInfo->fFileTypes[i], fFileInfo->fFileTypes[i+1]);
291 fTypes->AddEntry(s.Data(), i);
292 }
294
295 // Show all items in combobox without scrollbar
296 //TGDimension fw = fTypes->GetListBox()->GetContainer()->GetDefaultSize();
297 //fTypes->GetListBox()->Resize(fw.fWidth, fw.fHeight);
298
301 } else {
302 fTbfname->Clear();
303 if (dlg_type == kFDSave) {
304 fTbfname->AddText(0, "unnamed");
305 fName->SelectAll();
309 ext.ReplaceAll("*.", ".");
310 fTbfname->AddText(7, ext.Data());
311 }
312 fName->SetFocus();
313 }
314 }
315
316 fTypes->GetListBox()->Resize(230, 120);
317 if (dlg_type == kDOpen || dlg_type == kDSave) {
319 }
320
321 fHftype->AddFrame(fLftypes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
322 fHftype->AddFrame(fTypes, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
323
325
327
328 //--- Open/Save and Cancel buttons
329
330 TGVerticalFrame *fVbf = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
331
333 ? "&Save" : "&Open"), kIDF_OK);
334 fCancel = new TGTextButton(fVbf, new TGHotString("Cancel"), kIDF_CANCEL);
335
336 fOk->Associate(this);
337 fCancel->Associate(this);
338
339 fVbf->AddFrame(fOk, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
340 fVbf->AddFrame(fCancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
341
342 UInt_t width = std::max(fOk->GetDefaultWidth(), fCancel->GetDefaultWidth()) + 20;
343 fVbf->Resize(width + 20, fVbf->GetDefaultHeight());
344
346
347 AddFrame(fHf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
349
351
353
354 Resize(size);
355
356 //---- position relative to the parent's window
357
359
360 //---- make the message box non-resizable
361
362 SetWMSize(size.fWidth, size.fHeight);
363 SetWMSizeHints(size.fWidth, size.fHeight, 10000, 10000, 1, 1);
364
365 const char *wname = (dlg_type == kFDSave || dlg_type == kDSave) ? "Save As..." : "Open";
368 SetClassHints("ROOT", "FileDialog");
369
375
376 MapWindow();
378 if (dlg_type == kFDSave || dlg_type == kDSave)
379 fName->SetFocus();
380 fClient->WaitFor(this);
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Delete file dialog.
385
387{
388 if (IsZombie()) return;
389 TString str = fCheckB ? fCheckB->GetString() : TString();
390 if (str.Contains("Multiple") && fCheckB)
391 fCheckB->Disconnect("Toggled(Bool_t)");
396 delete fFc;
397}
398
399////////////////////////////////////////////////////////////////////////////////
400/// Close file dialog.
401
408
409////////////////////////////////////////////////////////////////////////////////
410/// Small function used to prevent memory leaks with TSystem::ExpandPathName,
411/// which returns a string created by StrDup, that has to be deleted
412
413namespace {
414 static inline void pExpandUnixPathName(TGFileInfo &file_info) {
415 char *tmpPath = gSystem->ExpandPathName(file_info.fFilename);
416 file_info.SetFilename(gSystem->UnixPathName(tmpPath));
417 delete[] tmpPath;
418 }
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Process messages generated by the user input in the file dialog.
423
425{
426 if (!fFc->GetDisplayStat()) return kTRUE; // Cancel button was pressed
427
430 TGFileItem *f;
431 void *p = 0;
432 TString txt;
434
435 switch (GET_MSG(msg)) {
436 case kC_COMMAND:
437 switch (GET_SUBMSG(msg)) {
438 case kCM_BUTTON:
439 switch (parm1) {
440 case kIDF_OK:
441 // same code as under kTE_ENTER
442 if (fTbfname->GetTextLength() == 0) {
443 txt = "Please provide file name or use \"Cancel\"";
445 "Missing File Name", txt, kMBIconExclamation,
446 kMBOk);
447 return kTRUE;
449 !strcmp(fOk->GetTitle(), "Save") && fCheckB &&
450 (!(fCheckB->GetState() == kButtonDown))) {
451 Int_t ret;
452 txt = TString::Format("File name %s already exists, OK to overwrite it?",
455 "File Name Exist", txt.Data(), kMBIconExclamation,
456 kMBYes | kMBNo, &ret);
457 if (ret == kMBNo)
458 return kTRUE;
459 }
461 fFileInfo->SetFilename(nullptr);
462 } else {
463 fFileInfo->SetFilename(nullptr);
464 // FIXME: once appropriate gSystem method exists, use SetFilename here
467 else
471 }
472 if (fCheckB && (fCheckB->GetState() == kButtonDown))
474 else
476 DeleteWindow();
477 break;
478
479 case kIDF_CANCEL:
480 fFileInfo->SetFilename(nullptr);
481 if (fDlgType == kDOpen || fDlgType == kDSave)
482 fFileInfo->SetIniDir(nullptr);
483 if (fFc->GetDisplayStat())
486 DeleteWindow();
487 return kTRUE; //no need to redraw fFc
488 break;
489
490 case kIDF_CDUP:
491 fFc->ChangeDirectory("..");
496 }
497 break;
498
499 case kIDF_NEW_FOLDER: {
500 char answer[128];
501 strlcpy(answer, "(empty)", sizeof(answer));
502 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
503 "Enter directory name:",
504 answer/*"(empty)"*/, answer);
505
506 while ( strcmp(answer, "(empty)") == 0 ) {
507 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
508 "Please enter a valid directory name.",
510 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
511 "Enter directory name:",
512 answer, answer);
513 }
514 if ( strcmp(answer, "") == 0 ) // Cancel button was pressed
515 break;
516
519 }
520 if ( gSystem->MakeDirectory(answer) != 0 )
521 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
522 TString::Format("Directory name \'%s\' already exists!", answer),
524 else {
526 }
528 break;
529 }
530
531 case kIDF_LIST:
534 break;
535
536 case kIDF_DETAILS:
539 break;
540 }
541 break;
542
543 case kCM_COMBOBOX:
544 switch (parm1) {
545 case kIDF_FSLB:
547 if (e) {
548 fFc->ChangeDirectory(e->GetPath()->GetString());
553 }
554 }
555 break;
556
557 case kIDF_FTYPESLB:
559 if (te) {
560 //fTbfname->Clear();
561 //fTbfname->AddText(0, fFileInfo->fFileTypes[te->EntryId()+1]);
562 fFileInfo->fFileTypeIdx = te->EntryId();
566 }
567 break;
568 }
569 break;
570
571 default:
572 break;
573 } // switch(GET_SUBMSG(msg))
574 break;
575
576 case kC_CONTAINER:
577 switch (GET_SUBMSG(msg)) {
578 case kCT_ITEMCLICK:
579 if (parm1 == kButton1) {
580 if (fFc->NumSelected() > 0) {
583 if (fDlgType == kFDOpen || fDlgType == kFDSave) {
584 if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
585 fTbfname->Clear();
586 if (e2->GetItemName())
587 fTbfname->AddText(0, e2->GetItemName()->GetString());
589 }
590 } else {
591 if ((e2) && R_ISDIR(((TGFileItem *)e2)->GetType())) {
592 fTbfname->Clear();
593 if (e2->GetItemName())
594 fTbfname->AddText(0, e2->GetItemName()->GetString());
597 } else if ((e2)) {
599 }
600 }
601 }
602 else {
604 TList *tmp = fFc->GetSelectedItems();
605 TObjString *el;
606 TIter next(tmp);
609 } else {
611 }
612 while ((el = (TObjString *) next())) {
614 el->GetString());
615 tmpString += "\"" + el->GetString() + "\" ";
617 delete [] s;
618 }
619 tmp->Delete();
620 delete tmp;
621 fTbfname->Clear();
624 }
625 }
626 }
627 break;
628
629 case kCT_ITEMDBLCLICK:
630
631 if (parm1 == kButton1) {
632 if (fFc->NumSelected() == 1) {
634 if (f && R_ISDIR(f->GetType())) {
635 fFc->ChangeDirectory(f->GetItemName()->GetString());
640 }
641 if (fDlgType == kDOpen || fDlgType == kDSave) {
642 fTbfname->Clear();
645 }
646 } else if (fDlgType == kFDOpen || fDlgType == kFDSave) {
647 if (!strcmp(fOk->GetTitle(), "Save") && fCheckB &&
648 (!(fCheckB->GetState() == kButtonDown))) {
649
650 Int_t ret;
651 txt = TString::Format("File name %s already exists, OK to overwrite it?",
654 "File Name Exist", txt.Data(), kMBIconExclamation,
655 kMBYes | kMBNo, &ret);
656 if (ret == kMBNo)
657 return kTRUE;
658 }
659 fFileInfo->SetFilename(nullptr);
660 // FIXME: once appropriate gSystem method exists, use SetFilename here
663 else
667 if (fCheckB && (fCheckB->GetState() == kButtonDown))
669 else
671
672 DeleteWindow();
673 }
674 }
675 }
676
677 break;
678
679 default:
680 break;
681
682 } // switch(GET_SUBMSG(msg))
683 break;
684
685 case kC_TEXTENTRY:
686 // when typing, re-enable previously disabled button after having clicked on file instead of folder
689
690 switch (GET_SUBMSG(msg)) {
691 case kTE_ENTER:
692 // same code as under kIDF_OK
693 if (fTbfname->GetTextLength() == 0) {
694 const char *txt2 = "Please provide file name or use \"Cancel\"";
696 "Missing File Name", txt2, kMBIconExclamation,
697 kMBOk);
698 return kTRUE;
700 FileStat_t buf;
701 if (!gSystem->GetPathInfo(fTbfname->GetString(), buf) &&
702 R_ISDIR(buf.fMode)) {
707 }
708 fName->SetText("", kFALSE);
709 return kTRUE;
710 }
711 else if (!strcmp(fOk->GetTitle(), "Save") && fCheckB &&
712 (!(fCheckB->GetState() == kButtonDown))) {
713 Int_t ret;
714 txt = TString::Format("File name %s already exists, OK to overwrite it?",
717 "File Name Exist", txt.Data(), kMBIconExclamation,
718 kMBYes | kMBNo, &ret);
719 if (ret == kMBNo)
720 return kTRUE;
721 }
722 }
723 fFileInfo->SetFilename(nullptr);
724 // FIXME: once appropriate gSystem method exists, use SetFilename here
728 if (fCheckB && (fCheckB->GetState() == kButtonDown))
730 else
732 DeleteWindow();
733 break;
734
735 default:
736 break;
737 }
738 break;
739
740 default:
741 break;
742
743 } // switch(GET_MSG(msg))
744
746 return kTRUE;
747}
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kButton1
Definition GuiTypes.h:214
int main()
Definition Prototype.cxx:12
#define f(i)
Definition RSha256.hxx:104
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kButtonEngaged
Definition TGButton.h:55
#define gClient
Definition TGClient.h:157
@ kSortByName
EFileFialog
@ kIDF_OK
@ kIDF_FTYPESLB
@ kIDF_FSLB
@ kIDF_CDUP
@ kIDF_DETAILS
@ kIDF_NEW_FOLDER
@ kIDF_CHECKB
@ kIDF_LIST
@ kIDF_CANCEL
static TGFileInfo gInfo
static const char * gDefTypes[]
EFileDialogMode
@ kFDOpen
@ kDOpen
@ kDSave
@ kFDSave
@ kMWMDecorResizeH
Definition TGFrame.h:65
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMFuncResize
Definition TGFrame.h:50
@ kMWMDecorMaximize
Definition TGFrame.h:69
@ kMWMDecorMinimize
Definition TGFrame.h:68
@ kMWMDecorMenu
Definition TGFrame.h:67
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMFuncMaximize
Definition TGFrame.h:53
@ kMWMInputModeless
Definition TGFrame.h:57
@ kMWMFuncMinimize
Definition TGFrame.h:52
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
@ kLVDetails
Definition TGListView.h:25
@ kLVList
Definition TGListView.h:24
@ kMBNo
Definition TGMsgBox.h:32
@ kMBYes
Definition TGMsgBox.h:31
@ kMBOk
Definition TGMsgBox.h:33
@ kMBIconExclamation
Definition TGMsgBox.h:24
@ kMBIconStop
Definition TGMsgBox.h:22
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
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
Option_t Option_t width
char * StrDup(const char *str)
Duplicate the string str.
Definition TString.cxx:2563
@ kFileExists
Definition TSystem.h:52
Bool_t R_ISDIR(Int_t mode)
Definition TSystem.h:123
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
Int_t GET_MSG(Long_t val)
@ kCM_COMBOBOX
@ kTE_ENTER
@ kCT_ITEMCLICK
@ kC_COMMAND
@ kCM_BUTTON
@ kC_TEXTENTRY
@ kCT_ITEMDBLCLICK
@ kC_CONTAINER
Int_t GET_SUBMSG(Long_t val)
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:439
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetOn(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition TGButton.h:120
virtual void AllowStayDown(Bool_t a)
Definition TGButton.h:113
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition TGButton.cxx:265
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:453
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:229
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
Selects different options.
Definition TGButton.h:264
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:223
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
Definition TGClient.cxx:717
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:316
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
virtual TGLBEntry * GetSelectedEntry() const
Definition TGComboBox.h:115
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:110
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:316
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1014
virtual void Associate(const TGWindow *w)
Definition TGCanvas.h:89
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition TGCanvas.cxx:678
virtual Int_t NumSelected() const
Definition TGCanvas.h:104
This is a combo box that is used in the File Selection dialog box.
virtual void Update(const char *path)
Update file system combo box.
virtual void SetDisplayStat(Bool_t stat=kTRUE)
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
virtual void ChangeDirectory(const char *path)
Change current directory.
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
virtual void SetFilter(const char *filter)
Set file selection filter.
Bool_t GetDisplayStat()
const char * GetDirectory() const
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.
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.
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.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:192
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:193
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:304
void MapWindow() override
map window
Definition TGFrame.h:206
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:268
static Pixel_t fgWhitePixel
Definition TGFrame.h:103
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
Input Dialog Widget.
TList * GetSelectedItems()
Get list of selected items in container.
void SetMultipleSelection(Bool_t multi=kTRUE)
Definition TGListView.h:233
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition TGListView.h:115
virtual void SetIncrements(Int_t hInc, Int_t vInc)
Set horizontal and vertical scrollbar increments.
TGTextButton ** GetHeaderButtons()
Definition TGListView.h:159
void SetContainer(TGFrame *f) override
Set list view container.
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode.
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition TGFrame.cxx:1772
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1850
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1793
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1885
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Yield an action as soon as it is clicked.
Definition TGButton.h:228
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
void AddText(Int_t pos, const char *text)
const char * GetString() const
UInt_t GetTextLength() const
Yield an action as soon as it is clicked.
Definition TGButton.h:142
const char * GetTitle() const override
Returns title of object.
Definition TGButton.h:190
TString GetString() const
Definition TGButton.h:191
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
virtual void SetFocus()
Set focus to this text entry.
virtual void SelectAll()
Selects all text (i.e.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
Text string listbox entries.
Definition TGListBox.h:48
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:500
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1949
A composite frame that layout their children in vertical way.
Definition TGFrame.h:376
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:150
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
A doubly linked list.
Definition TList.h:38
void Add(TObject *obj) override
Definition TList.h:81
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:467
Collectable string class.
Definition TObjString.h:28
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:159
void MakeZombie()
Definition TObject.h:53
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.
Definition TQObject.cxx:865
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2362
Bool_t cd(const char *path)
Definition TSystem.h:433
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1285
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name.
Definition TSystem.cxx:1082
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:836
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition TSystem.cxx:1409
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1307
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:872
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1073
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition TSystem.cxx:961
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:881
Int_t fMode
Definition TSystem.h:135