Mercurial > dwindows
comparison android/dw.cpp @ 2834:0cbe8201db3c
Android: Initial implementation of DW_CONTAINER_MODE_EXTRA/MULTI.
The layout diverges slightly from the iOS implementation for the sake of
implementation simplicity. Will unify the two looks in upcoming commits.
Still need to implement DW_SIGNAL_COLUMN_CLICKED.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 12 Sep 2022 10:13:24 +0000 |
parents | 469e5748c8a5 |
children | 1f0017a07771 |
comparison
equal
deleted
inserted
replaced
2833:469e5748c8a5 | 2834:0cbe8201db3c |
---|---|
42 static char _dw_app_id[_DW_APP_ID_SIZE+1]= {0}; | 42 static char _dw_app_id[_DW_APP_ID_SIZE+1]= {0}; |
43 static char _dw_app_name[_DW_APP_ID_SIZE+1]= {0}; | 43 static char _dw_app_name[_DW_APP_ID_SIZE+1]= {0}; |
44 static char _dw_exec_dir[MAX_PATH+1] = {0}; | 44 static char _dw_exec_dir[MAX_PATH+1] = {0}; |
45 static char _dw_user_dir[MAX_PATH+1] = {0}; | 45 static char _dw_user_dir[MAX_PATH+1] = {0}; |
46 static int _dw_android_api = 0; | 46 static int _dw_android_api = 0; |
47 static int _dw_container_mode = DW_CONTAINER_MODE_DEFAULT; | |
47 | 48 |
48 static pthread_key_t _dw_env_key; | 49 static pthread_key_t _dw_env_key; |
49 static pthread_key_t _dw_fgcolor_key; | 50 static pthread_key_t _dw_fgcolor_key; |
50 static pthread_key_t _dw_bgcolor_key; | 51 static pthread_key_t _dw_bgcolor_key; |
51 static HEV _dw_main_event; | 52 static HEV _dw_main_event; |
8079 case DW_FEATURE_UTF8_UNICODE: /* Supports UTF8 encoded Unicode text */ | 8080 case DW_FEATURE_UTF8_UNICODE: /* Supports UTF8 encoded Unicode text */ |
8080 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ | 8081 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ |
8081 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ | 8082 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ |
8082 case DW_FEATURE_TREE: /* Supports the Tree Widget */ | 8083 case DW_FEATURE_TREE: /* Supports the Tree Widget */ |
8083 return DW_FEATURE_ENABLED; | 8084 return DW_FEATURE_ENABLED; |
8085 case DW_FEATURE_CONTAINER_MODE: /* Supports alternate container view modes */ | |
8086 return _dw_container_mode; | |
8084 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ | 8087 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ |
8085 { | 8088 { |
8086 /* Dark Mode on Android requires Android 10 (API 29) */ | 8089 /* Dark Mode on Android requires Android 10 (API 29) */ |
8087 if(_dw_android_api >= 29) { | 8090 if(_dw_android_api >= 29) { |
8088 return _dw_dark_mode_detected(); | 8091 return _dw_dark_mode_detected(); |
8119 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ | 8122 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ |
8120 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ | 8123 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ |
8121 case DW_FEATURE_TREE: /* Supports the Tree Widget */ | 8124 case DW_FEATURE_TREE: /* Supports the Tree Widget */ |
8122 return DW_ERROR_GENERAL; | 8125 return DW_ERROR_GENERAL; |
8123 /* These features are supported and configurable */ | 8126 /* These features are supported and configurable */ |
8127 case DW_FEATURE_CONTAINER_MODE: /* Supports alternate container view modes */ | |
8128 { | |
8129 if(state >= DW_CONTAINER_MODE_DEFAULT && state < DW_CONTAINER_MODE_MAX) | |
8130 { | |
8131 JNIEnv *env; | |
8132 | |
8133 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
8134 { | |
8135 // First get the class that contains the method you need to call | |
8136 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
8137 // Get the method that you want to call | |
8138 jmethodID setContainerMode = env->GetMethodID(clazz, "setContainerMode", | |
8139 "(I)V"); | |
8140 _dw_container_mode = state; | |
8141 // Call the method on the object | |
8142 env->CallVoidMethod(_dw_obj, setContainerMode, (jint)state); | |
8143 _dw_jni_check_exception(env); | |
8144 } | |
8145 return DW_ERROR_NONE; | |
8146 } | |
8147 return DW_ERROR_GENERAL; | |
8148 } | |
8124 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ | 8149 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ |
8125 { | 8150 { |
8126 /* Dark Mode on Android requires 10 (API 29) */ | 8151 /* Dark Mode on Android requires 10 (API 29) */ |
8127 if(_dw_android_api >= 29) { | 8152 if(_dw_android_api >= 29) { |
8128 /* While technically configurable.... | 8153 /* While technically configurable.... |