Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGDimension.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 02/01/98
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_TGDimension
13#define ROOT_TGDimension
14
15
16#include "RtypesCore.h"
17
19public:
20 UInt_t fWidth; // width
21 UInt_t fHeight; // height
22
25 ~TGDimension() = default;
26
28 { return ((fWidth == b.fWidth) && (fHeight == b.fHeight)); }
30 { return TGDimension(fWidth - b.fWidth, fHeight - b.fHeight); }
32 { return TGDimension(fWidth + b.fWidth, fHeight + b.fHeight); }
33};
34
35
37public:
38 Int_t fX; ///< x position
39 Int_t fY; ///< y position
40
41 TGPosition(): fX(0), fY(0) { }
42 TGPosition(Int_t xc, Int_t yc): fX(xc), fY(yc) { }
43 ~TGPosition() = default;
44
46 { return ((fX == b.fX) && (fY == b.fY)); }
48 { return TGPosition(fX - b.fX, fY - b.fY); }
50 { return TGPosition(fX + b.fX, fY + b.fY); }
51};
52
53
55public:
56 Long_t fX; ///< x position
57 Long_t fY; ///< y position
58
59 TGLongPosition(): fX(0), fY(0) { }
60 TGLongPosition(Long_t xc, Long_t yc): fX(xc), fY(yc) { }
61 ~TGLongPosition() = default;
62
64 { return ((fX == b.fX) && (fY == b.fY)); }
66 { return TGLongPosition(fX - b.fX, fY - b.fY); }
68 { return TGLongPosition(fX + b.fX, fY + b.fY); }
69};
70
71
72class TGInsets {
73public:
74 Int_t fL; ///< left
75 Int_t fR; ///< right
76 Int_t fT; ///< top
77 Int_t fB; ///< bottom
78
79 TGInsets(): fL(0), fR(0), fT(0), fB(0) { }
80 TGInsets(Int_t lf, Int_t rg, Int_t tp, Int_t bt):
81 fL(lf), fR(rg), fT(tp), fB(bt) { }
82 ~TGInsets() = default;
83
84 Bool_t operator==(const TGInsets &in) const
85 { return ((fL == in.fL) && (fR == in.fR) && (fT == in.fT) && (fB == in.fB)); }
86};
87
88
90public:
91 Int_t fX; ///< x position
92 Int_t fY; ///< y position
93 UInt_t fW; ///< width
94 UInt_t fH; ///< height
95
96 // constructors
97 TGRectangle(): fX(0), fY(0), fW(0), fH(0) { Empty(); }
99 fX(rx), fY(ry), fW(rw), fH(rh) { }
101 fX(p.fX), fY(p.fY), fW(d.fWidth), fH(d.fHeight) { }
102 ~TGRectangle() = default;
103
104 // methods
106 { return ((px >= fX) && (px < fX + (Int_t) fW) &&
107 (py >= fY) && (py < fY + (Int_t) fH)); }
108 Bool_t Contains(const TGPosition &p) const
109 { return ((p.fX >= fX) && (p.fX < fX + (Int_t) fW) &&
110 (p.fY >= fY) && (p.fY < fY + (Int_t) fH)); }
112 { return ((fX <= r.fX + (Int_t) r.fW - 1) && (fX + (Int_t) fW - 1 >= r.fX) &&
113 (fY <= r.fY + (Int_t) r.fH - 1) && (fY + (Int_t) fH - 1 >= r.fY)); }
114 Int_t Area() const
115 { return (fW * fH); }
117 { return TGDimension(fW, fH); }
119 { return TGPosition(fX, fY); }
121 { return TGPosition(fX + (Int_t) fW - 1, fY + (Int_t) fH - 1); }
122 void Merge(const TGRectangle &r);
123 void Empty() { fX = fY = 0; fW = fH = 0; }
124 Bool_t IsEmpty() const { return ((fW == 0) && (fH == 0)); }
125};
126
127#endif
ROOT::R::TRInterface & r
Definition Object.C:4
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
long Long_t
Definition RtypesCore.h:54
include TDocParser_001 C image html pict1_TDocParser_001 png width
Bool_t operator==(const TGDimension &b) const
Definition TGDimension.h:27
~TGDimension()=default
TGDimension operator+(const TGDimension &b) const
Definition TGDimension.h:31
TGDimension(UInt_t width, UInt_t height)
Definition TGDimension.h:24
TGDimension operator-(const TGDimension &b) const
Definition TGDimension.h:29
UInt_t fHeight
Definition TGDimension.h:21
UInt_t fWidth
Definition TGDimension.h:20
~TGInsets()=default
Int_t fR
right
Definition TGDimension.h:75
Bool_t operator==(const TGInsets &in) const
Definition TGDimension.h:84
Int_t fL
left
Definition TGDimension.h:74
Int_t fB
bottom
Definition TGDimension.h:77
TGInsets(Int_t lf, Int_t rg, Int_t tp, Int_t bt)
Definition TGDimension.h:80
Int_t fT
top
Definition TGDimension.h:76
Bool_t operator==(const TGLongPosition &b) const
Definition TGDimension.h:63
~TGLongPosition()=default
TGLongPosition(Long_t xc, Long_t yc)
Definition TGDimension.h:60
Long_t fX
x position
Definition TGDimension.h:56
Long_t fY
y position
Definition TGDimension.h:57
TGLongPosition operator-(const TGLongPosition &b) const
Definition TGDimension.h:65
TGLongPosition operator+(const TGLongPosition &b) const
Definition TGDimension.h:67
~TGPosition()=default
TGPosition(Int_t xc, Int_t yc)
Definition TGDimension.h:42
TGPosition operator-(const TGPosition &b) const
Definition TGDimension.h:47
TGPosition operator+(const TGPosition &b) const
Definition TGDimension.h:49
Bool_t operator==(const TGPosition &b) const
Definition TGDimension.h:45
Int_t fY
y position
Definition TGDimension.h:39
Int_t fX
x position
Definition TGDimension.h:38
~TGRectangle()=default
Bool_t IsEmpty() const
Bool_t Contains(const TGPosition &p) const
UInt_t fH
height
Definition TGDimension.h:94
UInt_t fW
width
Definition TGDimension.h:93
TGRectangle(const TGPosition &p, const TGDimension &d)
TGPosition LeftTop() const
Int_t fX
x position
Definition TGDimension.h:91
Bool_t Intersects(const TGRectangle &r) const
Bool_t Contains(Int_t px, Int_t py) const
TGDimension Size() const
TGRectangle(Int_t rx, Int_t ry, UInt_t rw, UInt_t rh)
Definition TGDimension.h:98
void Merge(const TGRectangle &r)
Int_t Area() const
Int_t fY
y position
Definition TGDimension.h:92
TGPosition RightBottom() const