comparison android/dw.cpp @ 2776:858155527b05

Android: Minor tree changes... mostly testing my system to push changes to GitHub.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 21 Jun 2022 07:55:53 +0000
parents 5f77f52df8ac
children 7d7eac751f7d
comparison
equal deleted inserted replaced
2775:5f77f52df8ac 2776:858155527b05
400 { 400 {
401 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction; 401 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction;
402 char *text = (char *)params[1]; 402 char *text = (char *)params[1];
403 void *user = params[7]; 403 void *user = params[7];
404 404
405 retval = treeselectfunc(handler->window, params[0], text, handler->data, user); 405 retval = treeselectfunc(handler->window, (jobject)params[0], text, handler->data, user);
406 break; 406 break;
407 } 407 }
408 /* Set Focus event */ 408 /* Set Focus event */
409 case _DW_EVENT_SET_FOCUS: 409 case _DW_EVENT_SET_FOCUS:
410 { 410 {
3312 * Returns: 3312 * Returns:
3313 * A handle to a tree item or nullptr on failure. 3313 * A handle to a tree item or nullptr on failure.
3314 */ 3314 */
3315 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) 3315 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
3316 { 3316 {
3317 /* TODO: Implement the tree if possible. */ 3317 JNIEnv *env;
3318
3319 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
3320 {
3321 // Construct the string
3322 jstring jstr = env->NewStringUTF(title);
3323 // First get the class that contains the method you need to call
3324 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
3325 // Get the method that you want to call
3326 jmethodID treeInsertAfter = env->GetMethodID(clazz, "treeInsertAfter",
3327 "(Lorg/dbsoft/dwindows/DWTree;Lorg/dbsoft/dwindows/DWTreeItem;Ljava/lang/String;Landroid/graphics/drawable/Drawable;Lorg/dbsoft/dwindows/DWTreeItem;J)Lorg/dbsoft/dwindows/DWTreeItem;");
3328 // Call the method on the object
3329 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, treeInsertAfter, handle, item,
3330 jstr, icon, parent, (jlong)itemdata), _DW_REFERENCE_WEAK);
3331 return result;
3332 }
3318 return nullptr; 3333 return nullptr;
3319 } 3334 }
3320 3335
3321 /* 3336 /*
3322 * Inserts an item into a tree window (widget). 3337 * Inserts an item into a tree window (widget).
3329 * Returns: 3344 * Returns:
3330 * A handle to a tree item or nullptr on failure. 3345 * A handle to a tree item or nullptr on failure.
3331 */ 3346 */
3332 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) 3347 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata)
3333 { 3348 {
3334 /* TODO: Implement the tree if possible. */ 3349 return dw_tree_insert_after(handle, nullptr, title, icon, parent, itemdata);
3335 return nullptr;
3336 } 3350 }
3337 3351
3338 /* 3352 /*
3339 * Gets the text an item in a tree window (widget). 3353 * Gets the text an item in a tree window (widget).
3340 * Parameters: 3354 * Parameters: