diff options
author | hboehm <hboehm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-19 00:35:35 +0000 |
---|---|---|
committer | hboehm <hboehm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-19 00:35:35 +0000 |
commit | 1bb9b6bd11c487703fe1b824ce79eefdafd392e1 (patch) | |
tree | abb4641e8aaeacc764f059098100e1aa5dde90a7 /libjava/gnu | |
parent | b0f897eae0353849120b2d5fb9f990f3e65bb9c6 (diff) | |
download | gcc-1bb9b6bd11c487703fe1b824ce79eefdafd392e1.tar.gz |
2003-02-18 Hans Boehm <Hans.Boehm@hp.com>
* gnu/awt/xlib/XToolkit.java (getFontMetrics): initialize
if necessary.
* gnu/java/awt/peer/gtk/GtkButtonPeer.java,
gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
(setFont, gtkSetFont): add.
gnu/java/awt/peer/gtk/GtkComponentPeer.java (GtkComponentPeer):
Propagate font to peer. (setFont): add FIXME comment.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
(gtkTextGetSize): fix height, width computation.
* gnu/java/awt/peer/gtk/GtkFontPeer.java (GtkFontPeer):
Make X font name a bit less bogus.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
(post_adjustment_event): Pass on GTK_SCROLL_NONE.
* java/awt/Scrollbar.java (setValues): Fix visibleAmount range check.
(processAdjustmentEvent): Adjust value.
* java/awt/FlowLayout.java (layoutContainer) Fix 2 indexing and one
logic errors.
* java/awt/Component.java (setVisible, show, hide): Call show and
hide methods in subclasses.
(getPreferredSize): don't set prefSize before we have peer.
* java/awt/TextArea.java, java/awt/TextField.java (getPreferredSize):
Guess (0,0) if we don't have peer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63077 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/awt/xlib/XToolkit.java | 2 | ||||
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java | 7 | ||||
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java | 8 | ||||
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java | 24 | ||||
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java | 7 | ||||
-rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java | 7 |
6 files changed, 51 insertions, 4 deletions
diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java index c71b39d0f80..df3a2b6b595 100644 --- a/libjava/gnu/awt/xlib/XToolkit.java +++ b/libjava/gnu/awt/xlib/XToolkit.java @@ -183,7 +183,7 @@ public class XToolkit extends Toolkit public FontMetrics getFontMetrics(Font font) { - return defaultConfig.getXFontMetrics(font); + return getDefaultXGraphicsConfiguration().getXFontMetrics(font); } public void sync() diff --git a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java index 94603c0d3c9..a609f7ad818 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java @@ -47,6 +47,8 @@ public class GtkButtonPeer extends GtkComponentPeer { native void create (); + native void gtkSetFont(String xlfd, int size); + public GtkButtonPeer (Button b) { super (b); @@ -86,4 +88,9 @@ public class GtkButtonPeer extends GtkComponentPeer args.add ("label", ((Button)component).getLabel ()); } + + public void setFont (Font f) + { + gtkSetFont(((GtkFontPeer)f.getPeer()).getXLFD(), f.getSize()); + } } diff --git a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java index 6e3b25290c8..b3a4525314e 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java @@ -88,6 +88,8 @@ public class GtkComponentPeer extends GtkGenericPeer awtComponent.setBackground (getBackground ()); // if (c.getFont () == null) // c.setFont (cp.getFont ()); + if (awtComponent.getFont() != null) + setFont(awtComponent.getFont()); if (! (awtComponent instanceof Window)) { @@ -273,6 +275,9 @@ public class GtkComponentPeer extends GtkGenericPeer public void setFont (Font f) { + // FIXME: This should really affect the widget tree below me. + // Currently this is only handled if the call is made directly on + // a text widget, which implements setFont() itself. } public void setForeground (Color c) @@ -352,7 +357,8 @@ public class GtkComponentPeer extends GtkGenericPeer p = component.getPeer (); } while (p instanceof java.awt.peer.LightweightPeer); - args.add ("parent", p); + if (p != null) + args.add ("parent", p); } native void set (String name, String value); diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java index 47a46e81865..d3130a905e9 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java @@ -57,14 +57,34 @@ public class GtkFontPeer implements FontPeer } } - final private String Xname; + final private String Xname; // uses %d for font size. public GtkFontPeer (String name, int style) { if (bundle != null) Xname = bundle.getString (name.toLowerCase () + "." + style); else - Xname = "-*-*-medium-r-normal-*-12-*-*-*-c-*-*-*"; + { + String weight; + String slant; + String spacing; + + if (style == Font.ITALIC || (style == (Font.BOLD+Font.ITALIC))) + slant = "i"; + else + slant = "r"; + if (style == Font.BOLD || (style == (Font.BOLD+Font.ITALIC))) + weight = "bold"; + else + weight = "medium"; + if (name.equals("Serif") || name.equals("SansSerif") + || name.equals("Helvetica") || name.equals("Times")) + spacing = "p"; + else + spacing = "c"; + + Xname = "-*-*-" + weight + "-" + slant + "-normal-*-%d-*-*-*-" + spacing + "-*-*-*"; + } } public String getXLFD () diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java index 7a648b913ad..ad83008cb8a 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java @@ -45,6 +45,8 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer { native void create (int scrollbarVisibility); + native void gtkSetFont(String xlfd, int size); + void create () { create (((TextArea)awtComponent).getScrollbarVisibility ()); @@ -99,4 +101,9 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer { insert (str, pos); } + + public void setFont (Font f) + { + gtkSetFont(((GtkFontPeer)f.getPeer()).getXLFD(), f.getSize()); + } } diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java index 4dc23f8ba55..628cdd627ae 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java @@ -51,6 +51,8 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer native void gtkEntryGetSize (int cols, int dims[]); + native void gtkSetFont(String xlfd, int size); + public GtkTextFieldPeer (TextField tf) { super (tf); @@ -95,4 +97,9 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer { setEchoChar (c); } + + public void setFont (Font f) + { + gtkSetFont(((GtkFontPeer)f.getPeer()).getXLFD(), f.getSize()); + } } |