ROOT  6.06/09
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 "TGButton.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 "TSystem.h"
40 #include "TGInputDialog.h"
41 #include "TObjString.h"
42 
43 #include <sys/stat.h>
44 
55 };
56 
57 static const char *gDefTypes[] = { "All files", "*",
58  "ROOT files", "*.root",
59  "ROOT macros", "*.C",
60  0, 0 };
61 
63 
64 
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// TGFileInfo Destructor.
69 
71 {
72  delete [] fFilename;
73  delete [] fIniDir;
74  if ( fFileNamesList != 0 ) {
75  fFileNamesList->Delete();
76  delete fFileNamesList;
77  }
78 }
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Turn on/off multiple selection.
82 
84 {
85  if ( fMultipleSelection != option ) {
86  fMultipleSelection = option;
87  if ( fMultipleSelection == kTRUE )
88  fFileNamesList = new TList();
89  else {
91  delete fFileNamesList;
92  fFileNamesList = 0;
93  }
94  }
95 }
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// Create a file selection dialog. Depending on the dlg_type it can be
99 /// used for opening or saving a file.
100 /// About the first two arguments, p is the parent Window, usually the
101 /// desktop (root) window, and main is the main (TGMainFrame) application
102 /// window (the one opening the dialog), onto which the dialog is
103 /// usually centered, and which is waiting for it to close.
104 
106  EFileDialogMode dlg_type, TGFileInfo *file_info) :
107  TGTransientFrame(p, main, 10, 10, kVerticalFrame), fTbfname(0), fName(0),
108  fTypes(0), fTreeLB(0), fCdup(0), fNewf(0), fList(0), fDetails(0), fCheckB(0),
109  fPcdup(0), fPnewf(0), fPlist(0), fPdetails(0), fOk(0), fCancel(0), fFv(0),
110  fFc(0), fFileInfo(0)
111 {
113  Connect("CloseWindow()", "TGFileDialog", this, "CloseWindow()");
114  DontCallClose();
115 
116  int i;
117 
118  if (!p && !main) {
119  MakeZombie();
120  return;
121  }
122  if (!file_info) {
123  Error("TGFileDialog", "file_info argument not set");
124  fFileInfo = &gInfo;
125  if (fFileInfo->fIniDir) {
126  delete [] fFileInfo->fIniDir;
127  fFileInfo->fIniDir = 0;
128  }
129  if (fFileInfo->fFilename) {
130  delete [] fFileInfo->fFilename;
131  fFileInfo->fFilename = 0;
132  }
133  fFileInfo->fFileTypeIdx = 0;
134  } else
135  fFileInfo = file_info;
136 
137  if (!fFileInfo->fFileTypes)
139 
140  if (!fFileInfo->fIniDir)
141  fFileInfo->fIniDir = StrDup(".");
142 
143  TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
144 
145  //--- top toolbar elements
146  TGLabel *fLookin = new TGLabel(fHtop, new TGHotString((dlg_type == kFDSave)
147  ? "S&ave in:" : "&Look in:"));
148  fTreeLB = new TGFSComboBox(fHtop, kIDF_FSLB);
149  fTreeLB->Associate(this);
150 
151  fPcdup = fClient->GetPicture("tb_uplevel.xpm");
152  fPnewf = fClient->GetPicture("tb_newfolder.xpm");
153  fPlist = fClient->GetPicture("tb_list.xpm");
154  fPdetails = fClient->GetPicture("tb_details.xpm");
155 
156  if (!(fPcdup && fPnewf && fPlist && fPdetails))
157  Error("TGFileDialog", "missing toolbar pixmap(s).\n");
158 
159  fCdup = new TGPictureButton(fHtop, fPcdup, kIDF_CDUP);
161  fList = new TGPictureButton(fHtop, fPlist, kIDF_LIST);
163 
164  fCdup->SetStyle(gClient->GetStyle());
165  fNewf->SetStyle(gClient->GetStyle());
166  fList->SetStyle(gClient->GetStyle());
167  fDetails->SetStyle(gClient->GetStyle());
168 
169  fCdup->SetToolTipText("Up One Level");
170  fNewf->SetToolTipText("Create New Folder");
171  fList->SetToolTipText("List");
172  fDetails->SetToolTipText("Details");
173 
174  fCdup->Associate(this);
175  fNewf->Associate(this);
176  fList->Associate(this);
177  fDetails->Associate(this);
178 
181 
183 
184  fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
185  fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
186  fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
187  fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
188  fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
189  fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));
190 
191  if (dlg_type == kFDSave) {
192  fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
193  fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
194  } else {
195  fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
196  fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
197  fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
198  }
201  AddFrame(fHtop, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
202 
203  //--- file view
204 
205  fFv = new TGListView(this, 400, 161);
206 
208  10, 10, kHorizontalFrame, fgWhitePixel);
209  fFc->Associate(this);
210 
212  fFv->SetContainer(fFc);
214  fFv->SetIncrements(1, 19); // set vertical scroll one line height at a time
215 
216  TGTextButton** buttons = fFv->GetHeaderButtons();
217  if (buttons) {
218  buttons[0]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByName)");
219  buttons[1]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByType)");
220  buttons[2]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortBySize)");
221  buttons[3]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByOwner)");
222  buttons[4]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByGroup)");
223  buttons[5]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByDate)");
224  }
225 
227  fFc->Sort(kSortByName);
231 
233 
235 
236  if (dlg_type == kFDOpen) {
237  fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"SetMultipleSelection(Bool_t)");
238  fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"UnSelectAll()");
239  }
240 
241  //--- file name and types
242 
243  TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 10, 10);
244 
245  TGVerticalFrame *fVf = new TGVerticalFrame(fHf, 10, 10);
246 
247  TGHorizontalFrame *fHfname = new TGHorizontalFrame(fVf, 10, 10);
248 
249  TGLabel *fLfname = new TGLabel(fHfname, new TGHotString("File &name:"));
250  fTbfname = new TGTextBuffer(1034);
251  fName = new TGTextEntry(fHfname, fTbfname);
253  fName->Associate(this);
254 
255  fHfname->AddFrame(fLfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
256  fHfname->AddFrame(fName, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
257 
259 
260  TGHorizontalFrame *fHftype = new TGHorizontalFrame(fVf, 10, 10);
261 
262  TGLabel *fLftypes = new TGLabel(fHftype, new TGHotString("Files of &type:"));
263  fTypes = new TGComboBox(fHftype, kIDF_FTYPESLB);
264  fTypes->Associate(this);
266 
267  TString s;
268  for (i = 0; fFileInfo->fFileTypes[i] != 0; i += 2) {
269  s.Form("%s (%s)", fFileInfo->fFileTypes[i], fFileInfo->fFileTypes[i+1]);
270  fTypes->AddEntry(s.Data(), i);
271  }
273 
274  // Show all items in combobox without scrollbar
275  //TGDimension fw = fTypes->GetListBox()->GetContainer()->GetDefaultSize();
276  //fTypes->GetListBox()->Resize(fw.fWidth, fw.fHeight);
277 
280  else {
281  fTbfname->Clear();
282  if (dlg_type == kFDSave) {
283  fTbfname->AddText(0, "unnamed");
284  fName->SelectAll();
286  strstr(fFileInfo->fFileTypes[fFileInfo->fFileTypeIdx+1], "*.")) {
288  ext.ReplaceAll("*.", ".");
289  fTbfname->AddText(7, ext.Data());
290  }
291  fName->SetFocus();
292  }
293  }
294 
295  fTypes->GetListBox()->Resize(230, 120);
296  fHftype->AddFrame(fLftypes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
297  fHftype->AddFrame(fTypes, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
298 
300 
302 
303  //--- Open/Save and Cancel buttons
304 
305  TGVerticalFrame *fVbf = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
306 
307  fOk = new TGTextButton(fVbf, new TGHotString((dlg_type == kFDSave)
308  ? "&Save" : "&Open"), kIDF_OK);
309  fCancel = new TGTextButton(fVbf, new TGHotString("Cancel"), kIDF_CANCEL);
310 
311  fOk->Associate(this);
312  fCancel->Associate(this);
313 
314  fVbf->AddFrame(fOk, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
315  fVbf->AddFrame(fCancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
316 
318  fVbf->Resize(width + 20, fVbf->GetDefaultHeight());
319 
321 
322  AddFrame(fHf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
324 
325  MapSubwindows();
326 
327  TGDimension size = GetDefaultSize();
328 
329  Resize(size);
330 
331  //---- position relative to the parent's window
332 
333  CenterOnParent();
334 
335  //---- make the message box non-resizable
336 
337  SetWMSize(size.fWidth, size.fHeight);
338  SetWMSizeHints(size.fWidth, size.fHeight, 10000, 10000, 1, 1);
339 
340  const char *wname = (dlg_type == kFDSave) ? "Save As..." : "Open";
341  SetWindowName(wname);
342  SetIconName(wname);
343  SetClassHints("ROOT", "FileDialog");
344 
350 
351  MapWindow();
353  if (dlg_type == kFDSave)
354  fName->SetFocus();
355  fClient->WaitFor(this);
356 }
357 
358 ////////////////////////////////////////////////////////////////////////////////
359 /// Delete file dialog.
360 
362 {
363  if (IsZombie()) return;
364  TString str = fCheckB->GetString();
365  if (str.Contains("Multiple"))
366  fCheckB->Disconnect("Toggled(Bool_t)");
371  delete fFc;
372 }
373 
374 ////////////////////////////////////////////////////////////////////////////////
375 /// Close file dialog.
376 
378 {
379  if (fFileInfo->fFilename)
380  delete [] fFileInfo->fFilename;
381  fFileInfo->fFilename = 0;
382  if (fFileInfo->fFileNamesList != 0) {
385  }
386  DeleteWindow();
387 }
388 
389 ////////////////////////////////////////////////////////////////////////////////
390 /// Process messages generated by the user input in the file dialog.
391 
393 {
394  if (!fFc->GetDisplayStat()) return kTRUE; // Cancel button was pressed
395 
396  TGTreeLBEntry *e;
397  TGTextLBEntry *te;
398  TGFileItem *f;
399  void *p = 0;
400  TString txt;
401  TString sdir = gSystem->WorkingDirectory();
402 
403  switch (GET_MSG(msg)) {
404  case kC_COMMAND:
405  switch (GET_SUBMSG(msg)) {
406  case kCM_BUTTON:
407  switch (parm1) {
408  case kIDF_OK:
409  // same code as under kTE_ENTER
410  if (fTbfname->GetTextLength() == 0) {
411  txt = "Please provide file name or use \"Cancel\"";
413  "Missing File Name", txt, kMBIconExclamation,
414  kMBOk);
415  return kTRUE;
417  !strcmp(fOk->GetTitle(), "Save") &&
418  (!(fCheckB->GetState() == kButtonDown))) {
419  Int_t ret;
420  txt = TString::Format("File name %s already exists, OK to overwrite it?",
421  fTbfname->GetString());
423  "File Name Exist", txt.Data(), kMBIconExclamation,
424  kMBYes | kMBNo, &ret);
425  if (ret == kMBNo)
426  return kTRUE;
427  }
429  if (fFileInfo->fFilename)
430  delete [] fFileInfo->fFilename;
431  fFileInfo->fFilename = 0;
432  }
433  else {
434  if (fFileInfo->fFilename)
435  delete [] fFileInfo->fFilename;
438  else
440  fTbfname->GetString());
442  }
443  if (fCheckB && (fCheckB->GetState() == kButtonDown))
445  else
447  DeleteWindow();
448  break;
449 
450  case kIDF_CANCEL:
451  if (fFileInfo->fFilename)
452  delete [] fFileInfo->fFilename;
453  fFileInfo->fFilename = 0;
454  if (fFc->GetDisplayStat())
456  if (fFileInfo->fFileNamesList != 0) {
459  }
460  DeleteWindow();
461  return kTRUE; //no need to redraw fFc
462  break;
463 
464  case kIDF_CDUP:
465  fFc->ChangeDirectory("..");
467  if (fFileInfo->fIniDir) delete [] fFileInfo->fIniDir;
469  if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
470  gSystem->cd(fFc->GetDirectory());
471  }
472  break;
473 
474  case kIDF_NEW_FOLDER: {
475  char answer[128];
476  strlcpy(answer, "(empty)", sizeof(answer));
477  new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
478  "Enter directory name:",
479  answer/*"(empty)"*/, answer);
480 
481  while ( strcmp(answer, "(empty)") == 0 ) {
482  new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
483  "Please enter a valid directory name.",
484  kMBIconStop, kMBOk);
485  new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
486  "Enter directory name:",
487  answer, answer);
488  }
489  if ( strcmp(answer, "") == 0 ) // Cancel button was pressed
490  break;
491 
492  if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
493  gSystem->cd(fFc->GetDirectory());
494  }
495  if ( gSystem->MakeDirectory(answer) != 0 )
496  new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
497  TString::Format("Directory name \'%s\' already exists!", answer),
498  kMBIconStop, kMBOk);
499  else {
501  }
502  gSystem->ChangeDirectory(sdir.Data());
503  break;
504  }
505 
506  case kIDF_LIST:
509  break;
510 
511  case kIDF_DETAILS:
514  break;
515  }
516  break;
517 
518  case kCM_COMBOBOX:
519  switch (parm1) {
520  case kIDF_FSLB:
522  if (e) {
525  if (fFileInfo->fIniDir) delete [] fFileInfo->fIniDir;
527  if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
528  gSystem->cd(fFc->GetDirectory());
529  }
530  }
531  break;
532 
533  case kIDF_FTYPESLB:
535  if (te) {
536  //fTbfname->Clear();
537  //fTbfname->AddText(0, fFileInfo->fFileTypes[te->EntryId()+1]);
538  fFileInfo->fFileTypeIdx = te->EntryId();
542  }
543  break;
544  }
545  break;
546 
547  default:
548  break;
549  } // switch(GET_SUBMSG(msg))
550  break;
551 
552  case kC_CONTAINER:
553  switch (GET_SUBMSG(msg)) {
554  case kCT_ITEMCLICK:
555  if (parm1 == kButton1) {
556  if (fFc->NumSelected() > 0) {
557  if ( fFileInfo->fMultipleSelection == kFALSE ) {
558  TGLVEntry *e2 = (TGLVEntry *) fFc->GetNextSelected(&p);
559  if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
560  fTbfname->Clear();
561  if (e2->GetItemName())
562  fTbfname->AddText(0, e2->GetItemName()->GetString());
564  }
565  }
566  else {
567  TString tmpString;
568  TList *tmp = fFc->GetSelectedItems();
569  TObjString *el;
570  TIter next(tmp);
571  if ( fFileInfo->fFileNamesList != 0 ) {
573  }
574  else {
575  fFileInfo->fFileNamesList = new TList();
576  }
577  while ((el = (TObjString *) next())) {
578  char *s = gSystem->ConcatFileName(fFc->GetDirectory(),
579  el->GetString());
580  tmpString += "\"" + el->GetString() + "\" ";
582  delete [] s;
583  }
584  fTbfname->Clear();
585  fTbfname->AddText(0, tmpString);
587  }
588  }
589  }
590  break;
591 
592  case kCT_ITEMDBLCLICK:
593 
594  if (parm1 == kButton1) {
595  if (fFc->NumSelected() == 1) {
596  f = (TGFileItem *) fFc->GetNextSelected(&p);
597  if (f && R_ISDIR(f->GetType())) {
600  if (fFileInfo->fIniDir) delete [] fFileInfo->fIniDir;
602  if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
603  gSystem->cd(fFc->GetDirectory());
604  }
605  } else {
606  if (!strcmp(fOk->GetTitle(), "Save") &&
607  (!(fCheckB->GetState() == kButtonDown))) {
608 
609  Int_t ret;
610  txt = TString::Format("File name %s already exists, OK to overwrite it?",
611  fTbfname->GetString());
613  "File Name Exist", txt.Data(), kMBIconExclamation,
614  kMBYes | kMBNo, &ret);
615  if (ret == kMBNo)
616  return kTRUE;
617  }
618  if (fFileInfo->fFilename)
619  delete [] fFileInfo->fFilename;
622  else
624  fTbfname->GetString());
626  if (fCheckB && (fCheckB->GetState() == kButtonDown))
628  else
630 
631  DeleteWindow();
632  }
633  }
634  }
635 
636  break;
637 
638  default:
639  break;
640 
641  } // switch(GET_SUBMSG(msg))
642  break;
643 
644  case kC_TEXTENTRY:
645  switch (GET_SUBMSG(msg)) {
646  case kTE_ENTER:
647  // same code as under kIDF_OK
648  if (fTbfname->GetTextLength() == 0) {
649  const char *txt2 = "Please provide file name or use \"Cancel\"";
651  "Missing File Name", txt2, kMBIconExclamation,
652  kMBOk);
653  return kTRUE;
655  FileStat_t buf;
656  if (!gSystem->GetPathInfo(fTbfname->GetString(), buf) &&
657  R_ISDIR(buf.fMode)) {
660  if (strcmp(gSystem->WorkingDirectory(), fFc->GetDirectory())) {
661  gSystem->cd(fFc->GetDirectory());
662  }
663  fName->SetText("", kFALSE);
664  return kTRUE;
665  }
666  else if (!strcmp(fOk->GetTitle(), "Save") &&
667  (!(fCheckB->GetState() == kButtonDown))) {
668  Int_t ret;
669  txt = TString::Format("File name %s already exists, OK to overwrite it?",
670  fTbfname->GetString());
672  "File Name Exist", txt.Data(), kMBIconExclamation,
673  kMBYes | kMBNo, &ret);
674  if (ret == kMBNo)
675  return kTRUE;
676  }
677  }
678  if (fFileInfo->fFilename)
679  delete [] fFileInfo->fFilename;
681  fTbfname->GetString());
683  if (fCheckB && (fCheckB->GetState() == kButtonDown))
685  else
687  DeleteWindow();
688  break;
689 
690  default:
691  break;
692  }
693  break;
694 
695  default:
696  break;
697 
698  } // switch(GET_MSG(msg))
699 
701  return kTRUE;
702 }
TGTextBuffer * fTbfname
Definition: TGFileDialog.h:82
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:1265
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:945
const TGPicture * fPnewf
Definition: TGFileDialog.h:93
const char * GetDirectory() const
const TGString * GetPath() const
Definition: TGFSComboBox.h:65
TGFileInfo * fFileInfo
Definition: TGFileDialog.h:100
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1419
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition: TGCanvas.cxx:678
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:404
TGTextButton * fOk
Definition: TGFileDialog.h:96
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:865
virtual Int_t NumSelected() const
Definition: TGCanvas.h:116
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
Definition: TObjString.h:32
Bool_t fOverwrite
Definition: TGFileDialog.h:67
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition: TGFrame.cxx:1913
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
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:1363
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:222
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:821
TGComboBox * fTypes
Definition: TGFileDialog.h:84
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:856
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
TGPictureButton * fNewf
Definition: TGFileDialog.h:87
Bool_t cd(const char *path)
Definition: TSystem.h:414
virtual void Associate(const TGWindow *w)
Definition: TGCanvas.h:101
Bool_t IsZombie() const
Definition: TObject.h:141
Basic string class.
Definition: TString.h:137
#define gClient
Definition: TGClient.h:174
static Pixel_t fgWhitePixel
Definition: TGFrame.h:166
TGFSComboBox * fTreeLB
Definition: TGFileDialog.h:85
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TGTextButton * fCancel
Definition: TGFileDialog.h:97
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode.
const TGPicture * fPdetails
Definition: TGFileDialog.h:95
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:137
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
const TGPicture * fPcdup
Definition: TGFileDialog.h:92
TGFileDialog(const TGFileDialog &)
TString GetString() const
Definition: TGButton.h:195
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition: TGFrame.cxx:1738
TGString * GetItemName() const
Definition: TGListView.h:112
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1036
Int_t fMode
Definition: TSystem.h:138
const char * Data() const
Definition: TString.h:349
virtual void SelectAll()
Selects all text (i.e.
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:2334
virtual void ChangeDirectory(const char *path)
Change current directory.
virtual void SetIncrements(Int_t hInc, Int_t vInc)
Set horizontal and vertical scrollbar increments.
const char ** fFileTypes
Definition: TGFileDialog.h:65
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:1862
TGTextButton ** GetHeaderButtons()
Definition: TGListView.h:183
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:306
static const char * gDefTypes[]
virtual void SetFocus()
Set focus to this text entry.
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:443
const char * GetString() const
Definition: TGTextBuffer.h:49
void AddText(Int_t pos, const char *text)
Definition: TGTextBuffer.h:51
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:294
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1814
virtual void Sort(EFSSortMode sortType)
Sort file system list view container according to sortType.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
Definition: TGMsgBox.h:51
UInt_t fHeight
Definition: TGDimension.h:32
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:253
TGPictureButton * fList
Definition: TGFileDialog.h:88
TGListView * fFv
Definition: TGFileDialog.h:98
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
Definition: TGClient.cxx:706
A doubly linked list.
Definition: TList.h:47
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition: TGButton.cxx:221
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:1135
UInt_t fWidth
Definition: TGDimension.h:31
TString GetString() const
Definition: TObjString.h:50
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
Int_t EntryId() const
Definition: TGListBox.h:76
virtual EButtonState GetState() const
Definition: TGButton.h:116
Bool_t fMultipleSelection
Definition: TGFileDialog.h:68
Int_t GET_SUBMSG(Long_t val)
virtual void SetDisplayStat(Bool_t stat=kTRUE)
ClassImp(TGFileDialog) TGFileInfo
TGFileInfo Destructor.
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:389
virtual void AllowStayDown(Bool_t a)
Definition: TGButton.h:117
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void CloseWindow()
Close file dialog.
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:132
Int_t GetType() const
Definition: TGFSContainer.h:97
TList * fFileNamesList
Definition: TGFileDialog.h:69
void SetMultipleSelection(Bool_t multi=kTRUE)
Definition: TGListView.h:258
virtual void Update(const char *path)
Update file system combo box.
TGTextEntry * fName
Definition: TGFileDialog.h:83
TGFileContainer * fFc
Definition: TGFileDialog.h:99
TList * GetSelectedItems()
Get list of selected items in container.
Definition: TGListView.cxx:936
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2513
Int_t GET_MSG(Long_t val)
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:133
long Long_t
Definition: RtypesCore.h:50
UInt_t GetTextLength() const
Definition: TGTextBuffer.h:47
int main(int argc, char *argv[])
Definition: python64.c:14
double f(double x)
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1004
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:108
EFileFialog
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:287
Int_t fFileTypeIdx
Definition: TGFileDialog.h:66
char * fFilename
Definition: TGFileDialog.h:63
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:1293
virtual ~TGFileDialog()
Delete file dialog.
const TGPicture * fPlist
Definition: TGFileDialog.h:94
TGPictureButton * fDetails
Definition: TGFileDialog.h:89
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void SetOn(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition: TGButton.h:124
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
void Clear()
Definition: TGTextBuffer.h:54
Bool_t R_ISDIR(Int_t mode)
Definition: TSystem.h:126
virtual void SetFilter(const char *filter)
Set file selection filter.
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:254
virtual void Add(TObject *obj)
Definition: TList.h:81
virtual const char * GetTitle() const
Returns title of object.
Definition: TGButton.h:194
virtual void MapWindow()
Definition: TGFrame.h:267
TGClient * fClient
Definition: TGObject.h:41
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
void MakeZombie()
Definition: TObject.h:68
TGPictureButton * fCdup
Definition: TGFileDialog.h:86
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition: TGFrame.cxx:1849
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:370
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
static TGFileInfo gInfo
const char * GetString() const
Definition: TGString.h:44
Bool_t GetDisplayStat()
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by the user input in the file dialog.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:391
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1243
EFileDialogMode
Definition: TGFileDialog.h:39
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 DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
TGCheckButton * fCheckB
Definition: TGFileDialog.h:90
const Bool_t kTRUE
Definition: Rtypes.h:91
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition: TGFrame.cxx:1824
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1044
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual void SetContainer(TGFrame *f)
Set list view container.
char * fIniDir
Definition: TGFileDialog.h:64
Definition: TGMsgBox.h:52
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:229
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185