| 1 | /* GtkButtonPeer.java -- Implements ButtonPeer with GTK
|
|---|
| 2 | Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of the peer AWT libraries of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 6 | This library is free software; you can redistribute it and/or modify
|
|---|
| 7 | it under the terms of the GNU Library General Public License as published
|
|---|
| 8 | by the Free Software Foundation, either version 2 of the License, or
|
|---|
| 9 | (at your option) any later verion.
|
|---|
| 10 |
|
|---|
| 11 | This library is distributed in the hope that it will be useful, but
|
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 14 | GNU Library General Public License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU Library General Public License
|
|---|
| 17 | along with this library; if not, write to the Free Software Foundation
|
|---|
| 18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. */
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | package gnu.awt.gtk;
|
|---|
| 22 |
|
|---|
| 23 | import java.awt.*;
|
|---|
| 24 | import java.awt.event.MouseEvent;
|
|---|
| 25 | import java.awt.event.KeyEvent;
|
|---|
| 26 | import java.awt.peer.*;
|
|---|
| 27 |
|
|---|
| 28 | public class GtkButtonPeer extends GtkComponentPeer
|
|---|
| 29 | implements ButtonPeer
|
|---|
| 30 | {
|
|---|
| 31 | protected native void create ();
|
|---|
| 32 | public native void setLabel (String label);
|
|---|
| 33 |
|
|---|
| 34 | public GtkButtonPeer (Button b)
|
|---|
| 35 | {
|
|---|
| 36 | super (b);
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | public void handleEvent (AWTEvent e)
|
|---|
| 40 | {
|
|---|
| 41 | // if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled ()
|
|---|
| 42 | // && !modalHasGrab ())
|
|---|
| 43 | // {
|
|---|
| 44 | // MouseEvent me = (MouseEvent) e;
|
|---|
| 45 | // if (!me.isConsumed ()
|
|---|
| 46 | // && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0)
|
|---|
| 47 | // postActionEvent (((Button)awtComponent).getActionCommand (),
|
|---|
| 48 | // me.getModifiers ());
|
|---|
| 49 | // }
|
|---|
| 50 |
|
|---|
| 51 | // if (e.getID () == KeyEvent.KEY_PRESSED)
|
|---|
| 52 | // {
|
|---|
| 53 | // KeyEvent ke = (KeyEvent) e;
|
|---|
| 54 | // if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE)
|
|---|
| 55 | // postActionEvent (((Button)awtComponent).getActionCommand (),
|
|---|
| 56 | // ke.getModifiers ());
|
|---|
| 57 | // }
|
|---|
| 58 |
|
|---|
| 59 | super.handleEvent (e);
|
|---|
| 60 | }
|
|---|
| 61 | }
|
|---|