mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-18 12:41:25 +08:00
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
@ -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>
|
||||
|
||||
* java/awt/TextArea.java: Fix indentation. Flesh out javadocs.
|
||||
|
@ -53,7 +53,7 @@ import java.awt.peer.MenuBarPeer;
|
||||
public class GtkFramePeer extends GtkWindowPeer
|
||||
implements FramePeer
|
||||
{
|
||||
int menuBarHeight = 0;
|
||||
private int menuBarHeight;
|
||||
private MenuBarPeer menuBar;
|
||||
native int getMenuBarHeight (MenuBarPeer bar);
|
||||
|
||||
@ -76,9 +76,20 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||
removeMenuBarPeer(menuBar);
|
||||
menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
|
||||
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)
|
||||
{
|
||||
// Call setSize; otherwise when resizable is changed from true to
|
||||
@ -89,18 +100,15 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||
+ menuBarHeight);
|
||||
set ("allow_shrink", resizable);
|
||||
set ("allow_grow", resizable);
|
||||
}
|
||||
|
||||
protected void postSizeAllocateEvent()
|
||||
}
|
||||
|
||||
protected void postInsetsChangedEvent (int top, int left,
|
||||
int bottom, int right)
|
||||
{
|
||||
if (menuBar != null)
|
||||
{
|
||||
if (menuBarHeight != 0)
|
||||
insets.top -= menuBarHeight;
|
||||
menuBarHeight = getMenuBarHeight(menuBar);
|
||||
insets.top += menuBarHeight;
|
||||
}
|
||||
awtComponent.doLayout();
|
||||
insets.top = top + menuBarHeight;
|
||||
insets.left = left;
|
||||
insets.bottom = bottom;
|
||||
insets.right = right;
|
||||
}
|
||||
|
||||
public GtkFramePeer (Frame frame)
|
||||
|
@ -72,8 +72,6 @@ static jint window_get_new_state (GtkWidget *widget);
|
||||
static gboolean window_property_changed_cb (GtkWidget *widget,
|
||||
GdkEventProperty *event,
|
||||
jobject peer);
|
||||
static void menubar_resize_cb (GtkWidget *widget, GtkAllocation *alloc,
|
||||
jobject peer);
|
||||
|
||||
/*
|
||||
* Make a new window.
|
||||
@ -402,15 +400,12 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
|
||||
void *wptr;
|
||||
GtkWidget *mptr;
|
||||
GtkWidget *box;
|
||||
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
|
||||
|
||||
|
||||
wptr = NSA_GET_PTR (env, obj);
|
||||
mptr = NSA_GET_PTR (env, menubar);
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
g_signal_connect (G_OBJECT (mptr), "size-allocate",
|
||||
G_CALLBACK (menubar_resize_cb), *gref);
|
||||
box = GTK_BIN (wptr)->child;
|
||||
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;
|
||||
jint height;
|
||||
GtkRequisition gtkreq;
|
||||
|
||||
ptr = NSA_GET_PTR (env, menubar);
|
||||
|
||||
gdk_threads_enter ();
|
||||
height = ptr->allocation.height;
|
||||
gtk_widget_size_request (ptr, >kreq);
|
||||
|
||||
height = gtkreq.height;
|
||||
gdk_threads_leave ();
|
||||
return height;
|
||||
}
|
||||
@ -733,26 +731,3 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
|
||||
|
||||
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…
x
Reference in New Issue
Block a user