You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement android.widget.EditText using GtkEntry
This commit is contained in:
23
src/api-impl-jni/widgets/android_widget_EditText.c
Normal file
23
src/api-impl-jni/widgets/android_widget_EditText.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../util.h"
|
||||
|
||||
#include "WrapperWidget.h"
|
||||
|
||||
#include "../generated_headers/android_widget_EditText.h"
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_widget_EditText_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
|
||||
{
|
||||
GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
|
||||
GtkWidget *entry = gtk_entry_new();
|
||||
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), entry);
|
||||
return _INTPTR(entry);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_android_widget_EditText_native_1getText(JNIEnv *env, jobject this, jlong widget_ptr)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY(_PTR(widget_ptr));
|
||||
const char *text = gtk_entry_buffer_get_text(gtk_entry_get_buffer(entry));
|
||||
return _JSTRING(text);
|
||||
}
|
||||
Reference in New Issue
Block a user