35 Int_t GetUnID(
void) {
return ++fID; }
50 ~MyApplication()
override;
53 void DoEnteredCommand();
62 Connect(
"CloseWindow()",
"MyApplication",
this,
"DoExit()");
74 fComboCmd =
new TGComboBox(fHL2,
"", fIDs.GetUnID());
75 fCommand = fComboCmd->GetTextEntry();
76 fComboCmd->Resize(450, fCommand->GetDefaultHeight());
80 FILE *fhist = fopen(hist.Data(),
"rt");
83 while (fgets(histline, 256, fhist)) {
84 histline[strlen(histline) - 1] = 0;
85 fComboCmd->InsertEntry(histline, 0, -1);
91 gClient->GetColorByName(
"#c0c0c0", backpxl);
93 fTextView->SetBackground(backpxl);
97 fExit->Connect(
"Clicked()",
"MyApplication",
this,
"DoExit()");
101 SetWindowName(
"GUI with CLING Input/Output");
103 Resize(GetDefaultSize());
105 fCommand->Connect(
"ReturnPressed()",
"MyApplication",
this,
"DoEnteredCommand()");
109MyApplication::~MyApplication()
116void MyApplication::DoExit()
124void MyApplication::DoEnteredCommand()
128 const char *command = fCommand->GetTitle();
131 if (strlen(command)) {
133 prompt = ((
TRint *)
gROOT->GetApplication())->GetPrompt();
134 FILE *cintout = fopen(fName.Data(),
"a+t");
136 fputs(
Form(
"%s%s\n", prompt.
Data(), command), cintout);
140 gROOT->ProcessLine(command);
141 fComboCmd->InsertEntry(command, 0, fIDs.GetUnID());
142 Gl_histadd((
char *)command);
144 fTextView->LoadFile(fName.Data());
145 if (fTextView->ReturnLineCount() > 10)
146 fTextView->SetVsbPosition(fTextView->ReturnLineCount());
149 printf(
"No command entered\n");
151 fTextView->ShowBottom();
156 new MyApplication(
gClient->GetRoot(), 600, 300);
ULong_t Pixel_t
Pixel value.
#define ClassDefOverride(name, id)
R__EXTERN TApplication * gApplication
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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...
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
A TGTextView is a text viewer widget.
ROOT GUI Window base class.
TString fName
name of the window used in SavePrimitive()
const char * Data() const
virtual Int_t RedirectOutput(const char *name, const char *mode="a", RedirectHandle_t *h=nullptr)
Redirect standard output (stdout, stderr) to the specified file.
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
virtual const char * WorkingDirectory()
Return working directory.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
virtual int Unlink(const char *name)
Unlink, i.e.