Logo ROOT   6.08/07
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 
16 #ifndef ROOT_TObject
17 #include "TObject.h"
18 #endif
19 #ifndef ROOT_TAttLine
20 #include "TAttLine.h"
21 #endif
22 #ifndef ROOT_TAttFill
23 #include "TAttFill.h"
24 #endif
25 #ifndef ROOT_TAttBBox2D
26 #include "TAttBBox2D.h"
27 #endif
28 #ifndef ROOT_TPoint
29 #include "TPoint.h"
30 #endif
31 #ifndef ROOT_GuiTypes
32 #include "GuiTypes.h"
33 #endif
34 
35 
36 class TBox : public TObject, public TAttLine, public TAttFill, public TAttBBox2D {
37 
38 private:
39  TObject *fTip; ///<! tool tip associated with box
40 
41 protected:
42  Double_t fX1; ///< X of 1st point
43  Double_t fY1; ///< Y of 1st point
44  Double_t fX2; ///< X of 2nd point
45  Double_t fY2; ///< Y of 2nd point
46  Bool_t fResizing; ///<! True if box is being resized
47 
48 public:
49  // Private bits, clients can only test but not change them
50  enum {
51  kCannotMove = BIT(12) //if set the box cannot be moved/resized
52  };
53  TBox();
55  TBox(const TBox &box);
56  TBox& operator=(const TBox&);
57  virtual ~TBox();
58  void Copy(TObject &box) const;
59  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
60  virtual void Draw(Option_t *option="");
61  virtual TBox *DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
62  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
63  Bool_t IsBeingResized() const { return fResizing; }
64  Double_t GetX1() const { return fX1; }
65  Double_t GetX2() const { return fX2; }
66  Double_t GetY1() const { return fY1; }
67  Double_t GetY2() const { return fY2; }
68  virtual void HideToolTip(Int_t event);
69  virtual Int_t IsInside(Double_t x, Double_t y) const;
70  virtual void ls(Option_t *option="") const;
71  virtual void Paint(Option_t *option="");
72  virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="");
73  virtual void Print(Option_t *option="") const;
74  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
75  virtual void SetX1(Double_t x1) {fX1=x1;}
76  virtual void SetX2(Double_t x2) {fX2=x2;}
77  virtual void SetY1(Double_t y1) {fY1=y1;}
78  virtual void SetY2(Double_t y2) {fY2=y2;}
79  virtual void SetToolTipText(const char *text, Long_t delayms = 1000);
80  virtual Rectangle_t GetBBox();
81  virtual TPoint GetBBoxCenter();
82  virtual void SetBBoxCenter(const TPoint &p);
83  virtual void SetBBoxCenterX(const Int_t x);
84  virtual void SetBBoxCenterY(const Int_t y);
85  virtual void SetBBoxX1(const Int_t x);
86  virtual void SetBBoxX2(const Int_t x);
87  virtual void SetBBoxY1(const Int_t y);
88  virtual void SetBBoxY2(const Int_t y);
89 
90  ClassDef(TBox,3) //Box class
91 };
92 
93 #endif
94 
virtual Rectangle_t GetBBox()
Return the "bounding Box" of the Box.
Definition: TBox.cxx:727
void Copy(TObject &box) const
Copy a Box.
Definition: TBox.cxx:111
TBox & operator=(const TBox &)
Assignment operator.
Definition: TBox.cxx:92
virtual void SetBBoxCenter(const TPoint &p)
Set center of the Box.
Definition: TBox.cxx:762
TBox()
Box default constructor.
Definition: TBox.cxx:41
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
Definition: TBox.cxx:189
Double_t GetX2() const
Definition: TBox.h:65
const char Option_t
Definition: RtypesCore.h:62
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TBox.cxx:216
virtual void SetBBoxY1(const Int_t y)
Set top of BoundingBox to a value (resize in y direction on top)
Definition: TBox.cxx:837
Create a Box.
Definition: TBox.h:36
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Definition: TBox.cxx:679
#define BIT(n)
Definition: Rtypes.h:120
Double_t fY2
Y of 2nd point.
Definition: TBox.h:45
virtual TPoint GetBBoxCenter()
Return the center of the Box as TPoint in pixels.
Definition: TBox.cxx:751
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:600
virtual void ls(Option_t *option="") const
List this box with its attributes.
Definition: TBox.cxx:610
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Double_t GetY2() const
Definition: TBox.h:67
virtual void SetX1(Double_t x1)
Definition: TBox.h:75
virtual void SetX2(Double_t x2)
Definition: TBox.h:76
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
Double_t fY1
Y of 1st point.
Definition: TBox.h:43
virtual void SetBBoxY2(const Int_t y)
Set bottom of BoundingBox to a value (resize in y direction on bottom)
Definition: TBox.cxx:846
static const double x2[5]
Fill Area Attributes class.
Definition: TAttFill.h:24
Double_t x[n]
Definition: legend1.C:17
Bool_t fResizing
! True if box is being resized
Definition: TBox.h:46
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void HideToolTip(Int_t event)
Hide tool tip depending on the event type.
Definition: TBox.cxx:591
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:829
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TBox.cxx:659
Definition: TPoint.h:33
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a box.
Definition: TBox.cxx:134
virtual ~TBox()
Box destructor.
Definition: TBox.cxx:68
Double_t fX2
X of 2nd point.
Definition: TBox.h:44
virtual void Print(Option_t *option="") const
Dump this box with its attributes.
Definition: TBox.cxx:645
Double_t fX1
X of 1st point.
Definition: TBox.h:42
virtual void SetBBoxCenterX(const Int_t x)
Set X coordinate of the center of the Box.
Definition: TBox.cxx:787
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:627
virtual void SetY2(Double_t y2)
Definition: TBox.h:78
virtual void SetBBoxCenterY(const Int_t y)
Set Y coordinate of the center of the Box.
Definition: TBox.cxx:803
long Long_t
Definition: RtypesCore.h:50
static const double x1[5]
Double_t GetX1() const
Definition: TBox.h:64
double Double_t
Definition: RtypesCore.h:55
virtual void Paint(Option_t *option="")
Paint this box with its current attributes.
Definition: TBox.cxx:619
TText * text
Double_t y[n]
Definition: legend1.C:17
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:820
virtual void Draw(Option_t *option="")
Draw this box with its current attributes.
Definition: TBox.cxx:180
Mother of all ROOT objects.
Definition: TObject.h:37
Bool_t IsBeingResized() const
Definition: TBox.h:63
TObject * fTip
! tool tip associated with box
Definition: TBox.h:39
Abstract base class for elements drawn in the editor.
Definition: TAttBBox2D.h:23
Double_t GetY1() const
Definition: TBox.h:66
virtual void SetY1(Double_t y1)
Definition: TBox.h:77
Line Attributes class.
Definition: TAttLine.h:24