1 |
/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer |
/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer |
2 |
Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
41 |
#include "gnu_java_awt_peer_gtk_GtkFramePeer.h" |
#include "gnu_java_awt_peer_gtk_GtkFramePeer.h" |
42 |
#include <gdk/gdkprivate.h> |
#include <gdk/gdkprivate.h> |
43 |
#include <gdk/gdkx.h> |
#include <gdk/gdkx.h> |
44 |
void |
|
45 |
setBounds (GtkWidget *, jint, jint, jint, jint); |
static void setBounds (GtkWidget *, jint, jint, jint, jint); |
46 |
|
|
47 |
/* |
/* |
48 |
* Make a new window (any type) |
* Make a new window (any type) |
133 |
set_visible (window, visible); |
set_visible (window, visible); |
134 |
} |
} |
135 |
|
|
|
JNIEXPORT void JNICALL |
|
|
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setMenuBarPeer |
|
|
(JNIEnv *env, jobject obj, jobject menubar) |
|
|
{ |
|
|
void *wptr, *mptr; |
|
|
GtkBox *box; |
|
|
|
|
|
if (!menubar) return; |
|
|
|
|
|
wptr = NSA_GET_PTR (env, obj); |
|
|
mptr = NSA_GET_PTR (env, menubar); |
|
|
|
|
|
if (!mptr) return; /* this case should remove a menu */ |
|
|
|
|
|
gdk_threads_enter (); |
|
|
box = GTK_BOX (GTK_BIN (wptr)->child); |
|
|
gtk_box_pack_start (box, GTK_WIDGET (mptr), 0, 0, 0); |
|
|
gdk_threads_leave (); |
|
|
} |
|
|
|
|
|
|
|
136 |
/* |
/* |
137 |
* Set a frame's title |
* Set a frame's title |
138 |
*/ |
*/ |
209 |
gdk_threads_leave (); |
gdk_threads_leave (); |
210 |
} |
} |
211 |
|
|
212 |
void |
static void |
213 |
setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height) |
setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height) |
214 |
{ |
{ |
215 |
gint current_x, current_y; |
gint current_x, current_y; |
229 |
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds |
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds |
230 |
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) |
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) |
231 |
{ |
{ |
|
GtkWidget *widget; |
|
|
GList *children; |
|
232 |
void *ptr; |
void *ptr; |
233 |
|
|
234 |
ptr = NSA_GET_PTR (env, obj); |
ptr = NSA_GET_PTR (env, obj); |
235 |
|
|
236 |
gdk_threads_enter (); |
gdk_threads_enter (); |
237 |
|
|
238 |
widget = GTK_WIDGET (ptr); |
if (ptr) |
239 |
setBounds (widget, x, y, width, height); |
{ |
240 |
|
GtkWidget *widget = GTK_WIDGET (ptr); |
241 |
|
setBounds (widget, x, y, width, height); |
242 |
|
} |
243 |
|
|
244 |
|
gdk_threads_leave (); |
245 |
|
} |
246 |
|
|
247 |
|
JNIEXPORT void JNICALL |
248 |
|
Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer |
249 |
|
(JNIEnv *env, jobject obj, jobject menubar) |
250 |
|
{ |
251 |
|
void *wptr, *mptr; |
252 |
|
GtkBox *box; |
253 |
|
|
254 |
|
if (!menubar) return; |
255 |
|
|
256 |
|
wptr = NSA_GET_PTR (env, obj); |
257 |
|
mptr = NSA_GET_PTR (env, menubar); |
258 |
|
|
259 |
|
if (!mptr) return; /* this case should remove a menu */ |
260 |
|
|
261 |
|
gdk_threads_enter (); |
262 |
|
box = GTK_BOX (GTK_BIN (wptr)->child); |
263 |
|
gtk_box_pack_start (box, GTK_WIDGET (mptr), 0, 0, 0); |
264 |
gdk_threads_leave (); |
gdk_threads_leave (); |
265 |
} |
} |
266 |
|
|