aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorKim Ho <kho@redhat.com>2004-01-27 16:39:45 +0000
committerKim Ho <kho@gcc.gnu.org>2004-01-27 16:39:45 +0000
commit57e1391773cbfcaef7007c443dabfb6c4c536b67 (patch)
tree8358b9387d9ebe009bb199121c0fadbd4d87e791 /libjava
parent2a837cf80316570aaad5bf93b10655bb62ae67ad (diff)
downloadgcc-57e1391773cbfcaef7007c443dabfb6c4c536b67.zip
gcc-57e1391773cbfcaef7007c443dabfb6c4c536b67.tar.gz
gcc-57e1391773cbfcaef7007c443dabfb6c4c536b67.tar.bz2
GtkFramePeer.java (moveLayout): New method.
2004-01-26 Kim Ho <kho@redhat.com> * gnu/java/awt/peer/gtk/GtkFramePeer.java (moveLayout): New method. (setMenuBar): Shift the Gtk layout up/down by the MenuBar height and let the Layout Managers readjust anything that needs to move. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (moveLayout): New method. Shift everything in the Gtk layout in the Y direction by an offset. From-SVN: r76729
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog11
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java28
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c40
3 files changed, 71 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 72c37c2..10467cd 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,14 @@
+2004-01-26 Kim Ho <kho@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (moveLayout): New
+ method.
+ (setMenuBar): Shift the Gtk layout up/down by the MenuBar
+ height and let the Layout Managers readjust anything that
+ needs to move.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (moveLayout): New method. Shift everything in the Gtk
+ layout in the Y direction by an offset.
+
2004-01-26 David Jee <djee@redhat.com>
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
index 3b69b02..0aa78fd 100644
--- a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -59,24 +59,36 @@ public class GtkFramePeer extends GtkWindowPeer
native void setMenuBarPeer (MenuBarPeer bar);
native void removeMenuBarPeer (MenuBarPeer bar);
+ native void moveLayout (int offset);
public void setMenuBar (MenuBar bar)
{
- if (bar == null && menuBar != null)
+ if (bar == null)
{
- removeMenuBarPeer(menuBar);
- menuBar = null;
- insets.top -= menuBarHeight;
- menuBarHeight = 0;
- awtComponent.doLayout();
+ if (menuBar != null)
+ {
+ removeMenuBarPeer(menuBar);
+ menuBar = null;
+ moveLayout(menuBarHeight);
+ insets.top -= menuBarHeight;
+ menuBarHeight = 0;
+ awtComponent.doLayout();
+ }
}
- else if (bar != null)
+ else
{
+ int oldHeight = 0;
if (menuBar != null)
+ {
removeMenuBarPeer(menuBar);
+ oldHeight = menuBarHeight;
+ insets.top -= menuBarHeight;
+ }
menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
- setMenuBarPeer(menuBar);
+ setMenuBarPeer(menuBar);
menuBarHeight = getMenuBarHeight (menuBar);
+ if (oldHeight != menuBarHeight)
+ moveLayout(oldHeight-menuBarHeight);
insets.top += menuBarHeight;
awtComponent.doLayout();
}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 610fc14..9703806 100644
--- a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -433,6 +433,46 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
return height;
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout
+ (JNIEnv *env, jobject obj, jint offset)
+{
+ void* ptr;
+ GList* children;
+ GtkBox* vbox;
+ GtkLayout* layout;
+ GtkWidget* widget;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ children = gtk_container_get_children (GTK_CONTAINER (ptr));
+ vbox = children->data;
+ g_assert (GTK_IS_VBOX (vbox));
+
+ children = gtk_container_get_children (GTK_CONTAINER (vbox));
+ do
+ {
+ layout = children->data;
+ children = children->next;
+ }
+ while (!GTK_IS_LAYOUT (layout) && children != NULL);
+ g_assert (GTK_IS_LAYOUT (layout));
+ children = gtk_container_get_children (GTK_CONTAINER (layout));
+
+ while (children != NULL)
+ {
+ widget = children->data;
+ gtk_layout_move (layout, widget, widget->allocation.x,
+ widget->allocation.y+offset);
+ children = children->next;
+ }
+
+ gdk_threads_leave ();
+}
+
+
static void
window_get_frame_extents (GtkWidget *window,
int *top, int *left, int *bottom, int *right)