25
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2008 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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module org.eclipse.swt.widgets.Monitor;
|
|
14
|
|
15 import java.lang.all;
|
|
16
|
|
17 import org.eclipse.swt.graphics.Rectangle;
|
|
18
|
|
19 /**
|
|
20 * Instances of this class are descriptions of monitors.
|
|
21 *
|
|
22 * @see Display
|
|
23 * @see <a href="http://www.eclipse.org/swt/snippets/#monitor">Monitor snippets</a>
|
|
24 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
|
|
25 *
|
|
26 * @since 3.0
|
|
27 */
|
|
28 public final class Monitor {
|
|
29 int /*long*/ handle;
|
|
30 int x, y, width, height;
|
|
31 int clientX, clientY, clientWidth, clientHeight;
|
|
32
|
|
33 /**
|
|
34 * Prevents uninitialized instances from being created outside the package.
|
|
35 */
|
|
36 this () {
|
|
37 }
|
|
38
|
|
39 /**
|
|
40 * Compares the argument to the receiver, and returns true
|
|
41 * if they represent the <em>same</em> object using a class
|
|
42 * specific comparison.
|
|
43 *
|
|
44 * @param object the object to compare with this object
|
|
45 * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
|
|
46 *
|
|
47 * @see #hashCode()
|
|
48 */
|
26
|
49 public override equals_t opEquals (Object object) {
|
25
|
50 if (object is this) return true;
|
|
51 if ( auto mon = cast(org.eclipse.swt.widgets.Monitor.Monitor)object ){
|
|
52 return handle is mon.handle;
|
|
53 }
|
|
54 return false;
|
|
55 }
|
|
56
|
|
57 /**
|
|
58 * Returns a rectangle describing the receiver's size and location
|
|
59 * relative to its device. Note that on multi-monitor systems the
|
|
60 * origin can be negative.
|
|
61 *
|
|
62 * @return the receiver's bounding rectangle
|
|
63 */
|
|
64 public Rectangle getBounds () {
|
|
65 return new Rectangle (x, y, width, height);
|
|
66 }
|
|
67
|
|
68 /**
|
|
69 * Returns a rectangle which describes the area of the
|
|
70 * receiver which is capable of displaying data.
|
|
71 *
|
|
72 * @return the client area
|
|
73 */
|
|
74 public Rectangle getClientArea () {
|
|
75 return new Rectangle (clientX, clientY, clientWidth, clientHeight);
|
|
76 }
|
|
77
|
|
78 /**
|
|
79 * Returns an integer hash code for the receiver. Any two
|
|
80 * objects that return <code>true</code> when passed to
|
|
81 * <code>equals</code> must return the same value for this
|
|
82 * method.
|
|
83 *
|
|
84 * @return the receiver's hash
|
|
85 *
|
|
86 * @see #equals(Object)
|
|
87 */
|
|
88 public override hash_t toHash() {
|
|
89 return cast(hash_t)handle;
|
|
90 }
|
|
91
|
|
92 }
|