AWTEvent.java 2.11 KB
Newer Older
Tom Tromey committed
1
/* Copyright (C) 1999, 2000  Free Software Foundation
2

Bryce McKinlay committed
3
   This file is part of libgcj.
4 5

This software is copyrighted work licensed under the terms of the
Bryce McKinlay committed
6
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7 8 9 10
details.  */

package java.awt;

Bryce McKinlay committed
11 12 13 14 15 16 17 18 19 20 21
/* Written using on-line Java 2 Platform Standard Edition v1.3 API 
 * Specification, as well as "The Java Class Libraries", 2nd edition 
 * (Addison-Wesley, 1998).
 * Status:  Believed complete and correct, except for the java.awt.Event 
 * compatibility constructor.
 */

/**
 * AWTEvent is the root event class for all AWT events in the JDK 1.1 event 
 * model. It supercedes the Event class from JDK 1.0.
 */
22 23 24 25 26 27

public abstract class AWTEvent extends java.util.EventObject
{
  protected boolean consumed;
  protected int id;

Bryce McKinlay committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
  /* Event selection masks */
  public static final long COMPONENT_EVENT_MASK    = 1 << 0,
			   CONTAINER_EVENT_MASK    = 1 << 1,
			   FOCUS_EVENT_MASK        = 1 << 2,
			   KEY_EVENT_MASK          = 1 << 3,
			   MOUSE_EVENT_MASK        = 1 << 4, 
			   MOUSE_MOTION_EVENT_MASK = 1 << 5,
			   WINDOW_EVENT_MASK       = 1 << 6,
			   ACTION_EVENT_MASK       = 1 << 7,
			   ADJUSTMENT_EVENT_MASK   = 1 << 8,
			   ITEM_EVENT_MASK         = 1 << 9,
			   TEXT_EVENT_MASK         = 1 << 10,
			   INPUT_METHOD_EVENT_MASK = 1 << 11;

  /* Additional event selection masks from JDK 1.3 javadocs */
  public static final long PAINT_EVENT_MASK            = 1 << 13,
			   INVOCATION_EVENT_MASK       = 1 << 14,
			   HIERARCHY_EVENT_MASK        = 1 << 15,
			   HIERARCHY_BOUNDS_EVENT_MASK = 1 << 16;

  public static final int RESERVED_ID_MAX = 0x7cf;

  public AWTEvent(Event event)
  {
    // FIXME??
    super(event.target);
    this.id = event.id;
  }
  
  public AWTEvent(Object source, int id)
  {
    super(source);
    this.id = id;
  }

Tom Tromey committed
63 64 65 66 67 68 69
  public int getID()
  {
    return id;
  }

  public String paramString ()
  {
Bryce McKinlay committed
70
    return "";
Tom Tromey committed
71 72 73 74
  }

  public String toString ()
  {
Bryce McKinlay committed
75
    return getClass().getName() + "[" + paramString() + "] on " + source;
Tom Tromey committed
76
  }
Bryce McKinlay committed
77 78
  
  protected void consume()
79
  {
Bryce McKinlay committed
80 81 82 83 84 85
    consumed = true;
  }
  
  protected boolean isConsumed()
  {
    return consumed;
86 87
  }
}