Mercurial > projects > dwt-mac
comparison dwt/widgets/Monitor.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 1a8b3cb347e0 2952d5604c0a |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 *******************************************************************************/ | |
11 module dwt.widgets.Monitor; | |
12 | |
13 import dwt.dwthelper.utils; | |
14 | |
15 import dwt.graphics.Rectangle; | |
16 | |
17 /** | |
18 * Instances of this class are descriptions of monitors. | |
19 * | |
20 * @see Display | |
21 * | |
22 * @since 3.0 | |
23 */ | |
24 public final class Monitor { | |
25 int /*long*/ handle; | |
26 int x, y, width, height; | |
27 int clientX, clientY, clientWidth, clientHeight; | |
28 | |
29 /** | |
30 * Prevents uninitialized instances from being created outside the package. | |
31 */ | |
32 Monitor () { | |
33 } | |
34 | |
35 /** | |
36 * Compares the argument to the receiver, and returns true | |
37 * if they represent the <em>same</em> object using a class | |
38 * specific comparison. | |
39 * | |
40 * @param object the object to compare with this object | |
41 * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise | |
42 * | |
43 * @see #hashCode() | |
44 */ | |
45 public bool equals (Object object) { | |
46 if (object is this) return true; | |
47 if (!(object instanceof Monitor)) return false; | |
48 Monitor monitor = (Monitor) object; | |
49 return handle is monitor.handle; | |
50 } | |
51 | |
52 /** | |
53 * Returns a rectangle describing the receiver's size and location | |
54 * relative to its device. Note that on multi-monitor systems the | |
55 * origin can be negative. | |
56 * | |
57 * @return the receiver's bounding rectangle | |
58 */ | |
59 public Rectangle getBounds () { | |
60 return new Rectangle (x, y, width, height); | |
61 } | |
62 | |
63 /** | |
64 * Returns a rectangle which describes the area of the | |
65 * receiver which is capable of displaying data. | |
66 * | |
67 * @return the client area | |
68 */ | |
69 public Rectangle getClientArea () { | |
70 return new Rectangle (clientX, clientY, clientWidth, clientHeight); | |
71 } | |
72 | |
73 /** | |
74 * Returns an integer hash code for the receiver. Any two | |
75 * objects that return <code>true</code> when passed to | |
76 * <code>equals</code> must return the same value for this | |
77 * method. | |
78 * | |
79 * @return the receiver's hash | |
80 * | |
81 * @see #equals(Object) | |
82 */ | |
83 public int hashCode () { | |
84 return (int)/*64*/handle; | |
85 } | |
86 | |
87 } |