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