comparison dwt/graphics/Rectangle.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents db5a898b2119
children
comparison
equal deleted inserted replaced
44:ca5e494f2bbf 45:d8635bb48c7c
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * 10 *
11 * Port to the D programming language: 11 * Port to the D programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <doob@me.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.graphics.Rectangle; 14 module dwt.graphics.Rectangle;
15
15 16
16 import dwt.DWT; 17 import dwt.DWT;
17 import dwt.internal.SerializableCompatibility; 18 import dwt.internal.SerializableCompatibility;
18 19
19 import tango.text.convert.Format; 20 import tango.text.convert.Format;
43 * resources managed by each instance when those instances are no longer 44 * resources managed by each instance when those instances are no longer
44 * required, and thus no <code>dispose()</code> method is provided. 45 * required, and thus no <code>dispose()</code> method is provided.
45 * </p> 46 * </p>
46 * 47 *
47 * @see Point 48 * @see Point
49 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
48 */ 50 */
49 51
50 public final class Rectangle : SerializableCompatibility { 52 public final class Rectangle : SerializableCompatibility {
51 53
52 /** 54 /**
124 * @param x the x coordinate of the point to test for containment 126 * @param x the x coordinate of the point to test for containment
125 * @param y the y coordinate of the point to test for containment 127 * @param y the y coordinate of the point to test for containment
126 * @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise 128 * @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
127 */ 129 */
128 public bool contains (int x, int y) { 130 public bool contains (int x, int y) {
129 return (x >= this.x) && (y >= this.y) && ((x - this.x) < width) && ((y - this.y) < height); 131 return (x >= this.x) && (y >= this.y) && x < (this.x + width) && y < (this.y + height);
130 } 132 }
131 133
132 /** 134 /**
133 * Returns <code>true</code> if the given point is inside the 135 * Returns <code>true</code> if the given point is inside the
134 * area specified by the receiver, and <code>false</code> 136 * area specified by the receiver, and <code>false</code>