MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / PRectangle

Class PRectangle

scintilla/include/Platform.h:109–149  ·  view source on GitHub ↗

* A geometric rectangle class. * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably. * PRectangles contain their top and left sides, but not their right and bottom sides. */

Source from the content-addressed store, hash-verified

107 * PRectangles contain their top and left sides, but not their right and bottom sides.
108 */
109class PRectangle {
110public:
111 XYPOSITION left;
112 XYPOSITION top;
113 XYPOSITION right;
114 XYPOSITION bottom;
115
116 PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
117 left(left_), top(top_), right(right_), bottom(bottom_) {
118 }
119
120 // Other automatically defined methods (assignment, copy constructor, destructor) are fine
121
122 bool operator==(PRectangle &rc) {
123 return (rc.left == left) && (rc.right == right) &&
124 (rc.top == top) && (rc.bottom == bottom);
125 }
126 bool Contains(Point pt) {
127 return (pt.x >= left) && (pt.x <= right) &&
128 (pt.y >= top) && (pt.y <= bottom);
129 }
130 bool Contains(PRectangle rc) {
131 return (rc.left >= left) && (rc.right <= right) &&
132 (rc.top >= top) && (rc.bottom <= bottom);
133 }
134 bool Intersects(PRectangle other) {
135 return (right > other.left) && (left < other.right) &&
136 (bottom > other.top) && (top < other.bottom);
137 }
138 void Move(XYPOSITION xDelta, XYPOSITION yDelta) {
139 left += xDelta;
140 top += yDelta;
141 right += xDelta;
142 bottom += yDelta;
143 }
144 XYPOSITION Width() { return right - left; }
145 XYPOSITION Height() { return bottom - top; }
146 bool Empty() {
147 return (Height() <= 0) || (Width() <= 0);
148 }
149};
150
151/**
152 * Holds a desired RGB colour.

Callers 8

PixelGridAlignFunction · 0.85
CallTipMethod · 0.85
CallTipStartMethod · 0.85
GetPositionMethod · 0.85
GetClientPositionMethod · 0.85
GetMonitorRectMethod · 0.85
AdjustWindowRectMethod · 0.85
WndPaintMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected