26 #include <TApplication.h>
32 #include <TRootEmbeddedCanvas.h>
35 #include "TGFileDialog.h"
50 const char *gSaveAsTypes[] = {
52 "ROOT files",
"*.root",
54 "Encapsulated PostScript",
"*.eps",
63 fi.fFileTypes = gSaveAsTypes;
65 new TGFileDialog(gClient->GetRoot(), gClient->GetRoot(), kFDSave, &fi);
73 fpTab =
new TGTab(
this, 200, 200);
75 fHintPlots =
new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,
79 new TGLayoutHints(kLHintsExpandX |
80 kLHintsExpandY, 10,10,10,1));
85 TGHorizontalFrame* hframe=
new TGHorizontalFrame(
this, 200,40);
87 TGTextButton* save =
new TGTextButton(hframe,
"&Save as ...");
88 save->Connect(
"Clicked()",
"CanvasInTab",
this,
"SaveCanvas()");
89 hframe->AddFrame(save,
new TGLayoutHints(kLHintsCenterX,
92 TGTextButton *
exit =
new TGTextButton(hframe,
"&Exit ",
93 "gApplication->Terminate()");
94 hframe->AddFrame(exit,
new TGLayoutHints(kLHintsCenterX,
97 AddFrame(hframe,
new TGLayoutHints(kLHintsCenterX,2,2,2,2));
102 SetWindowName(
"PlotG");
104 Resize(GetDefaultSize());
124 auto compositeFrame =
fpTab->AddTab(name);
125 TRootEmbeddedCanvas* embeddedCanvas =
126 new TRootEmbeddedCanvas(name,
129 embeddedCanvas->SetAutoFit();
131 compositeFrame->AddFrame(embeddedCanvas,
fHintPlots);
132 embeddedCanvas->SetContainer(compositeFrame);
134 fpTab->MapSubwindows();
147 if(
fpTab->GetNumberOfTabs() == 0)
return;
151 if(name == 0 || strlen(name) == 0)
return;
153 int current =
fpTab->GetCurrent();
154 TCanvas* canvas =
fEcanvas[current]->GetCanvas();
155 canvas->SaveAs(name);