5 #include "TRootHelpDialog.h"
6 #include "TGFileDialog.h"
7 #include "TGInputDialog.h"
10 #include <TGResourcePool.h>
13 #include "HGCal/TBEventDisplay/interface/Dialog.h"
31 char* inidir =
new char[IniDir_.size()+1];
32 copy(IniDir_.begin(), IniDir_.end(), inidir);
33 inidir[IniDir_.size()]=0;
34 file_info.fIniDir = inidir;
36 if ( IniFilename_ !=
"" )
38 char* inifilename =
new char[IniFilename_.size()+1];
39 copy(IniFilename_.begin(), IniFilename_.end(), inifilename);
40 inifilename[IniFilename_.size()]=0;
41 file_info.fFilename = inifilename;
44 vector<string> ftypes;
45 if ( dlg_type == kFDOpen )
47 ftypes.push_back(
"Root files");
48 ftypes.push_back(
"*.root");
49 ftypes.push_back(
"All files");
50 ftypes.push_back(
"*");
54 ftypes.push_back(
"All files");
55 ftypes.push_back(
"*");
56 ftypes.push_back(
"Root files");
57 ftypes.push_back(
"*.root");
59 const char* filetypes[] = {ftypes[0].c_str(), ftypes[1].c_str(),
60 ftypes[2].c_str(), ftypes[3].c_str(),
63 file_info.fFileTypes = filetypes;
65 new TGFileDialog(window_, main_, dlg_type, &file_info);
66 _filename = string(file_info.fFilename);
67 _inidir = string(file_info.fIniDir);
82 TRootHelpDialog* d =
new TRootHelpDialog(main_,
85 d->SetText(text.c_str());
93 new TGInputDialog(window_, main_, prompt.c_str(), defstr.c_str(), retstr);
94 return string(retstr);
101 const TGWindow*
main,
102 EFileDialogMode dlg_type,
106 TGFileInfo file_info;
108 char* inidir =
new char[IniDir.size()+1];
109 copy(IniDir.begin(), IniDir.end(), inidir);
110 inidir[IniDir.size()]=0;
111 file_info.fIniDir = inidir;
113 if ( IniFilename !=
"" )
115 char* inifilename =
new char[IniFilename.size()+1];
116 copy(IniFilename.begin(), IniFilename.end(), inifilename);
117 inifilename[IniFilename.size()]=0;
118 file_info.fFilename = inifilename;
121 vector<string> ftypes;
122 if ( dlg_type == kFDOpen )
124 ftypes.push_back(
"Root files");
125 ftypes.push_back(
"*.root");
126 ftypes.push_back(
"All files");
127 ftypes.push_back(
"*");
131 ftypes.push_back(
"All files");
132 ftypes.push_back(
"*");
133 ftypes.push_back(
"Root files");
134 ftypes.push_back(
"*.root");
136 const char* filetypes[] = {ftypes[0].c_str(), ftypes[1].c_str(),
137 ftypes[2].c_str(), ftypes[3].c_str(),
140 file_info.fFileTypes = filetypes;
142 new TGFileDialog(window, main, dlg_type, &file_info);
143 _filename = string(file_info.fFilename);
144 _inidir = string(file_info.fIniDir);
163 TRootHelpDialog* d =
new TRootHelpDialog(main,
166 d->SetText(text.c_str());
std::string GetInput(std::string prompt, std::string defstr="")
std::string SelectFile(EFileDialogMode dlg_type=kFDOpen, std::string inidir=".", std::string inifilename="")
Dialog(const TGWindow *window, const TGWindow *main)
int main(int argc, char *argv[])
void SetText(std::string title, std::string text, UInt_t w=600, UInt_t h=300)