static gboolean wp_button_press_cb (GtkWidget *widget, GdkEventButton *event, AppearanceData *data) { GtkCellRenderer *cell; GdkEventButton *button_event = (GdkEventButton *) event; if (event->type != GDK_BUTTON_PRESS) return FALSE; if (gtk_icon_view_get_item_at_pos (GTK_ICON_VIEW (widget), button_event->x, button_event->y, NULL, &cell)) { if (g_object_get_data (G_OBJECT (cell), "buttons")) { gint w, h; GtkCellRenderer *cell2 = NULL; gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h); if (gtk_icon_view_get_item_at_pos (GTK_ICON_VIEW (widget), button_event->x + w, button_event->y, NULL, &cell2) && cell == cell2) next_frame (data, cell, -1); else next_frame (data, cell, 1); return TRUE; } } return FALSE; }
static VALUE iview_get_item_at_pos(VALUE self, VALUE x, VALUE y) { GtkTreePath* path; GtkCellRenderer* cell; gboolean item_at_pos = gtk_icon_view_get_item_at_pos(_SELF(self), NUM2INT(x), NUM2INT(y), &path, &cell); return item_at_pos ? rb_assoc_new(GTKTREEPATH2RVAL(path), GOBJ2RVAL(cell)) : Qnil; }
JNIEXPORT jboolean JNICALL Java_org_gnome_gtk_GtkIconView_gtk_1icon_1view_1get_1item_1at_1pos ( JNIEnv* env, jclass cls, jlong _self, jint _x, jint _y, jlongArray _path, jlongArray _cell ) { gboolean result; jboolean _result; GtkIconView* self; gint x; gint y; GtkTreePath** path; GtkCellRenderer** cell; // convert parameter self self = (GtkIconView*) _self; // convert parameter x x = (gint) _x; // convert parameter y y = (gint) _y; // convert parameter path path = (GtkTreePath**) bindings_java_convert_jarray_to_gpointer(env, _path); if (path == NULL) { return JNI_FALSE; // Java Exception already thrown } // convert parameter cell cell = (GtkCellRenderer**) bindings_java_convert_jarray_to_gpointer(env, _cell); if (cell == NULL) { return JNI_FALSE; // Java Exception already thrown } // call function result = gtk_icon_view_get_item_at_pos(self, x, y, path, cell); // cleanup parameter self // cleanup parameter x // cleanup parameter y // cleanup parameter path bindings_java_convert_gpointer_to_jarray(env, (gpointer*)path, _path); // cleanup parameter cell bindings_java_convert_gpointer_to_jarray(env, (gpointer*)cell, _cell); // translate return value to JNI type _result = (jboolean) result; // and finally return _result; }