Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TBox.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Rene Brun 12/12/94
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 <cstdlib>
13
14#include <iostream>
15#include "TROOT.h"
16#include "TBuffer.h"
17#include "TBox.h"
18#include "TVirtualPad.h"
19#include "TVirtualPadPainter.h"
20#include "TCanvasImp.h"
21#include "TClass.h"
22#include "TMath.h"
23#include "TPoint.h"
24
25
26/** \class TBox
27\ingroup BasicGraphics
28
29Create a Box.
30
31A box is defined by :
32
33- Its bottom left coordinates x1,y1
34- Its top right coordinates x2,y2
35
36A box has line attributes (see TAttLine) and fill area attributes (see TAttFill).
37*/
38
39////////////////////////////////////////////////////////////////////////////////
40/// Box default constructor.
41
43{
44 fTip = nullptr;
45 fX1 = 0.;
46 fY1 = 0.;
47 fX2 = 0.;
48 fY2 = 0.;
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Box standard constructor.
54
56 : TObject(), TAttLine(), TAttFill()
57{
58 if (x2 >= x1) {fX1 =x1; fX2 = x2;}
59 else {fX1 = x2; fX2 = x1;}
60 if (y2 >= y1) {fY1 =y1; fY2 = y2;}
61 else {fY1 = y2; fY2 = y1;}
63 fTip = nullptr;
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Box destructor.
68
70{
71 if (fTip && gPad) {
72 gPad->CloseToolTip(fTip);
73 gPad->DeleteToolTip(fTip);
74 }
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Box copy constructor.
79
81{
82 fX1 = 0.;
83 fY1 = 0.;
84 fX2 = 0.;
85 fY2 = 0.;
87 ((TBox&)box).TBox::Copy(*this);
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Assignment operator.
92
94{
95 if(this!=&b) {
97 TAttLine::operator=(b);
98 TAttFill::operator=(b);
99 fTip=b.fTip;
100 fX1=b.fX1;
101 fY1=b.fY1;
102 fX2=b.fX2;
103 fY2=b.fY2;
104 fResizing=b.fResizing;
105 }
106 return *this;
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Copy a Box.
111
112void TBox::Copy(TObject &obj) const
113{
114 TObject::Copy(obj);
115 TAttLine::Copy(((TBox&)obj));
116 TAttFill::Copy(((TBox&)obj));
117 ((TBox&)obj).fX1 = fX1;
118 ((TBox&)obj).fY1 = fY1;
119 ((TBox&)obj).fX2 = fX2;
120 ((TBox&)obj).fY2 = fY2;
121 ((TBox&)obj).fResizing = fResizing;
122 ((TBox&)obj).fTip = nullptr; //FIXME
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Compute distance from point px,py to a box.
127///
128/// Compute the closest distance of approach from point px,py to the
129/// edges of this box.
130/// The distance is computed in pixels units.
131///
132/// In case of a filled box the distance returned is 0 if the point
133/// (px,py) is inside the box, and is huge if the point is outside.
134
136{
137 if (!gPad) return 9999;
138 Int_t pxl, pyl, pxt, pyt;
139 Int_t px1 = gPad->XtoAbsPixel(fX1);
140 Int_t py1 = gPad->YtoAbsPixel(fY1);
141 Int_t px2 = gPad->XtoAbsPixel(fX2);
142 Int_t py2 = gPad->YtoAbsPixel(fY2);
143
144 Bool_t isBox = !(InheritsFrom("TPave") || InheritsFrom("TWbox"));
145
146 if (isBox) {
147 if (gPad->GetLogx()) {
148 if (fX1>0) px1 = gPad->XtoAbsPixel(TMath::Log10(fX1));
149 if (fX2>0) px2 = gPad->XtoAbsPixel(TMath::Log10(fX2));
150 }
151 if (gPad->GetLogy()) {
152 if (fY1>0) py1 = gPad->YtoAbsPixel(TMath::Log10(fY1));
153 if (fY2>0) py2 = gPad->YtoAbsPixel(TMath::Log10(fY2));
154 }
155 }
156
157 if (px1 < px2) {pxl = px1; pxt = px2;}
158 else {pxl = px2; pxt = px1;}
159 if (py1 < py2) {pyl = py1; pyt = py2;}
160 else {pyl = py2; pyt = py1;}
161
162 // Are we inside the box?
163 if (GetFillStyle()) {
164 if ( (px >= pxl && px <= pxt) && (py >= pyl && py <= pyt) ) return 0;
165 else return 9999;
166 }
167
168 // Are we on the edges?
169 Int_t dxl = TMath::Abs(px - pxl);
170 if (py < pyl) dxl += pyl - py;
171 if (py > pyt) dxl += py - pyt;
172 Int_t dxt = TMath::Abs(px - pxt);
173 if (py < pyl) dxt += pyl - py;
174 if (py > pyt) dxt += py - pyt;
175 Int_t dyl = TMath::Abs(py - pyl);
176 if (px < pxl) dyl += pxl - px;
177 if (px > pxt) dyl += px - pxt;
178 Int_t dyt = TMath::Abs(py - pyt);
179 if (px < pxl) dyt += pxl - px;
180 if (px > pxt) dyt += px - pxt;
181
183 if (dxt < distance) distance = dxt;
184 if (dyl < distance) distance = dyl;
185 if (dyt < distance) distance = dyt;
186
187 return distance - Int_t(0.5*fLineWidth);
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Draw this box with its current attributes.
192/// if the box has no fill style (ie fill style=0), the box contour is drawn
193/// if the box has a fill style, the box contour is not drawn by default.
194/// to force the contour to be drawn, specify option "l"
195
197{
199
200}
201
202////////////////////////////////////////////////////////////////////////////////
203/// Draw this box with new coordinates.
204
206{
207 TBox *newbox = new TBox(x1,y1,x2,y2);
210 newbox->SetBit(kCanDelete);
211 newbox->AppendPad();
212 return newbox;
213}
214
215////////////////////////////////////////////////////////////////////////////////
216/// Execute action corresponding to one event.
217///
218/// This member function is called when a BOX/WBOX/PAD object is clicked.
219///
220/// If the mouse is clicked in one of the 4 corners of the box (pA,pB,pC,pD)
221/// the box is resized with the rubber rectangle.
222///
223/// If the mouse is clicked inside the box, the box is moved.
224///
225/// If the mouse is clicked on the 4 edges (pL,pR,pTop,pBot), the box is
226/// rescaled parallel to this edge (same as Motif window manager).
227///
228/// Note that this function is duplicated on purpose by TPad::ExecuteEvent.
229/// If somebody modifies this function, may be similar changes should also
230/// be applied to TPad::ExecuteEvent.
231
233{
234 if (TestBit(kCannotMove)) return;
235
236 if (!gPad) return;
237
238 auto &parent = *gPad;
239
240 if (!parent.IsEditable() && event != kMouseEnter) return;
241
242 Bool_t isBox = !(InheritsFrom("TPave") || InheritsFrom("TWbox"));
244
245 if (event >= 10000) {
246 // special config from TSliderBox, where only single dimension can be changed
247 Int_t mask = event / 10000;
249 canX = mask & 1;
250 canY = mask & 2;
251 event = event % 10000;
252 }
253
254 constexpr Int_t kMaxDiff = 7;
255 constexpr Int_t kMinSize = 20;
256
257 static Int_t px1, px2, py1, py2, dpx1, dpy2;
258 static Double_t oldX1, oldY1, oldX2, oldY2;
259 static Bool_t hasOld = kFALSE;
260 static enum { pNone, pA, pB, pC, pD, pTop, pL, pR, pBot, pINSIDE } mode = pNone;
261 static bool firstPaint = kFALSE;
262 Bool_t opaque = parent.OpaqueMoving();
263 Bool_t ropaque = parent.OpaqueResizing();
264
265 // convert to user coordinates and either paint ot set back
266 auto paint_or_set = [&parent,isBox,canX, canY,liveUpdate,this](Bool_t paint)
267 {
268 auto x1 = parent.AbsPixeltoX(px1);
269 auto y1 = parent.AbsPixeltoY(py1);
270 auto x2 = parent.AbsPixeltoX(px2);
271 auto y2 = parent.AbsPixeltoY(py2);
272 if (paint) {
273 if (firstPaint)
275 else {
276 auto pp = parent.GetPainter();
277 pp->SetAttLine({GetFillColor() > 0 ? GetFillColor() : (Color_t) 1, GetLineStyle(), 2});
278 pp->DrawBox(x1, y1, x2, y2, TVirtualPadPainter::kHollow);
279 }
280 }
281 if (liveUpdate || !paint) {
282 if (isBox) {
283 x1 = parent.PadtoX(x1);
284 x2 = parent.PadtoX(x2);
285 y1 = parent.PadtoY(y1);
286 y2 = parent.PadtoY(y2);
287 }
288 if (canX) {
289 SetX1(x1);
290 SetX2(x2);
291 }
292 if (canY) {
293 SetY1(y1);
294 SetY2(y2);
295 }
296 }
297 };
298
300
301 switch (event) {
302
303 case kMouseEnter:
304 if (fTip) parent.ResetToolTip(fTip);
305 break;
306
307 case kArrowKeyPress:
308 case kButton1Down:
309
310 oldX1 = fX1;
311 oldY1 = fY1;
312 oldX2 = fX2;
313 oldY2 = fY2;
314 hasOld = kTRUE;
315
316 // No break !!!
317
318 case kMouseMotion:
319
320 px1 = parent.XtoAbsPixel(isBox ? parent.XtoPad(GetX1()) : GetX1());
321 py1 = parent.YtoAbsPixel(isBox ? parent.YtoPad(GetY1()) : GetY1());
322 px2 = parent.XtoAbsPixel(isBox ? parent.XtoPad(GetX2()) : GetX2());
323 py2 = parent.YtoAbsPixel(isBox ? parent.YtoPad(GetY2()) : GetY2());
324 if (px1 > px2)
325 std::swap(px1, px2);
326 if (py1 < py2)
327 std::swap(py1, py2);
328
329 if (TMath::Abs(px - px1) <= kMaxDiff && TMath::Abs(py - py2) <= kMaxDiff) {
330 mode = canX && canY ? pA : (canX ? pL : pTop);
331 } else if (TMath::Abs(px - px2) <= kMaxDiff && TMath::Abs(py - py2) <= kMaxDiff) {
332 mode = canX && canY ? pB : (canX ? pR : pTop);
333 } else if (TMath::Abs(px - px2) <= kMaxDiff && TMath::Abs(py - py1) <= kMaxDiff) {
334 mode = canX && canY ? pC : (canX ? pR : pBot);
335 } else if (TMath::Abs(px - px1) <= kMaxDiff && TMath::Abs(py - py1) <= kMaxDiff) {
336 mode = canX && canY ? pD : (canX ? pL : pBot);
337 } else if ((px > px1 + kMaxDiff && px < px2 - kMaxDiff) && TMath::Abs(py - py2) < kMaxDiff) {
338 mode = canY ? pTop : pNone;
339 } else if ((px > px1 + kMaxDiff && px < px2 - kMaxDiff) && TMath::Abs(py - py1) < kMaxDiff) {
340 mode = canY ? pBot : pNone;
341 } else if ((py > py2 + kMaxDiff && py < py1 - kMaxDiff) && TMath::Abs(px - px1) < kMaxDiff) {
342 mode = canX ? pL : pNone;
343 } else if ((py > py2 + kMaxDiff && py < py1 - kMaxDiff) && TMath::Abs(px - px2) < kMaxDiff) {
344 mode = canX ? pR : pNone;
345 } else if ((px > px1+kMaxDiff && px < px2-kMaxDiff) && (py > py2+kMaxDiff && py < py1-kMaxDiff)) {
346 dpx1 = px - px1; // cursor position relative to top-left corner
347 dpy2 = py - py2;
348 mode = pINSIDE;
349 } else {
350 mode = pNone;
351 }
352
353 switch (mode) {
354 case pNone: parent.SetCursor(kCross); break;
355 case pA: parent.SetCursor(kTopLeft); break;
356 case pB: parent.SetCursor(kTopRight); break;
357 case pC: parent.SetCursor(kBottomRight); break;
358 case pD: parent.SetCursor(kBottomLeft); break;
359 case pTop: parent.SetCursor(kTopSide); break;
360 case pL: parent.SetCursor(kLeftSide); break;
361 case pR: parent.SetCursor(kRightSide); break;
362 case pBot: parent.SetCursor(kBottomSide); break;
363 case pINSIDE: parent.SetCursor(event == kButton1Down ? kMove : kCross); break;
364 }
365
366 fResizing = (mode != pNone) && (mode != pINSIDE);
368
369 break;
370
371 case kArrowKeyRelease:
372 case kButton1Motion: {
373 Int_t px1p = parent.XtoAbsPixel(parent.GetX1()) + parent.GetBorderSize();
374 Int_t py1p = parent.YtoAbsPixel(parent.GetY1()) - parent.GetBorderSize();
375 Int_t px2p = parent.XtoAbsPixel(parent.GetX2()) - parent.GetBorderSize();
376 Int_t py2p = parent.YtoAbsPixel(parent.GetY2()) + parent.GetBorderSize();
377 if (px1p > px2p)
378 std::swap(px1p, px2p);
379 if (py1p < py2p)
380 std::swap(py1p, py2p);
381
382 switch (mode) {
383 case pNone:
384 return;
385 case pA:
387 px1 = TMath::Max(px1p, TMath::Min(px, px2 - kMinSize));
388 py2 = TMath::Max(py2p, TMath::Min(py, py1 - kMinSize));
390 break;
391 case pB:
393 px2 = TMath::Min(px2p, TMath::Max(px, px1 + kMinSize));
394 py2 = TMath::Max(py2p, TMath::Min(py, py1 - kMinSize));
396 break;
397 case pC:
399 px2 = TMath::Min(px2p, TMath::Max(px, px1 + kMinSize));
400 py1 = TMath::Min(py1p, TMath::Max(py, py2 + kMinSize));
402 break;
403 case pD:
405 px1 = TMath::Max(px1p, TMath::Min(px, px2 - kMinSize));
406 py1 = TMath::Min(py1p, TMath::Max(py, py2 + kMinSize));
408 break;
409 case pTop:
411 py2 = TMath::Max(py2p, TMath::Min(py, py1 - kMinSize));
413 break;
414 case pBot:
416 py1 = TMath::Min(py1p, TMath::Max(py, py2 + kMinSize));
418 break;
419 case pL:
421 px1 = TMath::Max(px1p, TMath::Min(px, px2 - kMinSize));
423 break;
424 case pR:
426 px2 = TMath::Min(px2p, TMath::Max(px, px1 + kMinSize));
428 break;
429 case pINSIDE:
431 if (canX) {
432 px2 += px - dpx1 - px1;
433 px1 = px - dpx1;
434 if (px1 < px1p) { px2 += px1p - px1; px1 = px1p; }
435 if (px2 > px2p) { px1 -= px2 - px2p; px2 = px2p; }
436 }
437 if (canY) {
438 py1 += py - dpy2 - py2;
439 py2 = py - dpy2;
440 if (py1 > py1p) { py2 -= py1 - py1p; py1 = py1p; }
441 if (py2 < py2p) { py1 += py2p - py2; py2 = py2p; }
442 }
444 break;
445 }
446
447 if ((mode == pINSIDE && opaque) || (fResizing && ropaque)) {
448 switch(mode) {
449 case pINSIDE: parent.ShowGuidelines(this, event, 'i', true); break;
450 case pTop: parent.ShowGuidelines(this, event, 't', true); break;
451 case pBot: parent.ShowGuidelines(this, event, 'b', true); break;
452 case pL: parent.ShowGuidelines(this, event, 'l', true); break;
453 case pR: parent.ShowGuidelines(this, event, 'r', true); break;
454 case pA: parent.ShowGuidelines(this, event, '1', true); break;
455 case pB: parent.ShowGuidelines(this, event, '2', true); break;
456 case pC: parent.ShowGuidelines(this, event, '3', true); break;
457 case pD: parent.ShowGuidelines(this, event, '4', true); break;
458 default: break; // not involved
459 }
460 parent.Modified(kTRUE);
461 }
462
463 break;
464 }
465
466 case kButton1Up:
467 if (opaque || ropaque)
468 parent.ShowGuidelines(this, event);
469
470 if (gROOT->IsEscaped()) {
471 gROOT->SetEscape(kFALSE);
472 if (opaque && (mode != pNone)) {
473 if (hasOld) {
474 SetX1(oldX1);
475 SetY1(oldY1);
476 SetX2(oldX2);
477 SetY2(oldY2);
478 }
479 hasOld = kFALSE;
480 mode = pNone;
482 parent.ModifiedUpdate();
483 }
484 break;
485 }
486
487 if ((!opaque && mode == pINSIDE) || (!ropaque && fResizing))
489
490 if (mode != pNone)
491 parent.Modified(kTRUE);
492
493 mode = pNone;
495 hasOld = kFALSE;
496
497 break;
498
499 case kButton1Locate:
500 // Sergey: code is never used, has to be removed in ROOT7
501
502 ExecuteEvent(kButton1Down, px, py);
503
504 while (true) {
505 px = py = 0;
506 event = parent.GetCanvasImp()->RequestLocator(px, py);
507
509
510 if (event != -1) { // button is released
511 ExecuteEvent(kButton1Up, px, py);
512 return;
513 }
514 }
515 }
516}
517
518////////////////////////////////////////////////////////////////////////////////
519/// Hide tool tip depending on the event type. Typically tool tips
520/// are hidden when event is not a kMouseEnter and not a kMouseMotion
521/// event.
522
524{
525 if (event != kMouseEnter && event != kMouseMotion && fTip && gPad)
526 gPad->CloseToolTip(fTip);
527}
528
529////////////////////////////////////////////////////////////////////////////////
530/// Function which returns 1 if point x,y lies inside the box, 0 otherwise.
531
533{
534 if (x < fX1 || x > fX2) return 0;
535 if (y < fY1 || y > fY2) return 0;
536 return 1;
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// List this box with its attributes.
541
542void TBox::ls(Option_t *) const
543{
545 printf("%s X1= %f Y1=%f X2=%f Y2=%f\n",IsA()->GetName(),fX1,fY1,fX2,fY2);
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Paint this box with its current attributes.
550
552{
553 if(gPad) PaintBox(gPad->XtoPad(fX1),gPad->YtoPad(fY1),gPad->XtoPad(fX2),gPad->YtoPad(fY2),option);
554}
555
556////////////////////////////////////////////////////////////////////////////////
557/// Draw this box with new coordinates.
558
560{
561 if (!gPad) return;
562
563 TAttLine::Modify(); //Change line attributes only if necessary
564 TAttFill::Modify(); //Change fill area attributes only if necessary
565
566 if (option) {
567 TString opt = option;
568 opt.ToLower();
569 if (opt.Contains("l")) gPad->PaintBox(x1,y1,x2,y2,"l");
570 else gPad->PaintBox(x1,y1,x2,y2);
571 } else {
572 gPad->PaintBox(x1,y1,x2,y2);
573 }
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Dump this box with its attributes.
578
580{
581 printf("%s X1=%f Y1=%f X2=%f Y2=%f",IsA()->GetName(),fX1,fY1,fX2,fY2);
582 if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
583 if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
584 if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
585 if (GetFillColor() != 0) printf(" FillColor=%d",GetFillColor());
586 if (GetFillStyle() != 0) printf(" FillStyle=%d",GetFillStyle());
587 printf("\n");
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Save primitive as a C++ statement(s) on output stream out
592
593void TBox::SavePrimitive(std::ostream &out, Option_t *option)
594{
595 SavePrimitiveConstructor(out, Class(), "box", TString::Format("%g, %g, %g, %g", fX1, fY1, fX2, fY2));
596
597 SaveFillAttributes(out, "box", -1, -1);
598 SaveLineAttributes(out, "box", 1, 1, 1);
599
600 SavePrimitiveDraw(out, "box", option);
601}
602
603////////////////////////////////////////////////////////////////////////////////
604/// Set tool tip text associated with this box. The delay is in
605/// milliseconds (minimum 250). To remove tool tip call method with
606/// text = 0.
607
609{
610 if (!gPad) {
611 Warning("SetToolTipText", "a canvas must exist before setting the tool tip text");
612 return;
613 }
614
615 if (fTip) {
616 gPad->DeleteToolTip(fTip);
617 fTip = nullptr;
618 }
619
620 if (text && strlen(text))
621 fTip = gPad->CreateToolTip(this, text, delayms);
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// Stream an object of class TBox.
626
628{
629 if (R__b.IsReading()) {
631 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
632 if (R__v > 1) {
633 R__b.ReadClassBuffer(TBox::Class(), this, R__v, R__s, R__c);
634 return;
635 }
636 //====process old versions before automatic schema evolution
640 Float_t x1,y1,x2,y2;
641 R__b >> x1; fX1 = x1;
642 R__b >> y1; fY1 = y1;
643 R__b >> x2; fX2 = x2;
644 R__b >> y2; fY2 = y2;
645 R__b.CheckByteCount(R__s, R__c, TBox::IsA());
646 //====end of old versions
647
648 } else {
649 R__b.WriteClassBuffer(TBox::Class(),this);
650 }
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Return the "bounding Box" of the Box
655
657{
658 Rectangle_t BBox{0,0,0,0};
659 if (gPad) {
660 Int_t px1 = gPad->XtoPixel(fX1);
661 Int_t px2 = gPad->XtoPixel(fX2);
662 Int_t py1 = gPad->YtoPixel(fY1);
663 Int_t py2 = gPad->YtoPixel(fY2);
664
665 if (px1 > px2)
666 std::swap(px1, px2);
667 if (py1 > py2)
668 std::swap(py1, py2);
669
670 BBox.fX = px1;
671 BBox.fY = py1;
672 BBox.fWidth = px2 - px1;
673 BBox.fHeight = py2 - py1;
674 }
675
676 return BBox;
677}
678
679////////////////////////////////////////////////////////////////////////////////
680/// Set X coordinate of the center of the Box
681
683{
684 Double_t w2 = 0.5* (fX2 - fX1);
686 SetX1(midx - w2);
687 SetX2(midx + w2);
688}
689
690////////////////////////////////////////////////////////////////////////////////
691/// Set Y coordinate of the center of the Box
692
694{
695 Double_t h2 = 0.5 * (fY2 - fY1);
697 SetY1(midy - h2);
698 SetY2(midy + h2);
699}
700
701////////////////////////////////////////////////////////////////////////////////
702/// Set left hand side of BoundingBox to a value
703/// (resize in x direction on left)
704
706{
707 SetX1(GetXCoord(x));
708}
709
710////////////////////////////////////////////////////////////////////////////////
711/// Set right hand side of BoundingBox to a value
712/// (resize in x direction on right)
713
715{
716 SetX2(GetXCoord(x));
717}
718
719////////////////////////////////////////////////////////////////////////////////
720/// Set top of BoundingBox to a value (resize in y direction on top)
721
723{
724 SetY2(GetYCoord(y));
725}
726
727////////////////////////////////////////////////////////////////////////////////
728/// Set bottom of BoundingBox to a value
729/// (resize in y direction on bottom)
730
732{
733 SetY1(GetYCoord(y));
734}
@ kMouseMotion
Definition Buttons.h:23
@ kArrowKeyRelease
Definition Buttons.h:21
@ kButton1Motion
Definition Buttons.h:20
@ kButton1Up
Definition Buttons.h:19
@ kArrowKeyPress
Definition Buttons.h:21
@ kButton1Down
Definition Buttons.h:17
@ kButton1Locate
Definition Buttons.h:22
@ kMouseEnter
Definition Buttons.h:23
@ kRightSide
Definition GuiTypes.h:374
@ kBottomSide
Definition GuiTypes.h:374
@ kTopLeft
Definition GuiTypes.h:373
@ kBottomRight
Definition GuiTypes.h:373
@ kTopSide
Definition GuiTypes.h:374
@ kLeftSide
Definition GuiTypes.h:374
@ kMove
Definition GuiTypes.h:375
@ kTopRight
Definition GuiTypes.h:373
@ kBottomLeft
Definition GuiTypes.h:373
@ kCross
Definition GuiTypes.h:375
#define b(i)
Definition RSha256.hxx:100
cudaEvent_t event
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
short Version_t
Class version identifier (short)
Definition RtypesCore.h:80
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:69
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
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 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 mask
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 mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:417
#define gPad
Abstract base class for elements drawn in the editor.
Definition TAttBBox2D.h:19
Double_t GetYCoord(const Int_t y, Bool_t is_ndc=kFALSE, Bool_t is_absolute=kFALSE)
Can return ndc or normal values Also one can specify to use absolute coordinates for input parameter ...
Double_t GetXCoord(const Int_t x, Bool_t is_ndc=kFALSE, Bool_t is_absolute=kFALSE)
Return user X coordinate for pixel X value Can return ndc or normal values Also one can specify to us...
Fill Area Attributes class.
Definition TAttFill.h:21
virtual void Streamer(TBuffer &)
virtual Color_t GetFillColor() const
Return the fill area color.
Definition TAttFill.h:32
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Definition TAttFill.cxx:203
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition TAttFill.h:33
virtual void Modify()
Change current fill area attributes if necessary.
Definition TAttFill.cxx:212
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:240
Line Attributes class.
Definition TAttLine.h:21
virtual void Streamer(TBuffer &)
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:36
virtual Width_t GetLineWidth() const
Return the line width.
Definition TAttLine.h:38
Width_t fLineWidth
Line width.
Definition TAttLine.h:26
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:37
virtual void Modify()
Change current line attributes if necessary.
Definition TAttLine.cxx:246
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
Definition TAttLine.cxx:176
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:289
Create a Box.
Definition TBox.h:22
void Draw(Option_t *option="") override
Draw this box with its current attributes.
Definition TBox.cxx:196
Double_t GetX1() const
Definition TBox.h:51
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Definition TBox.cxx:608
virtual void SetY2(Double_t y2)
Definition TBox.h:65
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:559
static TClass * Class()
void Streamer(TBuffer &) override
Stream an object of class TBox.
Definition TBox.cxx:627
void SetBBoxX1(const Int_t x) override
Set left hand side of BoundingBox to a value (resize in x direction on left)
Definition TBox.cxx:705
~TBox() override
Box destructor.
Definition TBox.cxx:69
TBox & operator=(const TBox &)
Assignment operator.
Definition TBox.cxx:93
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition TBox.cxx:731
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TBox.cxx:722
Double_t fX1
X of 1st point.
Definition TBox.h:28
TClass * IsA() const override
Definition TBox.h:75
virtual void HideToolTip(Int_t event)
Hide tool tip depending on the event type.
Definition TBox.cxx:523
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Box.
Definition TBox.cxx:693
Double_t GetX2() const
Definition TBox.h:52
void ls(Option_t *option="") const override
List this box with its attributes.
Definition TBox.cxx:542
Double_t GetY1() const
Definition TBox.h:53
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TBox.cxx:232
virtual void SetX1(Double_t x1)
Definition TBox.h:62
void Paint(Option_t *option="") override
Paint this box with its current attributes.
Definition TBox.cxx:551
Double_t GetY2() const
Definition TBox.h:54
virtual Int_t IsInside(Double_t x, Double_t y) const
Function which returns 1 if point x,y lies inside the box, 0 otherwise.
Definition TBox.cxx:532
virtual void SetX2(Double_t x2)
Definition TBox.h:63
TBox()
Box default constructor.
Definition TBox.cxx:42
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
Definition TBox.cxx:205
Rectangle_t GetBBox() override
Return the "bounding Box" of the Box.
Definition TBox.cxx:656
void Print(Option_t *option="") const override
Dump this box with its attributes.
Definition TBox.cxx:579
TObject * fTip
! tool tip associated with box
Definition TBox.h:25
Double_t fY2
Y of 2nd point.
Definition TBox.h:31
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TBox.cxx:593
Double_t fX2
X of 2nd point.
Definition TBox.h:30
Double_t fY1
Y of 1st point.
Definition TBox.h:29
@ kCannotMove
Definition TBox.h:37
void Copy(TObject &box) const override
Copy a Box.
Definition TBox.cxx:112
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a box.
Definition TBox.cxx:135
Bool_t fResizing
! True if box is being resized
Definition TBox.h:32
void SetBBoxX2(const Int_t x) override
Set right hand side of BoundingBox to a value (resize in x direction on right)
Definition TBox.cxx:714
virtual void SetY1(Double_t y1)
Definition TBox.h:64
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Box.
Definition TBox.cxx:682
Buffer base class used for serializing objects.
Definition TBuffer.h:43
Mother of all ROOT objects.
Definition TObject.h:42
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:305
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:461
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
Definition TObject.cxx:995
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1082
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:203
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:548
virtual void Copy(TObject &object) const
Copy this to obj.
Definition TObject.cxx:158
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:844
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:776
@ kCanDelete
if object in a list can be deleted
Definition TObject.h:71
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition TROOT.cxx:3067
Basic string class.
Definition TString.h:137
void ToLower()
Change string to lower-case.
Definition TString.cxx:1190
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:2460
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:642
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Definition TMathBase.h:197
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Definition TMath.h:775
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
Rectangle structure (maps to the X11 XRectangle structure)
Definition GuiTypes.h:362