35 Int_t GetUnID(
void) {
return ++fID; }
50 virtual ~MyApplication();
53 void DoEnteredCommand();
63 Connect(
"CloseWindow()",
"MyApplication",
this,
"DoExit()");
75 fComboCmd =
new TGComboBox(fHL2,
"", fIDs.GetUnID());
76 fCommand = fComboCmd->GetTextEntry();
77 fComboCmd->Resize(450, fCommand->GetDefaultHeight());
81 FILE *fhist = fopen(hist.Data(),
"rt");
84 while (fgets(histline, 256, fhist)) {
85 histline[strlen(histline)-1] = 0;
86 fComboCmd->InsertEntry(histline, 0, -1);
92 gClient->GetColorByName(
"#c0c0c0", backpxl);
94 fTextView->SetBackground(backpxl);
98 fExit->Connect(
"Clicked()",
"MyApplication",
this,
"DoExit()");
102 SetWindowName(
"GUI with CINT Input/Output");
104 Resize(GetDefaultSize());
106 fCommand->Connect(
"ReturnPressed()",
"MyApplication",
this,
"DoEnteredCommand()");
110MyApplication::~MyApplication()
117void MyApplication::DoExit()
125void MyApplication::DoEnteredCommand()
129 const char *command = fCommand->GetTitle();
132 if (strlen(command)) {
134 prompt = ((
TRint*)
gROOT->GetApplication())->GetPrompt();
135 FILE *cintout = fopen(fName.Data(),
"a+t");
137 fputs(
Form(
"%s%s\n",prompt.
Data(), command), cintout);
141 gROOT->ProcessLine(command);
142 fComboCmd->InsertEntry(command, 0, fIDs.GetUnID());
143 Gl_histadd((
char *)command);
145 fTextView->LoadFile(fName.Data());
146 if (fTextView->ReturnLineCount() > 10)
147 fTextView->SetVsbPosition(fTextView->ReturnLineCount());
150 printf(
"No command entered\n");
152 fTextView->ShowBottom();
157 new MyApplication(
gClient->GetRoot(),600,300);
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
const char * Data() const
virtual const char * HomeDirectory(const char *userName=0)
Return the user's home directory.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
virtual const char * WorkingDirectory()
Return working directory.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=0)
Redirect standard output (stdout, stderr) to the specified file.