Mercurial > projects > qtd
comparison qt/d2/qt/core/QRect.d @ 205:3dadfee97421
D2 fixes
author | eldar |
---|---|
date | Mon, 13 Jul 2009 23:35:23 +0000 |
parents | 6aeaf24018d7 |
children | 7664de4a55e5 |
comparison
equal
deleted
inserted
replaced
204:6aeaf24018d7 | 205:3dadfee97421 |
---|---|
1 module qt.core.QRect; | 1 module qt.core.QRect; |
2 | 2 |
3 public import qt.QGlobal; | 3 public import qt.QGlobal; |
4 public import qt.core.Qt; | 4 public import qt.core.Qt; |
5 | |
6 public import qt.core.QDataStream; | 5 public import qt.core.QDataStream; |
7 public import qt.core.QSize; | 6 public import qt.core.QSize; |
8 public import qt.core.QPoint; | 7 public import qt.core.QPoint; |
9 | 8 |
10 | 9 |
90 { x2 = pos; } | 89 { x2 = pos; } |
91 | 90 |
92 void setBottom(int pos) | 91 void setBottom(int pos) |
93 { y2 = pos; } | 92 { y2 = pos; } |
94 | 93 |
95 void setTopLeft(ref QPoint p) | 94 void setTopLeft(const QPoint p) |
96 { x1 = p.x(); y1 = p.y(); } | 95 { x1 = p.x(); y1 = p.y(); } |
97 | 96 |
98 void setBottomRight(ref QPoint p) | 97 void setBottomRight(const QPoint p) |
99 { x2 = p.x(); y2 = p.y(); } | 98 { x2 = p.x(); y2 = p.y(); } |
100 | 99 |
101 void setTopRight(ref QPoint p) | 100 void setTopRight(const QPoint p) |
102 { x2 = p.x(); y1 = p.y(); } | 101 { x2 = p.x(); y1 = p.y(); } |
103 | 102 |
104 void setBottomLeft(ref QPoint p) | 103 void setBottomLeft(const QPoint p) |
105 { x1 = p.x(); y2 = p.y(); } | 104 { x1 = p.x(); y2 = p.y(); } |
106 | 105 |
107 void setX(int ax) | 106 void setX(int ax) |
108 { x1 = ax; } | 107 { x1 = ax; } |
109 | 108 |
140 y1 += dy; | 139 y1 += dy; |
141 x2 += dx; | 140 x2 += dx; |
142 y2 += dy; | 141 y2 += dy; |
143 } | 142 } |
144 | 143 |
145 void translate(ref QPoint p) | 144 void translate(const QPoint p) |
146 { | 145 { |
147 x1 += p.x(); | 146 x1 += p.x(); |
148 y1 += p.y(); | 147 y1 += p.y(); |
149 x2 += p.x(); | 148 x2 += p.x(); |
150 y2 += p.y(); | 149 y2 += p.y(); |
151 } | 150 } |
152 | 151 |
153 QRect translated(int dx, int dy) const | 152 QRect translated(int dx, int dy) const |
154 { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } | 153 { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } |
155 | 154 |
156 QRect translated(ref QPoint p) const | 155 QRect translated(const QPoint p) const |
157 { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } | 156 { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } |
158 | 157 |
159 void moveTo(int ax, int ay) | 158 void moveTo(int ax, int ay) |
160 { | 159 { |
161 x2 += ax - x1; | 160 x2 += ax - x1; |
162 y2 += ay - y1; | 161 y2 += ay - y1; |
163 x1 = ax; | 162 x1 = ax; |
164 y1 = ay; | 163 y1 = ay; |
165 } | 164 } |
166 | 165 |
167 void moveTo(ref QPoint p) | 166 void moveTo(const QPoint p) |
168 { | 167 { |
169 x2 += p.x() - x1; | 168 x2 += p.x() - x1; |
170 y2 += p.y() - y1; | 169 y2 += p.y() - y1; |
171 x1 = p.x(); | 170 x1 = p.x(); |
172 y1 = p.y(); | 171 y1 = p.y(); |
188 { | 187 { |
189 y1 += (pos - y2); | 188 y1 += (pos - y2); |
190 y2 = pos; | 189 y2 = pos; |
191 } | 190 } |
192 | 191 |
193 void moveTopLeft(ref QPoint p) | 192 void moveTopLeft(const QPoint p) |
194 { | 193 { |
195 moveLeft(p.x()); | 194 moveLeft(p.x()); |
196 moveTop(p.y()); | 195 moveTop(p.y()); |
197 } | 196 } |
198 | 197 |
199 void moveBottomRight(ref QPoint p) | 198 void moveBottomRight(const QPoint p) |
200 { | 199 { |
201 moveRight(p.x()); | 200 moveRight(p.x()); |
202 moveBottom(p.y()); | 201 moveBottom(p.y()); |
203 } | 202 } |
204 | 203 |
205 void moveTopRight(ref QPoint p) | 204 void moveTopRight(const QPoint p) |
206 { | 205 { |
207 moveRight(p.x()); | 206 moveRight(p.x()); |
208 moveTop(p.y()); | 207 moveTop(p.y()); |
209 } | 208 } |
210 | 209 |
211 void moveBottomLeft(ref QPoint p) | 210 void moveBottomLeft(const QPoint p) |
212 { | 211 { |
213 moveLeft(p.x()); | 212 moveLeft(p.x()); |
214 moveBottom(p.y()); | 213 moveBottom(p.y()); |
215 } | 214 } |
216 | 215 |
261 { x2 = (x1 + w - 1); } | 260 { x2 = (x1 + w - 1); } |
262 | 261 |
263 void setHeight(int h) | 262 void setHeight(int h) |
264 { y2 = (y1 + h - 1); } | 263 { y2 = (y1 + h - 1); } |
265 | 264 |
266 void setSize(ref QSize s) | 265 void setSize(const QSize s) |
267 { | 266 { |
268 x2 = (s.width() + x1 - 1); | 267 x2 = (s.width() + x1 - 1); |
269 y2 = (s.height() + y1 - 1); | 268 y2 = (s.height() + y1 - 1); |
270 } | 269 } |
271 | 270 |
277 bool contains(int ax, int ay) const | 276 bool contains(int ax, int ay) const |
278 { | 277 { |
279 return contains(QPoint(ax, ay), false); | 278 return contains(QPoint(ax, ay), false); |
280 } | 279 } |
281 | 280 |
282 QRect opOrAssign(ref QRect r) | 281 QRect opOrAssign(const QRect r) |
283 { | 282 { |
284 this = this | r; | 283 this = this | r; |
285 return this; | 284 return this; |
286 } | 285 } |
287 | 286 |
288 QRect opAndAssign(ref QRect r) | 287 QRect opAndAssign(const QRect r) |
289 { | 288 { |
290 this = this & r; | 289 this = this & r; |
291 return this; | 290 return this; |
292 } | 291 } |
293 | 292 |
294 QRect intersected(ref QRect other) const | 293 QRect intersected(const QRect other) const |
295 { | 294 { |
296 return this & other; | 295 return this & other; |
297 } | 296 } |
298 | 297 |
299 QRect united(ref QRect r) const | 298 QRect united(const QRect r) const |
300 { | 299 { |
301 return this | r; | 300 return this | r; |
302 } | 301 } |
303 | 302 |
304 bool opEquals(ref QRect r) | 303 bool opEquals(const QRect r) |
305 { | 304 { |
306 return x1==r.x1 && x2==r.x2 && y1==r.y1 && y2==r.y2; | 305 return x1==r.x1 && x2==r.x2 && y1==r.y1 && y2==r.y2; |
307 } | 306 } |
308 | 307 |
309 public final void writeTo(QDataStream arg__1) { | 308 public final void writeTo(QDataStream arg__1) { |
312 | 311 |
313 public final void readFrom(QDataStream arg__1) { | 312 public final void readFrom(QDataStream arg__1) { |
314 qtd_QRect_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); | 313 qtd_QRect_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); |
315 } | 314 } |
316 | 315 |
317 public final QRect opAnd(ref QRect r) const { | 316 public final QRect opAnd(const QRect r) const { |
318 return qtd_QRect_operator_and_QRect(cast(void*)&this, &r); | 317 return qtd_QRect_operator_and_QRect(&this, &r); |
319 } | 318 } |
320 | 319 |
321 public final QRect opOr(ref QRect r) const { | 320 public final QRect opOr(const QRect r) const { |
322 return qtd_QRect_operator_or_QRect(cast(void*)&this, &r); | 321 return qtd_QRect_operator_or_QRect(&this, &r); |
323 } | 322 } |
324 | 323 |
325 public final bool contains(QPoint p, bool proper = false) const { | 324 public final bool contains(const QPoint p, bool proper = false) const { |
326 return qtd_QRect_contains_QPoint_bool(cast(void*)&this, &p, proper); | 325 return qtd_QRect_contains_QPoint_bool(&this, &p, proper); |
327 } | 326 } |
328 | 327 |
329 public final bool contains(QRect r, bool proper = false) const { | 328 public final bool contains(const QRect r, bool proper = false) const { |
330 return qtd_QRect_contains_QRect_bool(cast(void*)&this, &r, proper); | 329 return qtd_QRect_contains_QRect_bool(&this, &r, proper); |
331 } | 330 } |
332 | 331 |
333 public final bool intersects(QRect r) const { | 332 public final bool intersects(const QRect r) const { |
334 return qtd_QRect_intersects_QRect(cast(void*)&this, &r); | 333 return qtd_QRect_intersects_QRect(&this, &r); |
335 } | 334 } |
336 | 335 |
337 public final QRect normalized() const { | 336 public final QRect normalized() const { |
338 return qtd_QRect_normalized(cast(void*)&this); | 337 return qtd_QRect_normalized(&this); |
339 } | 338 } |
340 | 339 |
341 private: | 340 private: |
342 version(OSX) | 341 version(OSX) |
343 { | 342 { |
355 } | 354 } |
356 } | 355 } |
357 | 356 |
358 | 357 |
359 // C wrappers | 358 // C wrappers |
360 private extern(C) bool qtd_QRect_contains_QPoint_bool(void* __this_nativeId, | 359 private extern(C) bool qtd_QRect_contains_QPoint_bool(const void* __this_nativeId, |
361 void* p0, | 360 const void* p0, |
362 bool proper1); | 361 bool proper1); |
363 private extern(C) bool qtd_QRect_contains_QRect_bool(void* __this_nativeId, | 362 private extern(C) bool qtd_QRect_contains_QRect_bool(const void* __this_nativeId, |
364 void* r0, | 363 const void* r0, |
365 bool proper1); | 364 bool proper1); |
366 private extern(C) bool qtd_QRect_intersects_QRect(void* __this_nativeId, | 365 private extern(C) bool qtd_QRect_intersects_QRect(const void* __this_nativeId, |
367 void* r0); | 366 const void* r0); |
368 private extern(C) QRect qtd_QRect_normalized(void* __this_nativeId); | 367 private extern(C) QRect qtd_QRect_normalized(const void* __this_nativeId); |
369 private extern(C) void qtd_QRect_writeTo_QDataStream(void* __this_nativeId, | 368 private extern(C) void qtd_QRect_writeTo_QDataStream(void* __this_nativeId, |
370 void* arg__1); | 369 void* arg__1); |
371 private extern(C) void qtd_QRect_readFrom_QDataStream(void* __this_nativeId, | 370 private extern(C) void qtd_QRect_readFrom_QDataStream(void* __this_nativeId, |
372 void* arg__1); | 371 void* arg__1); |
373 private extern(C) QRect qtd_QRect_operator_and_QRect(void* __this_nativeId, | 372 private extern(C) QRect qtd_QRect_operator_and_QRect(const void* __this_nativeId, |
374 void* r0); | 373 const void* r0); |
375 private extern(C) QRect qtd_QRect_operator_or_QRect(void* __this_nativeId, | 374 private extern(C) QRect qtd_QRect_operator_or_QRect(const void* __this_nativeId, |
376 void* r0); | 375 const void* r0); |