diff options
| author | fitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-05 21:35:33 +0000 |
|---|---|---|
| committer | fitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-05 21:35:33 +0000 |
| commit | 22ab605adb1ef36f7680d232a92c498b94733153 (patch) | |
| tree | 54f0fde0c14793ae5d9f9b6f42326a0c2f6cd38f /libjava/gnu/java | |
| parent | 8abc3a4c9c146f2cd98c40a17ff13b12925ddb8e (diff) | |
| download | ppe42-gcc-22ab605adb1ef36f7680d232a92c498b94733153.tar.gz ppe42-gcc-22ab605adb1ef36f7680d232a92c498b94733153.zip | |
2004-01-05 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
(create(int, int)): New method.
(create): Call new create method.
(gtkScrolledWindowNew, gtkScrolledWindowSetSize): Remove
methods.
(childResized): Remove native implementation. Implement in
Java.
(getHScrollbarHeight, getVScrollbarWidth): Call
gtk_widget_size_request to get scrollbar dimensions.
* java/awt/ScrollPane.java (getViewportSize): Reimplement. Only
call getVScrollbarWidth and getHScrollbarHeight when vertical
and horizontal scrollbars respectively are needed.
(doLayout): Enlarge child if it is smaller than the viewport.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75446 138bc75d-0d04-0410-961f-82ee72b054a4
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); |

