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();
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;
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;
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 TPoint GetBBoxCenter() override;
69 void SetBBoxCenter(const TPoint &p) override;
70 void SetBBoxCenterX(const Int_t x) override;
71 void SetBBoxCenterY(const Int_t y) override;
72 void SetBBoxX1(const Int_t x) override;
73 void SetBBoxX2(const Int_t x) override;
74 void SetBBoxY1(const Int_t y) override;
75 void SetBBoxY2(const Int_t y) override;
76
77 ClassDefOverride(TBox,3) //Box class
78};
79
80#endif
81
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Abstract base class for elements drawn in the editor.
Definition TAttBBox2D.h:19
Fill Area Attributes class.
Definition TAttFill.h:19
Line Attributes class.
Definition TAttLine.h:18
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:732
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:678
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:888
~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:920
void SetBBoxY1(const Int_t y) override
Set top of BoundingBox to a value (resize in y direction on top)
Definition TBox.cxx:909
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:642
void SetBBoxCenterY(const Int_t y) override
Set Y coordinate of the center of the Box.
Definition TBox.cxx:869
Double_t GetX2() const
Definition TBox.h:52
void ls(Option_t *option="") const override
List this box with its attributes.
Definition TBox.cxx:661
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:670
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:651
TPoint GetBBoxCenter() override
Return the center of the Box as TPoint in pixels.
Definition TBox.cxx:812
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:780
Bool_t IsBeingResized() const
Definition TBox.h:50
void Print(Option_t *option="") const override
Dump this box with its attributes.
Definition TBox.cxx:698
TObject * fTip
! tool tip associated with box
Definition TBox.h:25
void SetBBoxCenter(const TPoint &p) override
Set center of the Box.
Definition TBox.cxx:825
@ kCannotMove
Definition TBox.h:37
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:712
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:899
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:851
Mother of all ROOT objects.
Definition TObject.h:41
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:361
th1 Draw()