Mercurial > projects > qtd
comparison qt/d1/qt/core/QRectF.d @ 231:99e74c8a22f8
change ref to in in structs
author | eldar |
---|---|
date | Fri, 17 Jul 2009 21:16:44 +0000 |
parents | 7dd099050621 |
children | 7664de4a55e5 |
comparison
equal
deleted
inserted
replaced
230:0c2a27b23238 | 231:99e74c8a22f8 |
---|---|
27 rt.w = awidth; | 27 rt.w = awidth; |
28 rt.h = aheight; | 28 rt.h = aheight; |
29 return rt; | 29 return rt; |
30 } | 30 } |
31 | 31 |
32 public static QRectF opCall(ref QPointF atopLeft, ref QSizeF asize) | 32 public static QRectF opCall(in QPointF atopLeft, in QSizeF asize) |
33 { | 33 { |
34 QRectF rt; | 34 QRectF rt; |
35 rt.xp = atopLeft.x(); | 35 rt.xp = atopLeft.x(); |
36 rt.yp = atopLeft.y(); | 36 rt.yp = atopLeft.y(); |
37 rt.w = asize.width(); | 37 rt.w = asize.width(); |
38 rt.h = asize.height(); | 38 rt.h = asize.height(); |
39 return rt; | 39 return rt; |
40 } | 40 } |
41 | 41 |
42 public static QRectF opCall(ref QPointF atopLeft, ref QPointF abottomRight) | 42 public static QRectF opCall(in QPointF atopLeft, in QPointF abottomRight) |
43 { | 43 { |
44 QRectF rt; | 44 QRectF rt; |
45 rt.xp = atopLeft.x(); | 45 rt.xp = atopLeft.x(); |
46 rt.yp = atopLeft.y(); | 46 rt.yp = atopLeft.y(); |
47 rt.w = abottomRight.x() - rt.xp; | 47 rt.w = abottomRight.x() - rt.xp; |
48 rt.h = abottomRight.y() - rt.yp; | 48 rt.h = abottomRight.y() - rt.yp; |
49 return rt; | 49 return rt; |
50 } | 50 } |
51 | 51 |
52 public static QRectF opCall(ref QRect r) | 52 public static QRectF opCall(in QRect r) |
53 { | 53 { |
54 QRectF rt; | 54 QRectF rt; |
55 rt.xp = r.x(); | 55 rt.xp = r.x(); |
56 rt.yp = r.y(); | 56 rt.yp = r.y(); |
57 rt.w = r.width(); | 57 rt.w = r.width(); |
104 | 104 |
105 void setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; } | 105 void setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; } |
106 | 106 |
107 void setBottom(qreal pos) { h = pos - yp; } | 107 void setBottom(qreal pos) { h = pos - yp; } |
108 | 108 |
109 void setTopLeft(ref QPointF p) { setLeft(p.x()); setTop(p.y()); } | 109 void setTopLeft(in QPointF p) { setLeft(p.x()); setTop(p.y()); } |
110 | 110 |
111 void setTopRight(ref QPointF p) { setRight(p.x()); setTop(p.y()); } | 111 void setTopRight(in QPointF p) { setRight(p.x()); setTop(p.y()); } |
112 | 112 |
113 void setBottomLeft(ref QPointF p) { setLeft(p.x()); setBottom(p.y()); } | 113 void setBottomLeft(in QPointF p) { setLeft(p.x()); setBottom(p.y()); } |
114 | 114 |
115 void setBottomRight(ref QPointF p) { setRight(p.x()); setBottom(p.y()); } | 115 void setBottomRight(in QPointF p) { setRight(p.x()); setBottom(p.y()); } |
116 | 116 |
117 QPointF center() // conts | 117 QPointF center() // conts |
118 { return QPointF(xp + w/2, yp + h/2); } | 118 { return QPointF(xp + w/2, yp + h/2); } |
119 | 119 |
120 void moveLeft(qreal pos) { xp = pos; } | 120 void moveLeft(qreal pos) { xp = pos; } |
123 | 123 |
124 void moveRight(qreal pos) { xp = pos - w; } | 124 void moveRight(qreal pos) { xp = pos - w; } |
125 | 125 |
126 void moveBottom(qreal pos) { yp = pos - h; } | 126 void moveBottom(qreal pos) { yp = pos - h; } |
127 | 127 |
128 void moveTopLeft(ref QPointF p) { moveLeft(p.x()); moveTop(p.y()); } | 128 void moveTopLeft(in QPointF p) { moveLeft(p.x()); moveTop(p.y()); } |
129 | 129 |
130 void moveTopRight(ref QPointF p) { moveRight(p.x()); moveTop(p.y()); } | 130 void moveTopRight(in QPointF p) { moveRight(p.x()); moveTop(p.y()); } |
131 | 131 |
132 void moveBottomLeft(ref QPointF p) { moveLeft(p.x()); moveBottom(p.y()); } | 132 void moveBottomLeft(in QPointF p) { moveLeft(p.x()); moveBottom(p.y()); } |
133 | 133 |
134 void moveBottomRight(ref QPointF p) { moveRight(p.x()); moveBottom(p.y()); } | 134 void moveBottomRight(in QPointF p) { moveRight(p.x()); moveBottom(p.y()); } |
135 | 135 |
136 void moveCenter(ref QPointF p) { xp = p.x() - w/2; yp = p.y() - h/2; } | 136 void moveCenter(in QPointF p) { xp = p.x() - w/2; yp = p.y() - h/2; } |
137 | 137 |
138 qreal width() // conts | 138 qreal width() // conts |
139 { return w; } | 139 { return w; } |
140 | 140 |
141 qreal height() // conts | 141 qreal height() // conts |
148 { | 148 { |
149 xp += dx; | 149 xp += dx; |
150 yp += dy; | 150 yp += dy; |
151 } | 151 } |
152 | 152 |
153 void translate(ref QPointF p) | 153 void translate(in QPointF p) |
154 { | 154 { |
155 xp += p.x(); | 155 xp += p.x(); |
156 yp += p.y(); | 156 yp += p.y(); |
157 } | 157 } |
158 | 158 |
160 { | 160 { |
161 xp = ax; | 161 xp = ax; |
162 yp = ay; | 162 yp = ay; |
163 } | 163 } |
164 | 164 |
165 void moveTo(ref QPointF p) | 165 void moveTo(in QPointF p) |
166 { | 166 { |
167 xp = p.x(); | 167 xp = p.x(); |
168 yp = p.y(); | 168 yp = p.y(); |
169 } | 169 } |
170 | 170 |
171 QRectF translated(qreal dx, qreal dy) // conts | 171 QRectF translated(qreal dx, qreal dy) // conts |
172 { return QRectF(xp + dx, yp + dy, w, h); } | 172 { return QRectF(xp + dx, yp + dy, w, h); } |
173 | 173 |
174 QRectF translated(ref QPointF p) // conts | 174 QRectF translated(in QPointF p) // conts |
175 { return QRectF(xp + p.x(), yp + p.y(), w, h); } | 175 { return QRectF(xp + p.x(), yp + p.y(), w, h); } |
176 | 176 |
177 void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) // conts | 177 void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) // conts |
178 { | 178 { |
179 *ax = this.xp; | 179 *ax = this.xp; |
216 { this.w = aw; } | 216 { this.w = aw; } |
217 | 217 |
218 void setHeight(qreal ah) // for convenience | 218 void setHeight(qreal ah) // for convenience |
219 { this.h = ah; } | 219 { this.h = ah; } |
220 | 220 |
221 void setSize(ref QSizeF s) // for convenience | 221 void setSize(in QSizeF s) // for convenience |
222 { | 222 { |
223 w = s.width(); | 223 w = s.width(); |
224 h = s.height(); | 224 h = s.height(); |
225 } | 225 } |
226 | 226 |
228 { this.w = aw; } | 228 { this.w = aw; } |
229 | 229 |
230 void height(qreal ah) | 230 void height(qreal ah) |
231 { this.h = ah; } | 231 { this.h = ah; } |
232 | 232 |
233 void size(ref QSizeF s) | 233 void size(in QSizeF s) |
234 { | 234 { |
235 w = s.width(); | 235 w = s.width(); |
236 h = s.height(); | 236 h = s.height(); |
237 } | 237 } |
238 | 238 |
239 bool contains(qreal ax, qreal ay) // conts | 239 bool contains(qreal ax, qreal ay) // conts |
240 { | 240 { |
241 return contains(QPointF(ax, ay)); | 241 return contains(QPointF(ax, ay)); |
242 } | 242 } |
243 | 243 |
244 QRectF opOrAssign(ref QRectF r) | 244 QRectF opOrAssign(in QRectF r) |
245 { | 245 { |
246 *this = *this | r; | 246 *this = *this | r; |
247 return *this; | 247 return *this; |
248 } | 248 } |
249 | 249 |
250 QRectF opAndAssign(ref QRectF r) | 250 QRectF opAndAssign(in QRectF r) |
251 { | 251 { |
252 *this = *this & r; | 252 *this = *this & r; |
253 return *this; | 253 return *this; |
254 } | 254 } |
255 | 255 |
256 QRectF intersected(ref QRectF r) // conts | 256 QRectF intersected(in QRectF r) // conts |
257 { | 257 { |
258 return *this & r; | 258 return *this & r; |
259 } | 259 } |
260 | 260 |
261 QRectF united(ref QRectF r) // conts | 261 QRectF united(in QRectF r) // conts |
262 { | 262 { |
263 return *this | r; | 263 return *this | r; |
264 } | 264 } |
265 | 265 |
266 bool opEquals(ref QRectF r) | 266 bool opEquals(in QRectF r) |
267 { | 267 { |
268 return qFuzzyCompare(xp, r.xp) && qFuzzyCompare(yp, r.yp) | 268 return qFuzzyCompare(xp, r.xp) && qFuzzyCompare(yp, r.yp) |
269 && qFuzzyCompare(w, r.w) && qFuzzyCompare(h, r.h); | 269 && qFuzzyCompare(w, r.w) && qFuzzyCompare(h, r.h); |
270 } | 270 } |
271 | 271 |
288 | 288 |
289 public final QRectF normalized() { | 289 public final QRectF normalized() { |
290 return qtd_QRectF_normalized(this); | 290 return qtd_QRectF_normalized(this); |
291 } | 291 } |
292 | 292 |
293 public final QRectF opAnd(ref QRectF r) { | 293 public final QRectF opAnd(in QRectF r) { |
294 return qtd_QRectF_operator_and_QRectF(this, &r); | 294 return qtd_QRectF_operator_and_QRectF(this, &r); |
295 } | 295 } |
296 | 296 |
297 public final void writeTo(QDataStream arg__1) { | 297 public final void writeTo(QDataStream arg__1) { |
298 qtd_QRectF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); | 298 qtd_QRectF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); |
300 | 300 |
301 public final void readFrom(QDataStream arg__1) { | 301 public final void readFrom(QDataStream arg__1) { |
302 qtd_QRectF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); | 302 qtd_QRectF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); |
303 } | 303 } |
304 | 304 |
305 public final QRectF opOr(ref QRectF r) { | 305 public final QRectF opOr(in QRectF r) { |
306 return qtd_QRectF_operator_or_QRectF(this, &r); | 306 return qtd_QRectF_operator_or_QRectF(this, &r); |
307 } | 307 } |
308 | 308 |
309 public final QRect toAlignedRect() // const | 309 public final QRect toAlignedRect() // const |
310 { | 310 { |