Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
20class TPoint;
21
22class TBox : public TObject, public TAttLine, public TAttFill, public TAttBBox2D {
23
24private:
25 TObject *fTip{nullptr}; ///<! tool tip associated with box
26
27protected:
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
34public:
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();
40 TBox(Double_t x1, Double_t y1,Double_t x2, Double_t y2);
41 TBox(const TBox &box);
42 TBox& operator=(const TBox&);
43 ~TBox() override;
44
45 void Copy(TObject &box) const override;
46 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
47 void Draw(Option_t *option="") override;
48 virtual TBox *DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
49 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
50 Bool_t IsBeingResized() const { return fResizing; }
51 Double_t GetX1() const { return fX1; }
52 Double_t GetX2() const { return fX2; }
53 Double_t GetY1() const { return fY1; }
54 Double_t GetY2() const { return fY2; }
55 virtual void HideToolTip(Int_t event);
56 virtual Int_t IsInside(Double_t x, Double_t y) const;
57 void ls(Option_t *option="") const override;
58 void Paint(Option_t *option="") override;
59 virtual void PaintBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="");
60 void Print(Option_t *option="") const override;
61 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
62 virtual void SetX1(Double_t x1) {fX1=x1;}
63 virtual void SetX2(Double_t x2) {fX2=x2;}
64 virtual void SetY1(Double_t y1) {fY1=y1;}
65 virtual void SetY2(Double_t y2) {fY2=y2;}
66 virtual void SetToolTipText(const char *text, Long_t delayms = 1000);
67 Rectangle_t GetBBox() override;
68 void SetBBoxCenterX(const Int_t x) override;
69 void SetBBoxCenterY(const Int_t y) override;
70 void SetBBoxX1(const Int_t x) override;
71 void SetBBoxX2(const Int_t x) override;
72 void SetBBoxY1(const Int_t y) override;
73 void SetBBoxY2(const Int_t y) override;
74
75 ClassDefOverride(TBox,3) //Box class
76};
77
78#endif
79
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Abstract base class for elements drawn in the editor.
Definition TAttBBox2D.h:19
Create a Box.
Definition TBox.h:22
Double_t GetX1() const
Definition TBox.h:51
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this box.
Definition TBox.cxx:589
virtual void SetY2(Double_t y2)
Definition TBox.h:65
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:540
@ kCannotMove
Definition TBox.h:37
void SetBBoxX1(const Int_t x) override
Set left hand side of BoundingBox to a value (resize in x direction on left).
Definition TBox.cxx:686
~TBox() override
Box destructor.
Definition TBox.cxx:69
TBox & operator=(const TBox &)
Assignment operator.
Definition TBox.cxx:93
void SetBBoxY2(const Int_t y) override
Set bottom of BoundingBox to a value (resize in y direction on bottom).
Definition TBox.cxx:712
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top).
Definition TBox.cxx:703
Double_t fX1
X of 1st point.
Definition TBox.h:28
virtual void HideToolTip(Int_t event)
Hide tool tip depending on the event type.
Definition TBox.cxx:504
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Box.
Definition TBox.cxx:674
Double_t GetX2() const
Definition TBox.h:52
void ls(Option_t *option="") const override
List this box with its attributes.
Definition TBox.cxx:523
Double_t GetY1() const
Definition TBox.h:53
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition TBox.cxx:232
virtual void SetX1(Double_t x1)
Definition TBox.h:62
void Paint(Option_t *option="") override
Paint this box with its current attributes.
Definition TBox.cxx:532
Double_t GetY2() const
Definition TBox.h:54
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:513
virtual void SetX2(Double_t x2)
Definition TBox.h:63
TBox()
Box default constructor.
Definition TBox.cxx:42
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
Definition TBox.cxx:205
Rectangle_t GetBBox() override
Return the "bounding Box" of the Box.
Definition TBox.cxx:637
Bool_t IsBeingResized() const
Definition TBox.h:50
void Print(Option_t *option="") const override
Dump this box with its attributes.
Definition TBox.cxx:560
TObject * fTip
! tool tip associated with box
Definition TBox.h:25
Double_t fY2
Y of 2nd point.
Definition TBox.h:31
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition TBox.cxx:574
Double_t fX2
X of 2nd point.
Definition TBox.h:30
Double_t fY1
Y of 1st point.
Definition TBox.h:29
void Copy(TObject &box) const override
Copy a Box.
Definition TBox.cxx:112
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a box.
Definition TBox.cxx:135
Bool_t fResizing
! True if box is being resized
Definition TBox.h:32
void SetBBoxX2(const Int_t x) override
Set right hand side of BoundingBox to a value (resize in x direction on right).
Definition TBox.cxx:695
virtual void SetY1(Double_t y1)
Definition TBox.h:64
void SetBBoxCenterX(const Int_t x) override
Set X coordinate of the center of the Box.
Definition TBox.cxx:663
Mother of all ROOT objects.
Definition TObject.h:42
TObject()
TObject constructor.
Definition TObject.h:259
TText * text
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Rectangle structure (maps to the X11 XRectangle structure).
Definition GuiTypes.h:362
th1 Draw()