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 "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
57static 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 ) {
76 delete fFileNamesList;
77 }
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// Turn on/off multiple selection.
82
84{
85 if ( fMultipleSelection != option ) {
86 fMultipleSelection = option;
88 fFileNamesList = new TList();
89 else {
91 delete fFileNamesList;
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()");
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 }
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
209 fFc->Associate(this);
210
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
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
326
328
329 Resize(size);
330
331 //---- position relative to the parent's window
332
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/// Small function used to prevent memory leaks with TSystem::ExpandPathName,
391/// which returns a string created by StrDup, that has to be deleted
392
393namespace {
394 static inline void pExpandUnixPathName(TGFileInfo &file_info) {
395 char *tmpPath = gSystem->ExpandPathName(file_info.fFilename);
396 delete [] file_info.fFilename;
397 file_info.fFilename = StrDup(gSystem->UnixPathName(tmpPath));
398 delete[] tmpPath;
399 }
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Process messages generated by the user input in the file dialog.
404
406{
407 if (!fFc->GetDisplayStat()) return kTRUE; // Cancel button was pressed
408
410 TGTextLBEntry *te;
411 TGFileItem *f;
412 void *p = 0;
413 TString txt;
415
416 switch (GET_MSG(msg)) {
417 case kC_COMMAND:
418 switch (GET_SUBMSG(msg)) {
419 case kCM_BUTTON:
420 switch (parm1) {
421 case kIDF_OK:
422 // same code as under kTE_ENTER
423 if (fTbfname->GetTextLength() == 0) {
424 txt = "Please provide file name or use \"Cancel\"";
426 "Missing File Name", txt, kMBIconExclamation,
427 kMBOk);
428 return kTRUE;
430 !strcmp(fOk->GetTitle(), "Save") &&
431 (!(fCheckB->GetState() == kButtonDown))) {
432 Int_t ret;
433 txt = TString::Format("File name %s already exists, OK to overwrite it?",
436 "File Name Exist", txt.Data(), kMBIconExclamation,
437 kMBYes | kMBNo, &ret);
438 if (ret == kMBNo)
439 return kTRUE;
440 }
442 if (fFileInfo->fFilename)
443 delete [] fFileInfo->fFilename;
444 fFileInfo->fFilename = 0;
445 }
446 else {
447 if (fFileInfo->fFilename)
448 delete [] fFileInfo->fFilename;
451 else
454 pExpandUnixPathName(*fFileInfo);
455 }
456 if (fCheckB && (fCheckB->GetState() == kButtonDown))
458 else
460 DeleteWindow();
461 break;
462
463 case kIDF_CANCEL:
464 if (fFileInfo->fFilename)
465 delete [] fFileInfo->fFilename;
466 fFileInfo->fFilename = 0;
467 if (fFc->GetDisplayStat())
469 if (fFileInfo->fFileNamesList != 0) {
472 }
473 DeleteWindow();
474 return kTRUE; //no need to redraw fFc
475 break;
476
477 case kIDF_CDUP:
478 fFc->ChangeDirectory("..");
480 if (fFileInfo->fIniDir) delete [] fFileInfo->fIniDir;
482 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
484 }
485 break;
486
487 case kIDF_NEW_FOLDER: {
488 char answer[128];
489 strlcpy(answer, "(empty)", sizeof(answer));
490 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
491 "Enter directory name:",
492 answer/*"(empty)"*/, answer);
493
494 while ( strcmp(answer, "(empty)") == 0 ) {
495 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
496 "Please enter a valid directory name.",
498 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
499 "Enter directory name:",
500 answer, answer);
501 }
502 if ( strcmp(answer, "") == 0 ) // Cancel button was pressed
503 break;
504
505 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
507 }
508 if ( gSystem->MakeDirectory(answer) != 0 )
509 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
510 TString::Format("Directory name \'%s\' already exists!", answer),
512 else {
514 }
516 break;
517 }
518
519 case kIDF_LIST:
522 break;
523
524 case kIDF_DETAILS:
527 break;
528 }
529 break;
530
531 case kCM_COMBOBOX:
532 switch (parm1) {
533 case kIDF_FSLB:
535 if (e) {
536 fFc->ChangeDirectory(e->GetPath()->GetString());
538 if (fFileInfo->fIniDir) delete [] fFileInfo->fIniDir;
540 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
542 }
543 }
544 break;
545
546 case kIDF_FTYPESLB:
548 if (te) {
549 //fTbfname->Clear();
550 //fTbfname->AddText(0, fFileInfo->fFileTypes[te->EntryId()+1]);
555 }
556 break;
557 }
558 break;
559
560 default:
561 break;
562 } // switch(GET_SUBMSG(msg))
563 break;
564
565 case kC_CONTAINER:
566 switch (GET_SUBMSG(msg)) {
567 case kCT_ITEMCLICK:
568 if (parm1 == kButton1) {
569 if (fFc->NumSelected() > 0) {
571 TGLVEntry *e2 = (TGLVEntry *) fFc->GetNextSelected(&p);
572 if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
573 fTbfname->Clear();
574 if (e2->GetItemName())
577 }
578 }
579 else {
580 TString tmpString;
581 TList *tmp = fFc->GetSelectedItems();
582 TObjString *el;
583 TIter next(tmp);
584 if ( fFileInfo->fFileNamesList != 0 ) {
586 }
587 else {
589 }
590 while ((el = (TObjString *) next())) {
592 el->GetString());
593 tmpString += "\"" + el->GetString() + "\" ";
595 delete [] s;
596 }
597 fTbfname->Clear();
598 fTbfname->AddText(0, tmpString);
600 }
601 }
602 }
603 break;
604
605 case kCT_ITEMDBLCLICK:
606
607 if (parm1 == kButton1) {
608 if (fFc->NumSelected() == 1) {
609 f = (TGFileItem *) fFc->GetNextSelected(&p);
610 if (f && R_ISDIR(f->GetType())) {
611 fFc->ChangeDirectory(f->GetItemName()->GetString());
613 if (fFileInfo->fIniDir) delete [] fFileInfo->fIniDir;
615 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
617 }
618 } else {
619 if (!strcmp(fOk->GetTitle(), "Save") &&
620 (!(fCheckB->GetState() == kButtonDown))) {
621
622 Int_t ret;
623 txt = TString::Format("File name %s already exists, OK to overwrite it?",
626 "File Name Exist", txt.Data(), kMBIconExclamation,
627 kMBYes | kMBNo, &ret);
628 if (ret == kMBNo)
629 return kTRUE;
630 }
631 if (fFileInfo->fFilename)
632 delete [] fFileInfo->fFilename;
635 else
638 pExpandUnixPathName(*fFileInfo);
639 if (fCheckB && (fCheckB->GetState() == kButtonDown))
641 else
643
644 DeleteWindow();
645 }
646 }
647 }
648
649 break;
650
651 default:
652 break;
653
654 } // switch(GET_SUBMSG(msg))
655 break;
656
657 case kC_TEXTENTRY:
658 switch (GET_SUBMSG(msg)) {
659 case kTE_ENTER:
660 // same code as under kIDF_OK
661 if (fTbfname->GetTextLength() == 0) {
662 const char *txt2 = "Please provide file name or use \"Cancel\"";
664 "Missing File Name", txt2, kMBIconExclamation,
665 kMBOk);
666 return kTRUE;
668 FileStat_t buf;
669 if (!gSystem->GetPathInfo(fTbfname->GetString(), buf) &&
670 R_ISDIR(buf.fMode)) {
673 if (strcmp(gSystem->WorkingDirectory(), fFc->GetDirectory())) {
675 }
676 fName->SetText("", kFALSE);
677 return kTRUE;
678 }
679 else if (!strcmp(fOk->GetTitle(), "Save") &&
680 (!(fCheckB->GetState() == kButtonDown))) {
681 Int_t ret;
682 txt = TString::Format("File name %s already exists, OK to overwrite it?",
685 "File Name Exist", txt.Data(), kMBIconExclamation,
686 kMBYes | kMBNo, &ret);
687 if (ret == kMBNo)
688 return kTRUE;
689 }
690 }
691 if (fFileInfo->fFilename)
692 delete [] fFileInfo->fFilename;
695 pExpandUnixPathName(*fFileInfo);
696 if (fCheckB && (fCheckB->GetState() == kButtonDown))
698 else
700 DeleteWindow();
701 break;
702
703 default:
704 break;
705 }
706 break;
707
708 default:
709 break;
710
711 } // switch(GET_MSG(msg))
712
714 return kTRUE;
715}
@ kButton1
Definition: GuiTypes.h:213
#define f(i)
Definition: RSha256.hxx:104
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
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:30
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:96
@ kMWMFuncAll
Definition: TGFrame.h:80
@ kMWMFuncResize
Definition: TGFrame.h:81
@ kMWMDecorMaximize
Definition: TGFrame.h:100
@ kMWMDecorMinimize
Definition: TGFrame.h:99
@ kMWMDecorMenu
Definition: TGFrame.h:98
@ kMWMDecorAll
Definition: TGFrame.h:94
@ kMWMFuncMaximize
Definition: TGFrame.h:84
@ kMWMInputModeless
Definition: TGFrame.h:88
@ kMWMFuncMinimize
Definition: TGFrame.h:83
@ kDeepCleanup
Definition: TGFrame.h:51
@ kVerticalFrame
Definition: TGFrame.h:59
@ kFixedWidth
Definition: TGFrame.h:65
@ kHorizontalFrame
Definition: TGFrame.h:60
@ 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:45
Bool_t R_ISDIR(Int_t mode)
Definition: TSystem.h:116
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
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:395
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:221
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
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:450
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 SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:373
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1004
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:90
const TGPicture * fPdetails
Definition: TGFileDialog.h:93
TGFileContainer * fFc
Definition: TGFileDialog.h:97
TGPictureButton * fDetails
Definition: TGFileDialog.h:87
TGPictureButton * fNewf
Definition: TGFileDialog.h:85
TGTextBuffer * fTbfname
Definition: TGFileDialog.h:80
TGTextButton * fCancel
Definition: TGFileDialog.h:95
TGFSComboBox * fTreeLB
Definition: TGFileDialog.h:83
virtual void CloseWindow()
Close file dialog.
TGFileInfo * fFileInfo
Definition: TGFileDialog.h:98
TGTextEntry * fName
Definition: TGFileDialog.h:81
const TGPicture * fPnewf
Definition: TGFileDialog.h:91
TGPictureButton * fList
Definition: TGFileDialog.h:86
TGPictureButton * fCdup
Definition: TGFileDialog.h:84
TGListView * fFv
Definition: TGFileDialog.h:96
const TGPicture * fPlist
Definition: TGFileDialog.h:92
TGFileDialog(const TGFileDialog &)
virtual ~TGFileDialog()
Delete file dialog.
TGTextButton * fOk
Definition: TGFileDialog.h:94
TGCheckButton * fCheckB
Definition: TGFileDialog.h:88
TGComboBox * fTypes
Definition: TGFileDialog.h:82
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
Bool_t fMultipleSelection
Definition: TGFileDialog.h:66
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:237
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:294
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void MapWindow()
Definition: TGFrame.h:251
static Pixel_t fgWhitePixel
Definition: TGFrame.h:150
Int_t EntryId() const
Definition: TGListBox.h:68
TList * GetSelectedItems()
Get list of selected items in container.
Definition: TGListView.cxx:936
void SetMultipleSelection(Bool_t multi=kTRUE)
Definition: TGListView.h:252
TGString * GetItemName() const
Definition: TGListView.h:106
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1419
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:1738
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1814
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1759
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition: TGFrame.cxx:1849
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
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
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
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:1913
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition: TGWindow.cxx:133
@ kEditDisable
Definition: TGWindow.h:59
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:467
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:134
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
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:867
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:1025
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:424
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1265
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1062
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:835
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:1389
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:1287
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:870
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1054
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:959
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:879
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:128