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:
parent
6d23f07f2b
commit
5efa76401e
|
@ -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>
|
2004-01-28 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
* gnu/java/lang/ClassHelper.java
|
* gnu/java/lang/ClassHelper.java
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||||
native void setMenuBarPeer (MenuBarPeer bar);
|
native void setMenuBarPeer (MenuBarPeer bar);
|
||||||
native void removeMenuBarPeer ();
|
native void removeMenuBarPeer ();
|
||||||
native void moveLayout (int offset);
|
native void moveLayout (int offset);
|
||||||
|
native void gtkLayoutSetVisible (boolean vis);
|
||||||
|
|
||||||
public void setMenuBar (MenuBar bar)
|
public void setMenuBar (MenuBar bar)
|
||||||
{
|
{
|
||||||
|
@ -67,16 +68,19 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||||
{
|
{
|
||||||
if (menuBar != null)
|
if (menuBar != null)
|
||||||
{
|
{
|
||||||
|
gtkLayoutSetVisible(false);
|
||||||
removeMenuBarPeer();
|
removeMenuBarPeer();
|
||||||
menuBar = null;
|
menuBar = null;
|
||||||
moveLayout(menuBarHeight);
|
moveLayout(menuBarHeight);
|
||||||
insets.top -= menuBarHeight;
|
insets.top -= menuBarHeight;
|
||||||
menuBarHeight = 0;
|
menuBarHeight = 0;
|
||||||
awtComponent.doLayout();
|
awtComponent.doLayout();
|
||||||
|
gtkLayoutSetVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gtkLayoutSetVisible(false);
|
||||||
int oldHeight = 0;
|
int oldHeight = 0;
|
||||||
if (menuBar != null)
|
if (menuBar != null)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +95,7 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||||
moveLayout(oldHeight - menuBarHeight);
|
moveLayout(oldHeight - menuBarHeight);
|
||||||
insets.top += menuBarHeight;
|
insets.top += menuBarHeight;
|
||||||
awtComponent.doLayout();
|
awtComponent.doLayout();
|
||||||
|
gtkLayoutSetVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -491,7 +491,38 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout
|
||||||
gdk_threads_leave ();
|
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
|
static void
|
||||||
window_get_frame_extents (GtkWidget *window,
|
window_get_frame_extents (GtkWidget *window,
|
||||||
int *top, int *left, int *bottom, int *right)
|
int *top, int *left, int *bottom, int *right)
|
||||||
|
|
Loading…
Reference in New Issue