GtkFramePeer.java (menuBarHeight): Mark private.
2004-01-26 Kim Ho <kho@redhat.com> * gnu/java/awt/peer/gtk/GtkFramePeer.java (menuBarHeight): Mark private. (setMenuBar): Grab MenuBar height and change insets. (setBounds): Account for MenuBar height. (postInsetsChangedEvent): Ditto. (postSizeAllocateEvent): Remove. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (menubar_resize_cb): Remove (setMenuBarPeer): Remove callback. (getMenuBarHeight): Use size requisition instead of allocation. From-SVN: r76633
This commit is contained in:
parent
4d39d873e0
commit
ecf67f46ef
3 changed files with 39 additions and 42 deletions
|
@ -1,3 +1,17 @@
|
||||||
|
2004-01-26 Kim Ho <kho@redhat.com>
|
||||||
|
|
||||||
|
* gnu/java/awt/peer/gtk/GtkFramePeer.java (menuBarHeight): Mark
|
||||||
|
private.
|
||||||
|
(setMenuBar): Grab MenuBar height and change insets.
|
||||||
|
(setBounds): Account for MenuBar height.
|
||||||
|
(postInsetsChangedEvent): Ditto.
|
||||||
|
(postSizeAllocateEvent): Remove.
|
||||||
|
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
|
||||||
|
(menubar_resize_cb): Remove
|
||||||
|
(setMenuBarPeer): Remove callback.
|
||||||
|
(getMenuBarHeight): Use size requisition instead of
|
||||||
|
allocation.
|
||||||
|
|
||||||
2004-01-25 Thomas Fitzsimmons <fitzsim@redhat.com>
|
2004-01-25 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||||
|
|
||||||
* java/awt/TextArea.java: Fix indentation. Flesh out javadocs.
|
* java/awt/TextArea.java: Fix indentation. Flesh out javadocs.
|
||||||
|
|
|
@ -53,7 +53,7 @@ import java.awt.peer.MenuBarPeer;
|
||||||
public class GtkFramePeer extends GtkWindowPeer
|
public class GtkFramePeer extends GtkWindowPeer
|
||||||
implements FramePeer
|
implements FramePeer
|
||||||
{
|
{
|
||||||
int menuBarHeight = 0;
|
private int menuBarHeight;
|
||||||
private MenuBarPeer menuBar;
|
private MenuBarPeer menuBar;
|
||||||
native int getMenuBarHeight (MenuBarPeer bar);
|
native int getMenuBarHeight (MenuBarPeer bar);
|
||||||
|
|
||||||
|
@ -76,9 +76,20 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||||
removeMenuBarPeer(menuBar);
|
removeMenuBarPeer(menuBar);
|
||||||
menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
|
menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
|
||||||
setMenuBarPeer(menuBar);
|
setMenuBarPeer(menuBar);
|
||||||
|
menuBarHeight = getMenuBarHeight (menuBar);
|
||||||
|
insets.top += menuBarHeight;
|
||||||
|
awtComponent.doLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBounds (int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
nativeSetBounds (x, y,
|
||||||
|
width - insets.left - insets.right,
|
||||||
|
height - insets.top - insets.bottom
|
||||||
|
+ menuBarHeight);
|
||||||
|
}
|
||||||
|
|
||||||
public void setResizable (boolean resizable)
|
public void setResizable (boolean resizable)
|
||||||
{
|
{
|
||||||
// Call setSize; otherwise when resizable is changed from true to
|
// Call setSize; otherwise when resizable is changed from true to
|
||||||
|
@ -89,18 +100,15 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||||
+ menuBarHeight);
|
+ menuBarHeight);
|
||||||
set ("allow_shrink", resizable);
|
set ("allow_shrink", resizable);
|
||||||
set ("allow_grow", resizable);
|
set ("allow_grow", resizable);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void postSizeAllocateEvent()
|
protected void postInsetsChangedEvent (int top, int left,
|
||||||
|
int bottom, int right)
|
||||||
{
|
{
|
||||||
if (menuBar != null)
|
insets.top = top + menuBarHeight;
|
||||||
{
|
insets.left = left;
|
||||||
if (menuBarHeight != 0)
|
insets.bottom = bottom;
|
||||||
insets.top -= menuBarHeight;
|
insets.right = right;
|
||||||
menuBarHeight = getMenuBarHeight(menuBar);
|
|
||||||
insets.top += menuBarHeight;
|
|
||||||
}
|
|
||||||
awtComponent.doLayout();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GtkFramePeer (Frame frame)
|
public GtkFramePeer (Frame frame)
|
||||||
|
|
|
@ -72,8 +72,6 @@ static jint window_get_new_state (GtkWidget *widget);
|
||||||
static gboolean window_property_changed_cb (GtkWidget *widget,
|
static gboolean window_property_changed_cb (GtkWidget *widget,
|
||||||
GdkEventProperty *event,
|
GdkEventProperty *event,
|
||||||
jobject peer);
|
jobject peer);
|
||||||
static void menubar_resize_cb (GtkWidget *widget, GtkAllocation *alloc,
|
|
||||||
jobject peer);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a new window.
|
* Make a new window.
|
||||||
|
@ -402,15 +400,12 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
|
||||||
void *wptr;
|
void *wptr;
|
||||||
GtkWidget *mptr;
|
GtkWidget *mptr;
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
|
||||||
|
|
||||||
wptr = NSA_GET_PTR (env, obj);
|
wptr = NSA_GET_PTR (env, obj);
|
||||||
mptr = NSA_GET_PTR (env, menubar);
|
mptr = NSA_GET_PTR (env, menubar);
|
||||||
|
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (mptr), "size-allocate",
|
|
||||||
G_CALLBACK (menubar_resize_cb), *gref);
|
|
||||||
box = GTK_BIN (wptr)->child;
|
box = GTK_BIN (wptr)->child;
|
||||||
gtk_box_pack_start (GTK_BOX (box), mptr, 0, 0, 0);
|
gtk_box_pack_start (GTK_BOX (box), mptr, 0, 0, 0);
|
||||||
|
|
||||||
|
@ -426,11 +421,14 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
|
||||||
{
|
{
|
||||||
GtkWidget *ptr;
|
GtkWidget *ptr;
|
||||||
jint height;
|
jint height;
|
||||||
|
GtkRequisition gtkreq;
|
||||||
|
|
||||||
ptr = NSA_GET_PTR (env, menubar);
|
ptr = NSA_GET_PTR (env, menubar);
|
||||||
|
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
height = ptr->allocation.height;
|
gtk_widget_size_request (ptr, >kreq);
|
||||||
|
|
||||||
|
height = gtkreq.height;
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
@ -733,26 +731,3 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menubar_resize_cb (GtkWidget *widget __attribute__((unused)),
|
|
||||||
GtkAllocation *alloc __attribute__((unused)),
|
|
||||||
jobject peer)
|
|
||||||
{
|
|
||||||
static int id_set = 0;
|
|
||||||
static jmethodID postSizeAllocateEventID;
|
|
||||||
|
|
||||||
if (!id_set)
|
|
||||||
{
|
|
||||||
jclass gtkframepeer = (*gdk_env)->FindClass (gdk_env,
|
|
||||||
"gnu/java/awt/peer/gtk/GtkFramePeer");
|
|
||||||
postSizeAllocateEventID = (*gdk_env)->GetMethodID (gdk_env,
|
|
||||||
gtkframepeer,
|
|
||||||
"postSizeAllocateEvent",
|
|
||||||
"()V");
|
|
||||||
id_set = 1;
|
|
||||||
}
|
|
||||||
gdk_threads_leave();
|
|
||||||
(*gdk_env)->CallVoidMethod (gdk_env, peer,
|
|
||||||
postSizeAllocateEventID);
|
|
||||||
gdk_threads_enter();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue