21 class TVirtualViewer3D;
22 class TVirtualPadPainter;
29 class TPad :
public TVirtualPad,
public TAttBBox2D {
40 Double_t fXtoAbsPixelk;
43 Double_t fYtoAbsPixelk;
47 Double_t fUtoAbsPixelk;
50 Double_t fVtoAbsPixelk;
54 Double_t fAbsPixeltoXk;
57 Double_t fAbsPixeltoYk;
81 Double_t fAspectRatio;
103 Bool_t fFixedAspectRatio;
112 TObject *fPadPointer;
114 static Int_t fgMaxPickDistance;
115 Int_t fNumPaletteColor;
116 Int_t fNextPaletteColor;
117 Bool_t *fCollideGrid;
122 TVirtualViewer3D *fViewer3D;
124 void DestroyExternalViewer3D();
125 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
126 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
127 virtual void HideToolTip(Int_t event);
128 void PaintBorder(Color_t color, Bool_t tops);
129 virtual void PaintBorderPS(Double_t xl,Double_t yl,Double_t xt,Double_t yt,Int_t bmode,Int_t bsize,Int_t dark,Int_t light);
131 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
132 virtual void SetBatch(Bool_t batch=kTRUE);
135 TPad(
const TPad &pad);
136 TPad &operator=(
const TPad &rhs);
138 void CopyBackgroundPixmap(Int_t x, Int_t y);
139 void CopyBackgroundPixmaps(TPad *start, TPad *stop, Int_t x, Int_t y);
140 void DrawDist(Rectangle_t aBBox, Rectangle_t bBBox,
char mode);
142 Bool_t Collide(Int_t i, Int_t j, Int_t w, Int_t h);
143 void FillCollideGrid(TObject *o);
144 void FillCollideGridTBox(TObject *o);
145 void FillCollideGridTFrame(TObject *o);
146 void FillCollideGridTGraph(TObject *o);
147 void FillCollideGridTH1(TObject *o);
148 void LineNotFree(Int_t x1, Int_t x2, Int_t y1, Int_t y2);
155 kClipFrame = BIT(10),
156 kPrintingPS = BIT(11),
157 kCannotMove = BIT(12),
158 kClearAfterCR = BIT(14)
162 TPad(
const char *name,
const char *title, Double_t xlow,
163 Double_t ylow, Double_t xup, Double_t yup,
164 Color_t color=-1, Short_t bordersize=-1, Short_t bordermode=-2);
166 void AbsCoordinates(Bool_t set) { fAbsCoord = set; }
167 Double_t AbsPixeltoX(Int_t px) {
return fAbsPixeltoXk + px*fPixeltoX;}
168 Double_t AbsPixeltoY(Int_t py) {
return fAbsPixeltoYk + py*fPixeltoY;}
169 virtual void AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y);
170 virtual void AddExec(
const char *name,
const char *command);
171 virtual void AutoExec();
172 virtual void Browse(TBrowser *b);
173 virtual TLegend *BuildLegend(Double_t x1=0.3, Double_t y1=0.21, Double_t x2=0.3, Double_t y2=0.21,
const char *title=
"", Option_t *option =
"");
174 TVirtualPad* cd(Int_t subpadnumber=0);
175 void Clear(Option_t *option=
"");
176 virtual Int_t Clip(Float_t *x, Float_t *y, Float_t xclipl, Float_t yclipb, Float_t xclipr, Float_t yclipt);
177 virtual Int_t Clip(Double_t *x, Double_t *y, Double_t xclipl, Double_t yclipb, Double_t xclipr, Double_t yclipt);
178 virtual Int_t ClippingCode(Double_t x, Double_t y, Double_t xcl1, Double_t ycl1, Double_t xcl2, Double_t ycl2);
179 virtual Int_t ClipPolygon(Int_t n, Double_t *x, Double_t *y, Int_t nn, Double_t *xc, Double_t *yc, Double_t xclipl, Double_t yclipb, Double_t xclipr, Double_t yclipt);
180 virtual void Close(Option_t *option=
"");
181 virtual void Closed() { Emit(
"Closed()"); }
182 virtual void CopyPixmap();
183 virtual void CopyPixmaps();
184 virtual void DeleteExec(
const char *name);
185 virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0);
186 virtual void DivideSquare(Int_t n, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0);
187 virtual void Draw(Option_t *option=
"");
188 virtual void DrawClassObject(
const TObject *obj, Option_t *option=
"");
189 static void DrawColorTable();
190 virtual void DrawCrosshair();
191 TH1F *DrawFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax,
const char *title=
"");
192 virtual void ExecuteEventAxis(Int_t event, Int_t px, Int_t py, TAxis *axis);
193 virtual TObject *FindObject(
const char *name)
const;
194 virtual TObject *FindObject(
const TObject *obj)
const;
195 virtual void UseCurrentStyle();
196 virtual Short_t GetBorderMode()
const {
return fBorderMode;}
197 virtual Short_t GetBorderSize()
const {
return fBorderSize;}
198 Int_t GetCrosshair()
const;
199 virtual Int_t GetCanvasID()
const;
200 virtual TCanvasImp *GetCanvasImp()
const;
202 virtual Int_t GetEvent()
const;
203 virtual Int_t GetEventX()
const;
204 virtual Int_t GetEventY()
const;
205 virtual Color_t GetHighLightColor()
const;
206 virtual void GetRange(Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2);
207 virtual void GetRangeAxis(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax);
208 virtual void GetPadPar(Double_t &xlow, Double_t &ylow, Double_t &xup, Double_t &yup);
209 Double_t GetXlowNDC()
const {
return fXlowNDC;}
210 Double_t GetYlowNDC()
const {
return fYlowNDC;}
212 Double_t GetWNDC()
const {
return fWNDC;}
214 Double_t GetHNDC()
const {
return fHNDC;}
215 virtual UInt_t GetWw()
const;
216 virtual UInt_t GetWh()
const;
217 Double_t GetAbsXlowNDC()
const {
return fAbsXlowNDC;}
218 Double_t GetAbsYlowNDC()
const {
return fAbsYlowNDC;}
219 Double_t GetAbsWNDC()
const {
return fAbsWNDC;}
220 Double_t GetAbsHNDC()
const {
return fAbsHNDC;}
221 Double_t GetAspectRatio()
const {
return fAspectRatio; }
222 Double_t GetPhi()
const {
return fPhi;}
223 Double_t GetTheta()
const {
return fTheta;}
225 Double_t GetUxmin()
const {
return fUxmin;}
227 Double_t GetUymin()
const {
return fUymin;}
229 Double_t GetUxmax()
const {
return fUxmax;}
231 Double_t GetUymax()
const {
return fUymax;}
232 Bool_t GetGridx()
const {
return fGridx;}
233 Bool_t GetGridy()
const {
return fGridy;}
234 Int_t GetNumber()
const {
return fNumber;}
235 Int_t GetTickx()
const {
return fTickx;}
236 Int_t GetTicky()
const {
return fTicky;}
237 Double_t GetX1()
const {
return fX1; }
238 Double_t GetX2()
const {
return fX2; }
239 Double_t GetY1()
const {
return fY1; }
240 Double_t GetY2()
const {
return fY2; }
241 static Int_t GetMaxPickDistance();
242 TList *GetListOfPrimitives()
const {
return fPrimitives;}
243 TList *GetListOfExecs()
const {
return fExecs;}
244 virtual TObject *GetPrimitive(
const char *name)
const;
245 virtual TObject *GetSelected()
const;
246 virtual TVirtualPad *GetPad(Int_t subpadnumber)
const;
247 virtual TObject *GetPadPointer()
const {
return fPadPointer;}
248 TVirtualPad *GetPadSave()
const;
249 TVirtualPad *GetSelectedPad()
const;
251 TView *GetView()
const {
return fView;}
252 TObject *GetView3D()
const {
return fPadView3D;}
253 Int_t GetLogx()
const {
return fLogx;}
254 Int_t GetLogy()
const {
return fLogy;}
255 Int_t GetLogz()
const {
return fLogz;}
256 virtual TVirtualPad *GetMother()
const {
return fMother;}
257 const char *GetName()
const {
return fName.Data();}
258 const char *GetTitle()
const {
return fTitle.Data();}
259 virtual TCanvas *GetCanvas()
const {
return fCanvas; }
260 virtual TVirtualPad *GetVirtCanvas()
const ;
261 virtual TVirtualPadPainter *GetPainter();
262 Int_t GetPadPaint()
const {
return fPadPaint;}
263 Int_t GetPixmapID()
const {
return fPixmapID;}
264 ULong_t Hash()
const {
return fName.Hash(); }
265 virtual Bool_t HasCrosshair()
const;
266 void HighLight(Color_t col=kRed, Bool_t set=kTRUE);
267 Bool_t HasFixedAspectRatio()
const {
return fFixedAspectRatio; }
268 virtual Bool_t IsBatch()
const;
269 virtual Bool_t IsEditable()
const {
return fEditable;}
270 Bool_t IsFolder()
const {
return kTRUE;}
271 Bool_t IsModified()
const {
return fModified;}
272 virtual Bool_t IsRetained()
const;
273 virtual Bool_t IsVertical()
const {
return !TestBit(kHori);}
274 virtual void ls(Option_t *option=
"")
const;
275 void Modified(Bool_t flag=1);
276 virtual Bool_t OpaqueMoving()
const;
277 virtual Bool_t OpaqueResizing()
const;
278 Double_t PadtoX(Double_t x)
const;
279 Double_t PadtoY(Double_t y)
const;
280 virtual void Paint(Option_t *option=
"");
281 void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option=
"");
282 void PaintFillArea(Int_t n, Float_t *x, Float_t *y, Option_t *option=
"");
283 void PaintFillArea(Int_t n, Double_t *x, Double_t *y, Option_t *option=
"");
284 void PaintFillAreaNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option=
"");
285 void PaintFillAreaHatches(Int_t n, Double_t *x, Double_t *y, Int_t FillStyle);
286 void PaintHatches(Double_t dy, Double_t angle, Int_t nn, Double_t *xx, Double_t *yy);
287 void PaintPadFrame(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
288 void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
289 void PaintLineNDC(Double_t u1, Double_t v1,Double_t u2, Double_t v2);
290 void PaintLine3D(Float_t *p1, Float_t *p2);
291 void PaintLine3D(Double_t *p1, Double_t *p2);
292 void PaintPolyLine(Int_t n, Float_t *x, Float_t *y, Option_t *option=
"");
293 void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option=
"");
294 void PaintPolyLine3D(Int_t n, Double_t *p);
295 void PaintPolyLineNDC(Int_t n, Double_t *x, Double_t *y, Option_t *option=
"");
296 void PaintPolyMarker(Int_t n, Float_t *x, Float_t *y, Option_t *option=
"");
297 void PaintPolyMarker(Int_t n, Double_t *x, Double_t *y, Option_t *option=
"");
298 virtual void PaintModified();
299 void PaintText(Double_t x, Double_t y,
const char *text);
300 void PaintText(Double_t x, Double_t y,
const wchar_t *text);
301 void PaintTextNDC(Double_t u, Double_t v,
const char *text);
302 void PaintTextNDC(Double_t u, Double_t v,
const wchar_t *text);
303 virtual TPad *Pick(Int_t px, Int_t py, TObjLink *&pickobj);
304 Double_t PixeltoX(Int_t px);
305 Double_t PixeltoY(Int_t py);
306 virtual void PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y);
308 virtual void Print(
const char *filename=
"")
const;
309 virtual void Print(
const char *filename, Option_t *option);
310 virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
311 virtual void RangeChanged() { Emit(
"RangeChanged()"); }
312 virtual void RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
313 virtual void RangeAxisChanged() { Emit(
"RangeAxisChanged()"); }
314 virtual void RecursiveRemove(TObject *obj);
315 virtual void RedrawAxis(Option_t *option=
"");
316 virtual void ResetView3D(TObject *view=0){fPadView3D=view;}
317 virtual void ResizePad(Option_t *option=
"");
318 virtual void Resized() { Emit(
"Resized()"); }
319 virtual void SaveAs(
const char *filename=
"",Option_t *option=
"")
const;
320 virtual void SetBorderMode(Short_t bordermode) {fBorderMode = bordermode; Modified();}
321 virtual void SetBorderSize(Short_t bordersize) {fBorderSize = bordersize; Modified();}
322 void SetCanvas(TCanvas *c) { fCanvas = c; }
323 virtual void SetCanvasSize(UInt_t ww, UInt_t wh);
324 virtual void SetCrosshair(Int_t crhair=1);
325 virtual void SetCursor(ECursor cursor);
326 virtual void SetDoubleBuffer(Int_t mode=1);
327 virtual void SetDrawOption(Option_t *option=
"");
328 virtual void SetEditable(Bool_t mode=kTRUE);
329 virtual void SetFixedAspectRatio(Bool_t fixed = kTRUE);
330 virtual void SetGrid(Int_t valuex = 1, Int_t valuey = 1) {fGridx = valuex; fGridy = valuey; Modified();}
331 virtual void SetGridx(Int_t value = 1) {fGridx = value; Modified();}
332 virtual void SetGridy(Int_t value = 1) {fGridy = value; Modified();}
333 virtual void SetFillStyle(Style_t fstyle);
334 virtual void SetLogx(Int_t value = 1);
335 virtual void SetLogy(Int_t value = 1);
336 virtual void SetLogz(Int_t value = 1);
337 virtual void SetNumber(Int_t number) {fNumber = number;}
338 virtual void SetPad(
const char *name,
const char *title,
339 Double_t xlow, Double_t ylow, Double_t xup,
340 Double_t yup, Color_t color=35,
341 Short_t bordersize=5, Short_t bordermode=-1);
342 virtual void SetPad(Double_t xlow, Double_t ylow, Double_t xup, Double_t yup);
343 virtual void SetAttFillPS(Color_t color, Style_t style);
344 virtual void SetAttLinePS(Color_t color, Style_t style, Width_t lwidth);
345 virtual void SetAttMarkerPS(Color_t color, Style_t style, Size_t msize);
346 virtual void SetAttTextPS(Int_t align, Float_t angle, Color_t color, Style_t font, Float_t tsize);
347 static void SetMaxPickDistance(Int_t maxPick=5);
348 virtual void SetName(
const char *name) {fName = name;}
349 virtual void SetSelected(TObject *obj);
350 virtual void SetTicks(Int_t valuex = 1, Int_t valuey = 1) {fTickx = valuex; fTicky = valuey; Modified();}
351 virtual void SetTickx(Int_t value = 1) {fTickx = value; Modified();}
352 virtual void SetTicky(Int_t value = 1) {fTicky = value; Modified();}
353 virtual void SetTitle(
const char *title=
"") {fTitle = title;}
354 virtual void SetTheta(Double_t theta=30) {fTheta = theta; Modified();}
355 virtual void SetPhi(Double_t phi=30) {fPhi = phi; Modified();}
356 virtual void SetToolTipText(
const char *text, Long_t delayms = 1000);
357 virtual void SetVertical(Bool_t vert=kTRUE);
358 virtual void SetView(TView *view = 0);
359 virtual void SetViewer3D(TVirtualViewer3D *viewer3d) {fViewer3D = viewer3d;}
361 virtual void SetGLDevice(Int_t dev) {fGLDevice = dev;}
362 virtual void SetCopyGLDevice(Bool_t copy) {fCopyGLDevice = copy;}
364 virtual void ShowGuidelines(TObject *
object,
const Int_t event,
const char mode =
'i',
const bool cling =
true);
365 virtual void Update();
366 Int_t UtoAbsPixel(Double_t u)
const {
return Int_t(fUtoAbsPixelk + u*fUtoPixel);}
367 Int_t VtoAbsPixel(Double_t v)
const {
return Int_t(fVtoAbsPixelk + v*fVtoPixel);}
368 Int_t UtoPixel(Double_t u)
const;
369 Int_t VtoPixel(Double_t v)
const;
370 virtual TObject *WaitPrimitive(
const char *pname=
"",
const char *emode=
"");
371 Int_t XtoAbsPixel(Double_t x)
const;
372 Int_t YtoAbsPixel(Double_t y)
const;
373 Double_t XtoPad(Double_t x)
const;
374 Double_t YtoPad(Double_t y)
const;
375 Int_t XtoPixel(Double_t x)
const;
376 Int_t YtoPixel(Double_t y)
const;
377 virtual void XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel)
const;
378 virtual void XYtoPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel)
const;
380 virtual TObject *CreateToolTip(
const TBox *b,
const char *text, Long_t delayms);
381 virtual void DeleteToolTip(TObject *tip);
382 virtual void ResetToolTip(TObject *tip);
383 virtual void CloseToolTip(TObject *tip);
385 Int_t IncrementPaletteColor(Int_t i, TString opt);
386 Int_t NextPaletteColor();
388 void DrawCollideGrid();
389 Bool_t PlaceBox(TObject *o, Double_t w, Double_t h, Double_t &xl, Double_t &yb);
391 virtual void x3d(Option_t *type=
"");
393 virtual TVirtualViewer3D *GetViewer3D(Option_t * type =
"");
394 virtual Bool_t HasViewer3D()
const {
return (fViewer3D); }
395 virtual void ReleaseViewer3D(Option_t * type =
"");
397 virtual Rectangle_t GetBBox();
398 virtual TPoint GetBBoxCenter();
399 virtual void SetBBoxCenter(
const TPoint &p);
400 virtual void SetBBoxCenterX(
const Int_t x);
401 virtual void SetBBoxCenterY(
const Int_t y);
402 virtual void SetBBoxX1(
const Int_t x);
403 virtual void SetBBoxX2(
const Int_t x);
404 virtual void SetBBoxY1(
const Int_t y);
405 virtual void SetBBoxY2(
const Int_t y);
407 virtual void RecordPave(
const TObject *obj);
408 virtual void RecordLatex(
const TObject *obj);
409 virtual void EventPave() { Emit(
"EventPave()"); }
410 virtual void StartEditing() { Emit(
"StartEditing()"); }
417 inline void TPad::Modified(Bool_t flag)
419 if (!fModified && flag) Emit(
"Modified()");
425 inline void TPad::AbsPixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y)
427 x = AbsPixeltoX(xpixel);
428 y = AbsPixeltoY(ypixel);
433 inline Double_t TPad::PixeltoX(Int_t px)
435 if (fAbsCoord)
return fAbsPixeltoXk + px*fPixeltoX;
436 else return fPixeltoXk + px*fPixeltoX;
441 inline Double_t TPad::PixeltoY(Int_t py)
443 if (fAbsCoord)
return fAbsPixeltoYk + py*fPixeltoY;
444 else return fPixeltoYk + py*fPixeltoY;
449 inline void TPad::PixeltoXY(Int_t xpixel, Int_t ypixel, Double_t &x, Double_t &y)
451 x = PixeltoX(xpixel);
452 y = PixeltoY(ypixel);
457 inline Int_t TPad::UtoPixel(Double_t u)
const
460 if (fAbsCoord) val = fUtoAbsPixelk + u*fUtoPixel;
461 else val = u*fUtoPixel;
462 if (val < -kMaxPixel)
return -kMaxPixel;
463 if (val > kMaxPixel)
return kMaxPixel;
469 inline Int_t TPad::VtoPixel(Double_t v)
const
472 if (fAbsCoord) val = fVtoAbsPixelk + v*fVtoPixel;
473 else val = fVtoPixelk + v*fVtoPixel;
474 if (val < -kMaxPixel)
return -kMaxPixel;
475 if (val > kMaxPixel)
return kMaxPixel;
481 inline Int_t TPad::XtoAbsPixel(Double_t x)
const
483 Double_t val = fXtoAbsPixelk + x*fXtoPixel;
484 if (val < -kMaxPixel)
return -kMaxPixel;
485 if (val > kMaxPixel)
return kMaxPixel;
491 inline Int_t TPad::XtoPixel(Double_t x)
const
494 if (fAbsCoord) val = fXtoAbsPixelk + x*fXtoPixel;
495 else val = fXtoPixelk + x*fXtoPixel;
496 if (val < -kMaxPixel)
return -kMaxPixel;
497 if (val > kMaxPixel)
return kMaxPixel;
503 inline Int_t TPad::YtoAbsPixel(Double_t y)
const
505 Double_t val = fYtoAbsPixelk + y*fYtoPixel;
506 if (val < -kMaxPixel)
return -kMaxPixel;
507 if (val > kMaxPixel)
return kMaxPixel;
513 inline Int_t TPad::YtoPixel(Double_t y)
const
516 if (fAbsCoord) val = fYtoAbsPixelk + y*fYtoPixel;
517 else val = fYtoPixelk + y*fYtoPixel;
518 if (val < -kMaxPixel)
return -kMaxPixel;
519 if (val > kMaxPixel)
return kMaxPixel;
525 inline void TPad::XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel)
const
527 xpixel = XtoAbsPixel(x);
528 ypixel = YtoAbsPixel(y);
533 inline void TPad::XYtoPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel)
const
535 xpixel = XtoPixel(x);
536 ypixel = YtoPixel(y);
541 inline void TPad::SetDrawOption(Option_t *)