diff options
author | Fernando Nasser <fnasser@redhat.com> | 2003-12-02 16:19:28 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@gcc.gnu.org> | 2003-12-02 16:19:28 +0000 |
commit | a1045386316fccf1a884820f8ce0589ecf8dcdd9 (patch) | |
tree | 2a0d045a518723b0b925c0ef30d8eae10ee18cf3 /libjava/gnu | |
parent | 10590d375b68a8e1fb8b663aa04c58c4306a489f (diff) | |
download | gcc-a1045386316fccf1a884820f8ce0589ecf8dcdd9.zip gcc-a1045386316fccf1a884820f8ce0589ecf8dcdd9.tar.gz gcc-a1045386316fccf1a884820f8ce0589ecf8dcdd9.tar.bz2 |
GtkListPeer.java (handleEvent): New method.
2003-12-02 Fernando Nasser <fnasser@redhat.com>
* gnu/java/awt/peer/gtk/GtkListPeer.java (handleEvent): New
method. Handle mouse and key events that must generate
ActionEvents.
* java/awt/List.java (getSelectedIndex): Return -1
if no list element is selected.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (awt_event_handler):
Correct handling of mouse and key events so that List receives them.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
(Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems): Fix removal of
multiple list elements.
From-SVN: r74189
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkListPeer.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java index 2ba183b..f90497e 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java @@ -38,8 +38,11 @@ exception statement from your version. */ package gnu.java.awt.peer.gtk; +import java.awt.AWTEvent; import java.awt.Dimension; import java.awt.List; +import java.awt.event.MouseEvent; +import java.awt.event.KeyEvent; import java.awt.peer.ListPeer; public class GtkListPeer extends GtkComponentPeer @@ -121,6 +124,29 @@ public class GtkListPeer extends GtkComponentPeer setMultipleMode (b); } + public void handleEvent (AWTEvent e) + { + if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled ()) + { + MouseEvent me = (MouseEvent) e; + if (!me.isConsumed () + && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0 + && me.getClickCount() > 1) + postActionEvent (((List)awtComponent).getSelectedItem (), + me.getModifiers ()); + } + + if (e.getID () == KeyEvent.KEY_PRESSED) + { + KeyEvent ke = (KeyEvent) e; + if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_ENTER) + postActionEvent (((List)awtComponent).getSelectedItem (), + ke.getModifiers ()); + } + + super.handleEvent (e); + } + protected void postItemEvent (int item, int stateChange) { postItemEvent (new Integer (item), stateChange); |