2004-01-29 Kim Ho <kho@redhat.com>

* gnu/java/awt/peer/gtk/GtkFramePeer.java
        (gtkLayoutSetVisible): New method
        (setMenuBar): Hide layout before setting MenuBar
        and reshow it after.
        * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
        (gtkLayoutSetVisible): Hide or show the Gtk Layout.

From-SVN: r76861
This commit is contained in:
Kim Ho 2004-01-29 14:34:31 +00:00 committed by Kim Ho
parent 6d23f07f2b
commit 5efa76401e
3 changed files with 45 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2004-01-29 Kim Ho <kho@redhat.com>
* gnu/java/awt/peer/gtk/GtkFramePeer.java
(gtkLayoutSetVisible): New method
(setMenuBar): Hide layout before setting MenuBar
and reshow it after.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(gtkLayoutSetVisible): Hide or show the Gtk Layout.
2004-01-28 Michael Koch <konqueror@gmx.de>
* gnu/java/lang/ClassHelper.java

View File

@ -60,6 +60,7 @@ public class GtkFramePeer extends GtkWindowPeer
native void setMenuBarPeer (MenuBarPeer bar);
native void removeMenuBarPeer ();
native void moveLayout (int offset);
native void gtkLayoutSetVisible (boolean vis);
public void setMenuBar (MenuBar bar)
{
@ -67,16 +68,19 @@ public class GtkFramePeer extends GtkWindowPeer
{
if (menuBar != null)
{
gtkLayoutSetVisible(false);
removeMenuBarPeer();
menuBar = null;
moveLayout(menuBarHeight);
insets.top -= menuBarHeight;
menuBarHeight = 0;
awtComponent.doLayout();
gtkLayoutSetVisible(true);
}
}
else
{
gtkLayoutSetVisible(false);
int oldHeight = 0;
if (menuBar != null)
{
@ -91,6 +95,7 @@ public class GtkFramePeer extends GtkWindowPeer
moveLayout(oldHeight - menuBarHeight);
insets.top += menuBarHeight;
awtComponent.doLayout();
gtkLayoutSetVisible(true);
}
}

View File

@ -491,7 +491,38 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout
gdk_threads_leave ();
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkLayoutSetVisible
(JNIEnv *env, jobject obj, jboolean vis)
{
void* ptr;
GList* children;
GtkBox* vbox;
GtkLayout* layout;
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));
if (vis)
gtk_widget_show (GTK_WIDGET (layout));
else
gtk_widget_hide (GTK_WIDGET (layout));
gdk_threads_leave ();
}
static void
window_get_frame_extents (GtkWidget *window,
int *top, int *left, int *bottom, int *right)