comparison android/dw.cpp @ 2689:7127de139acf

Android: Implement groupbox using RadioGroup... still missing the title and visible border seen on most other platforms, but it works for making sure radiobuttons contained inside only have one selected.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 28 Oct 2021 17:27:59 +0000
parents 42ff9d95e87b
children cee79add3669
comparison
equal deleted inserted replaced
2688:c359cbd0b20f 2689:7127de139acf
1368 * Returns: 1368 * Returns:
1369 * A handle to a groupbox window or nullptr on failure. 1369 * A handle to a groupbox window or nullptr on failure.
1370 */ 1370 */
1371 HWND API dw_groupbox_new(int type, int pad, const char *title) 1371 HWND API dw_groupbox_new(int type, int pad, const char *title)
1372 { 1372 {
1373 /* TODO: Just create a normal box for now */ 1373 JNIEnv *env;
1374 return dw_box_new(type, pad); 1374
1375 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
1376 {
1377 // Construct a String
1378 jstring jstr = title ? env->NewStringUTF(title) : nullptr;
1379 // First get the class that contains the method you need to call
1380 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
1381 // Get the method that you want to call
1382 jmethodID groupBoxNew = env->GetMethodID(clazz, "groupBoxNew",
1383 "(IILjava/lang/String;)Landroid/widget/LinearLayout;");
1384 // Call the method on the object
1385 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, groupBoxNew, type, pad, jstr), _DW_REFERENCE_WEAK);
1386 return result;
1387 }
1388 return nullptr;
1375 } 1389 }
1376 1390
1377 /* 1391 /*
1378 * Create a new scrollable Box to be packed. 1392 * Create a new scrollable Box to be packed.
1379 * Parameters: 1393 * Parameters: