comparison dynamin/gui/container.d @ 104:5c8c1c2e12c0

Change from real to double. double is not dependant on the platform, and it uses less space.
author Jordan Miner <jminer7@gmail.com>
date Fri, 06 Jul 2012 18:39:45 -0500
parents 73060bc3f004
children acdbb30fee7e
comparison
equal deleted inserted replaced
103:73060bc3f004 104:5c8c1c2e12c0
231 * Gets the child control at the specified point. If there are 231 * Gets the child control at the specified point. If there are
232 * multiple child controls at the point, the topmost control is returned. 232 * multiple child controls at the point, the topmost control is returned.
233 * If there is no child control at the point, null is returned. The returned 233 * If there is no child control at the point, null is returned. The returned
234 * control, if any, is a direct child of this container. 234 * control, if any, is a direct child of this container.
235 */ 235 */
236 Control getChildAtPoint(real[] pt) { 236 Control getChildAtPoint(double[] pt) {
237 assert(pt.length == 2, "pt must be just an x and y"); 237 assert(pt.length == 2, "pt must be just an x and y");
238 return getChildAtPoint(Point(pt[0], pt[1])); 238 return getChildAtPoint(Point(pt[0], pt[1]));
239 } 239 }
240 /// ditto 240 /// ditto
241 Control getChildAtPoint(real x, real y) { 241 Control getChildAtPoint(double x, double y) {
242 return getChildAtPoint(Point(x, y)); 242 return getChildAtPoint(Point(x, y));
243 } 243 }
244 /// ditto 244 /// ditto
245 Control getChildAtPoint(Point pt) { 245 Control getChildAtPoint(Point pt) {
246 for(int i = _children.count-1; i >= 0; --i) { 246 for(int i = _children.count-1; i >= 0; --i) {
254 254
255 /** 255 /**
256 * Never returns null. If there is no descendant at the specified point, 256 * Never returns null. If there is no descendant at the specified point,
257 * this container will be returned. 257 * this container will be returned.
258 */ 258 */
259 Control getDescendantAtPoint(real[] pt) { 259 Control getDescendantAtPoint(double[] pt) {
260 assert(pt.length == 2, "pt must be just an x and y"); 260 assert(pt.length == 2, "pt must be just an x and y");
261 return getDescendantAtPoint(Point(pt[0], pt[1])); 261 return getDescendantAtPoint(Point(pt[0], pt[1]));
262 } 262 }
263 /// ditto 263 /// ditto
264 Control getDescendantAtPoint(real x, real y) { 264 Control getDescendantAtPoint(double x, double y) {
265 return getDescendantAtPoint(Point(x, y)); 265 return getDescendantAtPoint(Point(x, y));
266 } 266 }
267 /// ditto 267 /// ditto
268 Control getDescendantAtPoint(Point pt) { 268 Control getDescendantAtPoint(Point pt) {
269 Container des = this; 269 Container des = this;
294 return; 294 return;
295 _minSize = size; 295 _minSize = size;
296 minSizeChanged(new EventArgs); 296 minSizeChanged(new EventArgs);
297 } 297 }
298 /// ditto 298 /// ditto
299 void minSize(real[] size) { 299 void minSize(double[] size) {
300 assert(size.length == 2, "size must be just a width and height"); 300 assert(size.length == 2, "size must be just a width and height");
301 minSize = Size(size[0], size[1]); 301 minSize = Size(size[0], size[1]);
302 } 302 }
303 /// 303 ///
304 real minWidth() { return _minSize.width; } 304 double minWidth() { return _minSize.width; }
305 /// 305 ///
306 real minHeight() { return _minSize.height; } 306 double minHeight() { return _minSize.height; }
307 307
308 /** 308 /**
309 * Gets or sets the maximum size of this window. A maximum width or 309 * Gets or sets the maximum size of this window. A maximum width or
310 * height of 0 means that there is no maximum width or height. 310 * height of 0 means that there is no maximum width or height.
311 * The default is Size(0, 0). 311 * The default is Size(0, 0).
317 return; 317 return;
318 _maxSize = size; 318 _maxSize = size;
319 minSizeChanged(new EventArgs); 319 minSizeChanged(new EventArgs);
320 } 320 }
321 /// ditto 321 /// ditto
322 void maxSize(real[] size) { 322 void maxSize(double[] size) {
323 assert(size.length == 2, "size must be just a width and height"); 323 assert(size.length == 2, "size must be just a width and height");
324 maxSize = Size(size[0], size[1]); 324 maxSize = Size(size[0], size[1]);
325 } 325 }
326 /// 326 ///
327 real maxWidth() { return _maxSize.width; } 327 double maxWidth() { return _maxSize.width; }
328 /// 328 ///
329 real maxHeight() { return _maxSize.height; } 329 double maxHeight() { return _maxSize.height; }
330 330
331 /** 331 /**
332 * Causes this container to position its child controls. Called on every 332 * Causes this container to position its child controls. Called on every
333 * resize. Usually, this function will get each child's best size, and 333 * resize. Usually, this function will get each child's best size, and
334 * then set each child's location and height. The definition in Container 334 * then set each child's location and height. The definition in Container