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
56};
57
58static const char *gDefTypes[] = { "All files", "*",
59 "ROOT files", "*.root",
60 "ROOT macros", "*.C",
61 nullptr, nullptr };
62
64
65
67
68////////////////////////////////////////////////////////////////////////////////
69/// TGFileInfo Destructor.
70
72{
73 delete [] fFilename;
74 delete [] fIniDir;
76}
77
78
79////////////////////////////////////////////////////////////////////////////////
80/// Delete file names list
81
83{
84 if (fFileNamesList) {
86 delete fFileNamesList;
87 fFileNamesList = nullptr;
88 }
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Turn on/off multiple selection.
93
95{
96 if ( fMultipleSelection != option ) {
100 fFileNamesList = new TList();
101 }
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Set file name
106
107void TGFileInfo::SetFilename(const char *fname)
108{
109 delete [] fFilename;
110 fFilename = fname ? StrDup(fname) : nullptr;
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// Set directory name
115
116void TGFileInfo::SetIniDir(const char *inidir)
117{
118 delete [] fIniDir;
119 fIniDir = inidir ? StrDup(inidir) : nullptr;
120}
121
122////////////////////////////////////////////////////////////////////////////////
123/// Create a file selection dialog. Depending on the dlg_type it can be
124/// used for opening or saving a file.
125/// About the first two arguments, p is the parent Window, usually the
126/// desktop (root) window, and main is the main (TGMainFrame) application
127/// window (the one opening the dialog), onto which the dialog is
128/// usually centered, and which is waiting for it to close.
129
131 EFileDialogMode dlg_type, TGFileInfo *file_info) :
132 TGTransientFrame(p, main, 10, 10, kVerticalFrame), fTbfname(0), fName(0),
133 fTypes(0), fTreeLB(0), fCdup(0), fNewf(0), fList(0), fDetails(0), fCheckB(0),
134 fPcdup(0), fPnewf(0), fPlist(0), fPdetails(0), fOk(0), fCancel(0), fFv(0),
135 fFc(0), fFileInfo(0), fDlgType(dlg_type)
136{
138 Connect("CloseWindow()", "TGFileDialog", this, "CloseWindow()");
140
141 int i;
142
143 if (!p && !main) {
144 MakeZombie();
145 return;
146 }
147 if (!file_info) {
148 Error("TGFileDialog", "file_info argument not set");
149 fFileInfo = &gInfo;
150 fFileInfo->SetIniDir(nullptr);
151 fFileInfo->SetFilename(nullptr);
153 } else
154 fFileInfo = file_info;
155
156 if (!fFileInfo->fFileTypes)
158
159 if (!fFileInfo->fIniDir)
160 fFileInfo->SetIniDir(".");
161
162 TGHorizontalFrame *fHtop = new TGHorizontalFrame(this, 10, 10);
163
164 //--- top toolbar elements
165 TGLabel *fLookin = new TGLabel(fHtop, new TGHotString((dlg_type == kFDSave || dlg_type == kDSave)
166 ? "S&ave in:" : "&Look in:"));
167 fTreeLB = new TGFSComboBox(fHtop, kIDF_FSLB);
168 fTreeLB->Associate(this);
169
170 fPcdup = fClient->GetPicture("tb_uplevel.xpm");
171 fPnewf = fClient->GetPicture("tb_newfolder.xpm");
172 fPlist = fClient->GetPicture("tb_list.xpm");
173 fPdetails = fClient->GetPicture("tb_details.xpm");
174
175 if (!(fPcdup && fPnewf && fPlist && fPdetails))
176 Error("TGFileDialog", "missing toolbar pixmap(s).\n");
177
178 fCdup = new TGPictureButton(fHtop, fPcdup, kIDF_CDUP);
180 fList = new TGPictureButton(fHtop, fPlist, kIDF_LIST);
182
183 fCdup->SetStyle(gClient->GetStyle());
184 fNewf->SetStyle(gClient->GetStyle());
185 fList->SetStyle(gClient->GetStyle());
186 fDetails->SetStyle(gClient->GetStyle());
187
188 fCdup->SetToolTipText("Up One Level");
189 fNewf->SetToolTipText("Create New Folder");
190 fList->SetToolTipText("List");
191 fDetails->SetToolTipText("Details");
192
193 fCdup->Associate(this);
194 fNewf->Associate(this);
195 fList->Associate(this);
196 fDetails->Associate(this);
197
200
202
203 fHtop->AddFrame(fLookin, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
204 fHtop->AddFrame(fTreeLB, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 3, 0, 2, 2));
205 fHtop->AddFrame(fCdup, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
206 fHtop->AddFrame(fNewf, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
207 fHtop->AddFrame(fList, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 0, 2, 2));
208 fHtop->AddFrame(fDetails, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 0, 8, 2, 2));
209
210 if (dlg_type == kFDSave) {
211 fCheckB = new TGCheckButton(fHtop, "&Overwrite", kIDF_CHECKB);
212 fCheckB->SetToolTipText("Overwrite a file without displaying a message if selected");
213 } else if (dlg_type == kFDOpen) {
214 fCheckB = new TGCheckButton(fHtop, "&Multiple files", kIDF_CHECKB);
215 fCheckB->SetToolTipText("Allows multiple file selection when SHIFT is pressed");
216 fCheckB->Connect("Toggled(Bool_t)","TGFileInfo",fFileInfo,"SetMultipleSelection(Bool_t)");
217 }
218 if (fCheckB) {
221 }
222 AddFrame(fHtop, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
223
224 //--- file view
225
226 fFv = new TGListView(this, 400, 161);
227
230 fFc->Associate(this);
231
235 fFv->SetIncrements(1, 19); // set vertical scroll one line height at a time
236
237 TGTextButton** buttons = fFv->GetHeaderButtons();
238 if (buttons) {
239 buttons[0]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByName)");
240 buttons[1]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByType)");
241 buttons[2]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortBySize)");
242 buttons[3]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByOwner)");
243 buttons[4]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByGroup)");
244 buttons[5]->Connect("Clicked()", "TGFileContainer", fFc, "Sort(=kSortByDate)");
245 }
246
252
254
256
257 if (dlg_type == kFDOpen) {
258 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"SetMultipleSelection(Bool_t)");
259 fCheckB->Connect("Toggled(Bool_t)","TGFileContainer",fFc,"UnSelectAll()");
260 }
261
262 //--- file name and types
263
264 TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 10, 10);
265
266 TGVerticalFrame *fVf = new TGVerticalFrame(fHf, 10, 10);
267
268 TGHorizontalFrame *fHfname = new TGHorizontalFrame(fVf, 10, 10);
269
270 TGLabel *fLfname = new TGLabel(fHfname, new TGHotString(
271 (dlg_type == kDOpen || dlg_type == kDSave ) ? "Folder &name:" : "File &name:"));
272 fTbfname = new TGTextBuffer(1034);
273 fName = new TGTextEntry(fHfname, fTbfname);
275 fName->Associate(this);
276
277 fHfname->AddFrame(fLfname, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
278 fHfname->AddFrame(fName, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
279
281
282 TGHorizontalFrame *fHftype = new TGHorizontalFrame(fVf, 10, 10);
283
284 TGLabel *fLftypes = new TGLabel(fHftype, new TGHotString("Files of &type:"));
285 fTypes = new TGComboBox(fHftype, kIDF_FTYPESLB);
286 fTypes->Associate(this);
288
289 TString s;
290 for (i = 0; fFileInfo->fFileTypes[i] != 0; i += 2) {
291 s.Form("%s (%s)", fFileInfo->fFileTypes[i], fFileInfo->fFileTypes[i+1]);
292 fTypes->AddEntry(s.Data(), i);
293 }
295
296 // Show all items in combobox without scrollbar
297 //TGDimension fw = fTypes->GetListBox()->GetContainer()->GetDefaultSize();
298 //fTypes->GetListBox()->Resize(fw.fWidth, fw.fHeight);
299
302 } else {
303 fTbfname->Clear();
304 if (dlg_type == kFDSave) {
305 fTbfname->AddText(0, "unnamed");
306 fName->SelectAll();
308 strstr(fFileInfo->fFileTypes[fFileInfo->fFileTypeIdx+1], "*.")) {
310 ext.ReplaceAll("*.", ".");
311 fTbfname->AddText(7, ext.Data());
312 }
313 fName->SetFocus();
314 }
315 }
316
317 fTypes->GetListBox()->Resize(230, 120);
318 if (dlg_type == kDOpen || dlg_type == kDSave) {
320 }
321
322 fHftype->AddFrame(fLftypes, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 2, 5, 2, 2));
323 fHftype->AddFrame(fTypes, new TGLayoutHints(kLHintsRight | kLHintsCenterY, 0, 20, 2, 2));
324
326
328
329 //--- Open/Save and Cancel buttons
330
331 TGVerticalFrame *fVbf = new TGVerticalFrame(fHf, 10, 10, kFixedWidth);
332
333 fOk = new TGTextButton(fVbf, new TGHotString((dlg_type == kFDSave || dlg_type == kDSave)
334 ? "&Save" : "&Open"), kIDF_OK);
335 fCancel = new TGTextButton(fVbf, new TGHotString("Cancel"), kIDF_CANCEL);
336
337 fOk->Associate(this);
338 fCancel->Associate(this);
339
340 fVbf->AddFrame(fOk, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
341 fVbf->AddFrame(fCancel, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
342
344 fVbf->Resize(width + 20, fVbf->GetDefaultHeight());
345
347
348 AddFrame(fHf, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 4, 4, 3, 1));
350
352
354
355 Resize(size);
356
357 //---- position relative to the parent's window
358
360
361 //---- make the message box non-resizable
362
363 SetWMSize(size.fWidth, size.fHeight);
364 SetWMSizeHints(size.fWidth, size.fHeight, 10000, 10000, 1, 1);
365
366 const char *wname = (dlg_type == kFDSave || dlg_type == kDSave) ? "Save As..." : "Open";
367 SetWindowName(wname);
368 SetIconName(wname);
369 SetClassHints("ROOT", "FileDialog");
370
376
377 MapWindow();
379 if (dlg_type == kFDSave || dlg_type == kDSave)
380 fName->SetFocus();
381 fClient->WaitFor(this);
382}
383
384////////////////////////////////////////////////////////////////////////////////
385/// Delete file dialog.
386
388{
389 if (IsZombie()) return;
390 TString str = fCheckB ? fCheckB->GetString() : TString();
391 if (str.Contains("Multiple") && fCheckB)
392 fCheckB->Disconnect("Toggled(Bool_t)");
397 delete fFc;
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Close file dialog.
402
404{
405 fFileInfo->SetFilename(nullptr);
407 DeleteWindow();
408}
409
410////////////////////////////////////////////////////////////////////////////////
411/// Small function used to prevent memory leaks with TSystem::ExpandPathName,
412/// which returns a string created by StrDup, that has to be deleted
413
414namespace {
415 static inline void pExpandUnixPathName(TGFileInfo &file_info) {
416 char *tmpPath = gSystem->ExpandPathName(file_info.fFilename);
417 file_info.SetFilename(gSystem->UnixPathName(tmpPath));
418 delete[] tmpPath;
419 }
420}
421
422////////////////////////////////////////////////////////////////////////////////
423/// Process messages generated by the user input in the file dialog.
424
426{
427 if (!fFc->GetDisplayStat()) return kTRUE; // Cancel button was pressed
428
430 TGTextLBEntry *te;
431 TGFileItem *f;
432 void *p = 0;
433 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
471 pExpandUnixPathName(*fFileInfo);
472 }
473 if (fCheckB && (fCheckB->GetState() == kButtonDown))
475 else
477 DeleteWindow();
478 break;
479
480 case kIDF_CANCEL:
481 fFileInfo->SetFilename(nullptr);
482 if (fDlgType == kDOpen || fDlgType == kDSave)
483 fFileInfo->SetIniDir(nullptr);
484 if (fFc->GetDisplayStat())
487 DeleteWindow();
488 return kTRUE; //no need to redraw fFc
489 break;
490
491 case kIDF_CDUP:
492 fFc->ChangeDirectory("..");
495 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
497 }
498 break;
499
500 case kIDF_NEW_FOLDER: {
501 char answer[128];
502 strlcpy(answer, "(empty)", sizeof(answer));
503 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
504 "Enter directory name:",
505 answer/*"(empty)"*/, answer);
506
507 while ( strcmp(answer, "(empty)") == 0 ) {
508 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
509 "Please enter a valid directory name.",
511 new TGInputDialog(gClient->GetRoot(), GetMainFrame(),
512 "Enter directory name:",
513 answer, answer);
514 }
515 if ( strcmp(answer, "") == 0 ) // Cancel button was pressed
516 break;
517
518 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
520 }
521 if ( gSystem->MakeDirectory(answer) != 0 )
522 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
523 TString::Format("Directory name \'%s\' already exists!", answer),
525 else {
527 }
529 break;
530 }
531
532 case kIDF_LIST:
535 break;
536
537 case kIDF_DETAILS:
540 break;
541 }
542 break;
543
544 case kCM_COMBOBOX:
545 switch (parm1) {
546 case kIDF_FSLB:
548 if (e) {
549 fFc->ChangeDirectory(e->GetPath()->GetString());
552 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
554 }
555 }
556 break;
557
558 case kIDF_FTYPESLB:
560 if (te) {
561 //fTbfname->Clear();
562 //fTbfname->AddText(0, fFileInfo->fFileTypes[te->EntryId()+1]);
567 }
568 break;
569 }
570 break;
571
572 default:
573 break;
574 } // switch(GET_SUBMSG(msg))
575 break;
576
577 case kC_CONTAINER:
578 switch (GET_SUBMSG(msg)) {
579 case kCT_ITEMCLICK:
580 if (parm1 == kButton1) {
581 if (fFc->NumSelected() > 0) {
584 if (fDlgType == kFDOpen || fDlgType == kFDSave) {
585 if ((e2) && !R_ISDIR(((TGFileItem *)e2)->GetType())) {
586 fTbfname->Clear();
587 if (e2->GetItemName())
590 }
591 } else {
592 if ((e2) && R_ISDIR(((TGFileItem *)e2)->GetType())) {
593 fTbfname->Clear();
594 if (e2->GetItemName())
598 } else if ((e2)) {
600 }
601 }
602 }
603 else {
604 TString tmpString;
605 TList *tmp = fFc->GetSelectedItems();
606 TObjString *el;
607 TIter next(tmp);
610 } else {
612 }
613 while ((el = (TObjString *) next())) {
615 el->GetString());
616 tmpString += "\"" + el->GetString() + "\" ";
618 delete [] s;
619 }
620 tmp->Delete();
621 delete tmp;
622 fTbfname->Clear();
623 fTbfname->AddText(0, tmpString);
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());
639 if (strcmp(gSystem->WorkingDirectory(),fFc->GetDirectory())) {
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
667 pExpandUnixPathName(*fFileInfo);
668 if (fCheckB && (fCheckB->GetState() == kButtonDown))
670 else
672
673 DeleteWindow();
674 }
675 }
676 }
677
678 break;
679
680 default:
681 break;
682
683 } // switch(GET_SUBMSG(msg))
684 break;
685
686 case kC_TEXTENTRY:
687 // when typing, re-enable previously disabled button after having clicked on file instead of folder
690
691 switch (GET_SUBMSG(msg)) {
692 case kTE_ENTER:
693 // same code as under kIDF_OK
694 if (fTbfname->GetTextLength() == 0) {
695 const char *txt2 = "Please provide file name or use \"Cancel\"";
697 "Missing File Name", txt2, kMBIconExclamation,
698 kMBOk);
699 return kTRUE;
701 FileStat_t buf;
702 if (!gSystem->GetPathInfo(fTbfname->GetString(), buf) &&
703 R_ISDIR(buf.fMode)) {
706 if (strcmp(gSystem->WorkingDirectory(), fFc->GetDirectory())) {
708 }
709 fName->SetText("", kFALSE);
710 return kTRUE;
711 }
712 else if (!strcmp(fOk->GetTitle(), "Save") && fCheckB &&
713 (!(fCheckB->GetState() == kButtonDown))) {
714 Int_t ret;
715 txt = TString::Format("File name %s already exists, OK to overwrite it?",
718 "File Name Exist", txt.Data(), kMBIconExclamation,
719 kMBYes | kMBNo, &ret);
720 if (ret == kMBNo)
721 return kTRUE;
722 }
723 }
724 fFileInfo->SetFilename(nullptr);
725 // FIXME: once appropriate gSystem method exists, use SetFilename here
728 pExpandUnixPathName(*fFileInfo);
729 if (fCheckB && (fCheckB->GetState() == kButtonDown))
731 else
733 DeleteWindow();
734 break;
735
736 default:
737 break;
738 }
739 break;
740
741 default:
742 break;
743
744 } // switch(GET_MSG(msg))
745
747 return kTRUE;
748}
@ 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
Definition RtypesCore.h:75
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:382
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
@ 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:2557
@ kFileExists
Definition TSystem.h:42
Bool_t R_ISDIR(Int_t mode)
Definition TSystem.h:113
R__EXTERN TSystem * gSystem
Definition TSystem.h:561
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:445
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:271
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:459
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
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:224
void WaitFor(TGWindow *w)
Wait for window to be destroyed.
Definition TGClient.cxx:718
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:381
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:317
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:316
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:314
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
virtual void Associate(const TGWindow *w)
Definition TGCanvas.h:89
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition TGCanvas.cxx:681
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
This class creates a file selection dialog.
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:605
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
void MapWindow() override
map window
Definition TGFrame.h:204
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
static Pixel_t fgWhitePixel
Definition TGFrame.h:103
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
Input Dialog Widget.
Int_t EntryId() const
Definition TGListBox.h:40
TList * GetSelectedItems()
Get list of selected items in container.
void SetMultipleSelection(Bool_t multi=kTRUE)
Definition TGListView.h:233
TGString * GetItemName() const
Definition TGListView.h:88
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
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:1780
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1858
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1893
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Yield an action as soon as it is clicked.
Definition TGButton.h:228
const char * GetString() const
Definition TGString.h:30
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:498
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1957
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
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:152
@ 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:468
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:153
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:869
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:139
const char * Data() const
Definition TString.h:376
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
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:2378
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
Bool_t cd(const char *path)
Definition TSystem.h:423
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition TSystem.cxx:1274
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition TSystem.cxx:1071
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:827
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:1398
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:1296
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:862
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1063
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition TSystem.cxx:951
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:871
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:250
Int_t fMode
Definition TSystem.h:125