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"));
243
244 constexpr Int_t kMaxDiff = 7;
245 constexpr Int_t kMinSize = 20;
246
247 static Int_t px1, px2, py1, py2, dpx1, dpy2;
248 static Int_t px1p, px2p, py1p, py2p;
249 static Double_t oldX1, oldY1, oldX2, oldY2;
250 static Bool_t hasOld = kFALSE;
251 static enum { pNone, pA, pB, pC, pD, pTop, pL, pR, pBot, pINSIDE } mode = pNone;
252 static bool firstPaint = kFALSE;
253 Bool_t opaque = parent.OpaqueMoving();
254 Bool_t ropaque = parent.OpaqueResizing();
255
256 // convert to user coordinates and either paint ot set back
257 auto paint_or_set = [&parent,isBox,this](Bool_t paint)
258 {
259 auto x1 = parent.AbsPixeltoX(px1);
260 auto y1 = parent.AbsPixeltoY(py1);
261 auto x2 = parent.AbsPixeltoX(px2);
262 auto y2 = parent.AbsPixeltoY(py2);
263 if (!paint) {
264 if (isBox) {
265 x1 = parent.PadtoX(x1);
266 x2 = parent.PadtoX(x2);
267 y1 = parent.PadtoY(y1);
268 y2 = parent.PadtoY(y2);
269 }
270 SetX1(x1);
271 SetY1(y1);
272 SetX2(x2);
273 SetY2(y2);
274 } else if (firstPaint) {
276 } else {
277 auto pp = parent.GetPainter();
278 pp->SetAttLine({GetFillColor() > 0 ? GetFillColor() : (Color_t) 1, GetLineStyle(), 2});
279 pp->DrawBox(x1, y1, x2, y2, TVirtualPadPainter::kHollow);
280 }
281 };
282
283 HideToolTip(event);
284
285 switch (event) {
286
287 case kMouseEnter:
288 if (fTip) parent.ResetToolTip(fTip);
289 break;
290
291 case kArrowKeyPress:
292 case kButton1Down:
293
294 oldX1 = fX1;
295 oldY1 = fY1;
296 oldX2 = fX2;
297 oldY2 = fY2;
298 hasOld = kTRUE;
299
300 // No break !!!
301
302 case kMouseMotion:
303
304 px1 = parent.XtoAbsPixel(isBox ? parent.XtoPad(GetX1()) : GetX1());
305 py1 = parent.YtoAbsPixel(isBox ? parent.YtoPad(GetY1()) : GetY1());
306 px2 = parent.XtoAbsPixel(isBox ? parent.XtoPad(GetX2()) : GetX2());
307 py2 = parent.YtoAbsPixel(isBox ? parent.YtoPad(GetY2()) : GetY2());
308 if (px1 > px2)
309 std::swap(px1, px2);
310 if (py1 < py2)
311 std::swap(py1, py2);
312
313 px1p = parent.XtoAbsPixel(parent.GetX1()) + parent.GetBorderSize();
314 py1p = parent.YtoAbsPixel(parent.GetY1()) - parent.GetBorderSize();
315 px2p = parent.XtoAbsPixel(parent.GetX2()) - parent.GetBorderSize();
316 py2p = parent.YtoAbsPixel(parent.GetY2()) + parent.GetBorderSize();
317 if (px1p > px2p)
318 std::swap(px1p, px2p);
319 if (py1p < py2p)
320 std::swap(py1p, py2p);
321
322 mode = pNone;
323
324 if (TMath::Abs(px - px1) <= kMaxDiff && TMath::Abs(py - py2) <= kMaxDiff) {
325 mode = pA;
326 parent.SetCursor(kTopLeft);
327 } else if (TMath::Abs(px - px2) <= kMaxDiff && TMath::Abs(py - py2) <= kMaxDiff) {
328 mode = pB;
329 parent.SetCursor(kTopRight);
330 } else if (TMath::Abs(px - px2) <= kMaxDiff && TMath::Abs(py - py1) <= kMaxDiff) {
331 mode = pC;
332 parent.SetCursor(kBottomRight);
333 } else if (TMath::Abs(px - px1) <= kMaxDiff && TMath::Abs(py - py1) <= kMaxDiff) {
334 mode = pD;
335 parent.SetCursor(kBottomLeft);
336 } else if ((px > px1 + kMaxDiff && px < px2 - kMaxDiff) && TMath::Abs(py - py2) < kMaxDiff) {
337 mode = pTop;
338 parent.SetCursor(kTopSide);
339 } else if ((px > px1 + kMaxDiff && px < px2 - kMaxDiff) && TMath::Abs(py - py1) < kMaxDiff) {
340 mode = pBot;
341 parent.SetCursor(kBottomSide);
342 } else if ((py > py2 + kMaxDiff && py < py1 - kMaxDiff) && TMath::Abs(px - px1) < kMaxDiff) {
343 mode = pL;
344 parent.SetCursor(kLeftSide);
345 } else if ((py > py2 + kMaxDiff && py < py1 - kMaxDiff) && TMath::Abs(px - px2) < kMaxDiff) {
346 mode = pR;
347 parent.SetCursor(kRightSide);
348 } else if ((px > px1+kMaxDiff && px < px2-kMaxDiff) && (py > py2+kMaxDiff && py < py1-kMaxDiff)) {
349 dpx1 = px - px1; // cursor position relative to top-left corner
350 dpy2 = py - py2;
351 mode = pINSIDE;
352 if (event == kButton1Down)
353 parent.SetCursor(kMove);
354 else
355 parent.SetCursor(kCross);
356 }
357
358 fResizing = (mode != pNone) && (mode != pINSIDE);
360 if (mode == pNone)
361 parent.SetCursor(kCross);
362
363 break;
364
365 case kArrowKeyRelease:
366 case kButton1Motion:
367
368 switch (mode) {
369 case pNone:
370 return;
371 case pA:
373 px1 = TMath::Max(px1p, TMath::Min(px, px2 - kMinSize));
374 py2 = TMath::Max(py2p, TMath::Min(py, py1 - kMinSize));
376 break;
377 case pB:
379 px2 = TMath::Min(px2p, TMath::Max(px, px1 + kMinSize));
380 py2 = TMath::Max(py2p, TMath::Min(py, py1 - kMinSize));
382 break;
383 case pC:
385 px2 = TMath::Min(px2p, TMath::Max(px, px1 + kMinSize));
386 py1 = TMath::Min(py1p, TMath::Max(py, py2 + kMinSize));
388 break;
389 case pD:
391 px1 = TMath::Max(px1p, TMath::Min(px, px2 - kMinSize));
392 py1 = TMath::Min(py1p, TMath::Max(py, py2 + kMinSize));
394 break;
395 case pTop:
397 py2 = TMath::Max(py2p, TMath::Min(py, py1 - kMinSize));
399 break;
400 case pBot:
402 py1 = TMath::Min(py1p, TMath::Max(py, py2 + kMinSize));
404 break;
405 case pL:
407 px1 = TMath::Max(px1p, TMath::Min(px, px2 - kMinSize));
409 break;
410 case pR:
412 px2 = TMath::Min(px2p, TMath::Max(px, px1 + kMinSize));
414 break;
415 case pINSIDE:
417 px2 += px - dpx1 - px1;
418 px1 = px - dpx1;
419 py1 += py - dpy2 - py2;
420 py2 = py - dpy2;
421 if (px1 < px1p) { px2 += px1p - px1; px1 = px1p; }
422 if (px2 > px2p) { px1 -= px2 - px2p; px2 = px2p; }
423 if (py1 > py1p) { py2 -= py1 - py1p; py1 = py1p; }
424 if (py2 < py2p) { py1 += py2p - py2; py2 = py2p; }
426 break;
427 }
428
429 if ((mode == pINSIDE && opaque) || (fResizing && ropaque)) {
430 switch(mode) {
431 case pINSIDE: parent.ShowGuidelines(this, event, 'i', true); break;
432 case pTop: parent.ShowGuidelines(this, event, 't', true); break;
433 case pBot: parent.ShowGuidelines(this, event, 'b', true); break;
434 case pL: parent.ShowGuidelines(this, event, 'l', true); break;
435 case pR: parent.ShowGuidelines(this, event, 'r', true); break;
436 case pA: parent.ShowGuidelines(this, event, '1', true); break;
437 case pB: parent.ShowGuidelines(this, event, '2', true); break;
438 case pC: parent.ShowGuidelines(this, event, '3', true); break;
439 case pD: parent.ShowGuidelines(this, event, '4', true); break;
440 default: break; // not involved
441 }
442 parent.Modified(kTRUE);
443 }
444
445 break;
446
447 case kButton1Up:
448 if (opaque || ropaque)
449 parent.ShowGuidelines(this, event);
450
451 if (gROOT->IsEscaped()) {
452 gROOT->SetEscape(kFALSE);
453 if (opaque && (mode != pNone)) {
454 if (hasOld) {
455 SetX1(oldX1);
456 SetY1(oldY1);
457 SetX2(oldX2);
458 SetY2(oldY2);
459 }
460 hasOld = kFALSE;
461 mode = pNone;
463 parent.ModifiedUpdate();
464 }
465 break;
466 }
467
468 if ((!opaque && mode == pINSIDE) || (!ropaque && fResizing))
470
471 if (mode != pNone)
472 parent.Modified(kTRUE);
473
474 mode = pNone;
476 hasOld = kFALSE;
477
478 break;
479
480 case kButton1Locate:
481 // Sergey: code is never used, has to be removed in ROOT7
482
483 ExecuteEvent(kButton1Down, px, py);
484
485 while (true) {
486 px = py = 0;
487 event = parent.GetCanvasImp()->RequestLocator(px, py);
488
490
491 if (event != -1) { // button is released
492 ExecuteEvent(kButton1Up, px, py);
493 return;
494 }
495 }
496 }
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Hide tool tip depending on the event type. Typically tool tips
501/// are hidden when event is not a kMouseEnter and not a kMouseMotion
502/// event.
503
505{
506 if (event != kMouseEnter && event != kMouseMotion && fTip && gPad)
507 gPad->CloseToolTip(fTip);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Function which returns 1 if point x,y lies inside the box, 0 otherwise.
512
514{
515 if (x < fX1 || x > fX2) return 0;
516 if (y < fY1 || y > fY2) return 0;
517 return 1;
518}
519
520////////////////////////////////////////////////////////////////////////////////
521/// List this box with its attributes.
522
523void TBox::ls(Option_t *) const
524{
526 printf("%s X1= %f Y1=%f X2=%f Y2=%f\n",IsA()->GetName(),fX1,fY1,fX2,fY2);
527}
528
529////////////////////////////////////////////////////////////////////////////////
530/// Paint this box with its current attributes.
531
533{
534 if(gPad) PaintBox(gPad->XtoPad(fX1),gPad->YtoPad(fY1),gPad->XtoPad(fX2),gPad->YtoPad(fY2),option);
535}
536
537////////////////////////////////////////////////////////////////////////////////
538/// Draw this box with new coordinates.
539
541{
542 if (!gPad) return;
543
544 TAttLine::Modify(); //Change line attributes only if necessary
545 TAttFill::Modify(); //Change fill area attributes only if necessary
546
547 if (option) {
548 TString opt = option;
549 opt.ToLower();
550 if (opt.Contains("l")) gPad->PaintBox(x1,y1,x2,y2,"l");
551 else gPad->PaintBox(x1,y1,x2,y2);
552 } else {
553 gPad->PaintBox(x1,y1,x2,y2);
554 }
555}
556
557////////////////////////////////////////////////////////////////////////////////
558/// Dump this box with its attributes.
559
561{
562 printf("%s X1=%f Y1=%f X2=%f Y2=%f",IsA()->GetName(),fX1,fY1,fX2,fY2);
563 if (GetLineColor() != 1) printf(" Color=%d",GetLineColor());
564 if (GetLineStyle() != 1) printf(" Style=%d",GetLineStyle());
565 if (GetLineWidth() != 1) printf(" Width=%d",GetLineWidth());
566 if (GetFillColor() != 0) printf(" FillColor=%d",GetFillColor());
567 if (GetFillStyle() != 0) printf(" FillStyle=%d",GetFillStyle());
568 printf("\n");
569}
570
571////////////////////////////////////////////////////////////////////////////////
572/// Save primitive as a C++ statement(s) on output stream out
573
574void TBox::SavePrimitive(std::ostream &out, Option_t *option)
575{
576 SavePrimitiveConstructor(out, Class(), "box", TString::Format("%g, %g, %g, %g", fX1, fY1, fX2, fY2));
577
578 SaveFillAttributes(out, "box", -1, -1);
579 SaveLineAttributes(out, "box", 1, 1, 1);
580
581 SavePrimitiveDraw(out, "box", option);
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// Set tool tip text associated with this box. The delay is in
586/// milliseconds (minimum 250). To remove tool tip call method with
587/// text = 0.
588
590{
591 if (!gPad) {
592 Warning("SetToolTipText", "a canvas must exist before setting the tool tip text");
593 return;
594 }
595
596 if (fTip) {
597 gPad->DeleteToolTip(fTip);
598 fTip = nullptr;
599 }
600
601 if (text && strlen(text))
602 fTip = gPad->CreateToolTip(this, text, delayms);
603}
604
605////////////////////////////////////////////////////////////////////////////////
606/// Stream an object of class TBox.
607
609{
610 if (R__b.IsReading()) {
612 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
613 if (R__v > 1) {
614 R__b.ReadClassBuffer(TBox::Class(), this, R__v, R__s, R__c);
615 return;
616 }
617 //====process old versions before automatic schema evolution
621 Float_t x1,y1,x2,y2;
622 R__b >> x1; fX1 = x1;
623 R__b >> y1; fY1 = y1;
624 R__b >> x2; fX2 = x2;
625 R__b >> y2; fY2 = y2;
626 R__b.CheckByteCount(R__s, R__c, TBox::IsA());
627 //====end of old versions
628
629 } else {
630 R__b.WriteClassBuffer(TBox::Class(),this);
631 }
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Return the "bounding Box" of the Box
636
638{
639 Rectangle_t BBox{0,0,0,0};
640 if (gPad) {
641 Int_t px1 = gPad->XtoPixel(fX1);
642 Int_t px2 = gPad->XtoPixel(fX2);
643 Int_t py1 = gPad->YtoPixel(fY1);
644 Int_t py2 = gPad->YtoPixel(fY2);
645
646 if (px1 > px2)
647 std::swap(px1, px2);
648 if (py1 > py2)
649 std::swap(py1, py2);
650
651 BBox.fX = px1;
652 BBox.fY = py1;
653 BBox.fWidth = px2 - px1;
654 BBox.fHeight = py2 - py1;
655 }
656
657 return BBox;
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Set X coordinate of the center of the Box
662
664{
665 Double_t w2 = 0.5* (fX2 - fX1);
667 SetX1(midx - w2);
668 SetX2(midx + w2);
669}
670
671////////////////////////////////////////////////////////////////////////////////
672/// Set Y coordinate of the center of the Box
673
675{
676 Double_t h2 = 0.5 * (fY2 - fY1);
678 SetY1(midy - h2);
679 SetY2(midy + h2);
680}
681
682////////////////////////////////////////////////////////////////////////////////
683/// Set left hand side of BoundingBox to a value
684/// (resize in x direction on left)
685
687{
688 SetX1(GetXCoord(x));
689}
690
691////////////////////////////////////////////////////////////////////////////////
692/// Set right hand side of BoundingBox to a value
693/// (resize in x direction on right)
694
696{
697 SetX2(GetXCoord(x));
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Set top of BoundingBox to a value (resize in y direction on top)
702
704{
705 SetY2(GetYCoord(y));
706}
707
708////////////////////////////////////////////////////////////////////////////////
709/// Set bottom of BoundingBox to a value
710/// (resize in y direction on bottom)
711
713{
714 SetY1(GetYCoord(y));
715}
@ 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
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
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 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)
Double_t GetXCoord(const Int_t x, Bool_t is_ndc=kFALSE)
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:589
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:540
static TClass * Class()
void Streamer(TBuffer &) override
Stream an object of class TBox.
Definition TBox.cxx:608
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:686
~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:712
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TBox.cxx:703
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:504
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Box.
Definition TBox.cxx:674
Double_t GetX2() const
Definition TBox.h:52
void ls(Option_t *option="") const override
List this box with its attributes.
Definition TBox.cxx:523
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:532
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:513
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:637
void Print(Option_t *option="") const override
Dump this box with its attributes.
Definition TBox.cxx:560
TObject * fTip
! tool tip associated with box
Definition TBox.h:25
@ kCannotMove
Definition TBox.h:37
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:574
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: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:695
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:663
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:459
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:994
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1081
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:201
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:546
virtual void Copy(TObject &object) const
Copy this to obj.
Definition TObject.cxx:156
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:842
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:774
@ 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:3052
Basic string class.
Definition TString.h:138
void ToLower()
Change string to lower-case.
Definition TString.cxx:1189
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:2385
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:641
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:773
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