Mercurial > dwindows
diff android/dw.cpp @ 2722:cacde852e2db
Android: Add dialog dismiss and color change handlers to the color chooser.
dw_color_choose() now blocks and waits for the user to pick a color....
previously it opened the dialog and returned the original color.
Probably need to add a GradientBar for the brightness... maybe some
buttons to apply or cancel, but for now the Android < button closes it.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 09 Dec 2021 11:52:59 +0000 |
parents | 9ce1649b0fbd |
children | bf585f375286 |
line wrap: on
line diff
--- a/android/dw.cpp Thu Dec 09 04:52:01 2021 +0000 +++ b/android/dw.cpp Thu Dec 09 11:52:59 2021 +0000 @@ -2986,6 +2986,8 @@ if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { unsigned long _value = _dw_get_color(value); + int r, g, b; + jint ac; // First get the class that contains the method you need to call jclass clazz = _dw_find_class(env, DW_CLASS_NAME); @@ -2993,10 +2995,15 @@ jmethodID colorChoose = env->GetMethodID(clazz, "colorChoose", "(IIIII)I"); // Call the method on the object - newcolor = (unsigned long)env->CallIntMethod(_dw_obj, colorChoose, (jint)value, 0, + ac = env->CallIntMethod(_dw_obj, colorChoose, (jint)value, 0, (jint)DW_RED_VALUE(_value), (jint)DW_GREEN_VALUE(_value), (jint)DW_BLUE_VALUE(_value)); - if(!_dw_jni_check_exception(env)) + if(_dw_jni_check_exception(env)) return value; + // Convert from Android Color to RGB back to Dynamic Windows + b = ac & 0xff; + g = (ac >> 8) & 0xff; + r = (ac >> 16) & 0xff; + newcolor = DW_RGB(r, g, b); } return newcolor; }