Logo ROOT  
Reference Guide
TBox.h
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 #ifndef ROOT_TBox
13 #define ROOT_TBox
14 
15 #include "TObject.h"
16 #include "TAttLine.h"
17 #include "TAttFill.h"
18 #include "TAttBBox2D.h"
19 
20 class TPoint;
21 
22 class TBox : public TObject, public TAttLine, public TAttFill, public TAttBBox2D {
23 
24 private:
25  TObject *fTip; ///<! tool tip associated with box
26 
27 protected:
28  Double_t fX1; ///< X of 1st point
29  Double_t fY1; ///< Y of 1st point
30  Double_t fX2; ///< X of 2nd point
31  Double_t fY2; ///< Y of 2nd point
32  Bool_t fResizing; ///<! True if box is being resized
33 
34 public:
35  // Private bits, clients can only test but not change them
36  enum {
37  kCannotMove = BIT(12) //if set the box cannot be moved/resized
38  };
39  TBox();
41  TBox(const TBox &box);
42  TBox& operator=(const TBox&);
43  virtual ~TBox();
44  void Copy(TObject &box) const;
45  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
46  virtual void Draw(Option_t *option="");
47  virtual TBox *DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
48  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
49  Bool_t IsBeingResized() const { return fResizing; }
50  Double_t GetX1() const { return fX1; }
51  Double_t GetX2() const { return fX2; }
52  Double_t GetY1() const { return fY1; }
53  Double_t GetY2() const { return fY2; }
54  virtual void HideToolTip(Int_t event);
55  virtual Int_t IsInside(Double_t x, Double_t y) const;
56  virtual void ls(Option_t *option="") const;
57  virtual void Paint(Option_t *option="");
58  virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="");
59  virtual void Print(Option_t *option="") const;
60  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
61  virtual void SetX1(Double_t x1) {fX1=x1;}
62  virtual void SetX2(Double_t x2) {fX2=x2;}
63  virtual void SetY1(Double_t y1) {fY1=y1;}
64  virtual void SetY2(Double_t y2) {fY2=y2;}
65  virtual void SetToolTipText(const char *text, Long_t delayms = 1000);
66  virtual Rectangle_t GetBBox();
67  virtual TPoint GetBBoxCenter();
68  virtual void SetBBoxCenter(const TPoint &p);
69  virtual void SetBBoxCenterX(const Int_t x);
70  virtual void SetBBoxCenterY(const Int_t y);
71  virtual void SetBBoxX1(const Int_t x);
72  virtual void SetBBoxX2(const Int_t x);
73  virtual void SetBBoxY1(const Int_t y);
74  virtual void SetBBoxY2(const Int_t y);
75 
76  ClassDef(TBox,3) //Box class
77 };
78 
79 #endif
80 
TBox::HideToolTip
virtual void HideToolTip(Int_t event)
Hide tool tip depending on the event type.
Definition: TBox.cxx:641
TBox::SetY2
virtual void SetY2(Double_t y2)
Definition: TBox.h:64
TAttBBox2D.h
TBox::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a box.
Definition: TBox.cxx:135
Option_t
const char Option_t
Definition: RtypesCore.h:66
Rectangle_t
Definition: GuiTypes.h:360
TBox::IsBeingResized
Bool_t IsBeingResized() const
Definition: TBox.h:49
TBox::GetX1
Double_t GetX1() const
Definition: TBox.h:50
TBox::fX2
Double_t fX2
X of 2nd point.
Definition: TBox.h:30
TBox::SetBBoxX1
virtual void SetBBoxX1(const Int_t x)
Set left hand side of BoundingBox to a value (resize in x direction on left)
Definition: TBox.cxx:876
Int_t
int Int_t
Definition: RtypesCore.h:45
box
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
TBox::fX1
Double_t fX1
X of 1st point.
Definition: TBox.h:28
x
Double_t x[n]
Definition: legend1.C:17
TBox::PaintBox
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
TBox::SetBBoxCenterX
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the Box.
Definition: TBox.cxx:839
TBox::SetBBoxCenterY
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the Box.
Definition: TBox.cxx:857
text
TText * text
Definition: entrylist_figure1.C:10
TBox::Paint
virtual void Paint(Option_t *option="")
Paint this box with its current attributes.
Definition: TBox.cxx:669
bool
TBox::fTip
TObject * fTip
! tool tip associated with box
Definition: TBox.h:25
TBox::SetY1
virtual void SetY1(Double_t y1)
Definition: TBox.h:63
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TAttBBox2D
Abstract base class for elements drawn in the editor.
Definition: TAttBBox2D.h:19
TAttLine.h
TBox::Draw
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
Definition: TBox.cxx:195
TBox::TBox
TBox()
Box default constructor.
Definition: TBox.cxx:42
TAttFill.h
TBox::operator=
TBox & operator=(const TBox &)
Assignment operator.
Definition: TBox.cxx:93
TAttLine
Line Attributes class.
Definition: TAttLine.h:18
TBox::SetToolTipText
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Definition: TBox.cxx:729
TBox::GetY1
Double_t GetY1() const
Definition: TBox.h:52
TBox::SetBBoxCenter
virtual void SetBBoxCenter(const TPoint &p)
Set center of the Box.
Definition: TBox.cxx:813
TBox::DrawBox
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
Definition: TBox.cxx:204
TBox::GetBBox
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
Definition: TBox.cxx:777
TBox::Copy
void Copy(TObject &box) const
Copy a Box.
Definition: TBox.cxx:112
Long_t
long Long_t
Definition: RtypesCore.h:54
TBox::SetBBoxY1
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Definition: TBox.cxx:897
TBox::ExecuteEvent
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TBox.cxx:231
TBox::GetY2
Double_t GetY2() const
Definition: TBox.h:53
BIT
#define BIT(n)
Definition: Rtypes.h:85
TBox::kCannotMove
@ kCannotMove
Definition: TBox.h:37
y
Double_t y[n]
Definition: legend1.C:17
TBox::GetX2
Double_t GetX2() const
Definition: TBox.h:51
TBox::GetBBoxCenter
virtual TPoint GetBBoxCenter()
Return the center of the Box as TPoint in pixels.
Definition: TBox.cxx:801
TBox::ls
virtual void ls(Option_t *option="") const
List this box with its attributes.
Definition: TBox.cxx:660
TBox::fY1
Double_t fY1
Y of 1st point.
Definition: TBox.h:29
TBox::fResizing
Bool_t fResizing
! True if box is being resized
Definition: TBox.h:32
TBox
Create a Box.
Definition: TBox.h:22
TBox::SetX2
virtual void SetX2(Double_t x2)
Definition: TBox.h:62
TPoint
Definition: TPoint.h:31
Double_t
double Double_t
Definition: RtypesCore.h:59
TBox::IsInside
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:650
TObject.h
TBox::SetBBoxY2
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition: TBox.cxx:908
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TBox::fY2
Double_t fY2
Y of 2nd point.
Definition: TBox.h:31
TBox::SetBBoxX2
virtual void SetBBoxX2(const Int_t x)
Set right hand side of BoundingBox to a value (resize in x direction on right)
Definition: TBox.cxx:887
TBox::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TBox.cxx:709
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TAttFill
Fill Area Attributes class.
Definition: TAttFill.h:19
TBox::SetX1
virtual void SetX1(Double_t x1)
Definition: TBox.h:61
TBox::Print
virtual void Print(Option_t *option="") const
Dump this box with its attributes.
Definition: TBox.cxx:695
TBox::~TBox
virtual ~TBox()
Box destructor.
Definition: TBox.cxx:69