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
This commit is contained in:
Kim Ho
2004-01-27 16:39:45 +00:00
committed by Kim Ho
parent 2a837cf803
commit 57e1391773
3 changed files with 73 additions and 10 deletions
+22 -10
View File
@@ -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();
}
else if (bar != null)
{
if (menuBar != null)
{
removeMenuBarPeer(menuBar);
menuBar = null;
moveLayout(menuBarHeight);
insets.top -= menuBarHeight;
menuBarHeight = 0;
awtComponent.doLayout();
}
}
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();
}