Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 #include "TObject.h"
17 #include "TAttLine.h"
18 #include "TAttFill.h"
19 #include "TAttBBox2D.h"
20 #include "TPoint.h"
21 #include "GuiTypes.h"
22 
23 
24 class TBox : public TObject, public TAttLine, public TAttFill, public TAttBBox2D {
25 
26 private:
27  TObject *fTip; ///<! tool tip associated with box
28 
29 protected:
30  Double_t fX1; ///< X of 1st point
31  Double_t fY1; ///< Y of 1st point
32  Double_t fX2; ///< X of 2nd point
33  Double_t fY2; ///< Y of 2nd point
34  Bool_t fResizing; ///<! True if box is being resized
35 
36 public:
37  // Private bits, clients can only test but not change them
38  enum {
39  kCannotMove = BIT(12) //if set the box cannot be moved/resized
40  };
41  TBox();
42  TBox(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
43  TBox(const TBox &box);
44  TBox& operator=(const TBox&);
45  virtual ~TBox();
46  void Copy(TObject &box) const;
47  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
48  virtual void Draw(Option_t *option="");
49  virtual TBox *DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
50  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
51  Bool_t IsBeingResized() const { return fResizing; }
52  Double_t GetX1() const { return fX1; }
53  Double_t GetX2() const { return fX2; }
54  Double_t GetY1() const { return fY1; }
55  Double_t GetY2() const { return fY2; }
56  virtual void HideToolTip(Int_t event);
57  virtual Int_t IsInside(Double_t x, Double_t y) const;
58  virtual void ls(Option_t *option="") const;
59  virtual void Paint(Option_t *option="");
60  virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="");
61  virtual void Print(Option_t *option="") const;
62  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
63  virtual void SetX1(Double_t x1) {fX1=x1;}
64  virtual void SetX2(Double_t x2) {fX2=x2;}
65  virtual void SetY1(Double_t y1) {fY1=y1;}
66  virtual void SetY2(Double_t y2) {fY2=y2;}
67  virtual void SetToolTipText(const char *text, Long_t delayms = 1000);
68  virtual Rectangle_t GetBBox();
69  virtual TPoint GetBBoxCenter();
70  virtual void SetBBoxCenter(const TPoint &p);
71  virtual void SetBBoxCenterX(const Int_t x);
72  virtual void SetBBoxCenterY(const Int_t y);
73  virtual void SetBBoxX1(const Int_t x);
74  virtual void SetBBoxX2(const Int_t x);
75  virtual void SetBBoxY1(const Int_t y);
76  virtual void SetBBoxY2(const Int_t y);
77 
78  ClassDef(TBox,3) //Box class
79 };
80 
81 #endif
82