summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2005-07-04 23:56:35 +0000
committerThomas Fitzsimmons <fitzsim@redhat.com>2005-07-04 23:56:35 +0000
commit6eaa0a1a249a0317fc7ff2db5c88805bb7ac1947 (patch)
treec9124caf2d0d90ec4b9038308d3d73eb65e6b563 /gnu
parent019c37823a30f8d511cb032e1d19487fb7d6fe7d (diff)
downloadclasspath-6eaa0a1a249a0317fc7ff2db5c88805bb7ac1947.tar.gz
2005-07-04 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkComponentPeer.java (postTextEvent): New method. * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java: Add TextComponentPeer method declarations. * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java: Likewise. * gnu/java/awt/peer/gtk/GtkTextComponentPeer.java: Remove file. * include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h: Regenerate. * include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h: Likewise. * native/jni/gtk-peer/Makefile.am (libgtkpeer_la_SOURCES): Remove gnu_java_awt_peer_gtk_GtkTextComponentPeer.c. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (classpath_gtk_component_connect_nonfocus_signals): New function. (classpath_gtk_component_connect_signals): Likewise. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c: Add method implementations from gnu_java_awt_peer_gtk_GtkTextComponentPeer.c. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c: Likewise. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c: Remove file. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (gtkInit): Get postTextEventID from GtkComponentPeer, not GtkTextComponentPeer. * native/jni/gtk-peer/gtkpeer.h (classpath_gtk_textcomponent_init_jni): Declare. (classpath_gtk_component_connect_signals): Likewise. (classpath_gtk_component_connect_nonfocus_signals): Likewise. (classpath_gtk_textcomponent_connect_signals): Likewise.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/java/awt/peer/gtk/GtkComponentPeer.java6
-rw-r--r--gnu/java/awt/peer/gtk/GtkTextAreaPeer.java38
-rw-r--r--gnu/java/awt/peer/gtk/GtkTextComponentPeer.java87
-rw-r--r--gnu/java/awt/peer/gtk/GtkTextFieldPeer.java38
4 files changed, 78 insertions, 91 deletions
diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index 44385053a..099b7252d 100644
--- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -63,6 +63,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.PaintEvent;
+import java.awt.event.TextEvent;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
@@ -530,6 +531,11 @@ public class GtkComponentPeer extends GtkGenericPeer
item, stateChange));
}
+ protected void postTextEvent ()
+ {
+ q().postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED));
+ }
+
public GraphicsConfiguration getGraphicsConfiguration ()
{
// FIXME: just a stub for now.
diff --git a/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
index fb0e2ced5..a842b8318 100644
--- a/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
@@ -41,11 +41,13 @@ package gnu.java.awt.peer.gtk;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
+import java.awt.Rectangle;
import java.awt.TextArea;
import java.awt.peer.TextAreaPeer;
+import java.awt.peer.TextComponentPeer;
-public class GtkTextAreaPeer extends GtkTextComponentPeer
- implements TextAreaPeer
+public class GtkTextAreaPeer extends GtkComponentPeer
+ implements TextComponentPeer, TextAreaPeer
{
private static transient int DEFAULT_ROWS = 10;
private static transient int DEFAULT_COLS = 80;
@@ -55,6 +57,35 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkWidgetRequestFocus ();
+ public native void connectSignals ();
+
+ public native int getCaretPosition ();
+ public native void setCaretPosition (int pos);
+ public native int getSelectionStart ();
+ public native int getSelectionEnd ();
+ public native String getText ();
+ public native void select (int start, int end);
+ public native void setEditable (boolean state);
+ public native void setText (String text);
+
+ public int getIndexAtPoint(int x, int y)
+ {
+ // FIXME
+ return 0;
+ }
+
+ public Rectangle getCharacterBounds (int pos)
+ {
+ // FIXME
+ return null;
+ }
+
+ public long filterEvents (long filter)
+ {
+ // FIXME
+ return filter;
+ }
+
void create ()
{
Font f = awtComponent.getFont ();
@@ -87,6 +118,9 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
public GtkTextAreaPeer (TextArea ta)
{
super (ta);
+
+ setText (ta.getText ());
+ setCaretPosition (0);
}
public native void insert (String str, int pos);
diff --git a/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java b/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
deleted file mode 100644
index c1f1cf0e1..000000000
--- a/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.awt.peer.gtk;
-
-import java.awt.Rectangle;
-import java.awt.TextComponent;
-import java.awt.event.TextEvent;
-import java.awt.peer.TextComponentPeer;
-
-public class GtkTextComponentPeer extends GtkComponentPeer
- implements TextComponentPeer
-{
- GtkTextComponentPeer (TextComponent tc)
- {
- super (tc);
-
- setText (tc.getText ());
- setCaretPosition(0);
- }
-
- public native void connectSignals ();
-
- public native int getCaretPosition ();
- public native void setCaretPosition (int pos);
- public native int getSelectionStart ();
- public native int getSelectionEnd ();
- public native String getText ();
- public native void select (int start, int end);
- public native void setEditable (boolean state);
- public native void setText (String text);
-
- public int getIndexAtPoint(int x, int y)
- {
- return 0; // FIXME
- }
-
- public Rectangle getCharacterBounds (int pos)
- {
- return null;
- }
-
- public long filterEvents (long filter)
- {
- return filter; // FIXME
- }
-
- protected void postTextEvent ()
- {
- q().postEvent (new TextEvent (awtComponent, TextEvent.TEXT_VALUE_CHANGED));
- }
-}
diff --git a/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
index 1031f7cc9..73a976bba 100644
--- a/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
@@ -42,17 +42,48 @@ import java.awt.AWTEvent;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
+import java.awt.Rectangle;
import java.awt.TextField;
import java.awt.event.KeyEvent;
import java.awt.peer.TextFieldPeer;
+import java.awt.peer.TextComponentPeer;
-public class GtkTextFieldPeer extends GtkTextComponentPeer
- implements TextFieldPeer
+public class GtkTextFieldPeer extends GtkComponentPeer
+ implements TextComponentPeer, TextFieldPeer
{
native void create (int width);
native void gtkWidgetSetBackground (int red, int green, int blue);
native void gtkWidgetSetForeground (int red, int green, int blue);
+ public native void connectSignals ();
+
+ public native int getCaretPosition ();
+ public native void setCaretPosition (int pos);
+ public native int getSelectionStart ();
+ public native int getSelectionEnd ();
+ public native String getText ();
+ public native void select (int start, int end);
+ public native void setEditable (boolean state);
+ public native void setText (String text);
+
+ public int getIndexAtPoint(int x, int y)
+ {
+ // FIXME
+ return 0;
+ }
+
+ public Rectangle getCharacterBounds (int pos)
+ {
+ // FIXME
+ return null;
+ }
+
+ public long filterEvents (long filter)
+ {
+ // FIXME
+ return filter;
+ }
+
void create ()
{
Font f = awtComponent.getFont ();
@@ -86,6 +117,9 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
{
super (tf);
+ setText (tf.getText ());
+ setCaretPosition (0);
+
if (tf.echoCharIsSet ())
setEchoChar (tf.getEchoChar ());
}