implement CheckBox and RadioButton using GtkCheckButton

This commit is contained in:
Julian Winkler
2024-03-10 16:05:31 +01:00
parent 1d0ad8132d
commit d22d083eb8
7 changed files with 650 additions and 0 deletions

View File

@@ -94,6 +94,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
'src/api-impl-jni/audio/android_media_SoundPool.c',
'src/api-impl-jni/widgets/android_widget_AbsListView.c',
'src/api-impl-jni/widgets/android_widget_Button.c',
'src/api-impl-jni/widgets/android_widget_CheckBox.c',
'src/api-impl-jni/widgets/android_widget_CompoundButton.c',
'src/api-impl-jni/widgets/android_widget_EditText.c',
'src/api-impl-jni/widgets/android_widget_ImageButton.c',
@@ -103,6 +104,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
'src/api-impl-jni/widgets/WrapperWidget.c',
'src/api-impl-jni/widgets/android_widget_TextView.c',
'src/api-impl-jni/widgets/android_widget_Progressbar.c',
'src/api-impl-jni/widgets/android_widget_RadioButton.c',
'src/api-impl-jni/widgets/android_view_SurfaceView.c',
'src/api-impl-jni/views/AndroidLayout.c',
'src/api-impl-jni/views/android_view_View.c',

View File

@@ -0,0 +1,245 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class android_widget_CheckBox */
#ifndef _Included_android_widget_CheckBox
#define _Included_android_widget_CheckBox
#ifdef __cplusplus
extern "C" {
#endif
#undef android_widget_CheckBox_NO_ID
#define android_widget_CheckBox_NO_ID -1L
#undef android_widget_CheckBox_NOT_FOCUSABLE
#define android_widget_CheckBox_NOT_FOCUSABLE 0L
#undef android_widget_CheckBox_FOCUSABLE
#define android_widget_CheckBox_FOCUSABLE 1L
#undef android_widget_CheckBox_FOCUSABLE_MASK
#define android_widget_CheckBox_FOCUSABLE_MASK 1L
#undef android_widget_CheckBox_FITS_SYSTEM_WINDOWS
#define android_widget_CheckBox_FITS_SYSTEM_WINDOWS 2L
#undef android_widget_CheckBox_VISIBLE
#define android_widget_CheckBox_VISIBLE 0L
#undef android_widget_CheckBox_INVISIBLE
#define android_widget_CheckBox_INVISIBLE 4L
#undef android_widget_CheckBox_GONE
#define android_widget_CheckBox_GONE 8L
#undef android_widget_CheckBox_VISIBILITY_MASK
#define android_widget_CheckBox_VISIBILITY_MASK 12L
#undef android_widget_CheckBox_ENABLED
#define android_widget_CheckBox_ENABLED 0L
#undef android_widget_CheckBox_DISABLED
#define android_widget_CheckBox_DISABLED 32L
#undef android_widget_CheckBox_ENABLED_MASK
#define android_widget_CheckBox_ENABLED_MASK 32L
#undef android_widget_CheckBox_WILL_NOT_DRAW
#define android_widget_CheckBox_WILL_NOT_DRAW 128L
#undef android_widget_CheckBox_DRAW_MASK
#define android_widget_CheckBox_DRAW_MASK 128L
#undef android_widget_CheckBox_SCROLLBARS_NONE
#define android_widget_CheckBox_SCROLLBARS_NONE 0L
#undef android_widget_CheckBox_SCROLLBARS_HORIZONTAL
#define android_widget_CheckBox_SCROLLBARS_HORIZONTAL 256L
#undef android_widget_CheckBox_SCROLLBARS_VERTICAL
#define android_widget_CheckBox_SCROLLBARS_VERTICAL 512L
#undef android_widget_CheckBox_SCROLLBARS_MASK
#define android_widget_CheckBox_SCROLLBARS_MASK 768L
#undef android_widget_CheckBox_FILTER_TOUCHES_WHEN_OBSCURED
#define android_widget_CheckBox_FILTER_TOUCHES_WHEN_OBSCURED 1024L
#undef android_widget_CheckBox_OPTIONAL_FITS_SYSTEM_WINDOWS
#define android_widget_CheckBox_OPTIONAL_FITS_SYSTEM_WINDOWS 2048L
#undef android_widget_CheckBox_FADING_EDGE_NONE
#define android_widget_CheckBox_FADING_EDGE_NONE 0L
#undef android_widget_CheckBox_FADING_EDGE_HORIZONTAL
#define android_widget_CheckBox_FADING_EDGE_HORIZONTAL 4096L
#undef android_widget_CheckBox_FADING_EDGE_VERTICAL
#define android_widget_CheckBox_FADING_EDGE_VERTICAL 8192L
#undef android_widget_CheckBox_FADING_EDGE_MASK
#define android_widget_CheckBox_FADING_EDGE_MASK 12288L
#undef android_widget_CheckBox_CLICKABLE
#define android_widget_CheckBox_CLICKABLE 16384L
#undef android_widget_CheckBox_DRAWING_CACHE_ENABLED
#define android_widget_CheckBox_DRAWING_CACHE_ENABLED 32768L
#undef android_widget_CheckBox_SAVE_DISABLED
#define android_widget_CheckBox_SAVE_DISABLED 65536L
#undef android_widget_CheckBox_SAVE_DISABLED_MASK
#define android_widget_CheckBox_SAVE_DISABLED_MASK 65536L
#undef android_widget_CheckBox_WILL_NOT_CACHE_DRAWING
#define android_widget_CheckBox_WILL_NOT_CACHE_DRAWING 131072L
#undef android_widget_CheckBox_FOCUSABLE_IN_TOUCH_MODE
#define android_widget_CheckBox_FOCUSABLE_IN_TOUCH_MODE 262144L
#undef android_widget_CheckBox_DRAWING_CACHE_QUALITY_LOW
#define android_widget_CheckBox_DRAWING_CACHE_QUALITY_LOW 524288L
#undef android_widget_CheckBox_DRAWING_CACHE_QUALITY_HIGH
#define android_widget_CheckBox_DRAWING_CACHE_QUALITY_HIGH 1048576L
#undef android_widget_CheckBox_DRAWING_CACHE_QUALITY_AUTO
#define android_widget_CheckBox_DRAWING_CACHE_QUALITY_AUTO 0L
#undef android_widget_CheckBox_DRAWING_CACHE_QUALITY_MASK
#define android_widget_CheckBox_DRAWING_CACHE_QUALITY_MASK 1572864L
#undef android_widget_CheckBox_LONG_CLICKABLE
#define android_widget_CheckBox_LONG_CLICKABLE 2097152L
#undef android_widget_CheckBox_DUPLICATE_PARENT_STATE
#define android_widget_CheckBox_DUPLICATE_PARENT_STATE 4194304L
#undef android_widget_CheckBox_SCROLLBARS_INSIDE_OVERLAY
#define android_widget_CheckBox_SCROLLBARS_INSIDE_OVERLAY 0L
#undef android_widget_CheckBox_SCROLLBARS_INSIDE_INSET
#define android_widget_CheckBox_SCROLLBARS_INSIDE_INSET 16777216L
#undef android_widget_CheckBox_SCROLLBARS_OUTSIDE_OVERLAY
#define android_widget_CheckBox_SCROLLBARS_OUTSIDE_OVERLAY 33554432L
#undef android_widget_CheckBox_SCROLLBARS_OUTSIDE_INSET
#define android_widget_CheckBox_SCROLLBARS_OUTSIDE_INSET 50331648L
#undef android_widget_CheckBox_SCROLLBARS_INSET_MASK
#define android_widget_CheckBox_SCROLLBARS_INSET_MASK 16777216L
#undef android_widget_CheckBox_SCROLLBARS_OUTSIDE_MASK
#define android_widget_CheckBox_SCROLLBARS_OUTSIDE_MASK 33554432L
#undef android_widget_CheckBox_SCROLLBARS_STYLE_MASK
#define android_widget_CheckBox_SCROLLBARS_STYLE_MASK 50331648L
#undef android_widget_CheckBox_KEEP_SCREEN_ON
#define android_widget_CheckBox_KEEP_SCREEN_ON 67108864L
#undef android_widget_CheckBox_SOUND_EFFECTS_ENABLED
#define android_widget_CheckBox_SOUND_EFFECTS_ENABLED 134217728L
#undef android_widget_CheckBox_HAPTIC_FEEDBACK_ENABLED
#define android_widget_CheckBox_HAPTIC_FEEDBACK_ENABLED 268435456L
#undef android_widget_CheckBox_PARENT_SAVE_DISABLED
#define android_widget_CheckBox_PARENT_SAVE_DISABLED 536870912L
#undef android_widget_CheckBox_PARENT_SAVE_DISABLED_MASK
#define android_widget_CheckBox_PARENT_SAVE_DISABLED_MASK 536870912L
#undef android_widget_CheckBox_FOCUSABLES_ALL
#define android_widget_CheckBox_FOCUSABLES_ALL 0L
#undef android_widget_CheckBox_FOCUSABLES_TOUCH_MODE
#define android_widget_CheckBox_FOCUSABLES_TOUCH_MODE 1L
#undef android_widget_CheckBox_FOCUS_BACKWARD
#define android_widget_CheckBox_FOCUS_BACKWARD 1L
#undef android_widget_CheckBox_FOCUS_FORWARD
#define android_widget_CheckBox_FOCUS_FORWARD 2L
#undef android_widget_CheckBox_FOCUS_LEFT
#define android_widget_CheckBox_FOCUS_LEFT 17L
#undef android_widget_CheckBox_FOCUS_UP
#define android_widget_CheckBox_FOCUS_UP 33L
#undef android_widget_CheckBox_FOCUS_RIGHT
#define android_widget_CheckBox_FOCUS_RIGHT 66L
#undef android_widget_CheckBox_FOCUS_DOWN
#define android_widget_CheckBox_FOCUS_DOWN 130L
#undef android_widget_CheckBox_MEASURED_SIZE_MASK
#define android_widget_CheckBox_MEASURED_SIZE_MASK 16777215L
#undef android_widget_CheckBox_MEASURED_STATE_MASK
#define android_widget_CheckBox_MEASURED_STATE_MASK -16777216L
#undef android_widget_CheckBox_MEASURED_HEIGHT_STATE_SHIFT
#define android_widget_CheckBox_MEASURED_HEIGHT_STATE_SHIFT 16L
#undef android_widget_CheckBox_MEASURED_STATE_TOO_SMALL
#define android_widget_CheckBox_MEASURED_STATE_TOO_SMALL 16777216L
#undef android_widget_CheckBox_PFLAG2_DRAG_CAN_ACCEPT
#define android_widget_CheckBox_PFLAG2_DRAG_CAN_ACCEPT 1L
#undef android_widget_CheckBox_PFLAG2_DRAG_HOVERED
#define android_widget_CheckBox_PFLAG2_DRAG_HOVERED 2L
#undef android_widget_CheckBox_LAYOUT_DIRECTION_LTR
#define android_widget_CheckBox_LAYOUT_DIRECTION_LTR 0L
#undef android_widget_CheckBox_LAYOUT_DIRECTION_RTL
#define android_widget_CheckBox_LAYOUT_DIRECTION_RTL 1L
#undef android_widget_CheckBox_LAYOUT_DIRECTION_INHERIT
#define android_widget_CheckBox_LAYOUT_DIRECTION_INHERIT 2L
#undef android_widget_CheckBox_LAYOUT_DIRECTION_LOCALE
#define android_widget_CheckBox_LAYOUT_DIRECTION_LOCALE 3L
#undef android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT
#define android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT 2L
#undef android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_MASK
#define android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_MASK 12L
#undef android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL
#define android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL 16L
#undef android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_RESOLVED
#define android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L
#undef android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK
#define android_widget_CheckBox_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L
#undef android_widget_CheckBox_STATUS_BAR_HIDDEN
#define android_widget_CheckBox_STATUS_BAR_HIDDEN 1L
#undef android_widget_CheckBox_STATUS_BAR_VISIBLE
#define android_widget_CheckBox_STATUS_BAR_VISIBLE 0L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_FULLSCREEN
#define android_widget_CheckBox_SYSTEM_UI_FLAG_FULLSCREEN 4L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_HIDE_NAVIGATION
#define android_widget_CheckBox_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_IMMERSIVE
#define android_widget_CheckBox_SYSTEM_UI_FLAG_IMMERSIVE 2048L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_IMMERSIVE_STICKY
#define android_widget_CheckBox_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
#define android_widget_CheckBox_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
#define android_widget_CheckBox_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_LAYOUT_STABLE
#define android_widget_CheckBox_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_LOW_PROFILE
#define android_widget_CheckBox_SYSTEM_UI_FLAG_LOW_PROFILE 1L
#undef android_widget_CheckBox_SYSTEM_UI_FLAG_VISIBLE
#define android_widget_CheckBox_SYSTEM_UI_FLAG_VISIBLE 0L
#undef android_widget_CheckBox_SYSTEM_UI_LAYOUT_FLAGS
#define android_widget_CheckBox_SYSTEM_UI_LAYOUT_FLAGS 1536L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_CENTER
#define android_widget_CheckBox_TEXT_ALIGNMENT_CENTER 4L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_GRAVITY
#define android_widget_CheckBox_TEXT_ALIGNMENT_GRAVITY 1L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_INHERIT
#define android_widget_CheckBox_TEXT_ALIGNMENT_INHERIT 0L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_TEXT_END
#define android_widget_CheckBox_TEXT_ALIGNMENT_TEXT_END 3L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_TEXT_START
#define android_widget_CheckBox_TEXT_ALIGNMENT_TEXT_START 2L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_VIEW_END
#define android_widget_CheckBox_TEXT_ALIGNMENT_VIEW_END 6L
#undef android_widget_CheckBox_TEXT_ALIGNMENT_VIEW_START
#define android_widget_CheckBox_TEXT_ALIGNMENT_VIEW_START 5L
#undef android_widget_CheckBox_TEXT_DIRECTION_ANY_RTL
#define android_widget_CheckBox_TEXT_DIRECTION_ANY_RTL 2L
#undef android_widget_CheckBox_TEXT_DIRECTION_FIRST_STRONG
#define android_widget_CheckBox_TEXT_DIRECTION_FIRST_STRONG 1L
#undef android_widget_CheckBox_TEXT_DIRECTION_INHERIT
#define android_widget_CheckBox_TEXT_DIRECTION_INHERIT 0L
#undef android_widget_CheckBox_TEXT_DIRECTION_LOCALE
#define android_widget_CheckBox_TEXT_DIRECTION_LOCALE 5L
#undef android_widget_CheckBox_TEXT_DIRECTION_LTR
#define android_widget_CheckBox_TEXT_DIRECTION_LTR 3L
#undef android_widget_CheckBox_TEXT_DIRECTION_RTL
#define android_widget_CheckBox_TEXT_DIRECTION_RTL 4L
/*
* Class: android_widget_CheckBox
* Method: native_constructor
* Signature: (Landroid/content/Context;Landroid/util/AttributeSet;)J
*/
JNIEXPORT jlong JNICALL Java_android_widget_CheckBox_native_1constructor
(JNIEnv *, jobject, jobject, jobject);
/*
* Class: android_widget_CheckBox
* Method: setOnCheckedChangeListener
* Signature: (Landroid/widget/CompoundButton/OnCheckedChangeListener;)V
*/
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setOnCheckedChangeListener
(JNIEnv *, jobject, jobject);
/*
* Class: android_widget_CheckBox
* Method: setChecked
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setChecked
(JNIEnv *, jobject, jboolean);
/*
* Class: android_widget_CheckBox
* Method: isChecked
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_android_widget_CheckBox_isChecked
(JNIEnv *, jobject);
/*
* Class: android_widget_CheckBox
* Method: setText
* Signature: (Ljava/lang/CharSequence;)V
*/
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setText
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,245 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class android_widget_RadioButton */
#ifndef _Included_android_widget_RadioButton
#define _Included_android_widget_RadioButton
#ifdef __cplusplus
extern "C" {
#endif
#undef android_widget_RadioButton_NO_ID
#define android_widget_RadioButton_NO_ID -1L
#undef android_widget_RadioButton_NOT_FOCUSABLE
#define android_widget_RadioButton_NOT_FOCUSABLE 0L
#undef android_widget_RadioButton_FOCUSABLE
#define android_widget_RadioButton_FOCUSABLE 1L
#undef android_widget_RadioButton_FOCUSABLE_MASK
#define android_widget_RadioButton_FOCUSABLE_MASK 1L
#undef android_widget_RadioButton_FITS_SYSTEM_WINDOWS
#define android_widget_RadioButton_FITS_SYSTEM_WINDOWS 2L
#undef android_widget_RadioButton_VISIBLE
#define android_widget_RadioButton_VISIBLE 0L
#undef android_widget_RadioButton_INVISIBLE
#define android_widget_RadioButton_INVISIBLE 4L
#undef android_widget_RadioButton_GONE
#define android_widget_RadioButton_GONE 8L
#undef android_widget_RadioButton_VISIBILITY_MASK
#define android_widget_RadioButton_VISIBILITY_MASK 12L
#undef android_widget_RadioButton_ENABLED
#define android_widget_RadioButton_ENABLED 0L
#undef android_widget_RadioButton_DISABLED
#define android_widget_RadioButton_DISABLED 32L
#undef android_widget_RadioButton_ENABLED_MASK
#define android_widget_RadioButton_ENABLED_MASK 32L
#undef android_widget_RadioButton_WILL_NOT_DRAW
#define android_widget_RadioButton_WILL_NOT_DRAW 128L
#undef android_widget_RadioButton_DRAW_MASK
#define android_widget_RadioButton_DRAW_MASK 128L
#undef android_widget_RadioButton_SCROLLBARS_NONE
#define android_widget_RadioButton_SCROLLBARS_NONE 0L
#undef android_widget_RadioButton_SCROLLBARS_HORIZONTAL
#define android_widget_RadioButton_SCROLLBARS_HORIZONTAL 256L
#undef android_widget_RadioButton_SCROLLBARS_VERTICAL
#define android_widget_RadioButton_SCROLLBARS_VERTICAL 512L
#undef android_widget_RadioButton_SCROLLBARS_MASK
#define android_widget_RadioButton_SCROLLBARS_MASK 768L
#undef android_widget_RadioButton_FILTER_TOUCHES_WHEN_OBSCURED
#define android_widget_RadioButton_FILTER_TOUCHES_WHEN_OBSCURED 1024L
#undef android_widget_RadioButton_OPTIONAL_FITS_SYSTEM_WINDOWS
#define android_widget_RadioButton_OPTIONAL_FITS_SYSTEM_WINDOWS 2048L
#undef android_widget_RadioButton_FADING_EDGE_NONE
#define android_widget_RadioButton_FADING_EDGE_NONE 0L
#undef android_widget_RadioButton_FADING_EDGE_HORIZONTAL
#define android_widget_RadioButton_FADING_EDGE_HORIZONTAL 4096L
#undef android_widget_RadioButton_FADING_EDGE_VERTICAL
#define android_widget_RadioButton_FADING_EDGE_VERTICAL 8192L
#undef android_widget_RadioButton_FADING_EDGE_MASK
#define android_widget_RadioButton_FADING_EDGE_MASK 12288L
#undef android_widget_RadioButton_CLICKABLE
#define android_widget_RadioButton_CLICKABLE 16384L
#undef android_widget_RadioButton_DRAWING_CACHE_ENABLED
#define android_widget_RadioButton_DRAWING_CACHE_ENABLED 32768L
#undef android_widget_RadioButton_SAVE_DISABLED
#define android_widget_RadioButton_SAVE_DISABLED 65536L
#undef android_widget_RadioButton_SAVE_DISABLED_MASK
#define android_widget_RadioButton_SAVE_DISABLED_MASK 65536L
#undef android_widget_RadioButton_WILL_NOT_CACHE_DRAWING
#define android_widget_RadioButton_WILL_NOT_CACHE_DRAWING 131072L
#undef android_widget_RadioButton_FOCUSABLE_IN_TOUCH_MODE
#define android_widget_RadioButton_FOCUSABLE_IN_TOUCH_MODE 262144L
#undef android_widget_RadioButton_DRAWING_CACHE_QUALITY_LOW
#define android_widget_RadioButton_DRAWING_CACHE_QUALITY_LOW 524288L
#undef android_widget_RadioButton_DRAWING_CACHE_QUALITY_HIGH
#define android_widget_RadioButton_DRAWING_CACHE_QUALITY_HIGH 1048576L
#undef android_widget_RadioButton_DRAWING_CACHE_QUALITY_AUTO
#define android_widget_RadioButton_DRAWING_CACHE_QUALITY_AUTO 0L
#undef android_widget_RadioButton_DRAWING_CACHE_QUALITY_MASK
#define android_widget_RadioButton_DRAWING_CACHE_QUALITY_MASK 1572864L
#undef android_widget_RadioButton_LONG_CLICKABLE
#define android_widget_RadioButton_LONG_CLICKABLE 2097152L
#undef android_widget_RadioButton_DUPLICATE_PARENT_STATE
#define android_widget_RadioButton_DUPLICATE_PARENT_STATE 4194304L
#undef android_widget_RadioButton_SCROLLBARS_INSIDE_OVERLAY
#define android_widget_RadioButton_SCROLLBARS_INSIDE_OVERLAY 0L
#undef android_widget_RadioButton_SCROLLBARS_INSIDE_INSET
#define android_widget_RadioButton_SCROLLBARS_INSIDE_INSET 16777216L
#undef android_widget_RadioButton_SCROLLBARS_OUTSIDE_OVERLAY
#define android_widget_RadioButton_SCROLLBARS_OUTSIDE_OVERLAY 33554432L
#undef android_widget_RadioButton_SCROLLBARS_OUTSIDE_INSET
#define android_widget_RadioButton_SCROLLBARS_OUTSIDE_INSET 50331648L
#undef android_widget_RadioButton_SCROLLBARS_INSET_MASK
#define android_widget_RadioButton_SCROLLBARS_INSET_MASK 16777216L
#undef android_widget_RadioButton_SCROLLBARS_OUTSIDE_MASK
#define android_widget_RadioButton_SCROLLBARS_OUTSIDE_MASK 33554432L
#undef android_widget_RadioButton_SCROLLBARS_STYLE_MASK
#define android_widget_RadioButton_SCROLLBARS_STYLE_MASK 50331648L
#undef android_widget_RadioButton_KEEP_SCREEN_ON
#define android_widget_RadioButton_KEEP_SCREEN_ON 67108864L
#undef android_widget_RadioButton_SOUND_EFFECTS_ENABLED
#define android_widget_RadioButton_SOUND_EFFECTS_ENABLED 134217728L
#undef android_widget_RadioButton_HAPTIC_FEEDBACK_ENABLED
#define android_widget_RadioButton_HAPTIC_FEEDBACK_ENABLED 268435456L
#undef android_widget_RadioButton_PARENT_SAVE_DISABLED
#define android_widget_RadioButton_PARENT_SAVE_DISABLED 536870912L
#undef android_widget_RadioButton_PARENT_SAVE_DISABLED_MASK
#define android_widget_RadioButton_PARENT_SAVE_DISABLED_MASK 536870912L
#undef android_widget_RadioButton_FOCUSABLES_ALL
#define android_widget_RadioButton_FOCUSABLES_ALL 0L
#undef android_widget_RadioButton_FOCUSABLES_TOUCH_MODE
#define android_widget_RadioButton_FOCUSABLES_TOUCH_MODE 1L
#undef android_widget_RadioButton_FOCUS_BACKWARD
#define android_widget_RadioButton_FOCUS_BACKWARD 1L
#undef android_widget_RadioButton_FOCUS_FORWARD
#define android_widget_RadioButton_FOCUS_FORWARD 2L
#undef android_widget_RadioButton_FOCUS_LEFT
#define android_widget_RadioButton_FOCUS_LEFT 17L
#undef android_widget_RadioButton_FOCUS_UP
#define android_widget_RadioButton_FOCUS_UP 33L
#undef android_widget_RadioButton_FOCUS_RIGHT
#define android_widget_RadioButton_FOCUS_RIGHT 66L
#undef android_widget_RadioButton_FOCUS_DOWN
#define android_widget_RadioButton_FOCUS_DOWN 130L
#undef android_widget_RadioButton_MEASURED_SIZE_MASK
#define android_widget_RadioButton_MEASURED_SIZE_MASK 16777215L
#undef android_widget_RadioButton_MEASURED_STATE_MASK
#define android_widget_RadioButton_MEASURED_STATE_MASK -16777216L
#undef android_widget_RadioButton_MEASURED_HEIGHT_STATE_SHIFT
#define android_widget_RadioButton_MEASURED_HEIGHT_STATE_SHIFT 16L
#undef android_widget_RadioButton_MEASURED_STATE_TOO_SMALL
#define android_widget_RadioButton_MEASURED_STATE_TOO_SMALL 16777216L
#undef android_widget_RadioButton_PFLAG2_DRAG_CAN_ACCEPT
#define android_widget_RadioButton_PFLAG2_DRAG_CAN_ACCEPT 1L
#undef android_widget_RadioButton_PFLAG2_DRAG_HOVERED
#define android_widget_RadioButton_PFLAG2_DRAG_HOVERED 2L
#undef android_widget_RadioButton_LAYOUT_DIRECTION_LTR
#define android_widget_RadioButton_LAYOUT_DIRECTION_LTR 0L
#undef android_widget_RadioButton_LAYOUT_DIRECTION_RTL
#define android_widget_RadioButton_LAYOUT_DIRECTION_RTL 1L
#undef android_widget_RadioButton_LAYOUT_DIRECTION_INHERIT
#define android_widget_RadioButton_LAYOUT_DIRECTION_INHERIT 2L
#undef android_widget_RadioButton_LAYOUT_DIRECTION_LOCALE
#define android_widget_RadioButton_LAYOUT_DIRECTION_LOCALE 3L
#undef android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT
#define android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_MASK_SHIFT 2L
#undef android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_MASK
#define android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_MASK 12L
#undef android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL
#define android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_RESOLVED_RTL 16L
#undef android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_RESOLVED
#define android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_RESOLVED 32L
#undef android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK
#define android_widget_RadioButton_PFLAG2_LAYOUT_DIRECTION_RESOLVED_MASK 48L
#undef android_widget_RadioButton_STATUS_BAR_HIDDEN
#define android_widget_RadioButton_STATUS_BAR_HIDDEN 1L
#undef android_widget_RadioButton_STATUS_BAR_VISIBLE
#define android_widget_RadioButton_STATUS_BAR_VISIBLE 0L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_FULLSCREEN
#define android_widget_RadioButton_SYSTEM_UI_FLAG_FULLSCREEN 4L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_HIDE_NAVIGATION
#define android_widget_RadioButton_SYSTEM_UI_FLAG_HIDE_NAVIGATION 2L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_IMMERSIVE
#define android_widget_RadioButton_SYSTEM_UI_FLAG_IMMERSIVE 2048L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_IMMERSIVE_STICKY
#define android_widget_RadioButton_SYSTEM_UI_FLAG_IMMERSIVE_STICKY 4096L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
#define android_widget_RadioButton_SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 1024L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
#define android_widget_RadioButton_SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 512L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_LAYOUT_STABLE
#define android_widget_RadioButton_SYSTEM_UI_FLAG_LAYOUT_STABLE 256L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_LOW_PROFILE
#define android_widget_RadioButton_SYSTEM_UI_FLAG_LOW_PROFILE 1L
#undef android_widget_RadioButton_SYSTEM_UI_FLAG_VISIBLE
#define android_widget_RadioButton_SYSTEM_UI_FLAG_VISIBLE 0L
#undef android_widget_RadioButton_SYSTEM_UI_LAYOUT_FLAGS
#define android_widget_RadioButton_SYSTEM_UI_LAYOUT_FLAGS 1536L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_CENTER
#define android_widget_RadioButton_TEXT_ALIGNMENT_CENTER 4L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_GRAVITY
#define android_widget_RadioButton_TEXT_ALIGNMENT_GRAVITY 1L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_INHERIT
#define android_widget_RadioButton_TEXT_ALIGNMENT_INHERIT 0L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_TEXT_END
#define android_widget_RadioButton_TEXT_ALIGNMENT_TEXT_END 3L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_TEXT_START
#define android_widget_RadioButton_TEXT_ALIGNMENT_TEXT_START 2L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_VIEW_END
#define android_widget_RadioButton_TEXT_ALIGNMENT_VIEW_END 6L
#undef android_widget_RadioButton_TEXT_ALIGNMENT_VIEW_START
#define android_widget_RadioButton_TEXT_ALIGNMENT_VIEW_START 5L
#undef android_widget_RadioButton_TEXT_DIRECTION_ANY_RTL
#define android_widget_RadioButton_TEXT_DIRECTION_ANY_RTL 2L
#undef android_widget_RadioButton_TEXT_DIRECTION_FIRST_STRONG
#define android_widget_RadioButton_TEXT_DIRECTION_FIRST_STRONG 1L
#undef android_widget_RadioButton_TEXT_DIRECTION_INHERIT
#define android_widget_RadioButton_TEXT_DIRECTION_INHERIT 0L
#undef android_widget_RadioButton_TEXT_DIRECTION_LOCALE
#define android_widget_RadioButton_TEXT_DIRECTION_LOCALE 5L
#undef android_widget_RadioButton_TEXT_DIRECTION_LTR
#define android_widget_RadioButton_TEXT_DIRECTION_LTR 3L
#undef android_widget_RadioButton_TEXT_DIRECTION_RTL
#define android_widget_RadioButton_TEXT_DIRECTION_RTL 4L
/*
* Class: android_widget_RadioButton
* Method: native_constructor
* Signature: (Landroid/content/Context;Landroid/util/AttributeSet;)J
*/
JNIEXPORT jlong JNICALL Java_android_widget_RadioButton_native_1constructor
(JNIEnv *, jobject, jobject, jobject);
/*
* Class: android_widget_RadioButton
* Method: setOnCheckedChangeListener
* Signature: (Landroid/widget/CompoundButton/OnCheckedChangeListener;)V
*/
JNIEXPORT void JNICALL Java_android_widget_RadioButton_setOnCheckedChangeListener
(JNIEnv *, jobject, jobject);
/*
* Class: android_widget_RadioButton
* Method: setChecked
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_android_widget_RadioButton_setChecked
(JNIEnv *, jobject, jboolean);
/*
* Class: android_widget_RadioButton
* Method: isChecked
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_android_widget_RadioButton_isChecked
(JNIEnv *, jobject);
/*
* Class: android_widget_RadioButton
* Method: setText
* Signature: (Ljava/lang/CharSequence;)V
*/
JNIEXPORT void JNICALL Java_android_widget_RadioButton_setText
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,55 @@
#include <gtk/gtk.h>
#include "WrapperWidget.h"
#include "../util.h"
#include "../generated_headers/android_widget_CheckBox.h"
#include "jni.h"
JNIEXPORT jlong JNICALL Java_android_widget_CheckBox_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
{
GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
GtkWidget *button = gtk_check_button_new();
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), button);
wrapper_widget_set_jobject(WRAPPER_WIDGET(wrapper), env, this);
return _INTPTR(button);
}
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setChecked(JNIEnv *env, jobject this, jboolean checked)
{
gtk_check_button_set_active(GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget"))), checked);
}
JNIEXPORT jboolean JNICALL Java_android_widget_CheckBox_isChecked(JNIEnv *env, jobject this)
{
return gtk_check_button_get_active(GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget"))));
}
static gboolean on_toggled(GtkCheckButton* self, jobject listener)
{
JNIEnv *env = get_jni_env();
WrapperWidget *wrapper = WRAPPER_WIDGET(gtk_widget_get_parent(GTK_WIDGET(self)));
jmethodID on_check_changed = _METHOD(_CLASS(listener), "onCheckedChanged", "(Landroid/widget/CompoundButton;Z)V");
gboolean state = gtk_check_button_get_active(self);
(*env)->CallVoidMethod(env, listener, on_check_changed, wrapper->jobj, state);
return FALSE;
}
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setOnCheckedChangeListener(JNIEnv *env, jobject this, jobject listener)
{
GtkCheckButton *button = GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget")));
g_signal_handlers_block_matched(button, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, on_toggled, NULL);
if (listener) {
g_signal_connect(button, "toggled", G_CALLBACK(on_toggled), _REF(listener));
}
}
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setText(JNIEnv *env, jobject this, jstring text)
{
GtkCheckButton *button = GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget")));
const char *text_str = (*env)->GetStringUTFChars(env, text, NULL);
gtk_check_button_set_label(button, text_str);
(*env)->ReleaseStringUTFChars(env, text, text_str);
}

View File

@@ -0,0 +1,57 @@
#include <gtk/gtk.h>
#include "WrapperWidget.h"
#include "../util.h"
#include "../generated_headers/android_widget_RadioButton.h"
#include "jni.h"
JNIEXPORT jlong JNICALL Java_android_widget_RadioButton_native_1constructor(JNIEnv *env, jobject this, jobject context, jobject attrs)
{
GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
GtkWidget *button = gtk_check_button_new();
// set group to make it a radio button
gtk_check_button_set_group(GTK_CHECK_BUTTON(button), GTK_CHECK_BUTTON(gtk_check_button_new()));
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), button);
wrapper_widget_set_jobject(WRAPPER_WIDGET(wrapper), env, this);
return _INTPTR(button);
}
JNIEXPORT void JNICALL Java_android_widget_RadioButton_setChecked(JNIEnv *env, jobject this, jboolean checked)
{
gtk_check_button_set_active(GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget"))), checked);
}
JNIEXPORT jboolean JNICALL Java_android_widget_RadioButton_isChecked(JNIEnv *env, jobject this)
{
return gtk_check_button_get_active(GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget"))));
}
static gboolean on_toggled(GtkCheckButton* self, jobject listener)
{
JNIEnv *env = get_jni_env();
WrapperWidget *wrapper = WRAPPER_WIDGET(gtk_widget_get_parent(GTK_WIDGET(self)));
jmethodID on_check_changed = _METHOD(_CLASS(listener), "onCheckedChanged", "(Landroid/widget/CompoundButton;Z)V");
gboolean state = gtk_check_button_get_active(self);
(*env)->CallVoidMethod(env, listener, on_check_changed, wrapper->jobj, state);
return FALSE;
}
JNIEXPORT void JNICALL Java_android_widget_RadioButton_setOnCheckedChangeListener(JNIEnv *env, jobject this, jobject listener)
{
GtkCheckButton *button = GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget")));
g_signal_handlers_block_matched(button, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, on_toggled, NULL);
if (listener) {
g_signal_connect(button, "toggled", G_CALLBACK(on_toggled), _REF(listener));
}
}
JNIEXPORT void JNICALL Java_android_widget_RadioButton_setText(JNIEnv *env, jobject this, jstring text)
{
GtkCheckButton *button = GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget")));
const char *text_str = (*env)->GetStringUTFChars(env, text, NULL);
gtk_check_button_set_label(button, text_str);
(*env)->ReleaseStringUTFChars(env, text, text_str);
}

View File

@@ -15,4 +15,27 @@ public class CheckBox extends CompoundButton {
public void setLines(int lines) {}
@Override
protected native long native_constructor(Context context, AttributeSet attrs);
@Override
public native void setOnCheckedChangeListener(OnCheckedChangeListener listener);
@Override
public native void setChecked(boolean checked);
@Override
public native boolean isChecked();
@Override
public native void setText(CharSequence text);
// following methods are overridden to prevent calling incompatible methods from superclasses
@Override
public void setOnClickListener(final OnClickListener l) {}
@Override
public void setTextColor(int color) {}
@Override
public void setTextSize(float size) {}
}

View File

@@ -13,4 +13,27 @@ public class RadioButton extends CompoundButton {
super(context, attributeSet);
}
@Override
protected native long native_constructor(Context context, AttributeSet attrs);
@Override
public native void setOnCheckedChangeListener(OnCheckedChangeListener listener);
@Override
public native void setChecked(boolean checked);
@Override
public native boolean isChecked();
@Override
public native void setText(CharSequence text);
// following methods are overridden to prevent calling incompatible methods from superclasses
@Override
public void setOnClickListener(final OnClickListener l) {}
@Override
public void setTextColor(int color) {}
@Override
public void setTextSize(float size) {}
}