Mercurial > dwindows
diff android/dw.cpp @ 2500:ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 05 May 2021 21:59:23 +0000 |
parents | ff3310fa6d72 |
children | 41984ffb5ca2 |
line wrap: on
line diff
--- a/android/dw.cpp Wed May 05 19:53:33 2021 +0000 +++ b/android/dw.cpp Wed May 05 21:59:23 2021 +0000 @@ -826,7 +826,8 @@ */ HWND API dw_groupbox_new(int type, int pad, const char *title) { - return 0; + /* TODO: Just create a normal box for now */ + return dw_box_new(type, pad); } /* @@ -839,8 +840,20 @@ */ HWND API dw_scrollbox_new(int type, int pad) { - /* TODO: Just create a normal box for now */ - return dw_box_new(type, pad); + JNIEnv *env; + + if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + { + // First get the class that contains the method you need to call + jclass clazz = _dw_find_class(env, DW_CLASS_NAME); + // Get the method that you want to call + jmethodID scrollBoxNew = env->GetMethodID(clazz, "scrollBoxNew", + "(II)Landroid/widget/ScrollView;"); + // Call the method on the object + jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, scrollBoxNew, type, pad)); + return result; + } + return 0; } /* @@ -879,7 +892,7 @@ // First get the class that contains the method you need to call jclass clazz = _dw_find_class(env, DW_CLASS_NAME); // Get the method that you want to call - jmethodID boxPack = env->GetMethodID(clazz, "boxPack", "(Landroid/widget/LinearLayout;Landroid/view/View;IIIIII)V"); + jmethodID boxPack = env->GetMethodID(clazz, "boxPack", "(Landroid/view/View;Landroid/view/View;IIIIII)V"); // Call the method on the object env->CallVoidMethod(_dw_obj, boxPack, box, item, index, width, height, hsize, vsize, pad); }