Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPave.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Rene Brun 16/10/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include <iostream>
13#include "TROOT.h"
14#include "TBuffer.h"
15#include "TPave.h"
16#include "TStyle.h"
17#include "TVirtualPad.h"
18#include "TClass.h"
19#include "TMath.h"
20
21
22/** \class TPave
23\ingroup BasicGraphics
24
25A TBox with a bordersize and a shadow option.
26The corners of a TPave can be rounded (option "arc")
27More functional objects like TPavelabel, TPaveText derive from TPave.
28
29\image html graf_pave.png
30*/
31
32////////////////////////////////////////////////////////////////////////////////
33/// Pave default constructor.
34
36{
37 fBorderSize = 4;
38 fOption = "brNDC";
39 fName = "";
40 fInit = 1;
41 fCornerRadius = 0;
42 fX1NDC = 0;
43 fY1NDC = 0;
44 fX2NDC = 0;
45 fY2NDC = 0;
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Pave normal constructor.
55///
56/// a PAVE is a box with a bordersize and a shadow option the border
57/// size is in pixels.
58///
59/// - option = "TR" Top and Right shadows are drawn.
60/// - option = "TL" Top and Left shadows are drawn.
61/// - option = "BR" Bottom and Right shadows are drawn.
62/// - option = "BL" Bottom and Left shadows are drawn.
63///
64/// If none of these four above options is specified the default the
65/// option "BR" will be used to draw the border. To produces a pave
66/// without any border it is enough to specify the option "NB" (no border).
67///
68/// - option = "NDC" x1,y1,x2,y2 are given in NDC
69/// - option = "ARC" corners are rounded
70///
71/// In case of option "ARC", the corner radius is specified
72/// via TPave::SetCornerRadius(rad) where rad is given in percent
73/// of the pave height (default value is 0.2).
74
77 :TBox(x1,y1,x2,y2)
78{
81 fName = "";
82 fInit = 0;
83 fCornerRadius = 0;
84 fX1NDC = 0;
85 fY1NDC = 0;
86 fX2NDC = 0;
87 fY2NDC = 0;
88
89 if (fOption == "NDC" || fOption == "ndc") fOption = "brNDC";
90
95 SetName((char*)ClassName());
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Pave default destructor.
101
103{
104 // Required since we overload TObject::Hash.
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Pave copy constructor.
110
112{
113 fX1NDC = 0.;
114 fY1NDC = 0.;
115 fX2NDC = 0.;
116 fY2NDC = 0.;
117 fCornerRadius = 0.;
118 fBorderSize = 0;
119 fInit = 0;
120 fShadowColor = 0;
121
122 pave.TPave::Copy(*this);
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Assignment operator
127
129{
130 src.TPave::Copy(*this);
131 return *this;
132}
133
134
135////////////////////////////////////////////////////////////////////////////////
136/// Convert pave coordinates from NDC to Pad coordinates.
137
139{
140 if (!gPad) return;
141 Double_t dpx = gPad->GetX2() - gPad->GetX1();
142 Double_t dpy = gPad->GetY2() - gPad->GetY1();
143 Double_t xp1 = gPad->GetX1();
144 Double_t yp1 = gPad->GetY1();
145
146 // Check if pave initialisation has been done.
147 // This operation cannot take place in the Pave constructor because
148 // the Pad range may not be known at this time.
149 if (!fInit) {
150 fInit = 1;
151 if (fOption.Contains("NDC")) {
152 fX1NDC = fX1;
153 fY1NDC = fY1;
154 fX2NDC = fX2;
155 fY2NDC = fY2;
156 fX1 = xp1 + fX1NDC*dpx;
157 fY1 = yp1 + fY1NDC*dpy;
158 fX2 = xp1 + fX2NDC*dpx;
159 fY2 = yp1 + fY2NDC*dpy;
160 } else {
161 if (gPad->GetLogx()) {
162 if (fX1 > 0) fX1 = TMath::Log10(fX1);
163 if (fX2 > 0) fX2 = TMath::Log10(fX2);
164 }
165 if (gPad->GetLogy()) {
166 if (fY1 > 0) fY1 = TMath::Log10(fY1);
167 if (fY2 > 0) fY2 = TMath::Log10(fY2);
168 }
169 fX1NDC = (fX1-xp1)/dpx;
170 fY1NDC = (fY1-yp1)/dpy;
171 fX2NDC = (fX2-xp1)/dpx;
172 fY2NDC = (fY2-yp1)/dpy;
173 }
174 } else {
175 fX1 = xp1 + fX1NDC*dpx;
176 fY1 = yp1 + fY1NDC*dpy;
177 fX2 = xp1 + fX2NDC*dpx;
178 fY2 = yp1 + fY2NDC*dpy;
179 }
180}
181
182////////////////////////////////////////////////////////////////////////////////
183/// Copy this pave to pave.
184
185void TPave::Copy(TObject &obj) const
186{
187 TBox::Copy(obj);
188 ((TPave&)obj).fX1NDC = fX1NDC;
189 ((TPave&)obj).fY1NDC = fY1NDC;
190 ((TPave&)obj).fX2NDC = fX2NDC;
191 ((TPave&)obj).fY2NDC = fY2NDC;
192 ((TPave&)obj).fBorderSize = fBorderSize;
193 ((TPave&)obj).fInit = fInit;
194 ((TPave&)obj).fOption = fOption;
195 ((TPave&)obj).fName = fName;
196 ((TPave&)obj).fCornerRadius= fCornerRadius;
197 ((TPave&)obj).fShadowColor = fShadowColor;
198}
199
200////////////////////////////////////////////////////////////////////////////////
201/// Compute distance from point px,py to a pave.
202///
203/// Compute the closest distance of approach from point px,py to the
204/// edges of this pave.
205/// The distance is computed in pixels units.
206
208{
209 if (!gPad) return 9999;
210 Int_t pxl, pyl, pxt, pyt;
211 Int_t px1 = gPad->XtoAbsPixel(fX1);
212 Int_t py1 = gPad->YtoAbsPixel(fY1);
213 Int_t px2 = gPad->XtoAbsPixel(fX2);
214 Int_t py2 = gPad->YtoAbsPixel(fY2);
215 if (px1 < px2) {pxl = px1; pxt = px2;}
216 else {pxl = px2; pxt = px1;}
217 if (py1 < py2) {pyl = py1; pyt = py2;}
218 else {pyl = py2; pyt = py1;}
219
220 // Are we inside the box?
221 if ( (px >= pxl && px <= pxt) && (py >= pyl && py <= pyt) ) return 0;
222 else return 9999;
223}
224
225////////////////////////////////////////////////////////////////////////////////
226/// Draw this pave with its current attributes.
227
229{
230 Option_t *opt;
231 if (option && strlen(option)) opt = option;
232 else opt = GetOption();
233
234 AppendPad(opt);
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// Draw this pave with new coordinates.
239
248
249////////////////////////////////////////////////////////////////////////////////
250/// Execute action corresponding to one event.
251///
252/// This member function is called when a PAVE object is clicked.
253
255{
256 if (!gPad) return;
257
258 if (!gPad->IsEditable()) return;
259
260 TBox::ExecuteEvent(event, px, py);
261
262 // In case pave coordinates have been modified, recompute NDC coordinates
263 SetX1(fX1);
264 SetX2(fX2);
265 SetY1(fY1);
266 SetY2(fY2);
267
268 // In case the bit NameIsAction is activated, execute the action
269 // in name via the interpreter.
270 if (event == kButton1Double) {
271 if (TestBit(kNameIsAction)) gROOT->ProcessLine(GetName());
272 }
273}
274
275////////////////////////////////////////////////////////////////////////////////
276/// List this pave with its attributes.
277
278void TPave::ls(Option_t *) const
279{
281 printf("OBJ: %s\t%s \tX1= %f Y1=%f X2=%f Y2=%f\n",IsA()->GetName(),GetName(),fX1,fY1,fX2,fY2);
282}
283
284////////////////////////////////////////////////////////////////////////////////
285/// Paint this pave with its current attributes.
286///
287/// - option = "TR" Top and Right shadows are drawn.
288/// - option = "TL" Top and Left shadows are drawn.
289/// - option = "BR" Bottom and Right shadows are drawn.
290/// - option = "BL" Bottom and Left shadows are drawn.
291///
292/// If none of these four above options is specified the default the
293/// option "BR" will be used to draw the border. To produces a pave
294/// without any border it is enough to specify the option "NB" (no border).
295///
296/// - option = "NDC" x1,y1,x2,y2 are given in NDC
297/// - option = "ARC" corners are rounded
298///
299/// In case of option "ARC", the corner radius is specified
300/// via TPave::SetCornerRadius(rad) where rad is given in percent
301/// of the pave height (default value is 0.2).
302
304{
305 // Convert from NDC to pad coordinates
307
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// Draw this pave with new coordinates.
313
316{
317 if (!gPad) return;
318 Double_t x[7],y[7];
319 TString opt = option;
320 opt.ToLower();
321
322 // if pave drawn with the arc option, goes through dedicated function
323 if (opt.Contains("arc")) {
325 return;
326 }
327
328 // normal rectangular pave
332
333 // Draw first pave as a normal filled box
334 if (fBorderSize <= 0 && fillstyle <= 0) return;
336 if (fBorderSize <= 0) return;
337 if (fBorderSize == 1) {
338 gPad->PaintLine(x1,y1,x2,y1);
339 gPad->PaintLine(x2,y1,x2,y2);
340 gPad->PaintLine(x2,y2,x1,y2);
341 gPad->PaintLine(x1,y2,x1,y1);
342 return;
343 }
344
345 if (fBorderSize <= 0 || opt.Contains("nb")) return;
346
347 Double_t wy = gPad->PixeltoY(0) - gPad->PixeltoY(fBorderSize);
348 Double_t wx = gPad->PixeltoX(fBorderSize) - gPad->PixeltoX(0);
349
350 if (opt.Contains("tr")) {
351 // Draw the shadow top right
352 x[0] = x1 + 1.5*wx; y[0] = y2;
353 x[1] = x[0]; y[1] = y2 + wy;
354 x[2] = x2 + wx; y[2] = y[1];
355 x[3] = x[2]; y[3] = y1 + 1.5*wy;
356 x[4] = x2; y[4] = y[3];
357 x[5] = x[4]; y[5] = y2;
358 } else if (opt.Contains("tl")) {
359 // Draw the shadow top left
360 x[0] = x1 - wx; y[0] = y1 + 1.5*wy;
361 x[1] = x[0]; y[1] = y2 + wy;
362 x[2] = x2 - 1.5*wx; y[2] = y[1];
363 x[3] = x[2]; y[3] = y2;
364 x[4] = x1; y[4] = y[3];
365 x[5] = x1; y[5] = y[0];
366 } else if (opt.Contains("bl")) {
367 // Draw the shadow bottom left
368 x[0] = x1 - wx; y[0] = y2 - 1.5*wy;
369 x[1] = x[0]; y[1] = y1 - wy;
370 x[2] = x2 - 1.5*wx; y[2] = y[1];
371 x[3] = x[2]; y[3] = y1;
372 x[4] = x1; y[4] = y[3];
373 x[5] = x[4]; y[5] = y[0];
374 } else {
375 // Draw the shadow bottom right
376 x[0] = x1 + 1.5*wx; y[0] = y1;
377 x[1] = x[0]; y[1] = y1 - wy;
378 x[2] = x2 + wx; y[2] = y[1];
379 x[3] = x[2]; y[3] = y2 - 1.5*wy;
380 x[4] = x2; y[4] = y[3];
381 x[5] = x[4]; y[5] = y1;
382 }
383
384 for (Int_t i=0;i<6;i++) {
385 if (x[i] < gPad->GetX1()) x[i] = gPad->GetX1();
386 if (x[i] > gPad->GetX2()) x[i] = gPad->GetX2();
387 if (y[i] < gPad->GetY1()) y[i] = gPad->GetY1();
388 if (y[i] > gPad->GetY2()) y[i] = gPad->GetY2();
389 }
390 x[6] = x[0]; y[6] = y[0];
391 SetFillStyle(1001);
394 gPad->PaintFillArea(6,x,y);
395 x[0] = x1; y[0] = y1;
396 x[1] = x1; y[1] = y2;
397 x[2] = x2; y[2] = y2;
398 x[3] = x2; y[3] = y1;
399 x[4] = x1; y[4] = y1;
400 gPad->PaintPolyLine(5,x,y);
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Draw this pave with rounded corners.
407
410{
411 if (!gPad) return;
412 const Int_t kNPARC = 10;
413 Double_t x[4*kNPARC+10], y[4*kNPARC+10];
414 Double_t px[4*kNPARC+10], py[4*kNPARC+10];
415 Int_t i;
416 TString opt = option;
417 opt.ToLower();
418
422
423 static Double_t cosa[kNPARC], sina[kNPARC];
424 static Bool_t done = kFALSE;
425 if (!done) {
426 done = kTRUE;
427 Double_t dtheta = 0.5*3.141592/(kNPARC+1);
428 Double_t theta = 0;
429 for (i=0;i<kNPARC;i++) {
430 theta += dtheta;
431 cosa[i] = TMath::Cos(theta);
432 sina[i] = TMath::Sin(theta);
433 }
434 }
435 Int_t px1 = gPad->XtoAbsPixel(x1);
436 Int_t py1 = gPad->YtoAbsPixel(y1);
437 Int_t px2 = gPad->XtoAbsPixel(x2);
438 Int_t py2 = gPad->YtoAbsPixel(y2);
439 // compute rounded corner radius
441 if (rad > 0 && rad < 0.5) rad = fCornerRadius;
442 else rad = 0.2;
443 Double_t r = rad*TMath::Abs(py1-py2);
444 if (r > 0.5*TMath::Abs(px2-px1)) r = 0.5*TMath::Abs(px2-px1);
445 if (r == 0) r = 1;
446
447 // Draw rounded box outline and fill area
448 px[0] = px2; py[0] = py1 - r; //starts at bottom right
449 px[1] = px2; py[1] = py2 + r;
450 Int_t np = 2;
451 for (i=0;i<kNPARC;i++) { //top right corner
452 px[np] = px2 - r + r*cosa[i];
453 py[np] = py2 + r - r*sina[i];
454 np++;
455 }
456 px[np] = px2 - r; py[np] = py2;
457 px[np+1] = px1 + r; py[np+1] = py2;
458 np += 2;
459 for (i=kNPARC-1;i>=0;i--) { //top left corner
460 px[np] = px1 + r - r*cosa[i];
461 py[np] = py2 + r - r*sina[i];
462 np++;
463 }
464 px[np] = px1; py[np] = py2 + r;
465 px[np+1] = px1; py[np+1] = py1 - r;
466 np += 2;
467 for (i=0;i<kNPARC;i++) { //bottom left corner
468 px[np] = px1 + r - r*cosa[i];
469 py[np] = py1 - r + r*sina[i];
470 np++;
471 }
472 px[np] = px1 + r; py[np] = py1;
473 px[np+1] = px2 - r; py[np+1] = py1;
474 np += 2;
475 for (i=kNPARC-1;i>=0;i--) { //bottom right corner
476 px[np] = px2 - r + r*cosa[i];
477 py[np] = py1 - r + r*sina[i];
478 np++;
479 }
480 px[np] = px[0]; py[np] =py[0];
483 for (i=0;i<=np;i++) {
484 x[i] = gPad->AbsPixeltoX(Int_t(px[i]));
485 y[i] = gPad->AbsPixeltoY(Int_t(py[i]));
486 }
487 gPad->PaintFillArea(np , x, y);
488 gPad->PaintPolyLine(np+1, x, y);
489
490 if (fBorderSize <= 0 || opt.Contains("nb")) return;
491
494
495 if (opt.Contains("tr")) {
496 // Draw the shadow top right
497 px[0] = px2; py[0] = py1 - r;
498 px[1] = px2; py[1] = py2 + r;
499 np = 2;
500 for (i=0;i<kNPARC;i++) { //top right corner inside
501 px[np] = px2 - r + r*cosa[i];
502 py[np] = py2 + r - r*sina[i];
503 np++;
504 }
505 px[np] = px2 - r; py[np] = py2;
506 px[np+1] = px1 + r; py[np+1] = py2;
507 px[np+2] = px1 + r; py[np+2] = py2 - wy;
508 px[np+3] = px2 - r; py[np+3] = py2 - wy;
509 np += 4;
510 for (i=kNPARC-1;i>=0;i--) { //top right corner outside
511 px[np] = px2 - r + r*cosa[i]*(1+wx/r);
512 py[np] = py2 + r - r*sina[i]*(1+wy/r);
513 np++;
514 }
515 px[np] = px2 + wx; py[np] = py2 + r;
516 px[np+1] = px2 + wx; py[np+1] = py1 - r;
517 px[np+2] = px[0]; py[np+2] = py[0];
518 np += 3;
519 } else if (opt.Contains("tl")) {
520 // Draw the shadow top left
521 px[0] = px2 - r; py[0] = py2;
522 px[1] = px1 + r; py[1] = py2;
523 np = 2;
524 for (i=kNPARC-1;i>=0;i--) { //top left corner inside
525 px[np] = px1 + r - r*cosa[i];
526 py[np] = py2 + r - r*sina[i];
527 np++;
528 }
529 px[np] = px1; py[np] = py2 + r;
530 px[np+1] = px1; py[np+1] = py1 - r;
531 px[np+2] = px1 - wx; py[np+2] = py1 - r;
532 px[np+3] = px1 - wx; py[np+3] = py2 + r;
533 np += 4;
534 for (i=0;i<kNPARC;i++) { //top left corner outside
535 px[np] = px1 + r - r*cosa[i]*(1+wx/r);
536 py[np] = py2 + r - r*sina[i]*(1+wy/r);
537 np++;
538 }
539 px[np] = px1 + r; py[np] = py2 - wy;
540 px[np+1] = px2 - r; py[np+1] = py2 - wy;
541 px[np+2] = px[0]; py[np+2] = y[0];
542 np += 3;
543 } else if (opt.Contains("bl")) {
544 // Draw the shadow bottom left
545 px[0] = px1; py[0] = py2 + r;
546 px[1] = px1; py[1] = py1 - r;
547 np = 2;
548 for (i=0;i<kNPARC;i++) { //bottom left corner inside
549 px[np] = px1 + r - r*cosa[i];
550 py[np] = py1 + r - r*sina[i];
551 np++;
552 }
553 px[np] = px1 + r; py[np] = py1;
554 px[np+1] = px2 - r; py[np+1] = py1;
555 px[np+2] = px2 - r; py[np+2] = py1 + wy;
556 px[np+3] = px1 + r; py[np+3] = py1 + wy;
557 np += 4;
558 for (i=kNPARC-1;i>=0;i--) { //bottom left corner outside
559 px[np] = px1 + r - r*cosa[i]*(1+wx/r);
560 py[np] = py1 - r + r*sina[i]*(1+wy/r);
561 np++;
562 }
563 px[np] = px1 - wx; py[np] = py1 - r;
564 px[np+1] = px1 - wx; py[np+1] = py[0];
565 px[np+2] = px[0]; py[np+2] = py[0];
566 np += 3;
567 } else {
568 // Draw the shadow bottom right (default)
569 px[0] = px1 + r; py[0] = py1;
570 px[1] = px2 - r; py[1] = py1;
571 np = 2;
572 for (i=kNPARC-1;i>=0;i--) { //bottom right corner inside
573 px[np] = px2 - r + r*cosa[i];
574 py[np] = py1 - r + r*sina[i];
575 np++;
576 }
577 px[np] = px2; py[np] = py1 - r;
578 px[np+1] = px2; py[np+1] = py2 + r;
579 px[np+2] = px2 + wx; py[np+2] = py2 + r;
580 px[np+3] = px2 + wx; py[np+3] = py1 - r;
581 np += 4;
582 for (i=0;i<kNPARC;i++) { //bottom right corner outside
583 px[np] = px2 - r + r*cosa[i]*(1+wx/r);
584 py[np] = py1 - r + r*sina[i]*(1+wy/r);
585 np++;
586 }
587 px[np] = px2 - r; py[np] = py1 + wy;
588 px[np+1] = px[0]; py[np+1] = py[0] + wy;
589 px[np+2] = px[0]; py[np+2] = py[0];
590 np += 3;
591 }
592
593 SetFillStyle(1001);
596 for (i=0;i<=np;i++) {
597 x[i] = gPad->AbsPixeltoX(Int_t(px[i]));
598 y[i] = gPad->AbsPixeltoY(Int_t(py[i]));
599 }
600 gPad->PaintFillArea(np,x,y);
603}
604
605////////////////////////////////////////////////////////////////////////////////
606/// Dump this pave with its attributes.
607
609{
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Returns arguments which should be used when saving primitive constructor
615/// Check if coordinates are initialized, add extra arguments and options
616
618{
619 Double_t x1 = fX1, y1 = fY1, x2 = fX2, y2 = fY2;
620 if (fOption.Contains("NDC")) {
621 // in some cases coordinates may not be initialized but were already set via direct call
622 // then one should store such modified coordinates
623 if (fInit || fX1NDC != 0.)
624 x1 = fX1NDC;
625 if (fInit || fY1NDC != 0.)
626 y1 = fY1NDC;
627 if (fInit || fX2NDC != 0.)
628 x2 = fX2NDC;
629 if (fInit || fY2NDC != 0.)
630 y2 = fY2NDC;
631 }
632
633 TString args = TString::Format("%g, %g, %g, %g", x1, y1, x2, y2);
634 if (extra_arg && *extra_arg) {
635 args.Append(", ");
636 args.Append(extra_arg);
637 }
638 if (save_option) {
639 args.Append(", \"");
640 args.Append(TString(fOption).ReplaceSpecialCppChars());
641 args.Append("\"");
642 }
643 return args;
644}
645
646////////////////////////////////////////////////////////////////////////////////
647/// Save primitive as a C++ statement(s) on output stream out
648
649void TPave::SavePrimitive(std::ostream &out, Option_t *option)
650{
652 SaveFillAttributes(out, "pave", 19, 1001);
653 SaveLineAttributes(out, "pave", 1, 1, 1);
654 if (strcmp(GetName(), "TPave"))
655 out << " pave->SetName(\"" << GetName() << "\");\n";
656 if (fCornerRadius)
657 out << " pave->SetCornerRadius(" << fCornerRadius << ");\n";
658 SavePrimitiveDraw(out, "pave", option);
659}
660
661////////////////////////////////////////////////////////////////////////////////
662/// Set the X1 value
663
665{
666 fX1 = x1;
667 if (gPad) {
668 Double_t dpx = gPad->GetX2() - gPad->GetX1();
669 Double_t xp1 = gPad->GetX1();
670 fX1NDC = (fX1-xp1)/dpx;
671 }
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// Set the X2 value
676
678{
679 fX2 = x2;
680 if (gPad) {
681 Double_t dpx = gPad->GetX2() - gPad->GetX1();
682 Double_t xp1 = gPad->GetX1();
683 fX2NDC = (fX2-xp1)/dpx;
684 }
685}
686
687////////////////////////////////////////////////////////////////////////////////
688/// Set the Y1 value
689
691{
692 fY1 = y1;
693 if (gPad) {
694 Double_t dpy = gPad->GetY2() - gPad->GetY1();
695 Double_t yp1 = gPad->GetY1();
696 fY1NDC = (fY1-yp1)/dpy;
697 }
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Set the Y2 value
702
704{
705 fY2 = y2;
706 if (gPad) {
707 Double_t dpy = gPad->GetY2() - gPad->GetY1();
708 Double_t yp1 = gPad->GetY1();
709 fY2NDC = (fY2-yp1)/dpy;
710 }
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// Stream an object of class TPave.
715
717{
718 if (R__b.IsReading()) {
720 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
721 if (R__v > 1) {
722 R__b.ReadClassBuffer(TPave::Class(), this, R__v, R__s, R__c);
723 return;
724 }
725 //====process old versions before automatic schema evolution
728 R__b >> x1ndc; fX1NDC = x1ndc;
729 R__b >> y1ndc; fY1NDC = y1ndc;
730 R__b >> x2ndc; fX2NDC = x2ndc;
731 R__b >> y2ndc; fY2NDC = y2ndc;
732 R__b >> fBorderSize;
733 R__b >> fInit;
734 R__b >> rad; fCornerRadius = rad;
737 R__b.CheckByteCount(R__s, R__c, TPave::IsA());
738 //====end of old versions
739
740 } else {
741 R__b.WriteClassBuffer(TPave::Class(),this);
742 }
743}
@ kButton1Double
Definition Buttons.h:24
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
Option_t Option_t SetFillStyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:411
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
#define gPad
virtual Color_t GetFillColor() const
Return the fill area color.
Definition TAttFill.h:31
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition TAttFill.h:32
virtual void Modify()
Change current fill area attributes if necessary.
Definition TAttFill.cxx:215
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
Definition TAttFill.cxx:238
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:35
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:44
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:36
virtual void Modify()
Change current line attributes if necessary.
Definition TAttLine.cxx:246
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
Definition TAttLine.cxx:274
Create a Box.
Definition TBox.h:22
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")
Draw this box with new coordinates.
Definition TBox.cxx:677
void Streamer(TBuffer &) override
Stream an object of class TBox.
Definition TBox.cxx:745
Double_t fX1
X of 1st point.
Definition TBox.h:28
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TBox.cxx:231
void Print(Option_t *option="") const override
Dump this box with its attributes.
Definition TBox.cxx:697
Double_t fY2
Y of 2nd point.
Definition TBox.h:31
Double_t fX2
X of 2nd point.
Definition TBox.h:30
Double_t fY1
Y of 1st point.
Definition TBox.h:29
void Copy(TObject &box) const override
Copy a Box.
Definition TBox.cxx:111
Buffer base class used for serializing objects.
Definition TBuffer.h:43
Mother of all ROOT objects.
Definition TObject.h:41
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:226
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:203
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
Definition TObject.cxx:822
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
Definition TObject.cxx:771
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:68
A TBox with a bordersize and a shadow option.
Definition TPave.h:19
TPave()
Pave default constructor.
Definition TPave.cxx:35
void Print(Option_t *option="") const override
Dump this pave with its attributes.
Definition TPave.cxx:608
void SetX2(Double_t x2) override
Set the X2 value.
Definition TPave.cxx:677
TPave & operator=(const TPave &src)
Assignment operator.
Definition TPave.cxx:128
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
Definition TPave.cxx:138
virtual void PaintPaveArc(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with rounded corners.
Definition TPave.cxx:408
const char * GetName() const override
Returns name of object.
Definition TPave.h:58
TString GetSavePaveArgs(const char *extra_arg=nullptr, Bool_t save_option=kTRUE)
Returns arguments which should be used when saving primitive constructor Check if coordinates are ini...
Definition TPave.cxx:617
void Copy(TObject &pave) const override
Copy this pave to pave.
Definition TPave.cxx:185
void Streamer(TBuffer &) override
Stream an object of class TPave.
Definition TPave.cxx:716
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TPave.cxx:254
Int_t fBorderSize
window box bordersize in pixels
Definition TPave.h:26
TClass * IsA() const override
Definition TPave.h:93
void Draw(Option_t *option="") override
Draw this pave with its current attributes.
Definition TPave.cxx:228
void ls(Option_t *option="") const override
List this pave with its attributes.
Definition TPave.cxx:278
virtual void SetName(const char *name="")
Definition TPave.h:81
void SetX1(Double_t x1) override
Set the X1 value.
Definition TPave.cxx:664
Double_t fX2NDC
X2 point in NDC coordinates.
Definition TPave.h:24
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TPave.cxx:649
Int_t fShadowColor
Color of the pave's shadow.
Definition TPave.h:28
void SetY1(Double_t y1) override
Set the Y1 value.
Definition TPave.cxx:690
Int_t fInit
(=0 if transformation to NDC not yet done)
Definition TPave.h:27
TString fOption
Pave style.
Definition TPave.h:30
Double_t fY2NDC
Y2 point in NDC coordinates.
Definition TPave.h:25
static TClass * Class()
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a pave.
Definition TPave.cxx:207
Double_t fX1NDC
X1 point in NDC coordinates.
Definition TPave.h:22
TString fName
Pave name.
Definition TPave.h:31
void SetY2(Double_t y2) override
Set the Y2 value.
Definition TPave.cxx:703
@ kNameIsAction
double clicking on TPave will execute action
Definition TPave.h:38
Double_t fCornerRadius
Corner radius in case of option arc.
Definition TPave.h:29
Option_t * GetOption() const override
Definition TPave.h:59
Double_t fY1NDC
Y1 point in NDC coordinates.
Definition TPave.h:23
void Paint(Option_t *option="") override
Paint this pave with its current attributes.
Definition TPave.cxx:303
~TPave() override
Pave default destructor.
Definition TPave.cxx:102
virtual TPave * DrawPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with new coordinates.
Definition TPave.cxx:240
Int_t GetShadowColor() const
Definition TPave.h:60
virtual void PaintPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with new coordinates.
Definition TPave.cxx:314
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition TROOT.cxx:2898
Basic string class.
Definition TString.h:138
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
virtual void Streamer(TBuffer &)
Stream a string object.
Definition TString.cxx:1418
TString & Append(const char *cs)
Definition TString.h:580
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.
Definition TROOT.h:400
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:773
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124