Mercurial > dwindows
comparison android/dw.cpp @ 2709:3cb5aa73dace
Android: Implement dw_container_scroll(), dw_container_cursor() and dw_container_cursor_by_data().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 22 Nov 2021 02:18:08 +0000 |
parents | 3a7dcc0ae08b |
children | 98cc4476b376 |
comparison
equal
deleted
inserted
replaced
2708:3a7dcc0ae08b | 2709:3cb5aa73dace |
---|---|
3891 * DW_SCROLL_BOTTOM. (rows is ignored for last two) | 3891 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
3892 * rows: The number of rows to be scrolled. | 3892 * rows: The number of rows to be scrolled. |
3893 */ | 3893 */ |
3894 void API dw_container_scroll(HWND handle, int direction, long rows) | 3894 void API dw_container_scroll(HWND handle, int direction, long rows) |
3895 { | 3895 { |
3896 JNIEnv *env; | |
3897 | |
3898 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
3899 { | |
3900 // First get the class that contains the method you need to call | |
3901 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
3902 // Get the method that you want to call | |
3903 jmethodID containerScroll = env->GetMethodID(clazz, "containerScroll", | |
3904 "(Landroid/widget/ListView;II)V"); | |
3905 // Call the method on the object | |
3906 env->CallVoidMethod(_dw_obj, containerScroll, handle, direction, (jint)rows); | |
3907 _dw_jni_check_exception(env); | |
3908 } | |
3896 } | 3909 } |
3897 | 3910 |
3898 /* | 3911 /* |
3899 * Starts a new query of a container. | 3912 * Starts a new query of a container. |
3900 * Parameters: | 3913 * Parameters: |
3985 * handle: Handle to the window (widget) to be queried. | 3998 * handle: Handle to the window (widget) to be queried. |
3986 * text: Text usually returned by dw_container_query(). | 3999 * text: Text usually returned by dw_container_query(). |
3987 */ | 4000 */ |
3988 void API dw_container_cursor(HWND handle, const char *text) | 4001 void API dw_container_cursor(HWND handle, const char *text) |
3989 { | 4002 { |
4003 JNIEnv *env; | |
4004 | |
4005 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
4006 { | |
4007 // Generate a string | |
4008 jstring jstr = text ? env->NewStringUTF(text) : nullptr; | |
4009 // First get the class that contains the method you need to call | |
4010 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
4011 // Get the method that you want to call | |
4012 jmethodID containerCursor = env->GetMethodID(clazz, "containerCursor", | |
4013 "(Landroid/widget/ListView;Ljava/lang/String;)V"); | |
4014 // Call the method on the object | |
4015 env->CallVoidMethod(_dw_obj, containerCursor, handle, jstr); | |
4016 _dw_jni_check_exception(env); | |
4017 } | |
3990 } | 4018 } |
3991 | 4019 |
3992 /* | 4020 /* |
3993 * Cursors the item with the data speficied, and scrolls to that item. | 4021 * Cursors the item with the data speficied, and scrolls to that item. |
3994 * Parameters: | 4022 * Parameters: |
3995 * handle: Handle to the window (widget) to be queried. | 4023 * handle: Handle to the window (widget) to be queried. |
3996 * data: Data usually returned by dw_container_query(). | 4024 * data: Data usually returned by dw_container_query(). |
3997 */ | 4025 */ |
3998 void API dw_container_cursor_by_data(HWND handle, void *data) | 4026 void API dw_container_cursor_by_data(HWND handle, void *data) |
3999 { | 4027 { |
4028 JNIEnv *env; | |
4029 | |
4030 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
4031 { | |
4032 // First get the class that contains the method you need to call | |
4033 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
4034 // Get the method that you want to call | |
4035 jmethodID containerCursorByData = env->GetMethodID(clazz, "containerCursorByData", | |
4036 "(Landroid/widget/ListView;J)V"); | |
4037 // Call the method on the object | |
4038 env->CallVoidMethod(_dw_obj, containerCursorByData, handle, (jlong)data); | |
4039 _dw_jni_check_exception(env); | |
4040 } | |
4000 } | 4041 } |
4001 | 4042 |
4002 /* | 4043 /* |
4003 * Deletes the item with the text speficied. | 4044 * Deletes the item with the text speficied. |
4004 * Parameters: | 4045 * Parameters: |