Logo ROOT  
Reference Guide
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// //
14// TGFileDialog //
15// //
16// This class creates a file selection dialog. It contains a combo box //
17// to select the desired directory. A listview with the different //
18// files in the current directory and a combo box with which you can //
19// select a filter (on file extensions). //
20// When creating a file dialog one passes a pointer to a TGFileInfo //
21// object. In this object you can set the fFileTypes and fIniDir to //
22// specify the list of file types for the filter combo box and the //
23// initial directory. When the TGFileDialog ctor returns the selected //
24// file name can be found in the TGFileInfo::fFilename field and the //
25// selected directory in TGFileInfo::fIniDir. The fFilename and //
26// fIniDir are deleted by the TGFileInfo dtor. //
27// //
28//////////////////////////////////////////////////////////////////////////
29
30#include "TGFileDialog.h"
31#include "TGLabel.h"
32#include "TGTextEntry.h"
33#include "TGComboBox.h"
34#include "TGListView.h"
35#include "TGFSContainer.h"
36#include "TGFSComboBox.h"
37#include "TGMsgBox.h"
38#include "TGInputDialog.h"
39#include "TSystem.h"
40#include "TObjString.h"
41
42#include <sys/stat.h>
43
54};
55
56static const char *gDefTypes[] = { "All files", "*",
57 "ROOT files", "*.root",
58 "ROOT macros", "*.C",
59 nullptr, nullptr };
60
62
63
65
66////////////////////////////////////////////////////////////////////////////////
67/// TGFileInfo Destructor.
68
70{
71 delete [] fFilename;
72 delete [] fIniDir;
74}
75
76
77////////////////////////////////////////////////////////////////////////////////
78/// Delete file names list
79
81{
82 if (fFileNamesList) {
84 delete fFileNamesList;
85 fFileNamesList = nullptr;
86 }
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Turn on/off multiple selection.
91
93{
94 if ( fMultipleSelection != option ) {
95 fMultipleSelection = option;
98 fFileNamesList = new TList();
99 }
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// Set file name
104
105void TGFileInfo::SetFilename(const char *fname)
106{
107 delete [] fFilename;
108 fFilename = fname ? StrDup(fname) : nullptr;
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Set directory name
113
114void TGFileInfo::SetIniDir(const char *inidir)
115{
116 delete [] fIniDir;
117 fIniDir = inidir ? StrDup(inidir) : nullptr;
118}
119
120////////////////////////////////////////////////////////////////////////////////
121/// Create a file selection dialog. Depending on the dlg_type it can be
122/// used for opening or saving a file.
123/// About the first two arguments, p is the parent Window, usually the
124/// desktop (root) window, and main is the main (TGMainFrame) application
125/// window (the one opening the dialog), onto which the dialog is
126/// usually centered, and which is waiting for it to close.
127
129 EFileDialogMode dlg_type, TGFileInfo *file_info) :
130 TGTransientFrame(p, main, 10, 10, kVerticalFrame), fTbfname(0), fName(0),
131 fTypes(0), fTreeLB(0), fCdup(0), fNewf(0), fList(0), fDetails(0), fCheckB(0),
132 fPcdup(0), fPnewf(0), fPlist(0), fPdetails(0), fOk(0), fCancel(0), fFv(0),
133 fFc(0), fFileInfo(0)
134{
136 Connect("CloseWindow()", "TGFileDialog", this, "CloseWindow()");
138
139 int i;
140
141 if (!p && !main) {
142 MakeZombie();
143 return;
144 }
145 if (!file_info) {
146 Error("TGFileDialog", "file_info argument not set");
147 fFileInfo = &gInfo;
148 fFileInfo->SetIniDir(nullptr);
149 fFileInfo->SetFilename(nullptr);
151 } else
152 fFileInfo = file_info;
153
154 if (!fFileInfo->fFileTypes)
156
157 if (!fFileInfo->fIniDir)
158 fFileInfo->SetIniDir(".");
159
160 TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
161
162 //--- top toolbar elements
163 TGLabel *fLookin = new TGLabel(fHtop, new TGHotString((dlg_type == kFDSave)
164 ? "S&ave in:" : "&Look in:"));
165 fTreeLB = new TGFSComboBox(fHtop, kIDF_FSLB);
166 fTreeLB->Associate(this);
167
168 fPcdup = fClient->GetPicture("tb_uplevel.xpm");
169 fPnewf = fClient->GetPicture("tb_newfolder.xpm");
170 fPlist = fClient->GetPicture("tb_list.xpm");
171 fPdetails = fClient->GetPicture("tb_details.xpm");
172
173 if (!(fPcdup && fPnewf && fPlist && fPdetails))
174 Error("TGFileDialog", "missing toolbar pixmap(s).\n");
175
176 fCdup = new TGPictureButton(fHtop, fPcdup, kIDF_CDUP);
178 fList = new TGPictureButton(fHtop, fPlist, kIDF_LIST);
180
181 fCdup->SetStyle(gClient->GetStyle());
182 fNewf->SetStyle(gClient->GetStyle());
183 fList->SetStyle(gClient->GetStyle());
184 fDetails->SetStyle(gClient->GetStyle());
185
186 fCdup->SetToolTipText("Up One Level");
187 fNewf->SetToolTipText("Create New Folder");
188 fList->SetToolTipText("List");
189 fDetails->SetToolTipText("Details");
190
191 fCdup->Associate(this);
192 fNewf->Associate(this);
193 fList->Associate(this);
194 fDetails->Associate(this);
195
198
200
201 fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
202 fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
203 fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
204 fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
205 fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
206 fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));
207
208 if (dlg_type == kFDSave) {
209 fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
210 fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
211 } else {
212 fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
213 fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
214 fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
215 }
218 AddFrame(fHtop, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
219
220 //--- file view
221
222 fFv = new TGListView(this, 400, 161);
223
226 fFc->Associate(this);
227
231 fFv->SetIncrements(1, 19); // set vertical scroll one line height at a time
232
233 TGTextButton** buttons = fFv->GetHeaderButtons();
234 if (buttons) {
235 buttons[0]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByName)");
236 buttons[1]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByType)");
237 buttons[2]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortBySize)");
238 buttons[3]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByOwner)");
239 buttons[4]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByGroup)");
240 buttons[5]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByDate)");
241 }
242
248
250
252
253 if (dlg_type == kFDOpen) {
254 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"SetMultipleSelection(Bool_t)");
255 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"UnSelectAll()");
256 }
257
258 //--- file name and types
259
260 TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 10, 10);
261
262 TGVerticalFrame *fVf = new TGVerticalFrame(fHf, 10, 10);
263
264 TGHorizontalFrame *fHfname = new TGHorizontalFrame(fVf, 10, 10);
265
266 TGLabel *fLfname = new TGLabel(fHfname, new TGHotString("File &name:"));
267 fTbfname = new TGTextBuffer(1034);
268 fName = new TGTextEntry(fHfname, fTbfname);
270 fName->Associate(this);
271
272 fHfname->AddFrame(fLfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
273 fHfname->AddFrame(fName, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
274
276
277 TGHorizontalFrame *fHftype = new TGHorizontalFrame(fVf, 10, 10);
278
279 TGLabel *fLftypes = new TGLabel(fHftype, new TGHotString("Files of &type:"));
280 fTypes = new TGComboBox(fHftype, kIDF_FTYPESLB);
281 fTypes->Associate(this);
283
284 TString s;
285 for (i = 0; fFileInfo->fFileTypes[i] != 0; i += 2) {
286 s.Form("%s (%s)", fFileInfo->fFileTypes[i], fFileInfo->fFileTypes[i+1]);
287 fTypes->AddEntry(s.Data(), i);
288 }
290
291 // Show all items in combobox without scrollbar
292 //TGDimension fw = fTypes->GetListBox()->GetContainer()->GetDefaultSize();
293 //fTypes->GetListBox()->Resize(fw.fWidth, fw.fHeight);
294
297 } else {
298 fTbfname->Clear();
299 if (dlg_type == kFDSave) {
300 fTbfname->AddText(0, "unnamed");
301 fName->SelectAll();
303 strstr(fFileInfo->fFileTypes[fFileInfo->fFileTypeIdx+1], "*.")) {
305 ext.ReplaceAll("*.", ".");
306 fTbfname->AddText(7, ext.Data());
307 }
308 fName->SetFocus();
309 }
310 }
311
312 fTypes->GetListBox()->Resize(230, 120);
313 fHftype->AddFrame(fLftypes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
314 fHftype->AddFrame(fTypes, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
315
317
319
320 //--- Open/Save and Cancel buttons
321
322 TGVerticalFrame *fVbf = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
323
324 fOk = new TGTextButton(fVbf, new TGHotString((dlg_type == kFDSave)
325 ? "&Save" : "&Open"), kIDF_OK);
326 fCancel = new TGTextButton(fVbf, new TGHotString("Cancel"), kIDF_CANCEL);
327
328 fOk->Associate(this);
329 fCancel->Associate(this);
330
331 fVbf->AddFrame(fOk, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
332 fVbf->AddFrame(fCancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
333
335 fVbf->Resize(width + 20, fVbf->GetDefaultHeight());
336
338
339 AddFrame(fHf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
341
343
345
346 Resize(size);
347
348 //---- position relative to the parent's window
349
351
352 //---- make the message box non-resizable
353
354 SetWMSize(size.fWidth, size.fHeight);
355 SetWMSizeHints(size.fWidth, size.fHeight, 10000, 10000, 1, 1);
356
357 const char *wname = (dlg_type == kFDSave) ? "Save As..." : "Open";
358 SetWindowName(wname);
359 SetIconName(wname);
360 SetClassHints("ROOT", "FileDialog");
361
367
368 MapWindow();
370 if (dlg_type == kFDSave)
371 fName->SetFocus();
372 fClient->WaitFor(this);
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Delete file dialog.
377
379{
380 if (IsZombie()) return;
381 TString str = fCheckB->GetString();
382 if (str.Contains("Multiple"))
383 fCheckB->Disconnect("Toggled(Bool_t)");
388 delete fFc;
389}
390
391////////////////////////////////////////////////////////////////////////////////
392/// Close file dialog.
393
395{
396 fFileInfo->SetFilename(nullptr);
398 DeleteWindow();
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// Small function used to prevent memory leaks with TSystem::ExpandPathName,
403/// which returns a string created by StrDup, that has to be deleted
404
405namespace {
406 static inline void pExpandUnixPathName(TGFileInfo &file_info) {
407 char *tmpPath = gSystem->ExpandPathName(file_info.fFilename);
408 file_info.SetFilename(gSystem->UnixPathName(tmpPath));
409 delete[] tmpPath;
410 }
411}
412
413////////////////////////////////////////////////////////////////////////////////
414/// Process messages generated by the user input in the file dialog.
415
417{
418 if (!fFc->GetDisplayStat()) return kTRUE; // Cancel button was pressed
419
421 TGTextLBEntry *te;
422 TGFileItem *f;
423 void *p = 0;
424 TString txt;
426
427 switch (GET_MSG(msg)) {
428 case kC_COMMAND:
429 switch (GET_SUBMSG(msg)) {
430 case kCM_BUTTON:
431 switch (parm1) {
432 case kIDF_OK:
433 // same code as under kTE_ENTER
434 if (fTbfname->GetTextLength() == 0) {
435 txt = "Please provide file name or use \"Cancel\"";
437 "Missing File Name", txt, kMBIconExclamation,
438 kMBOk);
439 return kTRUE;
441 !strcmp(fOk->GetTitle(), "Save") &&
442 (!(fCheckB->GetState() == kButtonDown))) {
443 Int_t ret;
444 txt = TString::Format("File name %s already exists, OK to overwrite it?",
447 "File Name Exist", txt.Data(), kMBIconExclamation,
448 kMBYes | kMBNo, &ret);
449 if (ret == kMBNo)
450 return kTRUE;
451 }
453 fFileInfo->SetFilename(nullptr);
454 } else {
455 fFileInfo->SetFilename(nullptr);
456 // FIXME: once appropriate gSystem method exists, use SetFilename here
459 else
462 pExpandUnixPathName(*fFileInfo);
463 }
464 if (fCheckB && (fCheckB->GetState() == kButtonDown))
466 else
468 DeleteWindow();
469 break;
470
471 case kIDF_CANCEL:
472 fFileInfo->SetFilename(nullptr);
473 if (fFc->GetDisplayStat())
476 DeleteWindow();
477 return kTRUE; //no need to redraw fFc
478 break;
479
480 case kIDF_CDUP:
481 fFc->ChangeDirectory("..");
484 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
486 }
487 break;
488
489 case kIDF_NEW_FOLDER: {
490 char answer[128];
491 strlcpy(answer, "(empty)", sizeof(answer));
492 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
493 "Enter directory name:",
494 answer/*"(empty)"*/, answer);
495
496 while ( strcmp(answer, "(empty)") == 0 ) {
497 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
498 "Please enter a valid directory name.",
500 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
501 "Enter directory name:",
502 answer, answer);
503 }
504 if ( strcmp(answer, "") == 0 ) // Cancel button was pressed
505 break;
506
507 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
509 }
510 if ( gSystem->MakeDirectory(answer) != 0 )
511 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
512 TString::Format("Directory name \'%s\' already exists!", answer),
514 else {
516 }
518 break;
519 }
520
521 case kIDF_LIST:
524 break;
525
526 case kIDF_DETAILS:
529 break;
530 }
531 break;
532
533 case kCM_COMBOBOX:
534 switch (parm1) {
535 case kIDF_FSLB:
537 if (e) {
538 fFc->ChangeDirectory(e->GetPath()->GetString());
541 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
543 }
544 }
545 break;
546
547 case kIDF_FTYPESLB:
549 if (te) {
550 //fTbfname->Clear();
551 //fTbfname->AddText(0, fFileInfo->fFileTypes[te->EntryId()+1]);
556 }
557 break;
558 }
559 break;
560
561 default:
562 break;
563 } // switch(GET_SUBMSG(msg))
564 break;
565
566 case kC_CONTAINER:
567 switch (GET_SUBMSG(msg)) {
568 case kCT_ITEMCLICK:
569 if (parm1 == kButton1) {
570 if (fFc->NumSelected() > 0) {
572 TGLVEntry *e2 = (TGLVEntry *) fFc->GetNextSelected(&p);
573 if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
574 fTbfname->Clear();
575 if (e2->GetItemName())
578 }
579 }
580 else {
581 TString tmpString;
582 TList *tmp = fFc->GetSelectedItems();
583 TObjString *el;
584 TIter next(tmp);
587 } else {
589 }
590 while ((el = (TObjString *) next())) {
592 el->GetString());
593 tmpString += "\"" + el->GetString() + "\" ";
595 delete [] s;
596 }
597 tmp->Delete();
598 delete tmp;
599 fTbfname->Clear();
600 fTbfname->AddText(0, tmpString);
602 }
603 }
604 }
605 break;
606
607 case kCT_ITEMDBLCLICK:
608
609 if (parm1 == kButton1) {
610 if (fFc->NumSelected() == 1) {
611 f = (TGFileItem *) fFc->GetNextSelected(&p);
612 if (f && R_ISDIR(f->GetType())) {
613 fFc->ChangeDirectory(f->GetItemName()->GetString());
616 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
618 }
619 } else {
620 if (!strcmp(fOk->GetTitle(), "Save") &&
621 (!(fCheckB->GetState() == kButtonDown))) {
622
623 Int_t ret;
624 txt = TString::Format("File name %s already exists, OK to overwrite it?",
627 "File Name Exist", txt.Data(), kMBIconExclamation,
628 kMBYes | kMBNo, &ret);
629 if (ret == kMBNo)
630 return kTRUE;
631 }
632 fFileInfo->SetFilename(nullptr);
633 // FIXME: once appropriate gSystem method exists, use SetFilename here
636 else
639 pExpandUnixPathName(*fFileInfo);
640 if (fCheckB && (fCheckB->GetState() == kButtonDown))
642 else
644
645 DeleteWindow();
646 }
647 }
648 }
649
650 break;
651
652 default:
653 break;
654
655 } // switch(GET_SUBMSG(msg))
656 break;
657
658 case kC_TEXTENTRY:
659 switch (GET_SUBMSG(msg)) {
660 case kTE_ENTER:
661 // same code as under kIDF_OK
662 if (fTbfname->GetTextLength() == 0) {
663 const char *txt2 = "Please provide file name or use \"Cancel\"";
665 "Missing File Name", txt2, kMBIconExclamation,
666 kMBOk);
667 return kTRUE;
669 FileStat_t buf;
670 if (!gSystem->GetPathInfo(fTbfname->GetString(), buf) &&
671 R_ISDIR(buf.fMode)) {
674 if (strcmp(gSystem->WorkingDirectory(), fFc->GetDirectory())) {
676 }
677 fName->SetText("", kFALSE);
678 return kTRUE;
679 }
680 else if (!strcmp(fOk->GetTitle(), "Save") &&
681 (!(fCheckB->GetState() == kButtonDown))) {
682 Int_t ret;
683 txt = TString::Format("File name %s already exists, OK to overwrite it?",
686 "File Name Exist", txt.Data(), kMBIconExclamation,
687 kMBYes | kMBNo, &ret);
688 if (ret == kMBNo)
689 return kTRUE;
690 }
691 }
692 fFileInfo->SetFilename(nullptr);
693 // FIXME: once appropriate gSystem method exists, use SetFilename here
696 pExpandUnixPathName(*fFileInfo);
697 if (fCheckB && (fCheckB->GetState() == kButtonDown))
699 else
701 DeleteWindow();
702 break;
703
704 default:
705 break;
706 }
707 break;
708
709 default:
710 break;
711
712 } // switch(GET_MSG(msg))
713
715 return kTRUE;
716}
@ kVerticalFrame
Definition: GuiTypes.h:381
@ kFixedWidth
Definition: GuiTypes.h:387
@ kHorizontalFrame
Definition: GuiTypes.h:382
@ kButton1
Definition: GuiTypes.h:213
#define f(i)
Definition: RSha256.hxx:104
#define e(i)
Definition: RSha256.hxx:103
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kButtonDown
Definition: TGButton.h:54
@ kButtonUp
Definition: TGButton.h:53
@ kButtonEngaged
Definition: TGButton.h:55
#define gClient
Definition: TGClient.h:166
@ kSortByName
Definition: TGFSContainer.h:29
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
Definition: TGFileDialog.h:37
@ kFDOpen
Definition: TGFileDialog.h:38
@ kFDSave
Definition: TGFileDialog.h:39
@ kMWMDecorResizeH
Definition: TGFrame.h:74
@ kMWMFuncAll
Definition: TGFrame.h:58
@ kMWMFuncResize
Definition: TGFrame.h:59
@ kMWMDecorMaximize
Definition: TGFrame.h:78
@ kMWMDecorMinimize
Definition: TGFrame.h:77
@ kMWMDecorMenu
Definition: TGFrame.h:76
@ kMWMDecorAll
Definition: TGFrame.h:72
@ kMWMFuncMaximize
Definition: TGFrame.h:62
@ kMWMInputModeless
Definition: TGFrame.h:66
@ kMWMFuncMinimize
Definition: TGFrame.h:61
@ kDeepCleanup
Definition: TGFrame.h:51
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsCenterY
Definition: TGLayout.h:35
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
@ kLVDetails
Definition: TGListView.h:43
@ kLVList
Definition: TGListView.h:42
@ kMBNo
Definition: TGMsgBox.h:43
@ kMBYes
Definition: TGMsgBox.h:42
@ kMBOk
Definition: TGMsgBox.h:44
@ kMBIconExclamation
Definition: TGMsgBox.h:35
@ kMBIconStop
Definition: TGMsgBox.h:33
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2490
@ kFileExists
Definition: TSystem.h:43
Bool_t R_ISDIR(Int_t mode)
Definition: TSystem.h:114
R__EXTERN TSystem * gSystem
Definition: TSystem.h:556
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:397
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:223
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:187
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:227
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:224
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
Definition: TGClient.cxx:708
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:308
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:135
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
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...
Definition: TGComboBox.cxx:451
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1056
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:353
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1148
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:351
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1006
virtual void Associate(const TGWindow *w)
Definition: TGCanvas.h:99
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition: TGCanvas.cxx:676
virtual Int_t NumSelected() const
Definition: TGCanvas.h:114
UInt_t fHeight
Definition: TGDimension.h:30
UInt_t fWidth
Definition: TGDimension.h:29
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
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by the user input in the file dialog.
const TGPicture * fPcdup
Definition: TGFileDialog.h:93
const TGPicture * fPdetails
Definition: TGFileDialog.h:96
TGFileContainer * fFc
Definition: TGFileDialog.h:100
TGPictureButton * fDetails
Definition: TGFileDialog.h:90
TGPictureButton * fNewf
Definition: TGFileDialog.h:88
TGTextBuffer * fTbfname
Definition: TGFileDialog.h:83
TGTextButton * fCancel
Definition: TGFileDialog.h:98
TGFSComboBox * fTreeLB
Definition: TGFileDialog.h:86
virtual void CloseWindow()
Close file dialog.
TGFileInfo * fFileInfo
Definition: TGFileDialog.h:101
TGTextEntry * fName
Definition: TGFileDialog.h:84
const TGPicture * fPnewf
Definition: TGFileDialog.h:94
TGPictureButton * fList
Definition: TGFileDialog.h:89
TGPictureButton * fCdup
Definition: TGFileDialog.h:87
TGListView * fFv
Definition: TGFileDialog.h:99
const TGPicture * fPlist
Definition: TGFileDialog.h:95
TGFileDialog(const TGFileDialog &)
virtual ~TGFileDialog()
Delete file dialog.
TGTextButton * fOk
Definition: TGFileDialog.h:97
TGCheckButton * fCheckB
Definition: TGFileDialog.h:91
TGComboBox * fTypes
Definition: TGFileDialog.h:85
TList * fFileNamesList
Definition: TGFileDialog.h:67
char * fFilename
Definition: TGFileDialog.h:61
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
Int_t fFileTypeIdx
Definition: TGFileDialog.h:64
const char ** fFileTypes
Definition: TGFileDialog.h:63
char * fIniDir
Definition: TGFileDialog.h:62
~TGFileInfo()
TGFileInfo Destructor.
Bool_t fOverwrite
Definition: TGFileDialog.h:65
void DeleteFileNamesList()
Delete file names list.
void SetFilename(const char *fname)
Set file name.
Bool_t fMultipleSelection
Definition: TGFileDialog.h:66
void SetIniDir(const char *inidir)
Set directory name.
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:215
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:296
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:260
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
virtual void MapWindow()
map window
Definition: TGFrame.h:229
static Pixel_t fgWhitePixel
Definition: TGFrame.h:128
Int_t EntryId() const
Definition: TGListBox.h:68
TList * GetSelectedItems()
Get list of selected items in container.
Definition: TGListView.cxx:941
void SetMultipleSelection(Bool_t multi=kTRUE)
Definition: TGListView.h:251
TGString * GetItemName() const
Definition: TGListView.h:106
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1420
virtual void SetIncrements(Int_t hInc, Int_t vInc)
Set horizontal and vertical scrollbar increments.
TGTextButton ** GetHeaderButtons()
Definition: TGListView.h:177
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode.
virtual void SetContainer(TGFrame *f)
Set list view container.
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition: TGFrame.cxx:1740
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1816
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1761
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition: TGFrame.cxx:1851
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition: TGFrame.cxx:1826
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.
Definition: TGFrame.cxx:1864
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1748
TGClient * fClient
Definition: TGObject.h:37
const char * GetString() const
Definition: TGString.h:40
void AddText(Int_t pos, const char *text)
Definition: TGTextBuffer.h:49
const char * GetString() const
Definition: TGTextBuffer.h:47
UInt_t GetTextLength() const
Definition: TGTextBuffer.h:45
void Clear()
Definition: TGTextBuffer.h:52
virtual const char * GetTitle() const
Returns title of object.
Definition: TGButton.h:190
TString GetString() const
Definition: TGButton.h:191
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.
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition: TGFrame.cxx:1915
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:142
@ kEditDisable
Definition: TGWindow.h:58
A doubly linked list.
Definition: TList.h:44
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:469
Collectable string class.
Definition: TObjString.h:28
const TString & GetString() const
Definition: TObjString.h:46
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition: TObject.h:149
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
void MakeZombie()
Definition: TObject.h:49
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:866
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1024
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:687
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:2311
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Bool_t cd(const char *path)
Definition: TSystem.h:419
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1269
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1066
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:823
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:1393
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:1291
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:858
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition: TSystem.cxx:1058
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:947
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:867
int main(int argc, char **argv)
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
static constexpr double s
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
Int_t fMode
Definition: TSystem.h:126