Logo ROOT  
Reference Guide
TPave.h
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Rene Brun 16/10/95
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_TPave
13#define ROOT_TPave
14
15
16#include "TBox.h"
17#include "TString.h"
18
19class TPave : public TBox {
20
21protected:
22 Double_t fX1NDC; ///< X1 point in NDC coordinates
23 Double_t fY1NDC; ///< Y1 point in NDC coordinates
24 Double_t fX2NDC; ///< X2 point in NDC coordinates
25 Double_t fY2NDC; ///< Y2 point in NDC coordinates
26 Int_t fBorderSize; ///< window box bordersize in pixels
27 Int_t fInit; ///< (=0 if transformation to NDC not yet done)
28 Int_t fShadowColor; ///< Color of the pave's shadow
29 Double_t fCornerRadius; ///< Corner radius in case of option arc
30 TString fOption; ///< Pave style
31 TString fName; ///< Pave name
32
33public:
34 // TPave status bits
35 enum {
36 kNameIsAction = BIT(11) ///< double clicking on TPave will execute action
37 };
38
39 TPave();
41 Int_t bordersize=4 ,Option_t *option="br");
42 TPave(const TPave &pave);
43 virtual ~TPave();
44
45 TPave &operator=(const TPave &src);
46
47 void Copy(TObject &pave) const override;
48 virtual void ConvertNDCtoPad();
49 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
50 void Draw(Option_t *option="") override;
52 Int_t bordersize=4 ,Option_t *option="br");
53 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
54 Int_t GetBorderSize() const { return fBorderSize;}
56 const char *GetName() const override {return fName.Data();}
57 Option_t *GetOption() const override {return fOption.Data();}
59 Double_t GetX1NDC() const {return fX1NDC;}
60 Double_t GetX2NDC() const {return fX2NDC;}
61 Double_t GetY1NDC() const {return fY1NDC;}
62 Double_t GetY2NDC() const {return fY2NDC;}
63 ULong_t Hash() const override { return fName.Hash(); }
64 Bool_t IsSortable() const override { return kTRUE; }
65 void ls(Option_t *option="") const override;
66 void Paint(Option_t *option="") override;
68 Int_t bordersize=4 ,Option_t *option="br");
70 Int_t bordersize=4 ,Option_t *option="br");
71 void Print(Option_t *option="") const override;
72 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
73 virtual void SetBorderSize(Int_t bordersize=4) {fBorderSize = bordersize;} // *MENU*
74 virtual void SetCornerRadius(Double_t rad = 0.2) {fCornerRadius = rad;} // *MENU*
75 virtual void SetName(const char *name="") {fName = name;} // *MENU*
76 virtual void SetOption(Option_t *option="br") {fOption = option;}
77 virtual void SetShadowColor(Int_t color) {fShadowColor=color;} // *MENU*
78 virtual void SetX1NDC(Double_t x1) {fX1NDC=x1;}
79 virtual void SetX2NDC(Double_t x2) {fX2NDC=x2;}
80 virtual void SetY1NDC(Double_t y1) {fY1NDC=y1;}
81 virtual void SetY2NDC(Double_t y2) {fY2NDC=y2;}
82 virtual void SetX1(Double_t x1) override;
83 virtual void SetX2(Double_t x2) override;
84 virtual void SetY1(Double_t y1) override;
85 virtual void SetY2(Double_t y2) override;
86
87 ClassDefOverride(TPave,3) //Pave. A box with shadowing
88};
89
90#endif
91
int Int_t
Definition: RtypesCore.h:45
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
unsigned long ULong_t
Definition: RtypesCore.h:55
const char Option_t
Definition: RtypesCore.h:66
#define BIT(n)
Definition: Rtypes.h:85
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char y1
char name[80]
Definition: TGX11.cxx:110
Create a Box.
Definition: TBox.h:22
Mother of all ROOT objects.
Definition: TObject.h:41
A TBox with a bordersize and a shadow option.
Definition: TPave.h:19
virtual void SetY1NDC(Double_t y1)
Definition: TPave.h:80
TPave()
Pave default constructor.
Definition: TPave.cxx:36
void Print(Option_t *option="") const override
Dump this pave with its attributes.
Definition: TPave.cxx:615
Double_t GetY2NDC() const
Definition: TPave.h:62
virtual void SetX2(Double_t x2) override
Set the X2 value.
Definition: TPave.cxx:665
Int_t GetBorderSize() const
Definition: TPave.h:54
virtual void SetCornerRadius(Double_t rad=0.2)
Definition: TPave.h:74
Double_t GetCornerRadius() const
Definition: TPave.h:55
TPave & operator=(const TPave &src)
Assignment operator.
Definition: TPave.cxx:129
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
Definition: TPave.cxx:139
virtual void PaintPaveArc(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with rounded corners.
Definition: TPave.cxx:413
const char * GetName() const override
Returns name of object.
Definition: TPave.h:56
Double_t GetX2NDC() const
Definition: TPave.h:60
@ kNameIsAction
double clicking on TPave will execute action
Definition: TPave.h:36
void Copy(TObject &pave) const override
Copy this pave to pave.
Definition: TPave.cxx:186
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition: TPave.cxx:254
Int_t fBorderSize
window box bordersize in pixels
Definition: TPave.h:26
virtual ~TPave()
Pave default destructor.
Definition: TPave.cxx:103
virtual void SetOption(Option_t *option="br")
Definition: TPave.h:76
Bool_t IsSortable() const override
Definition: TPave.h:64
ULong_t Hash() const override
Return hash value for this object.
Definition: TPave.h:63
void Draw(Option_t *option="") override
Draw this pave with its current attributes.
Definition: TPave.cxx:228
void ls(Option_t *option="") const override
List this pave with its attributes.
Definition: TPave.cxx:278
virtual void SetName(const char *name="")
Definition: TPave.h:75
virtual void SetX1(Double_t x1) override
Set the X1 value.
Definition: TPave.cxx:652
Double_t fX2NDC
X2 point in NDC coordinates.
Definition: TPave.h:24
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
Definition: TPave.cxx:623
Int_t fShadowColor
Color of the pave's shadow.
Definition: TPave.h:28
Double_t GetY1NDC() const
Definition: TPave.h:61
virtual void SetY1(Double_t y1) override
Set the Y1 value.
Definition: TPave.cxx:678
virtual void SetBorderSize(Int_t bordersize=4)
Definition: TPave.h:73
Int_t fInit
(=0 if transformation to NDC not yet done)
Definition: TPave.h:27
TString fOption
Pave style.
Definition: TPave.h:30
virtual void SetY2NDC(Double_t y2)
Definition: TPave.h:81
Double_t fY2NDC
Y2 point in NDC coordinates.
Definition: TPave.h:25
virtual void SetShadowColor(Int_t color)
Definition: TPave.h:77
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a pave.
Definition: TPave.cxx:208
Double_t fX1NDC
X1 point in NDC coordinates.
Definition: TPave.h:22
TString fName
Pave name.
Definition: TPave.h:31
virtual void SetY2(Double_t y2) override
Set the Y2 value.
Definition: TPave.cxx:691
Double_t fCornerRadius
Corner radius in case of option arc.
Definition: TPave.h:29
Option_t * GetOption() const override
Definition: TPave.h:57
Double_t fY1NDC
Y1 point in NDC coordinates.
Definition: TPave.h:23
void Paint(Option_t *option="") override
Paint this pave with its current attributes.
Definition: TPave.cxx:303
Double_t GetX1NDC() const
Definition: TPave.h:59
virtual TPave * DrawPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with new coordinates.
Definition: TPave.cxx:240
Int_t GetShadowColor() const
Definition: TPave.h:58
virtual void PaintPave(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t bordersize=4, Option_t *option="br")
Draw this pave with new coordinates.
Definition: TPave.cxx:314
virtual void SetX1NDC(Double_t x1)
Definition: TPave.h:78
virtual void SetX2NDC(Double_t x2)
Definition: TPave.h:79
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:671
static constexpr double rad