]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/Monitor.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / widgets / Monitor.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2016 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.widgets;
15
16 import org.eclipse.swt.graphics.*;
17
18 /**
19  * Instances of this class are descriptions of monitors.
20  *
21  * @see Display
22  * @see <a href="http://www.eclipse.org/swt/snippets/#monitor">Monitor snippets</a>
23  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
24  *
25  * @since 3.0
26  */
27 public final class Monitor {
28         long handle;
29         int x, y, width, height;
30         int clientX, clientY, clientWidth, clientHeight;
31         int zoom;
32
33 /**
34  * Prevents uninitialized instances from being created outside the package.
35  */
36 Monitor () {
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  */
49 @Override
50 public boolean equals (Object object) {
51         if (object == this) return true;
52         if (!(object instanceof Monitor)) return false;
53         Monitor monitor = (Monitor) object;
54         return handle == monitor.handle;
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 the zoom value for the monitor
80  *
81  * @return monitor's zoom value
82  *
83  * @since 3.107
84  */
85 public int getZoom () {
86         return zoom;
87 }
88
89 void setBounds (Rectangle rect) {
90         x = rect.x;
91         y = rect.y;
92         width = rect.width;
93         height = rect.height;
94 }
95
96 void setClientArea (Rectangle rect) {
97         clientX = rect.x;
98         clientY = rect.y;
99         clientWidth = rect.width;
100         clientHeight = rect.height;
101 }
102
103 /**
104  * Returns an integer hash code for the receiver. Any two
105  * objects that return <code>true</code> when passed to
106  * <code>equals</code> must return the same value for this
107  * method.
108  *
109  * @return the receiver's hash
110  *
111  * @see #equals(Object)
112  *
113  */
114 @Override
115 public int hashCode () {
116         return (int)/*64*/handle;
117 }
118
119 }