59 if (y2 >= y1) {
fY1 =y1;
fY2 = y2;}
86 ((
TBox&)box).TBox::Copy(*
this);
121 ((
TBox&)obj).fTip = 0;
136 Int_t pxl, pyl, pxt, pyt;
141 if (px1 < px2) {pxl = px1; pxt = px2;}
142 else {pxl = px2; pxt = px1;}
143 if (py1 < py2) {pyl = py1; pyt = py2;}
144 else {pyl = py2; pyt = py1;}
148 if ( (px >= pxl && px <= pxt) && (py >= pyl && py <= pyt) )
return 0;
154 if (py < pyl) dxl += pyl -
py;
if (py > pyt) dxl += py - pyt;
156 if (py < pyl) dxt += pyl -
py;
if (py > pyt) dxt += py - pyt;
158 if (px < pxl) dyl += pxl -
px;
if (px > pxt) dyl += px - pxt;
160 if (px < pxl) dyt += pxl -
px;
if (px > pxt) dyt += px - pxt;
163 if (dxt < distance) distance = dxt;
164 if (dyl < distance) distance = dyl;
165 if (dyt < distance) distance = dyt;
187 TBox *newbox =
new TBox(x1,y1,x2,y2);
219 const Int_t kMaxDiff = 7;
220 const Int_t kMinSize = 20;
222 static Int_t px1, px2, py1, py2, pxl, pyl, pxt, pyt, pxold, pyold;
223 static Int_t px1p, px2p, py1p, py2p, pxlp, pylp, pxtp, pytp;
224 static Double_t oldX1, oldY1, oldX2, oldY2;
225 static Bool_t pA, pB, pC, pD, pTop, pL, pR, pBot, pINSIDE;
302 pA = pB = pC = pD = pTop = pL = pR = pBot = pINSIDE =
kFALSE;
306 pxold = pxl; pyold = pyl; pA =
kTRUE;
311 pxold = pxt; pyold = pyl; pB =
kTRUE;
316 pxold = pxt; pyold = pyt; pC =
kTRUE;
321 pxold = pxl; pyold = pyt; pD =
kTRUE;
325 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
327 pxold = pxl; pyold = pyl; pTop =
kTRUE;
331 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
333 pxold = pxt; pyold = pyt; pBot =
kTRUE;
337 if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
339 pxold = pxl; pyold = pyl; pL =
kTRUE;
343 if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
345 pxold = pxt; pyold = pyt; pR =
kTRUE;
349 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
350 (py > pyl+kMaxDiff && py < pyt-kMaxDiff)) {
359 if (pA || pB || pC || pD || pTop || pL || pR || pBot)
362 if (!pA && !pB && !pC && !pD && !pTop && !pL && !pR && !pBot && !pINSIDE)
374 if (px > pxt-kMinSize) { px = pxt-kMinSize; wx =
px; }
375 if (py > pyt-kMinSize) { py = pyt-kMinSize; wy =
py; }
376 if (px < pxlp) { px = pxlp; wx =
px; }
377 if (py < pylp) { py = pylp; wy =
py; }
382 if (px < pxl+kMinSize) { px = pxl+kMinSize; wx =
px; }
383 if (py > pyt-kMinSize) { py = pyt-kMinSize; wy =
py; }
384 if (px > pxtp) { px = pxtp; wx =
px; }
385 if (py < pylp) { py = pylp; wy =
py; }
390 if (px < pxl+kMinSize) { px = pxl+kMinSize; wx =
px; }
391 if (py < pyl+kMinSize) { py = pyl+kMinSize; wy =
py; }
392 if (px > pxtp) { px = pxtp; wx =
px; }
393 if (py > pytp) { py = pytp; wy =
py; }
398 if (px > pxt-kMinSize) { px = pxt-kMinSize; wx =
px; }
399 if (py < pyl+kMinSize) { py = pyl+kMinSize; wy =
py; }
400 if (px < pxlp) { px = pxlp; wx =
px; }
401 if (py > pytp) { py = pytp; wy =
py; }
407 if (py2 > py1-kMinSize) { py2 = py1-kMinSize; wy = py2; }
408 if (py2 < py2p) { py2 = py2p; wy = py2; }
414 if (py1 < py2+kMinSize) { py1 = py2+kMinSize; wy = py1; }
415 if (py1 > py1p) { py1 = py1p; wy = py1; }
421 if (px1 > px2-kMinSize) { px1 = px2-kMinSize; wx = px1; }
422 if (px1 < px1p) { px1 = px1p; wx = px1; }
428 if (px2 < px1+kMinSize) { px2 = px1+kMinSize; wx = px2; }
429 if (px2 > px2p) { px2 = px2p; wx = px2; }
434 Int_t dx = px - pxold;
435 Int_t dy = py - pyold;
436 px1 += dx; py1 += dy; px2 += dx; py2 += dy;
437 if (px1 < px1p) { dx = px1p - px1; px1 += dx; px2 += dx; wx = px+dx; }
438 if (px2 > px2p) { dx = px2 - px2p; px1 -= dx; px2 -= dx; wx = px-dx; }
439 if (py1 > py1p) { dy = py1 - py1p; py1 -= dy; py2 -= dy; wy = py-dy; }
440 if (py2 < py2p) { dy = py2p - py2; py1 += dy; py2 += dy; wy = py+dy; }
454 if ((pINSIDE && opaque) || (
fResizing && ropaque)) {
456 fX1 =
gPad->AbsPixeltoX(pxold);
459 fY2 =
gPad->AbsPixeltoY(pyold);
464 fX2 =
gPad->AbsPixeltoX(pxold);
465 fY2 =
gPad->AbsPixeltoY(pyold);
469 fY1 =
gPad->AbsPixeltoY(pyold);
470 fX2 =
gPad->AbsPixeltoX(pxold);
474 fX1 =
gPad->AbsPixeltoX(pxold);
475 fY1 =
gPad->AbsPixeltoY(pyold);
479 if (pTop || pBot || pL || pR || pINSIDE) {
485 if (pINSIDE)
gPad->ShowGuidelines(
this, event,
'i',
true);
486 if (pTop)
gPad->ShowGuidelines(
this, event,
't',
true);
487 if (pBot)
gPad->ShowGuidelines(
this, event,
'b',
true);
488 if (pL)
gPad->ShowGuidelines(
this, event,
'l',
true);
489 if (pR)
gPad->ShowGuidelines(
this, event,
'r',
true);
490 if (pA)
gPad->ShowGuidelines(
this, event,
'1',
true);
491 if (pB)
gPad->ShowGuidelines(
this, event,
'2',
true);
492 if (pC)
gPad->ShowGuidelines(
this, event,
'3',
true);
493 if (pD)
gPad->ShowGuidelines(
this, event,
'4',
true);
500 if (
gROOT->IsEscaped()) {
513 if (opaque || ropaque) {
514 gPad->ShowGuidelines(
this, event);
518 fX1 =
gPad->AbsPixeltoX(pxold);
521 fY2 =
gPad->AbsPixeltoY(pyold);
526 fX2 =
gPad->AbsPixeltoX(pxold);
527 fY2 =
gPad->AbsPixeltoY(pyold);
531 fY1 =
gPad->AbsPixeltoY(pyold);
532 fX2 =
gPad->AbsPixeltoX(pxold);
536 fX1 =
gPad->AbsPixeltoX(pxold);
537 fY1 =
gPad->AbsPixeltoY(pyold);
541 if (pTop || pBot || pL || pR || pINSIDE) {
555 if (pA || pB || pC || pD || pTop || pL || pR || pBot)
gPad->Modified(
kTRUE);
570 event =
gVirtualX->RequestLocator(1, 1, px, py);
598 if (x < fX1 || x >
fX2)
return 0;
599 if (y < fY1 || y >
fY2)
return 0;
632 else gPad->PaintBox(x1,y1,x2,y2);
634 gPad->PaintBox(x1,y1,x2,y2);
662 out<<
"box = new TBox("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2<<
");"<<std::endl;
667 out<<
" box->Draw();"<<std::endl;
678 Warning(
"SetToolTipText",
"a canvas must exist before setting the tool tip text");
687 if (text && strlen(text))
688 fTip =
gPad->CreateToolTip(
this, text, delayms);
694 void TBox::Streamer(
TBuffer &R__b)
704 TObject::Streamer(R__b);
705 TAttLine::Streamer(R__b);
706 TAttFill::Streamer(R__b);
709 R__b >> y1;
fY1 = y1;
711 R__b >> y2;
fY2 = y2;
726 Int_t px1, py1, px2, py2;
733 if (px1>px2) { tmp = px1; px1 = px2; px2 = tmp;}
734 if (py1>py2) { tmp = py1; py1 = py2; py2 = tmp;}
void Copy(TObject &box) const
Copy a Box.
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
virtual Style_t GetLineStyle() const
virtual Style_t GetFillStyle() const
TBox & operator=(const TBox &)
Assignment operator.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetBBoxCenter(const TPoint &p)
Set center of the Box.
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
virtual void ls(Option_t *option="") const
List this box with its attributes.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Double_t distance(const TPoint2 &p1, const TPoint2 &p2)
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
virtual TPoint GetBBoxCenter()
Return the center of the Box as TPoint in pixels.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
virtual void SetX1(Double_t x1)
virtual void Modify()
Change current line attributes if necessary.
virtual void SetX2(Double_t x2)
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
virtual Double_t GetX1() const =0
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
static const double x2[5]
Fill Area Attributes class.
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.
virtual void Modify()
Change current fill area attributes if necessary.
virtual void HideToolTip(Int_t event)
Hide tool tip depending on the event type.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual Short_t GetBorderSize() const =0
virtual void Copy(TObject &object) const
Copy this to obj.
virtual Double_t GetY2() const =0
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a box.
virtual ~TBox()
Box destructor.
virtual Int_t XtoAbsPixel(Double_t x) const =0
virtual Color_t GetFillColor() const
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.
Bool_t TestBit(UInt_t f) const
Double_t fX1
tool tip associated with box
virtual Color_t GetLineColor() const
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the Box.
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.
virtual void Print(Option_t *option="") const
Dump this box with its attributes.
virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="")
Draw this box with new coordinates.
virtual Double_t GetY1() const =0
virtual void SetY2(Double_t y2)
virtual Int_t YtoAbsPixel(Double_t y) const =0
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the Box.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
static const double x1[5]
virtual const char * GetName() const
Returns name of object.
virtual void Paint(Option_t *option="")
Paint this box with its current attributes.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
Binding & operator=(OUT(*fun)(void))
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
Mother of all ROOT objects.
Abstract base class for elements drawn in the editor.
virtual Double_t GetX2() const =0
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
virtual Width_t GetLineWidth() const
virtual void SetY1(Double_t y1)
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.