diff options
Diffstat (limited to 'libjava/gnu/java')
| -rw-r--r-- | libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java index cd2c112c283..e4f5e8f312c 100644 --- a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java +++ b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java @@ -46,15 +46,17 @@ import java.awt.peer.ScrollPanePeer; public class GtkScrollPanePeer extends GtkContainerPeer implements ScrollPanePeer { - native void create (); + native void create (int width, int height); + + void create () + { + create (awtComponent.getWidth (), awtComponent.getHeight ()); + } - native void gtkScrolledWindowNew(ComponentPeer parent, - int policy, int w, int h, int[] dims); native void gtkScrolledWindowSetScrollPosition(int x, int y); native void gtkScrolledWindowSetHScrollIncrement (int u); native void gtkScrolledWindowSetVScrollIncrement (int u); - native void gtkScrolledWindowSetSize(int w, int h); - + public GtkScrollPanePeer (ScrollPane sp) { super (sp); @@ -63,7 +65,24 @@ public class GtkScrollPanePeer extends GtkContainerPeer } native void setPolicy (int policy); - native public void childResized (int width, int height); + public void childResized (int width, int height) + { + int dim[] = new int[2]; + + gtkWidgetGetDimensions (dim); + + // If the child is in this range, GTK adds both scrollbars, but + // the AWT doesn't. So set the peer's scroll policy to + // GTK_POLICY_NEVER. + if ((width > dim[0] - getVScrollbarWidth () + && width <= dim[0]) + && (height > dim[1] - getHScrollbarHeight () + && height <= dim[1])) + setPolicy (ScrollPane.SCROLLBARS_NEVER); + else + setPolicy (((ScrollPane) awtComponent).getScrollbarDisplayPolicy ()); + } + native public int getHScrollbarHeight (); native public int getVScrollbarWidth (); native public void setScrollPosition (int x, int y); |

