2022-10-02 23:06:56 +02:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
|
#include "../defines.h"
|
|
|
|
|
#include "../util.h"
|
|
|
|
|
|
|
|
|
|
#include "WrapperWidget.h"
|
|
|
|
|
|
|
|
|
|
#include "../generated_headers/android_widget_ImageView.h"
|
|
|
|
|
|
2023-08-17 12:59:37 +02:00
|
|
|
JNIEXPORT jlong JNICALL Java_android_widget_ImageView_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
|
2022-10-02 23:06:56 +02:00
|
|
|
{
|
2023-08-22 13:49:09 +02:00
|
|
|
GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
|
2023-06-18 10:57:19 +02:00
|
|
|
GtkWidget *image = gtk_picture_new_for_resource("/org/gtk/libgtk/icons/16x16/status/image-missing.png"); // show "broken image" icon
|
2022-10-02 23:06:56 +02:00
|
|
|
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), image);
|
2023-07-14 17:53:12 +02:00
|
|
|
wrapper_widget_set_jobject(WRAPPER_WIDGET(wrapper), env, this);
|
2023-08-17 12:59:37 +02:00
|
|
|
return _INTPTR(image);
|
2022-10-02 23:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
2023-06-18 10:57:19 +02:00
|
|
|
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf(JNIEnv *env, jobject this, jlong pixbuf_ptr)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *image = _PTR(_GET_LONG_FIELD(this, "widget"));
|
|
|
|
|
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
|
|
|
|
|
gtk_picture_set_pixbuf(GTK_PICTURE(image), pixbuf);
|
|
|
|
|
}
|