59 if (y2 >= y1) {
fY1 =y1;
fY2 = y2;}
121 ((
TBox&)obj).fTip = 0;
136 Int_t pxl, pyl, pxt, pyt;
145 if (
gPad->GetLogx()) {
149 if (
gPad->GetLogy()) {
155 if (px1 < px2) {pxl = px1; pxt = px2;}
156 else {pxl = px2; pxt = px1;}
157 if (py1 < py2) {pyl = py1; pyt = py2;}
158 else {pyl = py2; pyt = py1;}
162 if ( (px >= pxl && px <= pxt) && (py >= pyl && py <= pyt) )
return 0;
168 if (py < pyl) dxl += pyl - py;
169 if (py > pyt) dxl += py - pyt;
171 if (py < pyl) dxt += pyl - py;
172 if (py > pyt) dxt += py - pyt;
174 if (px < pxl) dyl += pxl - px;
175 if (px > pxt) dyl += px - pxt;
177 if (px < pxl) dyt += pxl - px;
178 if (px > pxt) dyt += px - pxt;
180 Int_t distance = dxl;
181 if (dxt < distance) distance = dxt;
182 if (dyl < distance) distance = dyl;
183 if (dyt < distance) distance = dyt;
239 const Int_t kMaxDiff = 7;
240 const Int_t kMinSize = 20;
242 static Int_t px1, px2, py1, py2, pxl, pyl, pxt, pyt, pxold, pyold;
243 static Int_t px1p, px2p, py1p, py2p, pxlp, pylp, pxtp, pytp;
244 static Double_t oldX1, oldY1, oldX2, oldY2;
245 static Bool_t pA, pB, pC, pD, pTop, pL, pR, pBot, pINSIDE;
288 if (
gPad->GetLogx()) {
292 if (
gPad->GetLogy()) {
333 pA = pB = pC = pD = pTop = pL = pR = pBot = pINSIDE =
kFALSE;
337 pxold = pxl; pyold = pyl; pA =
kTRUE;
342 pxold = pxt; pyold = pyl; pB =
kTRUE;
347 pxold = pxt; pyold = pyt; pC =
kTRUE;
352 pxold = pxl; pyold = pyt; pD =
kTRUE;
356 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
358 pxold = pxl; pyold = pyl; pTop =
kTRUE;
362 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
364 pxold = pxt; pyold = pyt; pBot =
kTRUE;
368 if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
370 pxold = pxl; pyold = pyl; pL =
kTRUE;
374 if ((py > pyl+kMaxDiff && py < pyt-kMaxDiff) &&
376 pxold = pxt; pyold = pyt; pR =
kTRUE;
380 if ((px > pxl+kMaxDiff && px < pxt-kMaxDiff) &&
381 (py > pyl+kMaxDiff && py < pyt-kMaxDiff)) {
382 pxold = px; pyold = py; pINSIDE =
kTRUE;
390 if (pA || pB || pC || pD || pTop || pL || pR || pBot)
393 if (!pA && !pB && !pC && !pD && !pTop && !pL && !pR && !pBot && !pINSIDE)
405 if (px > pxt-kMinSize) { px = pxt-kMinSize; wx = px; }
406 if (py > pyt-kMinSize) { py = pyt-kMinSize; wy = py; }
407 if (px < pxlp) { px = pxlp; wx = px; }
408 if (py < pylp) { py = pylp; wy = py; }
413 if (px < pxl+kMinSize) { px = pxl+kMinSize; wx = px; }
414 if (py > pyt-kMinSize) { py = pyt-kMinSize; wy = py; }
415 if (px > pxtp) { px = pxtp; wx = px; }
416 if (py < pylp) { py = pylp; wy = py; }
421 if (px < pxl+kMinSize) { px = pxl+kMinSize; wx = px; }
422 if (py < pyl+kMinSize) { py = pyl+kMinSize; wy = py; }
423 if (px > pxtp) { px = pxtp; wx = px; }
424 if (py > pytp) { py = pytp; wy = py; }
429 if (px > pxt-kMinSize) { px = pxt-kMinSize; wx = px; }
430 if (py < pyl+kMinSize) { py = pyl+kMinSize; wy = py; }
431 if (px < pxlp) { px = pxlp; wx = px; }
432 if (py > pytp) { py = pytp; wy = py; }
438 if (py2 > py1-kMinSize) { py2 = py1-kMinSize; wy = py2; }
439 if (py2 < py2p) { py2 = py2p; wy = py2; }
445 if (py1 < py2+kMinSize) { py1 = py2+kMinSize; wy = py1; }
446 if (py1 > py1p) { py1 = py1p; wy = py1; }
452 if (px1 > px2-kMinSize) { px1 = px2-kMinSize; wx = px1; }
453 if (px1 < px1p) { px1 = px1p; wx = px1; }
459 if (px2 < px1+kMinSize) { px2 = px1+kMinSize; wx = px2; }
460 if (px2 > px2p) { px2 = px2p; wx = px2; }
465 Int_t dx = px - pxold;
466 Int_t dy = py - pyold;
467 px1 += dx; py1 += dy; px2 += dx; py2 += dy;
468 if (px1 < px1p) { dx = px1p - px1; px1 += dx; px2 += dx; wx = px+dx; }
469 if (px2 > px2p) { dx = px2 - px2p; px1 -= dx; px2 -= dx; wx = px-dx; }
470 if (py1 > py1p) { dy = py1 - py1p; py1 -= dy; py2 -= dy; wy = py-dy; }
471 if (py2 < py2p) { dy = py2p - py2; py1 += dy; py2 += dy; wy = py+dy; }
485 if ((pINSIDE && opaque) || (
fResizing && ropaque)) {
487 fX1 =
gPad->AbsPixeltoX(pxold);
490 fY2 =
gPad->AbsPixeltoY(pyold);
495 fX2 =
gPad->AbsPixeltoX(pxold);
496 fY2 =
gPad->AbsPixeltoY(pyold);
500 fY1 =
gPad->AbsPixeltoY(pyold);
501 fX2 =
gPad->AbsPixeltoX(pxold);
505 fX1 =
gPad->AbsPixeltoX(pxold);
506 fY1 =
gPad->AbsPixeltoY(pyold);
510 if (pTop || pBot || pL || pR || pINSIDE) {
518 if (
gPad->GetLogx()) {
522 if (
gPad->GetLogy()) {
528 if (pINSIDE)
gPad->ShowGuidelines(
this, event,
'i',
true);
529 if (pTop)
gPad->ShowGuidelines(
this, event,
't',
true);
530 if (pBot)
gPad->ShowGuidelines(
this, event,
'b',
true);
531 if (pL)
gPad->ShowGuidelines(
this, event,
'l',
true);
532 if (pR)
gPad->ShowGuidelines(
this, event,
'r',
true);
533 if (pA)
gPad->ShowGuidelines(
this, event,
'1',
true);
534 if (pB)
gPad->ShowGuidelines(
this, event,
'2',
true);
535 if (pC)
gPad->ShowGuidelines(
this, event,
'3',
true);
536 if (pD)
gPad->ShowGuidelines(
this, event,
'4',
true);
543 if (
gROOT->IsEscaped()) {
556 if (opaque || ropaque) {
557 gPad->ShowGuidelines(
this, event);
561 fX1 =
gPad->AbsPixeltoX(pxold);
564 fY2 =
gPad->AbsPixeltoY(pyold);
569 fX2 =
gPad->AbsPixeltoX(pxold);
570 fY2 =
gPad->AbsPixeltoY(pyold);
574 fY1 =
gPad->AbsPixeltoY(pyold);
575 fX2 =
gPad->AbsPixeltoX(pxold);
579 fX1 =
gPad->AbsPixeltoX(pxold);
580 fY1 =
gPad->AbsPixeltoY(pyold);
584 if (pTop || pBot || pL || pR || pINSIDE) {
592 if (
gPad->GetLogx()) {
596 if (
gPad->GetLogy()) {
608 if (pA || pB || pC || pD || pTop || pL || pR || pBot)
gPad->Modified(
kTRUE);
623 event =
gVirtualX->RequestLocator(1, 1, px, py);
651 if (x < fX1 || x >
fX2)
return 0;
652 if (y < fY1 || y >
fY2)
return 0;
715 out<<
"box = new TBox("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2<<
");"<<std::endl;
720 out<<
" box->Draw();"<<std::endl;
731 Warning(
"SetToolTipText",
"a canvas must exist before setting the tool tip text");
747void TBox::Streamer(
TBuffer &R__b)
757 TObject::Streamer(R__b);
758 TAttLine::Streamer(R__b);
759 TAttFill::Streamer(R__b);
762 R__b >> y1;
fY1 = y1;
764 R__b >> y2;
fY2 = y2;
779 Int_t px1, py1, px2, py2;
786 if (px1>px2) { tmp = px1; px1 = px2; px2 = tmp;}
787 if (py1>py2) { tmp = py1; py1 = py2; py2 = tmp;}
static const double x2[5]
static const double x1[5]
Binding & operator=(OUT(*fun)(void))
Abstract base class for elements drawn in the editor.
Fill Area Attributes class.
virtual Color_t GetFillColor() const
Return the fill area color.
void Copy(TAttFill &attfill) const
Copy this fill attributes to a new TAttFill.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void Modify()
Change current fill area attributes if necessary.
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.
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
Width_t fLineWidth
Line width.
virtual Style_t GetLineStyle() const
Return the line style.
virtual void Modify()
Change current line attributes if necessary.
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
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 Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
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.
virtual void SetY2(Double_t y2)
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 void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
TBox & operator=(const TBox &)
Assignment operator.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Double_t fX1
X of 1st point.
virtual void ls(Option_t *option="") const
List this box with its attributes.
virtual void HideToolTip(Int_t event)
Hide tool tip depending on the event type.
virtual void SetBBoxCenter(const TPoint &p)
Set center of the Box.
virtual void SetX1(Double_t x1)
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
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 Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a box.
virtual void SetX2(Double_t x2)
virtual ~TBox()
Box destructor.
void Copy(TObject &box) const
Copy a Box.
TBox()
Box default constructor.
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
TObject * fTip
! tool tip associated with box
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the Box.
Double_t fY2
Y of 2nd point.
Double_t fX2
X of 2nd point.
Double_t fY1
Y of 1st point.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Bool_t fResizing
! True if box is being resized
virtual void SetY1(Double_t y1)
virtual TPoint GetBBoxCenter()
Return the center of the Box as TPoint in pixels.
virtual void Paint(Option_t *option="")
Paint this box with its current attributes.
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the Box.
virtual void Print(Option_t *option="") const
Dump this box with its attributes.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Copy(TObject &object) const
Copy this to obj.
@ kCanDelete
if object in a list can be deleted
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual Int_t YtoAbsPixel(Double_t y) const =0
virtual Double_t GetX2() const =0
virtual Int_t XtoAbsPixel(Double_t x) const =0
virtual Double_t GetY1() const =0
virtual Double_t GetY2() const =0
virtual Short_t GetBorderSize() const =0
virtual Double_t GetX1() const =0
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Short_t Max(Short_t a, Short_t b)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Short_t Min(Short_t a, Short_t b)
Double_t Log10(Double_t x)