Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGFileDialog.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id: f3cd439bd51d763ffd53693e89c42b2eaa27c520 $
2// Author: Fons Rademakers 20/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
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#include "strlcpy.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 nullptr, nullptr };
61
63
64
66
67////////////////////////////////////////////////////////////////////////////////
68/// TGFileInfo Destructor.
69
71{
72 delete [] fFilename;
73 delete [] fIniDir;
75}
76
77
78////////////////////////////////////////////////////////////////////////////////
79/// Delete file names list
80
82{
83 if (fFileNamesList) {
85 delete fFileNamesList;
86 fFileNamesList = nullptr;
87 }
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Turn on/off multiple selection.
92
94{
95 if ( fMultipleSelection != option ) {
96 fMultipleSelection = option;
99 fFileNamesList = new TList();
100 }
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// Set file name
105
106void TGFileInfo::SetFilename(const char *fname)
107{
108 delete [] fFilename;
109 fFilename = fname ? StrDup(fname) : nullptr;
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Set directory name
114
115void TGFileInfo::SetIniDir(const char *inidir)
116{
117 delete [] fIniDir;
118 fIniDir = inidir ? StrDup(inidir) : nullptr;
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Create a file selection dialog. Depending on the dlg_type it can be
123/// used for opening or saving a file.
124/// About the first two arguments, p is the parent Window, usually the
125/// desktop (root) window, and main is the main (TGMainFrame) application
126/// window (the one opening the dialog), onto which the dialog is
127/// usually centered, and which is waiting for it to close.
128
130 EFileDialogMode dlg_type, TGFileInfo *file_info) :
131 TGTransientFrame(p, main, 10, 10, kVerticalFrame), fTbfname(0), fName(0),
132 fTypes(0), fTreeLB(0), fCdup(0), fNewf(0), fList(0), fDetails(0), fCheckB(0),
133 fPcdup(0), fPnewf(0), fPlist(0), fPdetails(0), fOk(0), fCancel(0), fFv(0),
134 fFc(0), fFileInfo(0), fDlgType(dlg_type)
135{
137 Connect("CloseWindow()", "TGFileDialog", this, "CloseWindow()");
139
140 int i;
141
142 if (!p && !main) {
143 MakeZombie();
144 return;
145 }
146 if (!file_info) {
147 Error("TGFileDialog", "file_info argument not set");
148 fFileInfo = &gInfo;
149 fFileInfo->SetIniDir(nullptr);
150 fFileInfo->SetFilename(nullptr);
152 } else
153 fFileInfo = file_info;
154
155 if (!fFileInfo->fFileTypes)
157
158 if (!fFileInfo->fIniDir)
159 fFileInfo->SetIniDir(".");
160
161 TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
162
163 //--- top toolbar elements
164 TGLabel *fLookin = new TGLabel(fHtop, new TGHotString((dlg_type == kFDSave || dlg_type == kDSave)
165 ? "S&ave in:" : "&Look in:"));
166 fTreeLB = new TGFSComboBox(fHtop, kIDF_FSLB);
167 fTreeLB->Associate(this);
168
169 fPcdup = fClient->GetPicture("tb_uplevel.xpm");
170 fPnewf = fClient->GetPicture("tb_newfolder.xpm");
171 fPlist = fClient->GetPicture("tb_list.xpm");
172 fPdetails = fClient->GetPicture("tb_details.xpm");
173
174 if (!(fPcdup && fPnewf && fPlist && fPdetails))
175 Error("TGFileDialog", "missing toolbar pixmap(s).\n");
176
177 fCdup = new TGPictureButton(fHtop, fPcdup, kIDF_CDUP);
179 fList = new TGPictureButton(fHtop, fPlist, kIDF_LIST);
181
182 fCdup->SetStyle(gClient->GetStyle());
183 fNewf->SetStyle(gClient->GetStyle());
184 fList->SetStyle(gClient->GetStyle());
185 fDetails->SetStyle(gClient->GetStyle());
186
187 fCdup->SetToolTipText("Up One Level");
188 fNewf->SetToolTipText("Create New Folder");
189 fList->SetToolTipText("List");
190 fDetails->SetToolTipText("Details");
191
192 fCdup->Associate(this);
193 fNewf->Associate(this);
194 fList->Associate(this);
195 fDetails->Associate(this);
196
199
201
202 fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
203 fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
204 fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
205 fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
206 fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
207 fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));
208
209 if (dlg_type == kFDSave) {
210 fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
211 fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
212 } else if (dlg_type == kFDOpen) {
213 fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
214 fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
215 fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
216 }
217 if (fCheckB) {
220 }
221 AddFrame(fHtop, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
222
223 //--- file view
224
225 fFv = new TGListView(this, 400, 161);
226
229 fFc->Associate(this);
230
234 fFv->SetIncrements(1, 19); // set vertical scroll one line height at a time
235
236 TGTextButton** buttons = fFv->GetHeaderButtons();
237 if (buttons) {
238 buttons[0]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByName)");
239 buttons[1]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByType)");
240 buttons[2]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortBySize)");
241 buttons[3]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByOwner)");
242 buttons[4]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByGroup)");
243 buttons[5]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByDate)");
244 }
245
251
253
255
256 if (dlg_type == kFDOpen) {
257 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"SetMultipleSelection(Bool_t)");
258 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"UnSelectAll()");
259 }
260
261 //--- file name and types
262
263 TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 10, 10);
264
265 TGVerticalFrame *fVf = new TGVerticalFrame(fHf, 10, 10);
266
267 TGHorizontalFrame *fHfname = new TGHorizontalFrame(fVf, 10, 10);
268
269 TGLabel *fLfname = new TGLabel(fHfname, new TGHotString(
270 (dlg_type == kDOpen || dlg_type == kDSave ) ? "Folder &name:" : "File &name:"));
271 fTbfname = new TGTextBuffer(1034);
272 fName = new TGTextEntry(fHfname, fTbfname);
274 fName->Associate(this);
275
276 fHfname->AddFrame(fLfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
277 fHfname->AddFrame(fName, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
278
280
281 TGHorizontalFrame *fHftype = new TGHorizontalFrame(fVf, 10, 10);
282
283 TGLabel *fLftypes = new TGLabel(fHftype, new TGHotString("Files of &type:"));
284 fTypes = new TGComboBox(fHftype, kIDF_FTYPESLB);
285 fTypes->Associate(this);
287
288 TString s;
289 for (i = 0; fFileInfo->fFileTypes[i] != 0; i += 2) {
290 s.Form("%s (%s)", fFileInfo->fFileTypes[i], fFileInfo->fFileTypes[i+1]);
291 fTypes->AddEntry(s.Data(), i);
292 }
294
295 // Show all items in combobox without scrollbar
296 //TGDimension fw = fTypes->GetListBox()->GetContainer()->GetDefaultSize();
297 //fTypes->GetListBox()->Resize(fw.fWidth, fw.fHeight);
298
301 } else {
302 fTbfname->Clear();
303 if (dlg_type == kFDSave) {
304 fTbfname->AddText(0, "unnamed");
305 fName->SelectAll();
307 strstr(fFileInfo->fFileTypes[fFileInfo->fFileTypeIdx+1], "*.")) {
309 ext.ReplaceAll("*.", ".");
310 fTbfname->AddText(7, ext.Data());
311 }
312 fName->SetFocus();
313 }
314 }
315
316 fTypes->GetListBox()->Resize(230, 120);
317 if (dlg_type == kDOpen || dlg_type == kDSave) {
319 }
320
321 fHftype->AddFrame(fLftypes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
322 fHftype->AddFrame(fTypes, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
323
325
327
328 //--- Open/Save and Cancel buttons
329
330 TGVerticalFrame *fVbf = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
331
332 fOk = new TGTextButton(fVbf, new TGHotString((dlg_type == kFDSave || dlg_type == kDSave)
333 ? "&Save" : "&Open"), kIDF_OK);
334 fCancel = new TGTextButton(fVbf, new TGHotString("Cancel"), kIDF_CANCEL);
335
336 fOk->Associate(this);
337 fCancel->Associate(this);
338
339 fVbf->AddFrame(fOk, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
340 fVbf->AddFrame(fCancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
341
343 fVbf->Resize(width + 20, fVbf->GetDefaultHeight());
344
346
347 AddFrame(fHf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
349
351
353
354 Resize(size);
355
356 //---- position relative to the parent's window
357
359
360 //---- make the message box non-resizable
361
362 SetWMSize(size.fWidth, size.fHeight);
363 SetWMSizeHints(size.fWidth, size.fHeight, 10000, 10000, 1, 1);
364
365 const char *wname = (dlg_type == kFDSave || dlg_type == kDSave) ? "Save As..." : "Open";
366 SetWindowName(wname);
367 SetIconName(wname);
368 SetClassHints("ROOT", "FileDialog");
369
375
376 MapWindow();
378 if (dlg_type == kFDSave || dlg_type == kDSave)
379 fName->SetFocus();
380 fClient->WaitFor(this);
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Delete file dialog.
385
387{
388 if (IsZombie()) return;
389 TString str = fCheckB ? fCheckB->GetString() : "";
390 if (str.Contains("Multiple") && fCheckB)
391 fCheckB->Disconnect("Toggled(Bool_t)");
396 delete fFc;
397}
398
399////////////////////////////////////////////////////////////////////////////////
400/// Close file dialog.
401
403{
404 fFileInfo->SetFilename(nullptr);
406 DeleteWindow();
407}
408
409////////////////////////////////////////////////////////////////////////////////
410/// Small function used to prevent memory leaks with TSystem::ExpandPathName,
411/// which returns a string created by StrDup, that has to be deleted
412
413namespace {
414 static inline void pExpandUnixPathName(TGFileInfo &file_info) {
415 char *tmpPath = gSystem->ExpandPathName(file_info.fFilename);
416 file_info.SetFilename(gSystem->UnixPathName(tmpPath));
417 delete[] tmpPath;
418 }
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Process messages generated by the user input in the file dialog.
423
425{
426 if (!fFc->GetDisplayStat()) return kTRUE; // Cancel button was pressed
427
429 TGTextLBEntry *te;
430 TGFileItem *f;
431 void *p = 0;
432 TString txt;
434
435 switch (GET_MSG(msg)) {
436 case kC_COMMAND:
437 switch (GET_SUBMSG(msg)) {
438 case kCM_BUTTON:
439 switch (parm1) {
440 case kIDF_OK:
441 // same code as under kTE_ENTER
442 if (fTbfname->GetTextLength() == 0) {
443 txt = "Please provide file name or use \"Cancel\"";
445 "Missing File Name", txt, kMBIconExclamation,
446 kMBOk);
447 return kTRUE;
449 !strcmp(fOk->GetTitle(), "Save") && fCheckB &&
450 (!(fCheckB->GetState() == kButtonDown))) {
451 Int_t ret;
452 txt = TString::Format("File name %s already exists, OK to overwrite it?",
455 "File Name Exist", txt.Data(), kMBIconExclamation,
456 kMBYes | kMBNo, &ret);
457 if (ret == kMBNo)
458 return kTRUE;
459 }
461 fFileInfo->SetFilename(nullptr);
462 } else {
463 fFileInfo->SetFilename(nullptr);
464 // FIXME: once appropriate gSystem method exists, use SetFilename here
467 else
470 pExpandUnixPathName(*fFileInfo);
471 }
472 if (fCheckB && (fCheckB->GetState() == kButtonDown))
474 else
476 DeleteWindow();
477 break;
478
479 case kIDF_CANCEL:
480 fFileInfo->SetFilename(nullptr);
481 if (fFc->GetDisplayStat())
484 DeleteWindow();
485 return kTRUE; //no need to redraw fFc
486 break;
487
488 case kIDF_CDUP:
489 fFc->ChangeDirectory("..");
492 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
494 }
495 break;
496
497 case kIDF_NEW_FOLDER: {
498 char answer[128];
499 strlcpy(answer, "(empty)", sizeof(answer));
500 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
501 "Enter directory name:",
502 answer/*"(empty)"*/, answer);
503
504 while ( strcmp(answer, "(empty)") == 0 ) {
505 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
506 "Please enter a valid directory name.",
508 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
509 "Enter directory name:",
510 answer, answer);
511 }
512 if ( strcmp(answer, "") == 0 ) // Cancel button was pressed
513 break;
514
515 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
517 }
518 if ( gSystem->MakeDirectory(answer) != 0 )
519 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
520 TString::Format("Directory name \'%s\' already exists!", answer),
522 else {
524 }
526 break;
527 }
528
529 case kIDF_LIST:
532 break;
533
534 case kIDF_DETAILS:
537 break;
538 }
539 break;
540
541 case kCM_COMBOBOX:
542 switch (parm1) {
543 case kIDF_FSLB:
545 if (e) {
546 fFc->ChangeDirectory(e->GetPath()->GetString());
549 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
551 }
552 }
553 break;
554
555 case kIDF_FTYPESLB:
557 if (te) {
558 //fTbfname->Clear();
559 //fTbfname->AddText(0, fFileInfo->fFileTypes[te->EntryId()+1]);
564 }
565 break;
566 }
567 break;
568
569 default:
570 break;
571 } // switch(GET_SUBMSG(msg))
572 break;
573
574 case kC_CONTAINER:
575 switch (GET_SUBMSG(msg)) {
576 case kCT_ITEMCLICK:
577 if (parm1 == kButton1) {
578 if (fFc->NumSelected() > 0) {
580 TGLVEntry *e2 = (TGLVEntry *) fFc->GetNextSelected(&p);
581 if (fDlgType == kFDOpen || fDlgType == kFDSave) {
582 if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
583 fTbfname->Clear();
584 if (e2->GetItemName())
587 }
588 } else {
589 if ((e2) && R_ISDIR(((TGFileItem *)e2)->GetType())) {
590 fTbfname->Clear();
591 if (e2->GetItemName())
595 } else if ((e2)) {
597 }
598 }
599 }
600 else {
601 TString tmpString;
602 TList *tmp = fFc->GetSelectedItems();
603 TObjString *el;
604 TIter next(tmp);
607 } else {
609 }
610 while ((el = (TObjString *) next())) {
612 el->GetString());
613 tmpString += "\"" + el->GetString() + "\" ";
615 delete [] s;
616 }
617 tmp->Delete();
618 delete tmp;
619 fTbfname->Clear();
620 fTbfname->AddText(0, tmpString);
622 }
623 }
624 }
625 break;
626
627 case kCT_ITEMDBLCLICK:
628
629 if (parm1 == kButton1) {
630 if (fFc->NumSelected() == 1) {
631 f = (TGFileItem *) fFc->GetNextSelected(&p);
632 if (f && R_ISDIR(f->GetType())) {
633 fFc->ChangeDirectory(f->GetItemName()->GetString());
636 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
638 }
639 if (fDlgType == kDOpen || fDlgType == kDSave) {
640 fTbfname->Clear();
643 }
644 } else if (fDlgType == kFDOpen || fDlgType == kFDSave) {
645 if (!strcmp(fOk->GetTitle(), "Save") && fCheckB &&
646 (!(fCheckB->GetState() == kButtonDown))) {
647
648 Int_t ret;
649 txt = TString::Format("File name %s already exists, OK to overwrite it?",
652 "File Name Exist", txt.Data(), kMBIconExclamation,
653 kMBYes | kMBNo, &ret);
654 if (ret == kMBNo)
655 return kTRUE;
656 }
657 fFileInfo->SetFilename(nullptr);
658 // FIXME: once appropriate gSystem method exists, use SetFilename here
661 else
664 pExpandUnixPathName(*fFileInfo);
665 if (fCheckB && (fCheckB->GetState() == kButtonDown))
667 else
669
670 DeleteWindow();
671 }
672 }
673 }
674
675 break;
676
677 default:
678 break;
679
680 } // switch(GET_SUBMSG(msg))
681 break;
682
683 case kC_TEXTENTRY:
684 // when typing, re-enable previously disabled button after having clicked on file instead of folder
687
688 switch (GET_SUBMSG(msg)) {
689 case kTE_ENTER:
690 // same code as under kIDF_OK
691 if (fTbfname->GetTextLength() == 0) {
692 const char *txt2 = "Please provide file name or use \"Cancel\"";
694 "Missing File Name", txt2, kMBIconExclamation,
695 kMBOk);
696 return kTRUE;
698 FileStat_t buf;
699 if (!gSystem->GetPathInfo(fTbfname->GetString(), buf) &&
700 R_ISDIR(buf.fMode)) {
703 if (strcmp(gSystem->WorkingDirectory(), fFc->GetDirectory())) {
705 }
706 fName->SetText("", kFALSE);
707 return kTRUE;
708 }
709 else if (!strcmp(fOk->GetTitle(), "Save") && fCheckB &&
710 (!(fCheckB->GetState() == kButtonDown))) {
711 Int_t ret;
712 txt = TString::Format("File name %s already exists, OK to overwrite it?",
715 "File Name Exist", txt.Data(), kMBIconExclamation,
716 kMBYes | kMBNo, &ret);
717 if (ret == kMBNo)
718 return kTRUE;
719 }
720 }
721 fFileInfo->SetFilename(nullptr);
722 // FIXME: once appropriate gSystem method exists, use SetFilename here
725 pExpandUnixPathName(*fFileInfo);
726 if (fCheckB && (fCheckB->GetState() == kButtonDown))
728 else
730 DeleteWindow();
731 break;
732
733 default:
734 break;
735 }
736 break;
737
738 default:
739 break;
740
741 } // switch(GET_MSG(msg))
742
744 return kTRUE;
745}
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kButton1
Definition GuiTypes.h:214
#define f(i)
Definition RSha256.hxx:104
#define e(i)
Definition RSha256.hxx:103
const Bool_t kFALSE
Definition RtypesCore.h:92
long Long_t
Definition RtypesCore.h:54
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
@ kButtonEngaged
Definition TGButton.h:55
#define gClient
Definition TGClient.h:166
@ kSortByName
EFileFialog
@ kIDF_OK
@ kIDF_FTYPESLB
@ kIDF_FSLB
@ kIDF_CDUP
@ kIDF_DETAILS
@ kIDF_NEW_FOLDER
@ kIDF_CHECKB
@ kIDF_LIST
@ kIDF_CANCEL
static TGFileInfo gInfo
static const char * gDefTypes[]
EFileDialogMode
@ kFDOpen
@ kDOpen
@ kDSave
@ kFDSave
@ kMWMDecorResizeH
Definition TGFrame.h:73
@ kMWMFuncAll
Definition TGFrame.h:57
@ kMWMFuncResize
Definition TGFrame.h:58
@ kMWMDecorMaximize
Definition TGFrame.h:77
@ kMWMDecorMinimize
Definition TGFrame.h:76
@ kMWMDecorMenu
Definition TGFrame.h:75
@ kMWMDecorAll
Definition TGFrame.h:71
@ kMWMFuncMaximize
Definition TGFrame.h:61
@ kMWMInputModeless
Definition TGFrame.h:65
@ kMWMFuncMinimize
Definition TGFrame.h:60
@ kDeepCleanup
Definition TGFrame.h:50
@ 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:39
@ kMBYes
Definition TGMsgBox.h:38
@ kMBOk
Definition TGMsgBox.h:40
@ kMBIconExclamation
Definition TGMsgBox.h:31
@ kMBIconStop
Definition TGMsgBox.h:29
char * StrDup(const char *str)
Duplicate the string str.
Definition TString.cxx:2510
@ kFileExists
Definition TSystem.h:44
Bool_t R_ISDIR(Int_t mode)
Definition TSystem.h:115
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
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:398
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:224
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:412
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:188
TGViewPort * GetViewPort() const
Definition TGCanvas.h:227
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:223
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
Definition TGClient.cxx:708
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:371
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:307
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...
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1057
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:352
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1149
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:350
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1007
virtual void Associate(const TGWindow *w)
Definition TGCanvas.h:99
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition TGCanvas.cxx:677
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
const TGPicture * fPdetails
TGFileContainer * fFc
TGPictureButton * fDetails
TGPictureButton * fNewf
EFileDialogMode fDlgType
TGTextBuffer * fTbfname
TGTextButton * fCancel
TGFSComboBox * fTreeLB
virtual void CloseWindow()
Close file dialog.
TGFileInfo * fFileInfo
TGTextEntry * fName
const TGPicture * fPnewf
TGPictureButton * fList
TGPictureButton * fCdup
TGListView * fFv
const TGPicture * fPlist
virtual ~TGFileDialog()
Delete file dialog.
TGTextButton * fOk
TGCheckButton * fCheckB
TGFileDialog(const TGFileDialog &)=delete
TGComboBox * fTypes
TList * fFileNamesList
char * fFilename
void SetMultipleSelection(Bool_t option)
Turn on/off multiple selection.
Int_t fFileTypeIdx
const char ** fFileTypes
char * fIniDir
~TGFileInfo()
TGFileInfo Destructor.
Bool_t fOverwrite
void DeleteFileNamesList()
Delete file names list.
void SetFilename(const char *fname)
Set file name.
Bool_t fMultipleSelection
void SetIniDir(const char *inidir)
Set directory name.
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:214
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:215
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:297
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:261
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
virtual void MapWindow()
map window
Definition TGFrame.h:228
static Pixel_t fgWhitePixel
Definition TGFrame.h:127
Int_t EntryId() const
Definition TGListBox.h:67
TList * GetSelectedItems()
Get list of selected items in container.
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.
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:1741
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1817
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1762
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1852
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGFrame.cxx:1827
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:1865
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1749
TGClient * fClient
Definition TGObject.h:37
const char * GetString() const
Definition TGString.h:40
void AddText(Int_t pos, const char *text)
const char * GetString() const
UInt_t GetTextLength() const
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:1916
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:82
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:151
@ 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:470
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
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.
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
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:2331
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2309
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
Bool_t cd(const char *path)
Definition TSystem.h:421
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1272
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition TSystem.cxx:1069
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:826
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:1396
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:1294
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:861
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1061
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition TSystem.cxx:950
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:870
int main()
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:212
Int_t fMode
Definition TSystem.h:127