Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
2721:c0be28906839 | 2722:cacde852e2db |
---|---|
2984 unsigned long newcolor = value; | 2984 unsigned long newcolor = value; |
2985 | 2985 |
2986 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | 2986 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2987 { | 2987 { |
2988 unsigned long _value = _dw_get_color(value); | 2988 unsigned long _value = _dw_get_color(value); |
2989 int r, g, b; | |
2990 jint ac; | |
2989 | 2991 |
2990 // First get the class that contains the method you need to call | 2992 // First get the class that contains the method you need to call |
2991 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | 2993 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2992 // Get the method that you want to call | 2994 // Get the method that you want to call |
2993 jmethodID colorChoose = env->GetMethodID(clazz, "colorChoose", | 2995 jmethodID colorChoose = env->GetMethodID(clazz, "colorChoose", |
2994 "(IIIII)I"); | 2996 "(IIIII)I"); |
2995 // Call the method on the object | 2997 // Call the method on the object |
2996 newcolor = (unsigned long)env->CallIntMethod(_dw_obj, colorChoose, (jint)value, 0, | 2998 ac = env->CallIntMethod(_dw_obj, colorChoose, (jint)value, 0, |
2997 (jint)DW_RED_VALUE(_value), (jint)DW_GREEN_VALUE(_value), (jint)DW_BLUE_VALUE(_value)); | 2999 (jint)DW_RED_VALUE(_value), (jint)DW_GREEN_VALUE(_value), (jint)DW_BLUE_VALUE(_value)); |
2998 if(!_dw_jni_check_exception(env)) | 3000 if(_dw_jni_check_exception(env)) |
2999 return value; | 3001 return value; |
3002 // Convert from Android Color to RGB back to Dynamic Windows | |
3003 b = ac & 0xff; | |
3004 g = (ac >> 8) & 0xff; | |
3005 r = (ac >> 16) & 0xff; | |
3006 newcolor = DW_RGB(r, g, b); | |
3000 } | 3007 } |
3001 return newcolor; | 3008 return newcolor; |
3002 } | 3009 } |
3003 | 3010 |
3004 /* Draw a point on a window (preferably a render window). | 3011 /* Draw a point on a window (preferably a render window). |