OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [java/] [awt/] [AWTEvent.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
 
2
/* AWTEvent.java -- the root event in AWT
3
   Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation
4
 
5
This file is part of GNU Classpath.
6
 
7
GNU Classpath is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
10
any later version.
11
 
12
GNU Classpath is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GNU Classpath; see the file COPYING.  If not, write to the
19
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
02110-1301 USA.
21
 
22
Linking this library statically or dynamically with other modules is
23
making a combined work based on this library.  Thus, the terms and
24
conditions of the GNU General Public License cover the whole
25
combination.
26
 
27
As a special exception, the copyright holders of this library give you
28
permission to link this library with independent modules to produce an
29
executable, regardless of the license terms of these independent
30
modules, and to copy and distribute the resulting executable under
31
terms of your choice, provided that you also meet, for each linked
32
independent module, the terms and conditions of the license of that
33
module.  An independent module is a module which is not derived from
34
or based on this library.  If you modify this library, you may extend
35
this exception to your version of the library, but you are not
36
obligated to do so.  If you do not wish to do so, delete this
37
exception statement from your version. */
38
 
39
 
40
package java.awt;
41
 
42
import java.util.EventObject;
43
 
44
/**
45
 * AWTEvent is the root event class for all AWT events in the JDK 1.1 event
46
 * model. It supersedes the Event class from JDK 1.0. Subclasses outside of
47
 * the java.awt package should have IDs greater than RESERVED_ID_MAX.
48
 *
49
 * <p>Event masks defined here are used by components in
50
 * <code>enableEvents</code> to select event types not selected by registered
51
 * listeners. Event masks are appropriately set when registering on
52
 * components.
53
 *
54
 * @author Warren Levy  (warrenl@cygnus.com)
55
 * @author Aaron M. Renn (arenn@urbanophile.com)
56
 * @since 1.1
57
 * @status updated to 1.4
58
 */
59
public abstract class AWTEvent extends EventObject
60
{
61
  /**
62
   * Compatible with JDK 1.1+.
63
   */
64
  private static final long serialVersionUID = -1825314779160409405L;
65
 
66
  /**
67
   * The ID of the event.
68
   *
69
   * @see #getID()
70
   * @see #AWTEvent(Object, int)
71
   * @serial the identifier number of this event
72
   */
73
  protected int id;
74
 
75
  /**
76
   * Indicates if the event has been consumed. False mean it is passed to
77
   * the peer, true means it has already been processed. Semantic events
78
   * generated by low-level events always have the value true.
79
   *
80
   * @see #consume()
81
   * @see #isConsumed()
82
   * @serial whether the event has been consumed
83
   */
84
  protected boolean consumed;
85
 
86
  /**
87
   * Who knows? It's in the serial version.
88
   *
89
   * @serial No idea what this is for.
90
   */
91
  byte[] bdata;
92
 
93
  /** Mask for selecting component events. */
94
  public static final long COMPONENT_EVENT_MASK = 0x00001;
95
 
96
  /** Mask for selecting container events. */
97
  public static final long CONTAINER_EVENT_MASK = 0x00002;
98
 
99
  /** Mask for selecting component focus events. */
100
  public static final long FOCUS_EVENT_MASK = 0x00004;
101
 
102
  /** Mask for selecting keyboard events. */
103
  public static final long KEY_EVENT_MASK = 0x00008;
104
 
105
  /** Mask for mouse button events. */
106
  public static final long MOUSE_EVENT_MASK = 0x00010;
107
 
108
  /** Mask for mouse motion events. */
109
  public static final long MOUSE_MOTION_EVENT_MASK = 0x00020;
110
 
111
  /** Mask for window events. */
112
  public static final long WINDOW_EVENT_MASK = 0x00040;
113
 
114
  /** Mask for action events. */
115
  public static final long ACTION_EVENT_MASK = 0x00080;
116
 
117
  /** Mask for adjustment events. */
118
  public static final long ADJUSTMENT_EVENT_MASK = 0x00100;
119
 
120
  /** Mask for item events. */
121
  public static final long ITEM_EVENT_MASK = 0x00200;
122
 
123
  /** Mask for text events. */
124
  public static final long TEXT_EVENT_MASK = 0x00400;
125
 
126
  /**
127
   * Mask for input method events.
128
   * @since 1.3
129
   */
130
  public static final long INPUT_METHOD_EVENT_MASK = 0x00800;
131
 
132
  /**
133
   * Mask if input methods are enabled. Package visible only.
134
   */
135
  static final long INPUT_ENABLED_EVENT_MASK = 0x01000;
136
 
137
  /**
138
   * Mask for paint events.
139
   * @since 1.3
140
   */
141
  public static final long PAINT_EVENT_MASK = 0x02000;
142
 
143
  /**
144
   * Mask for invocation events.
145
   * @since 1.3
146
   */
147
  public static final long INVOCATION_EVENT_MASK = 0x04000;
148
 
149
  /**
150
   * Mask for hierarchy events.
151
   * @since 1.3
152
   */
153
  public static final long HIERARCHY_EVENT_MASK = 0x08000;
154
 
155
  /**
156
   * Mask for hierarchy bounds events.
157
   * @since 1.3
158
   */
159
  public static final long HIERARCHY_BOUNDS_EVENT_MASK = 0x10000;
160
 
161
  /**
162
   * Mask for mouse wheel events.
163
   * @since 1.4
164
   */
165
  public static final long MOUSE_WHEEL_EVENT_MASK = 0x20000;
166
 
167
  /**
168
   * Mask for window state events.
169
   * @since 1.4
170
   */
171
  public static final long WINDOW_STATE_EVENT_MASK = 0x40000;
172
 
173
  /**
174
   * Mask for window focus events.
175
   * @since 1.4
176
   */
177
  public static final long WINDOW_FOCUS_EVENT_MASK = 0x80000;
178
 
179
  /**
180
  * This is the highest number for event ids that are reserved for use by
181
  * the AWT system itself. Subclasses outside of java.awt should use higher
182
  * ids.
183
  */
184
  public static final int RESERVED_ID_MAX = 1999;
185
 
186
 
187
  /**
188
   * Initializes a new AWTEvent from the old Java 1.0 event object.
189
   *
190
   * @param event the old-style event
191
   * @throws NullPointerException if event is null
192
   */
193
  public AWTEvent(Event event)
194
  {
195
    this(event.target, event.id);
196
    consumed = event.consumed;
197
  }
198
 
199
  /**
200
   * Create an event on the specified source object and id.
201
   *
202
   * @param source the object that caused the event
203
   * @param id the event id
204
   * @throws IllegalArgumentException if source is null
205
   */
206
  public AWTEvent(Object source, int id)
207
  {
208
    super(source);
209
    this.id = id;
210
  }
211
 
212
  /**
213
   * Retarget the event, such as converting a heavyweight component to a
214
   * lightweight child of the original. This is not for general use, but
215
   * is for event targeting systems like KeyboardFocusManager.
216
   *
217
   * @param source the new source
218
   */
219
  public void setSource(Object source)
220
  {
221
    this.source = source;
222
  }
223
 
224
  /**
225
   * Returns the event type id.
226
   *
227
   * @return the id number of this event
228
   */
229
  public int getID()
230
  {
231
    return id;
232
  }
233
 
234
  /**
235
   * Create a string that represents this event in the format
236
   * <code>classname[eventstring] on sourcecomponentname</code>.
237
   *
238
   * @return a string representing this event
239
   */
240
  public String toString ()
241
  {
242
    String string = getClass ().getName () + "[" + paramString () + "] on "
243
    + source;
244
 
245
    return string;
246
  }
247
 
248
  /**
249
   * Returns a string representation of the state of this event. It may be
250
   * empty, but must not be null; it is implementation defined.
251
   *
252
   * @return a string representation of this event
253
   */
254
  public String paramString()
255
  {
256
    return "";
257
  }
258
 
259
  /**
260
   * Consumes this event so that it will not be processed in the default
261
   * manner.
262
   */
263
  protected void consume()
264
  {
265
    consumed = true;
266
  }
267
 
268
  /**
269
   * Tests whether not not this event has been consumed. A consumed event
270
   * is not processed in the default manner.
271
   *
272
   * @return true if this event has been consumed
273
   */
274
  protected boolean isConsumed()
275
  {
276
    return consumed;
277
  }
278
} // class AWTEvent

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.