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