本文整理汇总了C++中NSA_GET_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ NSA_GET_PTR函数的具体用法?C++ NSA_GET_PTR怎么用?C++ NSA_GET_PTR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NSA_GET_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gdk_threads_enter
JNIEXPORT jstring JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getText
(JNIEnv *env, jobject obj)
{
void *ptr;
char *contents = NULL;
jstring jcontents;
GtkWidget *text = NULL;
GtkTextBuffer *buf;
GtkTextIter start, end;
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
text = textarea_get_widget (GTK_WIDGET (ptr));
buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
gtk_text_buffer_get_start_iter (buf, &start);
gtk_text_buffer_get_end_iter (buf, &end);
contents = gtk_text_buffer_get_text (buf, &start, &end, FALSE);
jcontents = (*env)->NewStringUTF (env, contents);
g_free (contents);
gdk_threads_leave ();
return jcontents;
}
示例2: gdk_threads_enter
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
(JNIEnv *env, jobject obj)
{
void *ptr;
void *mptr;
void *fixed;
GList* children;
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
children = gtk_container_get_children (GTK_CONTAINER (fixed));
while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
{
children = children->next;
}
/* If there's a menu bar, remove it. */
if (children != NULL)
{
mptr = children->data;
/* This will actually destroy the MenuBar. By removing it from
its parent, the reference count for the MenuBar widget will
decrement to 0. The widget will be automatically destroyed by
GTK. */
gtk_container_remove (GTK_CONTAINER (fixed), GTK_WIDGET (mptr));
}
gdk_threads_leave ();
}
示例3: NSA_GET_PTR
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
(JNIEnv *env, jobject obj, jstring label)
{
void *ptr;
const char *str;
ptr = NSA_GET_PTR (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
gdk_threads_enter ();
if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child);
else
{
GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
gtk_label_set_text (GTK_LABEL (accel_label), str);
gtk_accel_label_refetch (accel_label);
}
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, label, str);
}
示例4: gdk_threads_enter
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
(JNIEnv *env, jobject obj, jobject peer)
{
struct graphics2d *gr = NULL;
GtkWidget *widget = NULL;
void *ptr = NULL;
gdk_threads_enter();
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; }
ptr = NSA_GET_PTR (env, peer);
g_assert (ptr != NULL);
gr = (struct graphics2d *) malloc (sizeof (struct graphics2d));
g_assert (gr != NULL);
memset (gr, 0, sizeof(struct graphics2d));
check_for_debug (gr);
gr->cr = cairo_create();
g_assert (gr->cr != NULL);
widget = GTK_WIDGET (ptr);
g_assert (widget != NULL);
grab_current_drawable (widget, &(gr->drawable), &(gr->win));
g_assert (gr->drawable != NULL);
if (x_server_has_render_extension ())
init_graphics2d_as_renderable (gr);
else
init_graphics2d_as_pixbuf (gr);
NSA_SET_G2D_PTR (env, obj, gr);
gdk_threads_leave();
}
示例5: NSA_GET_PTR
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setNativeBounds
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
GtkWidget *widget;
void *ptr;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
/* We assume that -1 is a width or height and not a request for the
widget's natural size. */
width = width < 0 ? 0 : width;
height = height < 0 ? 0 : height;
if (!(width == 0 && height == 0))
{
/* Set the event box's size request... */
gtk_widget_set_size_request (widget, width, height);
/* ...and the label's size request. */
gtk_widget_set_size_request (gtk_bin_get_child (GTK_BIN (widget)),
width, height);
if (widget->parent != NULL)
gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
}
gdk_threads_leave ();
}
示例6: malloc
/* copy the native state of the peer (GtkWidget *) to the native state
of the graphics object */
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
(JNIEnv *env, jobject obj, jobject peer)
{
struct graphics *g = (struct graphics *) malloc (sizeof (struct graphics));
void *ptr;
GtkWidget *widget;
GdkColor color;
ptr = NSA_GET_PTR (env, peer);
g->x_offset = g->y_offset = 0;
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
g->drawable = (GdkDrawable *) widget->window;
gdk_window_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
gdk_colormap_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
color = widget->style->fg[GTK_STATE_NORMAL];
gdk_threads_leave ();
NSA_SET_PTR (env, obj, g);
}
示例7: gdk_threads_enter
JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_getVScrollbarWidth
(JNIEnv *env, jobject obj)
{
void *ptr;
GtkScrolledWindow *sw;
GtkRequisition requisition;
jint width = 0;
jint spacing = 0;
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
sw = GTK_SCROLLED_WINDOW (ptr);
if (sw)
{
gtk_widget_size_request (sw->vscrollbar, &requisition);
gtk_widget_style_get (GTK_WIDGET (sw), "scrollbar_spacing", &spacing, NULL);
width = requisition.width + spacing;
}
gdk_threads_leave ();
return width;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:27,代码来源:gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
示例8: NSA_GET_PTR
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr = NSA_GET_PTR (env, obj);
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
g_assert (gref);
gdk_threads_enter ();
gtk_widget_realize (GTK_WIDGET (ptr));
/* connect buttons to handlers */
g_signal_connect (G_OBJECT (GTK_DIALOG (ptr)),
"response",
GTK_SIGNAL_FUNC (window_closed), *gref);
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (ptr)->ok_button),
"clicked",
GTK_SIGNAL_FUNC (ok_clicked), *gref);
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (ptr)->cancel_button),
"clicked",
GTK_SIGNAL_FUNC (cancel_clicked), *gref);
gdk_threads_leave ();
/* Connect the superclass signals. */
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
}
示例9: classpath_jawt_get_drawable
Drawable
classpath_jawt_get_drawable (JNIEnv* env, jobject canvas)
{
GtkWidget *widget;
int drawable;
void *ptr;
jobject peer;
jclass class_id;
jmethodID method_id;
class_id = (*env)->GetObjectClass (env, canvas);
method_id = (*env)->GetMethodID (env, class_id,
"getPeer",
"()Ljava/awt/peer/ComponentPeer;");
peer = (*env)->CallObjectMethod (env, canvas, method_id);
ptr = NSA_GET_PTR (env, peer);
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
g_assert (GTK_WIDGET_REALIZED (widget));
drawable = GDK_DRAWABLE_XID (widget->window);
gdk_threads_leave ();
return drawable;
}
示例10: classpath_jawt_get_visualID
VisualID
classpath_jawt_get_visualID (JNIEnv* env, jobject canvas)
{
GtkWidget *widget;
Visual *visual;
void *ptr;
jobject peer;
jclass class_id;
jmethodID method_id;
class_id = (*env)->GetObjectClass (env, canvas);
method_id = (*env)->GetMethodID (env, class_id,
"getPeer",
"()Ljava/awt/peer/ComponentPeer;");
peer = (*env)->CallObjectMethod (env, canvas, method_id);
ptr = NSA_GET_PTR (env, peer);
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
g_assert (GTK_WIDGET_REALIZED (widget));
visual = gdk_x11_visual_get_xvisual (gtk_widget_get_visual (widget));
g_assert (visual != NULL);
gdk_threads_leave ();
return visual->visualid;
}
示例11: NSA_GET_PTR
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectSignals
(JNIEnv *env, jobject obj)
{
struct range_scrollbar *rs;
void *ptr = NSA_GET_PTR (env, obj);
jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
g_assert (gref);
rs = (struct range_scrollbar *) malloc (sizeof (struct range_scrollbar));
gdk_threads_enter ();
gtk_widget_realize (GTK_WIDGET (ptr));
rs->range = GTK_RANGE (ptr);
rs->scrollbar = gref;
g_signal_connect (G_OBJECT (GTK_RANGE (ptr)),
"move-slider",
GTK_SIGNAL_FUNC (post_adjustment_event), rs);
g_signal_connect (G_OBJECT (GTK_RANGE (ptr)),
"value-changed",
GTK_SIGNAL_FUNC (post_change_event), rs);
gdk_threads_leave ();
/* Connect the superclass signals. */
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
}
示例12: NSA_GET_PTR
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetForeground
(JNIEnv *env, jobject obj, jint red, jint green, jint blue)
{
GdkColor color;
GtkWidget *label;
void *ptr;
ptr = NSA_GET_PTR (env, obj);
color.red = (red / 255.0) * 65535;
color.green = (green / 255.0) * 65535;
color.blue = (blue / 255.0) * 65535;
gdk_threads_enter ();
label = gtk_bin_get_child (GTK_BIN(ptr));
if (!label)
return;
gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &color);
gtk_widget_modify_fg (label, GTK_STATE_ACTIVE, &color);
gtk_widget_modify_fg (label, GTK_STATE_PRELIGHT, &color);
gdk_threads_leave ();
}
示例13: NSA_SET_GLOBAL_REF
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate
(JNIEnv *env, jobject obj, jobject group, jboolean state)
{
GtkWidget *button;
/* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
if (group == NULL)
button = gtk_check_button_new_with_label ("");
else
{
void *native_group = NSA_GET_PTR (env, group);
button = gtk_radio_button_new_with_label_from_widget (native_group, "");
if (native_group == NULL)
{
/* Set the native group so we can use the correct value the
next time around. FIXME: this doesn't work! */
NSA_SET_PTR (env, group, button);
}
}
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), state);
gdk_threads_leave ();
NSA_SET_PTR (env, obj, button);
}
示例14: gdk_threads_enter
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkChoicePeer_nativeRemoveAll
(JNIEnv *env, jobject obj)
{
void *ptr;
GtkTreeModel *model;
GtkWidget *bin;
gint count, i;
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
bin = choice_get_widget (GTK_WIDGET (ptr));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (bin));
count = gtk_tree_model_iter_n_children (model, NULL);
/* First, unselect everything, to avoid problems when removing items. */
gtk_combo_box_set_active (GTK_COMBO_BOX (bin), -1);
for (i = count - 1; i >= 0; i--) {
gtk_combo_box_remove_text (GTK_COMBO_BOX (bin), i);
}
gdk_threads_leave ();
}
示例15: NSA_GET_PTR
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
(JNIEnv *env, jobject obj, jchar c)
{
void *ptr;
GtkEntry *entry;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
entry = GTK_ENTRY (ptr);
if (c != 0)
{
/* FIXME: use gtk_entry_set_invisible_char (GtkEntry *entry,
gunichar ch) here. That means we must convert from jchar
(utf16) to gunichar (ucs4). */
gtk_entry_set_visibility (entry, FALSE);
}
else
gtk_entry_set_visibility (entry, TRUE);
gdk_threads_leave ();
}