Mercurial > dwindows
annotate android/dw.cpp @ 2658:ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
Other platforms are able to access the bundled assets via the filesystem.
Android keeps the assets in the Zipped APK archive, so during initialization
we now extract the non-resource (numeric images) into the app cache dir.
dw_app_dir() now returns the path to the application cache.
dw_user_dir() returns either the HOME directory or the path to the
application root directory (usually the parent of the cache).
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 24 Sep 2021 13:57:16 +0000 |
parents | 9535f533a230 |
children | 917f2d1f9cae |
rev | line source |
---|---|
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 * Dynamic Windows: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 * A GTK like GUI implementation of the Android GUI. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 * |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 * (C) 2011-2021 Brian Smith <brian@dbsoft.org> |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 * (C) 2011-2021 Mark Hessling <mark@rexx.org> |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 * |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
8 * Requires Android API 19 (KitKat) or higher. |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
9 * |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #include "dw.h" |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #include <stdlib.h> |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 #include <string.h> |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
15 #include <sys/utsname.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
16 #include <sys/socket.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
17 #include <sys/un.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
18 #include <sys/mman.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
19 #include <sys/types.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
20 #include <sys/stat.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
21 #include <dlfcn.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
22 #include <errno.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
23 #include <fcntl.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
24 #include <unistd.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
25 #if defined(__ANDROID__) && (__ANDROID_API__+0) < 21 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
26 #include <sys/syscall.h> |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
27 |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
28 /* Until Android API version 21 NDK does not define getsid wrapper in libc, although there is the corresponding syscall */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
29 inline pid_t getsid(pid_t pid) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
30 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
31 return static_cast< pid_t >(::syscall(__NR_getsid, pid)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
32 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
33 #endif |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 #ifdef __cplusplus |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 extern "C" { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 #endif |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
39 /* Define this to enable threading for events... |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
40 * most Android events don't handle return values, so |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
41 * we can launch a new thread to handle the event. |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
42 * #define _DW_EVENT_THREADING |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
43 */ |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
44 /* #define _DW_EVENT_THREADING */ |
2484
cb5b67154399
Android: The DWindows class should be org.dbsoft.dwindows, remove dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2483
diff
changeset
|
45 #define DW_CLASS_NAME "org/dbsoft/dwindows/DWindows" |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
46 |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
47 /* Dynamic Windows internal variables */ |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
48 static char _dw_app_id[_DW_APP_ID_SIZE+1]= {0}; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
49 static char _dw_app_name[_DW_APP_ID_SIZE+1]= {0}; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
50 static char _dw_exec_dir[MAX_PATH+1] = {0}; |
2658
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
51 static char _dw_user_dir[MAX_PATH+1] = {0}; |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
52 static int _dw_android_api = 0; |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
53 |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
54 static pthread_key_t _dw_env_key; |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
55 static pthread_key_t _dw_fgcolor_key; |
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
56 static pthread_key_t _dw_bgcolor_key; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
57 static HEV _dw_main_event; |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
58 static JavaVM *_dw_jvm; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
59 static jobject _dw_obj; |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
60 static jobject _dw_class_loader; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
61 static jmethodID _dw_class_method; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
62 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
63 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
64 { |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
65 JNIEnv *env; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
66 jclass randomClass, classClass, classLoaderClass; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
67 jmethodID getClassLoaderMethod; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
68 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
69 /* Initialize the handle to the Java Virtual Machine */ |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
70 _dw_jvm = pjvm; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
71 _dw_jvm->GetEnv((void**)&env, JNI_VERSION_1_6); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
72 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
73 randomClass = env->FindClass(DW_CLASS_NAME); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
74 classClass = env->GetObjectClass(randomClass); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
75 classLoaderClass = env->FindClass("java/lang/ClassLoader"); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
76 getClassLoaderMethod = env->GetMethodID(classClass, "getClassLoader", |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
77 "()Ljava/lang/ClassLoader;"); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
78 _dw_class_loader = env->NewGlobalRef(env->CallObjectMethod(randomClass, getClassLoaderMethod)); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
79 _dw_class_method = env->GetMethodID(classLoaderClass, "findClass", |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
80 "(Ljava/lang/String;)Ljava/lang/Class;"); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
81 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
82 return JNI_VERSION_1_6; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
83 } |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
84 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
85 jclass _dw_find_class(JNIEnv *env, const char* name) |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
86 { |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
87 return static_cast<jclass>(env->CallObjectMethod(_dw_class_loader, _dw_class_method, env->NewStringUTF(name))); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
88 } |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
89 |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
90 // Do a quick check if an exception occurred... |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
91 // Display then clear it so we can continue... |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
92 // Return TRUE if an exception had occurred |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
93 int _dw_jni_check_exception(JNIEnv *env) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
94 { |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
95 if(env->ExceptionCheck()) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
96 { |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
97 env->ExceptionDescribe(); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
98 env->ExceptionClear(); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
99 return TRUE; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
100 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
101 return FALSE; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
102 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
103 |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
104 #define _DW_REFERENCE_NONE 0 |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
105 #define _DW_REFERENCE_WEAK 1 |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
106 #define _DW_REFERENCE_STRONG 2 |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
107 |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
108 // Handle returns from JNI functions and make sure the |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
109 // return value is sane... |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
110 // Reference: 0 no reference 1 weak 2 strong |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
111 jobject _dw_jni_check_result(JNIEnv *env, jobject obj, int reference) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
112 { |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
113 jobject result = nullptr; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
114 |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
115 if(!_dw_jni_check_exception(env) && obj) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
116 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
117 if(reference == _DW_REFERENCE_WEAK) |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
118 result = env->NewWeakGlobalRef(obj); |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
119 else if(reference == _DW_REFERENCE_STRONG) |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
120 result = env->NewGlobalRef(obj); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
121 else |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
122 result = obj; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
123 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
124 return result; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
125 } |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
126 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
127 /* Call the dwmain entry point, Android has no args, so just pass the app path */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
128 void _dw_main_launch(char *arg) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
129 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
130 static HEV startup = nullptr; |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
131 |
2496
3bf2f08fdc45
Android: Remove ugly workaround for initialization issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2495
diff
changeset
|
132 /* Safety check to prevent multiple initializations... */ |
2511
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
133 if(startup) |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
134 { |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
135 /* If we are called a second time.. post the event... |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
136 * so we stop waiting. |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
137 */ |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
138 dw_event_post(startup); |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
139 return; |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
140 } |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
141 else |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
142 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
143 char *argv[2] = {arg, nullptr}; |
2511
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
144 |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
145 /* Wait for a short while to see if we get called again... |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
146 * if we get called again we will be posted, if not... |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
147 * just wait for the timer to expire. |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
148 */ |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
149 startup = dw_event_new(); |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
150 /* Wait for 10 seconds to see if we get called again */ |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
151 dw_event_wait(startup, 10000); |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
152 |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
153 /* Continue after being posted or after our timeout */ |
2513
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
154 dwmain(1, argv); |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
155 } |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
156 free(arg); |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
157 } |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
158 |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
159 /* Called when DWindows activity starts up... so we create a thread |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
160 * to call the dwmain() entrypoint... then we wait for dw_main() |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
161 * to be called and return. |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
162 * Parameters: |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
163 * path: The path to the Android app. |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
164 */ |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
165 JNIEXPORT void JNICALL |
2658
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
166 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring apppath, jstring appcache, jstring appID) |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
167 { |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
168 char *arg = strdup(env->GetStringUTFChars((jstring)apppath, nullptr)); |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
169 const char *cache = env->GetStringUTFChars((jstring)appcache, nullptr); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
170 const char *appid = env->GetStringUTFChars((jstring)appID, nullptr); |
2658
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
171 char *home = getenv("HOME"); |
2513
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
172 |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
173 if(!_dw_main_event) |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
174 { |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
175 /* Save our class object pointer for later */ |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
176 _dw_obj = env->NewGlobalRef(obj); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
177 |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
178 /* Save the JNIEnv for the main thread */ |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
179 pthread_key_create(&_dw_env_key, nullptr); |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
180 pthread_setspecific(_dw_env_key, env); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
181 pthread_key_create(&_dw_fgcolor_key, nullptr); |
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
182 pthread_setspecific(_dw_fgcolor_key, nullptr); |
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
183 pthread_key_create(&_dw_bgcolor_key, nullptr); |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
184 pthread_setspecific(_dw_bgcolor_key, (void *)DW_RGB_TRANSPARENT); |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
185 |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
186 /* Create the dwmain event */ |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
187 _dw_main_event = dw_event_new(); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
188 } |
2513
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
189 |
2658
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
190 if(cache) |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
191 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
192 /* Store the passed in path for dw_app_dir() */ |
2658
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
193 strncpy(_dw_exec_dir, cache, MAX_PATH); |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
194 } |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
195 /* Store the best path for dw_user_dir() */ |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
196 if(home) |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
197 strncpy(_dw_user_dir, home, MAX_PATH); |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
198 else if(arg) |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
199 strncpy(_dw_user_dir, arg, MAX_PATH); |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
200 else |
ad6fc7f1a9af
Android: Asset/Resource refactoring for compatibility with other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2657
diff
changeset
|
201 strcpy(_dw_user_dir, "/"); |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
202 if(appid) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
203 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
204 /* Store our reported Android AppID */ |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
205 strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
206 } |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
207 |
2513
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
208 /* Launch the new thread to execute dwmain() */ |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
209 dw_thread_new((void *) _dw_main_launch, arg, 0); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
210 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
211 |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
212 typedef struct _dwsighandler |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
213 { |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
214 struct _dwsighandler *next; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
215 ULONG message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
216 HWND window; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
217 int id; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
218 void *signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
219 void *discfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
220 void *data; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
221 |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
222 } DWSignalHandler; |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
223 |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
224 static DWSignalHandler *DWRoot = nullptr; |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
225 |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
226 DWSignalHandler *_dw_get_handler(HWND window, int messageid) |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
227 { |
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
228 DWSignalHandler *tmp = DWRoot; |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
229 JNIEnv *env; |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
230 |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
231 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
232 /* Find any callbacks for this function */ |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
233 while (tmp) { |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
234 if (tmp->message == messageid && env->IsSameObject(window, tmp->window)) { |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
235 return tmp; |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
236 } |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
237 tmp = tmp->next; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
238 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
239 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
240 return nullptr; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
241 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
242 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
243 typedef struct |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
244 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
245 ULONG message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
246 char name[30]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
247 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
248 } DWSignalList; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
249 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
250 /* List of signals */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
251 #define SIGNALMAX 19 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
252 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
253 static DWSignalList DWSignalTranslate[SIGNALMAX] = { |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
254 { _DW_EVENT_CONFIGURE, DW_SIGNAL_CONFIGURE }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
255 { _DW_EVENT_KEY_PRESS, DW_SIGNAL_KEY_PRESS }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
256 { _DW_EVENT_BUTTON_PRESS, DW_SIGNAL_BUTTON_PRESS }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
257 { _DW_EVENT_BUTTON_RELEASE, DW_SIGNAL_BUTTON_RELEASE }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
258 { _DW_EVENT_MOTION_NOTIFY, DW_SIGNAL_MOTION_NOTIFY }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
259 { _DW_EVENT_DELETE, DW_SIGNAL_DELETE }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
260 { _DW_EVENT_EXPOSE, DW_SIGNAL_EXPOSE }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
261 { _DW_EVENT_CLICKED, DW_SIGNAL_CLICKED }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
262 { _DW_EVENT_ITEM_ENTER, DW_SIGNAL_ITEM_ENTER }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
263 { _DW_EVENT_ITEM_CONTEXT, DW_SIGNAL_ITEM_CONTEXT }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
264 { _DW_EVENT_LIST_SELECT, DW_SIGNAL_LIST_SELECT }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
265 { _DW_EVENT_ITEM_SELECT, DW_SIGNAL_ITEM_SELECT }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
266 { _DW_EVENT_SET_FOCUS, DW_SIGNAL_SET_FOCUS }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
267 { _DW_EVENT_VALUE_CHANGED, DW_SIGNAL_VALUE_CHANGED }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
268 { _DW_EVENT_SWITCH_PAGE, DW_SIGNAL_SWITCH_PAGE }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
269 { _DW_EVENT_TREE_EXPAND, DW_SIGNAL_TREE_EXPAND }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
270 { _DW_EVENT_COLUMN_CLICK, DW_SIGNAL_COLUMN_CLICK }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
271 { _DW_EVENT_HTML_RESULT, DW_SIGNAL_HTML_RESULT }, |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
272 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED } |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
273 }; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
274 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
275 #define _DW_EVENT_PARAM_SIZE 10 |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
276 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
277 int _dw_event_handler2(void **params) |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
278 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
279 DWSignalHandler *handler = (DWSignalHandler *)params[9]; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
280 int message = DW_POINTER_TO_INT(params[8]); |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
281 int retval = -1; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
282 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
283 if(handler) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
284 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
285 switch(message) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
286 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
287 /* Timer event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
288 case _DW_EVENT_TIMER: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
289 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
290 int (*timerfunc)(void *) = (int (* API)(void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
291 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
292 if(!timerfunc(handler->data)) |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
293 dw_timer_disconnect(handler->window); |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
294 retval = 0; |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
295 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
296 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
297 /* Configure/Resize event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
298 case _DW_EVENT_CONFIGURE: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
299 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
300 int (*sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
301 int width = DW_POINTER_TO_INT(params[3]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
302 int height = DW_POINTER_TO_INT(params[4]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
303 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
304 if(width > 0 && height > 0) |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
305 retval = sizefunc(handler->window, width, height, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
306 else |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
307 retval = 0; |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
308 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
309 } |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
310 case _DW_EVENT_KEY_PRESS: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
311 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
312 int (*keypressfunc)(HWND, char, int, int, void *, char *) = (int (* API)(HWND, char, int, int, void *, char *))handler->signalfunction; |
2596
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
313 char *utf8 = (char *)params[1], ch = (char)DW_POINTER_TO_INT(params[3]); |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
314 int vk = DW_POINTER_TO_INT(params[4]), special = DW_POINTER_TO_INT(params[5]); |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
315 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
316 retval = keypressfunc(handler->window, ch, (int)vk, special, handler->data, utf8); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
317 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
318 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
319 /* Button press and release event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
320 case _DW_EVENT_BUTTON_PRESS: |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
321 case _DW_EVENT_BUTTON_RELEASE: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
322 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
323 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
2608
a11522c30345
Android: Add initial code to handle button presses and long clicks on DWRender.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2607
diff
changeset
|
324 int button = params[5] ? DW_POINTER_TO_INT(params[5]) : 1; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
325 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
326 retval = buttonfunc(handler->window, DW_POINTER_TO_INT(params[3]), DW_POINTER_TO_INT(params[4]), button, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
327 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
328 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
329 /* Motion notify event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
330 case _DW_EVENT_MOTION_NOTIFY: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
331 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
332 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
333 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
334 retval = motionfunc(handler->window, DW_POINTER_TO_INT(params[3]), DW_POINTER_TO_INT(params[4]), DW_POINTER_TO_INT(params[5]), handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
335 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
336 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
337 /* Window close event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
338 case _DW_EVENT_DELETE: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
339 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
340 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
341 retval = closefunc(handler->window, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
342 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
343 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
344 /* Window expose/draw event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
345 case _DW_EVENT_EXPOSE: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
346 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
347 DWExpose exp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
348 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
349 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
350 exp.x = DW_POINTER_TO_INT(params[3]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
351 exp.y = DW_POINTER_TO_INT(params[4]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
352 exp.width = DW_POINTER_TO_INT(params[5]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
353 exp.height = DW_POINTER_TO_INT(params[6]); |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
354 retval = exposefunc(handler->window, &exp, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
355 /* Return here so we don't free params since we |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
356 * are always handling expose/draw on the UI thread. |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
357 */ |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
358 return retval; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
359 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
360 /* Clicked event for buttons and menu items */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
361 case _DW_EVENT_CLICKED: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
362 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
363 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
364 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
365 retval = clickfunc(handler->window, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
366 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
367 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
368 /* Container class selection event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
369 case _DW_EVENT_ITEM_ENTER: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
370 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
371 int (*containerselectfunc)(HWND, char *, void *, void *) =(int (* API)(HWND, char *, void *, void *)) handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
372 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
373 retval = containerselectfunc(handler->window, (char *)params[1], handler->data, params[7]); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
374 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
375 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
376 /* Container context menu event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
377 case _DW_EVENT_ITEM_CONTEXT: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
378 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
379 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
380 char *text = (char *)params[1]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
381 void *user = params[7]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
382 int x = DW_POINTER_TO_INT(params[3]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
383 int y = DW_POINTER_TO_INT(params[4]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
384 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
385 retval = containercontextfunc(handler->window, text, x, y, handler->data, user); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
386 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
387 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
388 /* Generic selection changed event for several classes */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
389 case _DW_EVENT_LIST_SELECT: |
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
390 case _DW_EVENT_VALUE_CHANGED: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
391 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
392 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
393 int selected = DW_POINTER_TO_INT(params[3]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
394 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
395 retval = valuechangedfunc(handler->window, selected, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
396 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
397 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
398 /* Tree class selection event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
399 case _DW_EVENT_ITEM_SELECT: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
400 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
401 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
402 char *text = (char *)params[1]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
403 void *user = params[7]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
404 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
405 retval = treeselectfunc(handler->window, params[0], text, handler->data, user); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
406 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
407 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
408 /* Set Focus event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
409 case _DW_EVENT_SET_FOCUS: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
410 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
411 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
412 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
413 retval = setfocusfunc(handler->window, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
414 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
415 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
416 /* Notebook page change event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
417 case _DW_EVENT_SWITCH_PAGE: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
418 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
419 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction; |
2495
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
420 unsigned long pageID = DW_POINTER_TO_INT(params[3]); |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
421 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
422 retval = switchpagefunc(handler->window, pageID, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
423 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
424 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
425 /* Tree expand event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
426 case _DW_EVENT_TREE_EXPAND: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
427 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
428 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
429 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
430 retval = treeexpandfunc(handler->window, (HTREEITEM)params[0], handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
431 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
432 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
433 /* Column click event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
434 case _DW_EVENT_COLUMN_CLICK: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
435 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
436 int (* API clickcolumnfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
437 int column_num = DW_POINTER_TO_INT(params[3]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
438 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
439 retval = clickcolumnfunc(handler->window, column_num, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
440 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
441 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
442 /* HTML result event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
443 case _DW_EVENT_HTML_RESULT: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
444 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
445 int (* API htmlresultfunc)(HWND, int, char *, void *, void *) = (int (* API)(HWND, int, char *, void *, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
446 char *result = (char *)params[1]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
447 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
448 retval = htmlresultfunc(handler->window, result ? DW_ERROR_NONE : DW_ERROR_UNKNOWN, result, params[7], handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
449 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
450 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
451 /* HTML changed event */ |
2620
dcd71b04cc46
Android: Add internal event constants for more clarity about what code does.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2608
diff
changeset
|
452 case _DW_EVENT_HTML_CHANGED: |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
453 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
454 int (* API htmlchangedfunc)(HWND, int, char *, void *) = (int (* API)(HWND, int, char *, void *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
455 char *uri = (char *)params[1]; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
456 |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
457 retval = htmlchangedfunc(handler->window, DW_POINTER_TO_INT(params[3]), uri, handler->data); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
458 break; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
459 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
460 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
461 } |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
462 #ifdef _DW_EVENT_THREADING |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
463 /* Free the memory we allocated for this tread */ |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
464 if(params[1]) |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
465 free(params[1]); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
466 if(params[2]) |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
467 free(params[2]); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
468 free(params); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
469 #endif |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
470 return retval; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
471 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
472 |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
473 /* If we aren't using threading, we create a queue of events... |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
474 * the oldest event indexed by _dw_event_head, the newest by |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
475 * _dw_event_tail. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
476 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
477 #ifndef _DW_EVENT_THREADING |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
478 #define _DW_EVENT_QUEUE_LENGTH 10 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
479 void *_dw_event_queue[_DW_EVENT_QUEUE_LENGTH][_DW_EVENT_PARAM_SIZE]; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
480 int _dw_event_head = -1, _dw_event_tail = -1, _dw_main_active = TRUE; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
481 HMTX _dw_event_mutex = nullptr; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
482 DWTID _dw_main_thread = -1; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
483 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
484 /* Add a new event to the queue if there is space. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
485 * This will be handled in the thread running dw_main() |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
486 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
487 int _dw_queue_event(void **params) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
488 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
489 int newtail = _dw_event_tail + 1; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
490 int retval = FALSE; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
491 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
492 /* Initialize the mutex if necessary... return on failure. */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
493 if(!_dw_event_mutex && !(_dw_event_mutex = dw_mutex_new())) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
494 return retval; |
2632
04d5c8147e33
Android: mainSleep seems to be hanging, so switch to using dw_mutex_trylock()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2631
diff
changeset
|
495 |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
496 /* Protect the queue in a mutex... hold for as short as possible */ |
2632
04d5c8147e33
Android: mainSleep seems to be hanging, so switch to using dw_mutex_trylock()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2631
diff
changeset
|
497 while(dw_mutex_trylock(_dw_event_mutex) != DW_ERROR_NONE) |
04d5c8147e33
Android: mainSleep seems to be hanging, so switch to using dw_mutex_trylock()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2631
diff
changeset
|
498 sched_yield(); |
04d5c8147e33
Android: mainSleep seems to be hanging, so switch to using dw_mutex_trylock()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2631
diff
changeset
|
499 |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
500 /* If we are at the end of the queue, loop back to the start. */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
501 if(newtail >= _DW_EVENT_QUEUE_LENGTH) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
502 newtail = 0; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
503 /* If the new tail will be at the head, the event queue |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
504 * if full... drop the event. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
505 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
506 if(newtail != _dw_event_head) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
507 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
508 /* If the queue was empty, head and tail will be the same. */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
509 if (_dw_event_head == -1) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
510 _dw_event_head = newtail; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
511 /* Copy the new event from the stack into the event queue. */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
512 memcpy(&_dw_event_queue[newtail], params, _DW_EVENT_PARAM_SIZE * sizeof(void *)); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
513 /* Update the tail index */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
514 _dw_event_tail = newtail; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
515 /* Successfully queued event */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
516 retval = TRUE; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
517 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
518 dw_mutex_unlock(_dw_event_mutex); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
519 return retval; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
520 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
521 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
522 /* If there is an event waiting, pop it off the queue, |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
523 * advance the head and return TRUE. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
524 * If there are no events waiting return FALSE |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
525 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
526 int _dw_dequeue_event(void **params) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
527 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
528 int retval = FALSE; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
529 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
530 /* Initialize the mutex if necessary... return FALSE on failure. */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
531 if(!_dw_event_mutex && !(_dw_event_mutex = dw_mutex_new())) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
532 return retval; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
533 dw_mutex_lock(_dw_event_mutex); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
534 if(_dw_event_head != -1) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
535 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
536 /* Copy the params out of the queue so it can be filled in by new events */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
537 memcpy(params, &_dw_event_queue[_dw_event_head], _DW_EVENT_PARAM_SIZE * sizeof(void *)); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
538 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
539 /* If the head is the same as the tail... |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
540 * there was only one event... so set the |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
541 * head and tail to -1 to indicate empty. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
542 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
543 if(_dw_event_head == _dw_event_tail) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
544 _dw_event_head = _dw_event_tail = -1; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
545 else |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
546 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
547 /* Advance the head */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
548 _dw_event_head++; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
549 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
550 /* If we are at the end of the queue, loop back to the start. */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
551 if(_dw_event_head >= _DW_EVENT_QUEUE_LENGTH) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
552 _dw_event_head = 0; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
553 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
554 /* Successfully dequeued event */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
555 retval = TRUE; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
556 /* Notify dw_main() that there is an event to handle */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
557 dw_event_post(_dw_main_event); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
558 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
559 dw_mutex_unlock(_dw_event_mutex); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
560 return retval; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
561 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
562 #endif |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
563 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
564 int _dw_event_handler(jobject object, void **params) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
565 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
566 DWSignalHandler *handler = _dw_get_handler(object, DW_POINTER_TO_INT(params[8])); |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
567 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
568 if (handler) |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
569 { |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
570 params[9] = (void *)handler; |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
571 |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
572 /* We have to handle draw events in the main thread... |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
573 * If it isn't a draw event, either queue the event |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
574 * or launch a new thread to handle it. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
575 */ |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
576 if(DW_POINTER_TO_INT(params[8]) != 7) |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
577 { |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
578 #ifdef _DW_EVENT_THREADING |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
579 /* Make a copy of the params so it isn't allocated from the stack */ |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
580 void *newparams = calloc(_DW_EVENT_PARAM_SIZE, sizeof(void *)); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
581 |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
582 memcpy(newparams, params, _DW_EVENT_PARAM_SIZE * sizeof(void *)); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
583 dw_thread_new((void *) _dw_event_handler2, newparams, 0); |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
584 #else |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
585 /* Push the new event onto the queue if it fits */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
586 _dw_queue_event(params); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
587 #endif |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
588 } |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
589 else |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
590 return _dw_event_handler2(params); |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
591 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
592 } |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
593 return 0; |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
594 } |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
595 |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
596 /* |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
597 * Entry location for all event handlers from the Android UI |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
598 */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
599 JNIEXPORT jint JNICALL |
2484
cb5b67154399
Android: The DWindows class should be org.dbsoft.dwindows, remove dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2483
diff
changeset
|
600 Java_org_dbsoft_dwindows_DWindows_eventHandler(JNIEnv* env, jobject obj, jobject obj1, jobject obj2, |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
601 jint message, jstring str1, jstring str2, |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
602 jint inta, jint intb, jint intc, jint intd) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
603 #ifdef _DW_EVENT_THREADING |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
604 char *utf81 = str1 ? strdup(env->GetStringUTFChars(str1, nullptr)) : nullptr; |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
605 char *utf82 = str2 ? strdup(env->GetStringUTFChars(str2, nullptr)) : nullptr; |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
606 #else |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
607 const char *utf81 = str1 ? env->GetStringUTFChars(str1, nullptr) : nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
608 const char *utf82 = str2 ? env->GetStringUTFChars(str2, nullptr) : nullptr; |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
609 #endif |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
610 void *params[_DW_EVENT_PARAM_SIZE] = { (void *)obj2, (void *)utf81, (void *)utf82, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
611 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
612 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
613 DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
614 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
615 return _dw_event_handler(obj1, params); |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
616 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
617 |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
618 /* A more simple method for quicker calls */ |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
619 JNIEXPORT void JNICALL |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
620 Java_org_dbsoft_dwindows_DWindows_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
621 { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
622 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
623 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
624 params[8] = DW_INT_TO_POINTER(message); |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
625 _dw_event_handler(obj1, params); |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
626 } |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
627 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
628 /* Handler for notebook page changes */ |
2495
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
629 JNIEXPORT void JNICALL |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
630 Java_org_dbsoft_dwindows_DWindows_eventHandlerNotebook(JNIEnv* env, jobject obj, jobject obj1, jint message, jlong pageID) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
631 { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
632 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
633 |
2577
6fdab466d7a2
Android: Fix notebook page change event page always being 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2572
diff
changeset
|
634 params[3] = DW_INT_TO_POINTER(pageID); |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
635 params[8] = DW_INT_TO_POINTER(message); |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
636 _dw_event_handler(obj1, params); |
2495
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
637 } |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
638 |
2505
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
639 /* Handlers for HTML events */ |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
640 JNIEXPORT void JNICALL |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
641 Java_org_dbsoft_dwindows_DWindows_eventHandlerHTMLResult(JNIEnv* env, jobject obj, jobject obj1, |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
642 jint message, jstring htmlResult, jlong data) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
643 #ifdef _DW_EVENT_THREADING |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
644 char *result = strdup(env->GetStringUTFChars(htmlResult, nullptr)); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
645 #else |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
646 const char *result = env->GetStringUTFChars(htmlResult, nullptr); |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
647 #endif |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
648 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, DW_POINTER(result), nullptr, nullptr, nullptr, nullptr, nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
649 DW_INT_TO_POINTER(data), DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
650 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
651 _dw_event_handler(obj1, params); |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
652 } |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
653 |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
654 JNIEXPORT void JNICALL |
2505
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
655 Java_org_dbsoft_dwindows_DWWebViewClient_eventHandlerHTMLChanged(JNIEnv* env, jobject obj, jobject obj1, |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
656 jint message, jstring URI, jint status) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
657 #ifdef _DW_EVENT_THREADING |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
658 char *uri = strdup(env->GetStringUTFChars(URI, nullptr)); |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
659 #else |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
660 const char *uri = env->GetStringUTFChars(URI, nullptr); |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
661 #endif |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
662 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, DW_POINTER(uri), nullptr, DW_INT_TO_POINTER(status), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
663 nullptr, nullptr, nullptr, nullptr, DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
664 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
665 _dw_event_handler(obj1, params); |
2505
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
666 } |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
667 |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
668 JNIEXPORT void JNICALL |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
669 Java_org_dbsoft_dwindows_DWindows_eventHandlerInt(JNIEnv* env, jobject obj, jobject obj1, jint message, |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
670 jint inta, jint intb, jint intc, jint intd) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
671 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, nullptr, nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
672 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
673 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
674 DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
675 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
676 _dw_event_handler(obj1, params); |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
677 } |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
678 |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
679 JNIEXPORT void JNICALL |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
680 Java_org_dbsoft_dwindows_DWComboBox_eventHandlerInt(JNIEnv* env, jobject obj, jint message, |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
681 jint inta, jint intb, jint intc, jint intd) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
682 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, nullptr, nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
683 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
684 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
685 DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
686 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
687 _dw_event_handler(obj, params); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
688 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
689 |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
690 JNIEXPORT void JNICALL |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
691 Java_org_dbsoft_dwindows_DWSpinButton_eventHandlerInt(JNIEnv* env, jobject obj, jint message, |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
692 jint inta, jint intb, jint intc, jint intd) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
693 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, nullptr, nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
694 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
695 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
696 DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
697 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
698 _dw_event_handler(obj, params); |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
699 } |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
700 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
701 JNIEXPORT void JNICALL |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
702 Java_org_dbsoft_dwindows_DWListBox_eventHandlerInt(JNIEnv* env, jobject obj, jint message, |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
703 jint inta, jint intb, jint intc, jint intd) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
704 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, nullptr, nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
705 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
706 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
707 DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
708 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
709 _dw_event_handler(obj, params); |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
710 } |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
711 |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
712 JNIEXPORT void JNICALL |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
713 Java_org_dbsoft_dwindows_DWRender_eventHandlerInt(JNIEnv* env, jobject obj, jint message, |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
714 jint inta, jint intb, jint intc, jint intd) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
715 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, nullptr, nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
716 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
717 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), nullptr, |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
718 DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
719 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
720 _dw_event_handler(obj, params); |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
721 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
722 |
2560
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
723 JNIEXPORT void JNICALL |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
724 Java_org_dbsoft_dwindows_DWindows_eventHandlerContainer(JNIEnv* env, jobject obj, jobject obj1, |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
725 jint message, jstring jtitle, jint x, jint y, jlong data) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
726 #ifdef _DW_EVENT_THREADING |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
727 char *title = jtitle ? strdup(env->GetStringUTFChars(jtitle, nullptr)) : nullptr; |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
728 #else |
2560
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
729 const char *title = jtitle ? env->GetStringUTFChars(jtitle, nullptr) : nullptr; |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
730 #endif |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
731 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, DW_POINTER(title), nullptr, DW_INT_TO_POINTER(x), DW_INT_TO_POINTER(y), |
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
732 nullptr, nullptr, (void *)data, DW_INT_TO_POINTER(message), nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
733 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
734 _dw_event_handler(obj1, params); |
2560
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
735 } |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
736 |
2596
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
737 JNIEXPORT void JNICALL |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
738 Java_org_dbsoft_dwindows_DWindows_eventHandlerKey(JNIEnv *env, jobject obj, jobject obj1, jint message, jint ch, |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
739 jint vk, jint modifiers, jstring str) { |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
740 #ifdef _DW_EVENT_THREADING |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
741 char *cstr = str ? strdup(env->GetStringUTFChars(str, nullptr)) : nullptr; |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
742 #else |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
743 const char *cstr = str ? env->GetStringUTFChars(str, nullptr) : nullptr; |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
744 #endif |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
745 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr, DW_POINTER(cstr), nullptr, DW_INT_TO_POINTER(ch), DW_INT_TO_POINTER(vk), |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
746 DW_INT_TO_POINTER(modifiers), nullptr, nullptr, DW_INT_TO_POINTER(message), nullptr }; |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
747 |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
748 _dw_event_handler(obj1, params); |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
749 } |
60ec91d23746
Android: Add initial keyboard support for Android.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2584
diff
changeset
|
750 |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
751 /* Handler for Timer events */ |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
752 JNIEXPORT jint JNICALL |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
753 Java_org_dbsoft_dwindows_DWindows_eventHandlerTimer(JNIEnv* env, jobject obj, jlong sigfunc, jlong data) { |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
754 int (*timerfunc)(void *) = (int (* API)(void *))sigfunc; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
755 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
756 pthread_setspecific(_dw_env_key, env); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
757 return timerfunc((void *)data); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
758 } |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
759 |
2544
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
760 /* A more simple method for quicker calls */ |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
761 JNIEXPORT void JNICALL |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
762 Java_org_dbsoft_dwindows_DWMenu_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) { |
2571
e34b627b2491
Android: Functional version of the event threading changes... this improves stability...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2566
diff
changeset
|
763 void *params[_DW_EVENT_PARAM_SIZE] = { nullptr }; |
2566
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
764 |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
765 params[8] = DW_INT_TO_POINTER(message); |
4427af56eebe
Android: Add experimental event threading code, currently disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2561
diff
changeset
|
766 _dw_event_handler(obj1, params); |
2544
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
767 } |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
768 |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
769 |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
770 /* This function adds a signal handler callback into the linked list. |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
771 */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
772 void _dw_new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
773 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
774 DWSignalHandler *newsig = (DWSignalHandler *)malloc(sizeof(DWSignalHandler)); |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
775 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
776 newsig->message = message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
777 newsig->window = window; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
778 newsig->id = msgid; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
779 newsig->signalfunction = signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
780 newsig->discfunction = discfunc; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
781 newsig->data = data; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
782 newsig->next = nullptr; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
783 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
784 if (!DWRoot) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
785 DWRoot = newsig; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
786 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
787 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
788 DWSignalHandler *prev = nullptr, *tmp = DWRoot; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
789 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
790 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
791 if(tmp->message == message && |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
792 tmp->window == window && |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
793 tmp->id == msgid && |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
794 tmp->signalfunction == signalfunction) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
795 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
796 tmp->data = data; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
797 free(newsig); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
798 return; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
799 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
800 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
801 tmp = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
802 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
803 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
804 prev->next = newsig; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
805 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
806 DWRoot = newsig; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
807 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
808 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
809 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
810 /* Finds the message number for a given signal name */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
811 ULONG _dw_findsigmessage(const char *signame) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
812 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
813 int z; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
814 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
815 for(z=0;z<SIGNALMAX;z++) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
816 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
817 if(strcasecmp(signame, DWSignalTranslate[z].name) == 0) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
818 return DWSignalTranslate[z].message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
819 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
820 return 0L; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
821 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
822 |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
823 unsigned long _dw_colors[] = |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
824 { |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
825 0x00000000, /* 0 black */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
826 0x000000bb, /* 1 red */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
827 0x0000bb00, /* 2 green */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
828 0x0000aaaa, /* 3 yellow */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
829 0x00cc0000, /* 4 blue */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
830 0x00bb00bb, /* 5 magenta */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
831 0x00bbbb00, /* 6 cyan */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
832 0x00bbbbbb, /* 7 white */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
833 0x00777777, /* 8 grey */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
834 0x000000ff, /* 9 bright red */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
835 0x0000ff00, /* 10 bright green */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
836 0x0000eeee, /* 11 bright yellow */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
837 0x00ff0000, /* 12 bright blue */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
838 0x00ff00ff, /* 13 bright magenta */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
839 0x00eeee00, /* 14 bright cyan */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
840 0x00ffffff, /* 15 bright white */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
841 0xff000000 /* 16 default color */ |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
842 }; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
843 |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
844 /* Return the RGB color regardless if a predefined color was passed */ |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
845 jlong _dw_get_color(unsigned long thiscolor) |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
846 { |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
847 if(thiscolor & DW_RGB_COLOR) |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
848 { |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
849 return ((jlong)thiscolor) & ~DW_RGB_COLOR; |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
850 } |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
851 else if(thiscolor < 17) |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
852 { |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
853 return _dw_colors[thiscolor]; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
854 } |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
855 else if(thiscolor == DW_RGB_TRANSPARENT) |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
856 { |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
857 return -1; |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
858 } |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
859 return 0; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
860 } |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
861 |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
862 int _dw_dark_mode_detected() |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
863 { |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
864 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
865 int retval = DW_ERROR_UNKNOWN; |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
866 |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
867 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
868 { |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
869 // First get the class that contains the method you need to call |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
870 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
871 // Get the method that you want to call |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
872 jmethodID darkModeDetected = env->GetMethodID(clazz, "darkModeDetected", |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
873 "()I"); |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
874 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
875 retval = env->CallIntMethod(_dw_obj, darkModeDetected); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
876 _dw_jni_check_exception(env); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
877 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
878 return retval; |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
879 } |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
880 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
881 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
882 * Runs a message loop for Dynamic Windows. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
883 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
884 void API dw_main(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
885 { |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
886 JNIEnv *env; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
887 |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
888 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
889 { |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
890 // First get the class that contains the method you need to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
891 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
892 // Get the method that you want to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
893 jmethodID dwMain = env->GetMethodID(clazz, "dwMain", |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
894 "()V"); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
895 // Call the method on the object |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
896 env->CallVoidMethod(_dw_obj, dwMain); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
897 _dw_jni_check_exception(env); |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
898 } |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
899 |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
900 #ifdef _DW_EVENT_THREADING |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
901 /* We don't actually run a loop here, |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
902 * we launched a new thread to run the loop there. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
903 * Just wait for dw_main_quit() on the DWMainEvent. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
904 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
905 dw_event_wait(_dw_main_event, DW_TIMEOUT_INFINITE); |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
906 #else |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
907 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
908 /* Save our thread ID, so we know if we should handle |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
909 * events in callback dw_main_sleep/iteration() calls. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
910 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
911 _dw_main_thread = dw_thread_id(); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
912 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
913 do |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
914 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
915 void *params[_DW_EVENT_PARAM_SIZE]; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
916 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
917 dw_event_reset(_dw_main_event); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
918 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
919 /* Dequeue and handle any pending events */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
920 while(_dw_dequeue_event(params)) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
921 _dw_event_handler2(params); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
922 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
923 /* Wait for something to wake us up, |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
924 * either a posted event, or dw_main_quit() |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
925 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
926 dw_event_wait(_dw_main_event, 100); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
927 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
928 } while(_dw_main_active); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
929 _dw_main_thread = -1; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
930 #endif |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
931 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
932 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
933 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
934 * Causes running dw_main() to return. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
935 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
936 void API dw_main_quit(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
937 { |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
938 #ifndef _DW_EVENT_THREADING |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
939 _dw_main_active = FALSE; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
940 #endif |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
941 dw_event_post(_dw_main_event); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
942 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
943 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
944 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
945 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
946 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
947 * milliseconds: Number of milliseconds to run the loop for. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
948 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
949 void API dw_main_sleep(int milliseconds) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
950 { |
2514
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
951 JNIEnv *env; |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
952 |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
953 #ifndef _DW_EVENT_THREADING |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
954 /* If we are in an event callback from dw_main() ... |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
955 * we need to continue handling events from the UI. |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
956 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
957 if(_dw_main_thread == dw_thread_id()) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
958 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
959 struct timeval tv, start; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
960 /* The time left to wait from the start */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
961 int difference = milliseconds; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
962 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
963 gettimeofday(&start, NULL); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
964 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
965 do |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
966 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
967 void *params[_DW_EVENT_PARAM_SIZE]; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
968 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
969 dw_event_reset(_dw_main_event); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
970 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
971 /* Dequeue and handle any pending events */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
972 while(_dw_dequeue_event(params)) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
973 _dw_event_handler2(params); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
974 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
975 /* Wait for something to wake us up, |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
976 * either a posted event, or dw_main_quit() |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
977 */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
978 dw_event_wait(_dw_main_event, difference); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
979 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
980 gettimeofday(&tv, NULL); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
981 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
982 } while(_dw_main_active && (difference = ((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000)) <= milliseconds); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
983 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
984 else |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
985 #endif |
2514
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
986 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
987 { |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
988 // First get the class that contains the method you need to call |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
989 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
990 // Get the method that you want to call |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
991 jmethodID mainSleep = env->GetMethodID(clazz, "mainSleep", |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
992 "(I)V"); |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
993 // Call the method on the object |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
994 env->CallVoidMethod(_dw_obj, mainSleep, milliseconds); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
995 _dw_jni_check_exception(env); |
2514
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
996 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
997 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
998 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
999 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1000 * Processes a single message iteration and returns. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1001 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1002 void API dw_main_iteration(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1003 { |
2631
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1004 #ifndef _DW_EVENT_THREADING |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1005 if(_dw_main_thread == dw_thread_id()) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1006 { |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1007 void *params[_DW_EVENT_PARAM_SIZE]; |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1008 |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1009 /* Dequeue a single pending event */ |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1010 if (_dw_dequeue_event(params)) |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1011 _dw_event_handler2(params); |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1012 } |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1013 else |
e9f4f0d2e5da
Android: Implement an event queue that will be handled by dw_main() and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2626
diff
changeset
|
1014 #endif |
2514
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
1015 /* If we sleep for 0 milliseconds... we will drop out |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
1016 * of the loop at the first idle moment |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
1017 */ |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
1018 dw_main_sleep(0); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1019 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1020 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1021 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1022 * Cleanly terminates a DW session, should be signal handler safe. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1023 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1024 * exitcode: Exit code reported to the operating system. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1025 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1026 void API dw_exit(int exitcode) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1027 { |
2487
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1028 JNIEnv *env; |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1029 |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1030 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1031 { |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1032 // First get the class that contains the method you need to call |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1033 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1034 // Get the method that you want to call |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1035 jmethodID dwindowsExit = env->GetMethodID(clazz, "dwindowsExit", |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1036 "(I)V"); |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1037 // Call the method on the object |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1038 env->CallVoidMethod(_dw_obj, dwindowsExit, exitcode); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1039 _dw_jni_check_exception(env); |
2487
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
1040 } |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
1041 // We shouldn't get here, but in case JNI can't call dwindowsExit... |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1042 exit(exitcode); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1043 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1044 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1045 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1046 * Free's memory allocated by dynamic windows. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1047 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1048 * ptr: Pointer to dynamic windows allocated |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1049 * memory to be free()'d. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1050 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1051 void API dw_free(void *ptr) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1052 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1053 free(ptr); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1054 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1055 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1056 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1057 * Returns a pointer to a static buffer which contains the |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1058 * current user directory. Or the root directory if it could |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1059 * not be determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1060 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1061 char * API dw_user_dir(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1062 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1063 return _dw_user_dir; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1064 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1065 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1066 /* |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1067 * Returns a pointer to a static buffer which contains the |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1068 * private application data directory. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1069 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1070 char * API dw_app_dir(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1071 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1072 /* The path is passed in via JNI dwindowsInit() */ |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1073 return _dw_exec_dir; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1074 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1075 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1076 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1077 * Sets the application ID used by this Dynamic Windows application instance. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1078 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1079 * appid: A string typically in the form: com.company.division.application |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1080 * appname: The application name used on Windows or nullptr. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1081 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1082 * DW_ERROR_NONE after successfully setting the application ID. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1083 * DW_ERROR_UNKNOWN if unsupported on this system. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1084 * DW_ERROR_GENERAL if the application ID is not allowed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1085 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1086 * This must be called before dw_init(). If dw_init() is called first |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1087 * it will create a unique ID in the form: org.dbsoft.dwindows.application |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1088 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1089 * The appname is used on Windows and Android. If nullptr is passed the |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1090 * detected name will be used, but a prettier name may be desired. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1091 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1092 int API dw_app_id_set(const char *appid, const char *appname) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1093 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1094 if(appid) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1095 strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1096 if(appname) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1097 strncpy(_dw_app_name, appname, _DW_APP_ID_SIZE); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
1098 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1099 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1100 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1101 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1102 * Displays a debug message on the console... |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1103 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1104 * format: printf style format string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1105 * ...: Additional variables for use in the format. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1106 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1107 void API dw_debug(const char *format, ...) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1108 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1109 va_list args; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1110 char outbuf[1025] = {0}; |
2482
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1111 JNIEnv *env; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1112 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1113 va_start(args, format); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1114 vsnprintf(outbuf, 1024, format, args); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1115 va_end(args); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1116 |
2482
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1117 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1118 { |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1119 // Construct a String |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1120 jstring jstr = env->NewStringUTF(outbuf); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1121 // First get the class that contains the method you need to call |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1122 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1123 // Get the method that you want to call |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1124 jmethodID debugMessage = env->GetMethodID(clazz, "debugMessage", |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1125 "(Ljava/lang/String;)V"); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1126 // Call the method on the object |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1127 env->CallVoidMethod(_dw_obj, debugMessage, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1128 _dw_jni_check_exception(env); |
2482
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1129 } |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1130 else { |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1131 /* Output to stderr, if there is another way to send it |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1132 * on the implementation platform, change this. |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1133 */ |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1134 fprintf(stderr, "%s", outbuf); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
1135 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1136 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1137 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1138 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1139 * Displays a Message Box with given text and title.. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1140 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1141 * title: The title of the message box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1142 * flags: flags to indicate buttons and icon |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1143 * format: printf style format string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1144 * ...: Additional variables for use in the format. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1145 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1146 * DW_MB_RETURN_YES, DW_MB_RETURN_NO, DW_MB_RETURN_OK, |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1147 * or DW_MB_RETURN_CANCEL based on flags and user response. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1148 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1149 int API dw_messagebox(const char *title, int flags, const char *format, ...) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1150 { |
2486
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1151 va_list args; |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1152 char outbuf[1025] = {0}; |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1153 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1154 int retval = 0; |
2486
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1155 |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1156 va_start(args, format); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1157 vsnprintf(outbuf, 1024, format, args); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1158 va_end(args); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1159 |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1160 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1161 { |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1162 // Construct a String |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1163 jstring jstr = env->NewStringUTF(outbuf); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1164 jstring jstrtitle = env->NewStringUTF(title); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1165 // First get the class that contains the method you need to call |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1166 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1167 // Get the method that you want to call |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1168 jmethodID messageBox = env->GetMethodID(clazz, "messageBox", |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1169 "(Ljava/lang/String;Ljava/lang/String;I)I"); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
1170 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1171 retval = env->CallIntMethod(_dw_obj, messageBox, jstrtitle, jstr, flags); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1172 _dw_jni_check_exception(env); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1173 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1174 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1175 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1176 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1177 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1178 * Opens a file dialog and queries user selection. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1179 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1180 * title: Title bar text for dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1181 * defpath: The default path of the open dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1182 * ext: Default file extention. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1183 * flags: DW_FILE_OPEN or DW_FILE_SAVE. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1184 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1185 * nullptr on error. A malloced buffer containing |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1186 * the file path on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1187 * |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1188 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1189 char * API dw_file_browse(const char *title, const char *defpath, const char *ext, int flags) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1190 { |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1191 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1192 char *retval = nullptr; |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1193 |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1194 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1195 { |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1196 // Use a long parameter |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1197 jstring jstr = env->NewStringUTF(title); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1198 jstring path = nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1199 jstring jext = nullptr; |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1200 if(defpath) |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1201 path = env->NewStringUTF(defpath); |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1202 if(ext) |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1203 jext = env->NewStringUTF(defpath); |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1204 // First get the class that contains the method you need to call |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
1205 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1206 // Get the method that you want to call |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1207 jmethodID fileBrowse = env->GetMethodID(clazz, "fileBrowse", |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1208 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;"); |
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1209 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1210 jstring jresult = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, fileBrowse, jstr, path, jext, flags), _DW_REFERENCE_NONE); |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
1211 if(jresult) |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1212 retval = strdup(env->GetStringUTFChars(jresult, nullptr)); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1213 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1214 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1215 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1216 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1217 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1218 * Gets the contents of the default clipboard as text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1219 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1220 * None. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1221 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1222 * Pointer to an allocated string of text or nullptr if clipboard empty or contents could not |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1223 * be converted to text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1224 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1225 char * API dw_clipboard_get_text() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1226 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1227 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1228 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1229 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1230 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1231 const char *utf8 = nullptr; |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1232 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1233 // First get the class that contains the method you need to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1234 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1235 // Get the method that you want to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1236 jmethodID clipboardGetText = env->GetMethodID(clazz, "clipboardGetText", |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1237 "()Ljava/lang/String;"); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1238 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1239 jstring result = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, clipboardGetText), _DW_REFERENCE_NONE); |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1240 // Get the UTF8 string result |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1241 if(result) |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
1242 utf8 = env->GetStringUTFChars(result, nullptr); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1243 return utf8 ? strdup(utf8) : nullptr; |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1244 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1245 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1246 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1247 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1248 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1249 * Sets the contents of the default clipboard to the supplied text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1250 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1251 * str: Text to put on the clipboard. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1252 * len: Length of the text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1253 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1254 void API dw_clipboard_set_text(const char *str, int len) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1255 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1256 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1257 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1258 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1259 { |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1260 // Construct a String |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1261 jstring jstr = env->NewStringUTF(str); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1262 // First get the class that contains the method you need to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1263 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1264 // Get the method that you want to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1265 jmethodID clipboardSetText = env->GetMethodID(clazz, "clipboardSetText", |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1266 "(Ljava/lang/String;)V"); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1267 // Call the method on the object |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1268 env->CallVoidMethod(_dw_obj, clipboardSetText, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1269 _dw_jni_check_exception(env); |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1270 } |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1271 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1272 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1273 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1274 * Allocates and initializes a dialog struct. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1275 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1276 * data: User defined data to be passed to functions. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1277 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1278 * A handle to a dialog or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1279 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1280 DWDialog * API dw_dialog_new(void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1281 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1282 DWDialog *tmp = (DWDialog *)malloc(sizeof(DWDialog)); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1283 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1284 if(tmp) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1285 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1286 tmp->eve = dw_event_new(); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1287 dw_event_reset(tmp->eve); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1288 tmp->data = data; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1289 tmp->done = FALSE; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1290 tmp->result = nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1291 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1292 return tmp; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1293 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1294 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1295 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1296 * Accepts a dialog struct and returns the given data to the |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1297 * initial called of dw_dialog_wait(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1298 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1299 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1300 * result: Data to be returned by dw_dialog_wait(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1301 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1302 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1303 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1304 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1305 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1306 dialog->result = result; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1307 dw_event_post(dialog->eve); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1308 dialog->done = TRUE; |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
1309 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1310 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1311 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1312 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1313 * Accepts a dialog struct waits for dw_dialog_dismiss() to be |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1314 * called by a signal handler with the given dialog struct. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1315 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1316 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1317 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1318 * The data passed to dw_dialog_dismiss(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1319 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1320 void * API dw_dialog_wait(DWDialog *dialog) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1321 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1322 void *tmp = nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1323 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1324 while(!dialog->done) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1325 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1326 dw_main_iteration(); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1327 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1328 dw_event_close(&dialog->eve); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1329 tmp = dialog->result; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1330 free(dialog); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1331 return tmp; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1332 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1333 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1334 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1335 * Create a new Box to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1336 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1337 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1338 * pad: Number of pixels to pad around the box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1339 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1340 * A handle to a box or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1341 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1342 HWND API dw_box_new(int type, int pad) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1343 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1344 JNIEnv *env; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1345 |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1346 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1347 { |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1348 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1349 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1350 // Get the method that you want to call |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1351 jmethodID boxNew = env->GetMethodID(clazz, "boxNew", "(II)Landroid/widget/LinearLayout;"); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1352 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1353 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, boxNew, type, pad), _DW_REFERENCE_WEAK); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1354 return result; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1355 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1356 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1357 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1358 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1359 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1360 * Create a new Group Box to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1361 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1362 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1363 * pad: Number of pixels to pad around the box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1364 * title: Text to be displayined in the group outline. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1365 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1366 * A handle to a groupbox window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1367 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1368 HWND API dw_groupbox_new(int type, int pad, const char *title) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1369 { |
2500
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1370 /* TODO: Just create a normal box for now */ |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1371 return dw_box_new(type, pad); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1372 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1373 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1374 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1375 * Create a new scrollable Box to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1376 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1377 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1378 * pad: Number of pixels to pad around the box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1379 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1380 * A handle to a scrollbox or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1381 */ |
2495
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
1382 HWND API dw_scrollbox_new(int type, int pad) |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
1383 { |
2500
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1384 JNIEnv *env; |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1385 |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1386 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1387 { |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1388 // First get the class that contains the method you need to call |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1389 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1390 // Get the method that you want to call |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1391 jmethodID scrollBoxNew = env->GetMethodID(clazz, "scrollBoxNew", |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1392 "(II)Landroid/widget/ScrollView;"); |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1393 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1394 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, scrollBoxNew, type, pad), _DW_REFERENCE_WEAK); |
2500
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1395 return result; |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1396 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1397 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1398 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1399 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1400 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1401 * Returns the position of the scrollbar in the scrollbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1402 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1403 * handle: Handle to the scrollbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1404 * orient: The vertical or horizontal scrollbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1405 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1406 * The vertical or horizontal position in the scrollbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1407 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1408 int API dw_scrollbox_get_pos(HWND handle, int orient) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1409 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1410 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1411 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1412 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1413 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1414 * Gets the range for the scrollbar in the scrollbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1415 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1416 * handle: Handle to the scrollbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1417 * orient: The vertical or horizontal scrollbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1418 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1419 * The vertical or horizontal range of the scrollbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1420 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1421 int API dw_scrollbox_get_range(HWND handle, int orient) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1422 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1423 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1424 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1425 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1426 /* Internal box packing function called by the other 3 functions */ |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1427 void _dw_box_pack(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad, const char *funcname) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1428 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1429 JNIEnv *env; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1430 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1431 if(box && item && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1432 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1433 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1434 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1435 // Get the method that you want to call |
2500
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
1436 jmethodID boxPack = env->GetMethodID(clazz, "boxPack", "(Landroid/view/View;Landroid/view/View;IIIIII)V"); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1437 // Call the method on the object |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
1438 env->CallVoidMethod(_dw_obj, boxPack, box, item, index, width, height, hsize, vsize, pad); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1439 _dw_jni_check_exception(env); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1440 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1441 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1442 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1443 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1444 * Remove windows (widgets) from the box they are packed into. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1445 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1446 * handle: Window handle of the packed item to be removed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1447 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1448 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1449 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1450 int API dw_box_unpack(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1451 { |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1452 JNIEnv *env; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1453 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1454 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1455 { |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1456 // First get the class that contains the method you need to call |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1457 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1458 // Get the method that you want to call |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1459 jmethodID boxUnpack = env->GetMethodID(clazz, "boxUnpack", "(Landroid/view/View;)V"); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1460 // Call the method on the object |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1461 env->CallVoidMethod(_dw_obj, boxUnpack, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1462 _dw_jni_check_exception(env); |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1463 return DW_ERROR_NONE; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1464 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1465 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1466 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1467 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1468 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1469 * Remove windows (widgets) from a box at an arbitrary location. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1470 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1471 * box: Window handle of the box to be removed from. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1472 * index: 0 based index of packed items. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1473 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1474 * Handle to the removed item on success, 0 on failure or padding. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1475 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1476 HWND API dw_box_unpack_at_index(HWND box, int index) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1477 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1478 JNIEnv *env; |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1479 HWND retval = nullptr; |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1480 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1481 if(box && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1482 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1483 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1484 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1485 jmethodID boxUnpackAtIndex = env->GetMethodID(clazz, "boxUnpackAtIndex", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1486 "(Landroid/widget/LinearLayout;I)Landroid/view/View;"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1487 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1488 retval = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, boxUnpackAtIndex, box, index), _DW_REFERENCE_WEAK); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1489 } |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1490 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1491 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1492 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1493 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1494 * Pack windows (widgets) into a box at an arbitrary location. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1495 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1496 * box: Window handle of the box to be packed into. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1497 * item: Window handle of the item to pack. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1498 * index: 0 based index of packed items. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1499 * width: Width in pixels of the item or -1 to be self determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1500 * height: Height in pixels of the item or -1 to be self determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1501 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1502 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1503 * pad: Number of pixels of padding around the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1504 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1505 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1506 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1507 _dw_box_pack(box, item, index, width, height, hsize, vsize, pad, "dw_box_pack_at_index()"); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1508 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1509 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1510 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1511 * Pack windows (widgets) into a box from the start (or top). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1512 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1513 * box: Window handle of the box to be packed into. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1514 * item: Window handle of the item to pack. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1515 * width: Width in pixels of the item or -1 to be self determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1516 * height: Height in pixels of the item or -1 to be self determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1517 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1518 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1519 * pad: Number of pixels of padding around the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1520 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1521 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1522 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1523 /* 65536 is the table limit on GTK... |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1524 * seems like a high enough value we will never hit it here either. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1525 */ |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
1526 _dw_box_pack(box, item, -1, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1527 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1528 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1529 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1530 * Pack windows (widgets) into a box from the end (or bottom). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1531 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1532 * box: Window handle of the box to be packed into. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1533 * item: Window handle of the item to pack. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1534 * width: Width in pixels of the item or -1 to be self determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1535 * height: Height in pixels of the item or -1 to be self determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1536 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1537 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1538 * pad: Number of pixels of padding around the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1539 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1540 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1541 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1542 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1543 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1544 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1545 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1546 * Create a new button window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1547 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1548 * text: The text to be display by the static text widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1549 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1550 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1551 * A handle to a button window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1552 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1553 HWND API dw_button_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1554 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1555 JNIEnv *env; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1556 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1557 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1558 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1559 // Construct a String |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1560 jstring jstr = env->NewStringUTF(text); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1561 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1562 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1563 // Get the method that you want to call |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1564 jmethodID buttonNew = env->GetMethodID(clazz, "buttonNew", |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1565 "(Ljava/lang/String;I)Landroid/widget/Button;"); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1566 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1567 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, buttonNew, jstr, (int)cid), _DW_REFERENCE_WEAK); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1568 return result; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1569 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1570 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1571 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1572 |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1573 HWND _dw_entryfield_new(const char *text, ULONG cid, int password) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1574 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1575 JNIEnv *env; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1576 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1577 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1578 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1579 // Construct a String |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1580 jstring jstr = env->NewStringUTF(text); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1581 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1582 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1583 // Get the method that you want to call |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1584 jmethodID entryfieldNew = env->GetMethodID(clazz, "entryfieldNew", |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1585 "(Ljava/lang/String;II)Landroid/widget/EditText;"); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1586 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1587 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, entryfieldNew, jstr, (int)cid, password), _DW_REFERENCE_WEAK); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1588 return result; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1589 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1590 return nullptr; |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1591 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1592 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1593 * Create a new Entryfield window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1594 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1595 * text: The default text to be in the entryfield widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1596 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1597 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1598 * A handle to an entryfield window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1599 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1600 HWND API dw_entryfield_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1601 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1602 return _dw_entryfield_new(text, cid, FALSE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1603 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1604 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1605 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1606 * Create a new Entryfield (password) window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1607 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1608 * text: The default text to be in the entryfield widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1609 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1610 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1611 * A handle to an entryfield password window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1612 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1613 HWND API dw_entryfield_password_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1614 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1615 return _dw_entryfield_new(text, cid, TRUE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1616 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1617 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1618 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1619 * Sets the entryfield character limit. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1620 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1621 * handle: Handle to the spinbutton to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1622 * limit: Number of characters the entryfield will take. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1623 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1624 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1625 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1626 JNIEnv *env; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1627 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1628 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1629 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1630 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1631 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1632 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1633 jmethodID entryfieldSetLimit = env->GetMethodID(clazz, "entryfieldSetLimit", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1634 "(Landroid/widget/EditText;J)V"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1635 // Call the method on the object |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1636 env->CallVoidMethod(_dw_obj, entryfieldSetLimit, handle, (jlong)limit); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1637 _dw_jni_check_exception(env); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1638 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1639 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1640 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1641 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1642 * Create a new bitmap button window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1643 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1644 * text: Bubble help text to be displayed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1645 * id: An ID of a bitmap in the resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1646 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1647 * A handle to a bitmap button window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1648 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1649 HWND API dw_bitmapbutton_new(const char *text, ULONG resid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1650 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1651 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1652 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1653 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1654 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1655 // Construct a String |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1656 jstring jstr = env->NewStringUTF(text); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1657 // First get the class that contains the method you need to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1658 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1659 // Get the method that you want to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1660 jmethodID bitmapButtonNew = env->GetMethodID(clazz, "bitmapButtonNew", |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1661 "(Ljava/lang/String;I)Landroid/widget/ImageButton;"); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1662 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1663 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, bitmapButtonNew, jstr, (int)resid), _DW_REFERENCE_WEAK); |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1664 return result; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1665 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1666 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1667 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1668 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1669 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1670 * Create a new bitmap button window (widget) to be packed from a file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1671 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1672 * text: Bubble help text to be displayed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1673 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1674 * filename: Name of the file, omit extention to have |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1675 * DW pick the appropriate file extension. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1676 * (BMP on OS/2 or Windows, XPM on Unix) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1677 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1678 * A handle to a bitmap button window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1679 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1680 HWND API dw_bitmapbutton_new_from_file(const char *text, unsigned long cid, const char *filename) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1681 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1682 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1683 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1684 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1685 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1686 // Construct a String |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1687 jstring jstr = env->NewStringUTF(text); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1688 jstring path = env->NewStringUTF(text); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1689 // First get the class that contains the method you need to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1690 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1691 // Get the method that you want to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1692 jmethodID bitmapButtonNewFromFile = env->GetMethodID(clazz, "bitmapButtonNewFromFile", |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1693 "(Ljava/lang/String;ILjava/lang/String;)Landroid/widget/ImageButton;"); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1694 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1695 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, bitmapButtonNewFromFile, jstr, (int)cid, path), _DW_REFERENCE_WEAK); |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1696 return result; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1697 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1698 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1699 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1700 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1701 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1702 * Create a new bitmap button window (widget) to be packed from data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1703 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1704 * text: Bubble help text to be displayed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1705 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1706 * data: The contents of the image |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1707 * (BMP or ICO on OS/2 or Windows, XPM on Unix) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1708 * len: length of str |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1709 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1710 * A handle to a bitmap button window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1711 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1712 HWND API dw_bitmapbutton_new_from_data(const char *text, unsigned long cid, const char *data, int len) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1713 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1714 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1715 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1716 if(data && len > 0 && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1717 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1718 // Construct a String |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1719 jstring jstr = env->NewStringUTF(text); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1720 // Construct a byte array |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1721 jbyteArray bytearray = env->NewByteArray(len); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1722 env->SetByteArrayRegion(bytearray, 0, len, reinterpret_cast<const jbyte *>(data)); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1723 // First get the class that contains the method you need to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1724 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1725 // Get the method that you want to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1726 jmethodID bitmapButtonNewFromData = env->GetMethodID(clazz, "bitmapButtonNewFromData", |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1727 "(Ljava/lang/String;I[BI)Landroid/widget/ImageButton;"); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1728 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1729 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, bitmapButtonNewFromData, jstr, (int)cid, bytearray, len), _DW_REFERENCE_WEAK); |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1730 // Clean up after the array now that we are finished |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1731 //env->ReleaseByteArrayElements(bytearray, (jbyte *) data, 0); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1732 return result; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1733 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1734 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1735 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1736 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1737 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1738 * Create a new spinbutton window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1739 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1740 * text: The text to be display by the static text widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1741 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1742 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1743 * A handle to a spinbutton window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1744 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1745 HWND API dw_spinbutton_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1746 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1747 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1748 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1749 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1750 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1751 // Construct a String |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1752 jstring jstr = env->NewStringUTF(text); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1753 // First get the class that contains the method you need to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1754 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1755 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1756 jmethodID spinButtonNew = env->GetMethodID(clazz, "spinButtonNew", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1757 "(Ljava/lang/String;I)Lorg/dbsoft/dwindows/DWSpinButton;"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1758 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1759 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, spinButtonNew, jstr, (int)cid), _DW_REFERENCE_WEAK); |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1760 return result; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1761 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1762 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1763 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1764 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1765 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1766 * Sets the spinbutton value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1767 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1768 * handle: Handle to the spinbutton to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1769 * position: Current value of the spinbutton. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1770 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1771 void API dw_spinbutton_set_pos(HWND handle, long position) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1772 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1773 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1774 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1775 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1776 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1777 // First get the class that contains the method you need to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1778 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1779 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1780 jmethodID spinButtonSetPos = env->GetMethodID(clazz, "spinButtonSetPos", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1781 "(Lorg/dbsoft/dwindows/DWSpinButton;J)V"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1782 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1783 env->CallVoidMethod(_dw_obj, spinButtonSetPos, handle, (jlong)position); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1784 _dw_jni_check_exception(env); |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1785 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1786 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1787 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1788 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1789 * Sets the spinbutton limits. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1790 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1791 * handle: Handle to the spinbutton to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1792 * upper: Upper limit. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1793 * lower: Lower limit. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1794 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1795 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1796 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1797 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1798 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1799 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1800 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1801 // First get the class that contains the method you need to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1802 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1803 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1804 jmethodID spinButtonSetLimits = env->GetMethodID(clazz, "spinButtonSetLimits", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1805 "(Lorg/dbsoft/dwindows/DWSpinButton;JJ)V"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1806 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1807 env->CallVoidMethod(_dw_obj, spinButtonSetLimits, handle, (jlong)upper, (jlong)lower); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1808 _dw_jni_check_exception(env); |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1809 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1810 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1811 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1812 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1813 * Returns the current value of the spinbutton. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1814 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1815 * handle: Handle to the spinbutton to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1816 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1817 * Number value displayed in the spinbutton. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1818 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1819 long API dw_spinbutton_get_pos(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1820 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1821 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1822 long retval = 0; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1823 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1824 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1825 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1826 // First get the class that contains the method you need to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1827 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1828 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1829 jmethodID spinButtonGetPos = env->GetMethodID(clazz, "spinButtonGetPos", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1830 "(Lorg/dbsoft/dwindows/DWSpinButton;)J"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1831 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1832 retval = env->CallLongMethod(_dw_obj, spinButtonGetPos, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1833 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1834 retval = 0; |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1835 } |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1836 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1837 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1838 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1839 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1840 * Create a new radiobutton window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1841 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1842 * text: The text to be display by the static text widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1843 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1844 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1845 * A handle to a radio button window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1846 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1847 HWND API dw_radiobutton_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1848 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1849 JNIEnv *env; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1850 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1851 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1852 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1853 // Construct a String |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1854 jstring jstr = env->NewStringUTF(text); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1855 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1856 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1857 // Get the method that you want to call |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1858 jmethodID radioButtonNew = env->GetMethodID(clazz, "radioButtonNew", |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1859 "(Ljava/lang/String;I)Landroid/widget/RadioButton;"); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1860 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1861 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, radioButtonNew, jstr, (int)cid), _DW_REFERENCE_WEAK); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1862 return result; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1863 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1864 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1865 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1866 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1867 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1868 * Create a new slider window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1869 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1870 * vertical: TRUE or FALSE if slider is vertical. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1871 * increments: Number of increments available. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1872 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1873 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1874 * A handle to a slider window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1875 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1876 HWND API dw_slider_new(int vertical, int increments, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1877 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1878 JNIEnv *env; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1879 |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1880 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1881 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1882 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1883 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1884 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1885 jmethodID sliderNew = env->GetMethodID(clazz, "sliderNew", "(III)Landroid/widget/SeekBar;"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1886 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1887 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, sliderNew, vertical, increments, (jint)cid), _DW_REFERENCE_WEAK); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1888 return result; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1889 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
1890 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1891 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1892 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1893 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1894 * Returns the position of the slider. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1895 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1896 * handle: Handle to the slider to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1897 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1898 * Position of the slider in the set range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1899 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1900 unsigned int API dw_slider_get_pos(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1901 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1902 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1903 unsigned int retval = 0; |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1904 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1905 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1906 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1907 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1908 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1909 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1910 jmethodID percentGetPos = env->GetMethodID(clazz, "percentGetPos", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1911 "(Landroid/widget/ProgressBar;)I"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1912 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1913 retval = env->CallIntMethod(_dw_obj, percentGetPos, handle); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1914 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1915 retval = 0; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1916 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1917 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1918 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1919 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1920 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1921 * Sets the slider position. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1922 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1923 * handle: Handle to the slider to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1924 * position: Position of the slider withing the range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1925 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1926 void API dw_slider_set_pos(HWND handle, unsigned int position) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1927 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1928 dw_percent_set_pos(handle, position); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1929 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1930 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1931 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1932 * Create a new scrollbar window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1933 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1934 * vertical: TRUE or FALSE if scrollbar is vertical. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1935 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1936 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1937 * A handle to a scrollbar window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1938 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1939 HWND API dw_scrollbar_new(int vertical, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1940 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1941 return dw_slider_new(vertical, 100, cid); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1942 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1943 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1944 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1945 * Returns the position of the scrollbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1946 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1947 * handle: Handle to the scrollbar to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1948 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1949 * Position of the scrollbar in the set range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1950 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1951 unsigned int API dw_scrollbar_get_pos(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1952 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1953 return dw_slider_get_pos(handle); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1954 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1955 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1956 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1957 * Sets the scrollbar position. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1958 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1959 * handle: Handle to the scrollbar to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1960 * position: Position of the scrollbar withing the range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1961 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1962 void API dw_scrollbar_set_pos(HWND handle, unsigned int position) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1963 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1964 dw_percent_set_pos(handle, position); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1965 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1966 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1967 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1968 * Sets the scrollbar range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1969 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1970 * handle: Handle to the scrollbar to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1971 * range: Maximum range value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1972 * visible: Visible area relative to the range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1973 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1974 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1975 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1976 JNIEnv *env; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1977 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1978 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1979 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1980 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1981 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1982 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1983 jmethodID percentSetRange = env->GetMethodID(clazz, "percentSetRange", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1984 "(Landroid/widget/ProgressBar;I)V"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1985 // Call the method on the object |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1986 env->CallVoidMethod(_dw_obj, percentSetRange, handle, (jint)range); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
1987 _dw_jni_check_exception(env); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1988 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1989 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1990 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1991 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1992 * Create a new percent bar window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1993 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1994 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1995 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
1996 * A handle to a percent bar window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1997 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1998 HWND API dw_percent_new(ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1999 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2000 JNIEnv *env; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2001 |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2002 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2003 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2004 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2005 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2006 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2007 jmethodID percentNew = env->GetMethodID(clazz, "percentNew", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2008 "(I)Landroid/widget/ProgressBar;"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2009 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2010 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, percentNew, (jint)cid), _DW_REFERENCE_WEAK); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2011 return result; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2012 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2013 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2014 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2015 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2016 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2017 * Sets the percent bar position. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2018 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2019 * handle: Handle to the percent bar to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2020 * position: Position of the percent bar withing the range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2021 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2022 void API dw_percent_set_pos(HWND handle, unsigned int position) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2023 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2024 JNIEnv *env; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2025 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
2026 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2027 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2028 // First get the class that contains the method you need to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2029 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2030 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2031 jmethodID percentSetPos = env->GetMethodID(clazz, "percentSetPos", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2032 "(Landroid/widget/ProgressBar;I)V"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2033 // Call the method on the object |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2034 env->CallVoidMethod(_dw_obj, percentSetPos, handle, (jint)position); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2035 _dw_jni_check_exception(env); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2036 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2037 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2038 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2039 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2040 * Create a new checkbox window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2041 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2042 * text: The text to be display by the static text widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2043 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2044 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2045 * A handle to a checkbox window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2046 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2047 HWND API dw_checkbox_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2048 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2049 JNIEnv *env; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2050 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2051 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2052 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2053 // Construct a String |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2054 jstring jstr = env->NewStringUTF(text); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2055 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
2056 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2057 // Get the method that you want to call |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2058 jmethodID checkboxNew = env->GetMethodID(clazz, "checkboxNew", |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2059 "(Ljava/lang/String;I)Landroid/widget/CheckBox;"); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2060 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2061 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, checkboxNew, jstr, (int)cid), _DW_REFERENCE_WEAK); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2062 return result; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2063 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2064 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2065 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2066 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2067 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2068 * Returns the state of the checkbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2069 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2070 * handle: Handle to the checkbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2071 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2072 * State of checkbox (TRUE or FALSE). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2073 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2074 int API dw_checkbox_get(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2075 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2076 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2077 int retval = FALSE; |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2078 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
2079 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2080 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2081 // First get the class that contains the method you need to call |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2082 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2083 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2084 jmethodID checkOrRadioGetChecked = env->GetMethodID(clazz, "checkOrRadioGetChecked", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2085 "(Landroid/view/View;)Z"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2086 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2087 retval = env->CallBooleanMethod(_dw_obj, checkOrRadioGetChecked, handle); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2088 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2089 retval = FALSE; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2090 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2091 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2092 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2093 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2094 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2095 * Sets the state of the checkbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2096 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2097 * handle: Handle to the checkbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2098 * value: TRUE for checked, FALSE for unchecked. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2099 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2100 void API dw_checkbox_set(HWND handle, int value) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2101 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2102 JNIEnv *env; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2103 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
2104 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2105 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2106 // First get the class that contains the method you need to call |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2107 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2108 // Get the method that you want to call |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2109 jmethodID checkOrRadioSetChecked = env->GetMethodID(clazz, "checkOrRadioSetChecked", |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2110 "(Landroid/view/View;I)V"); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2111 // Call the method on the object |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2112 env->CallVoidMethod(_dw_obj, checkOrRadioSetChecked, handle, value); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2113 _dw_jni_check_exception(env); |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
2114 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2115 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2116 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2117 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2118 * Create a new listbox window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2119 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2120 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2121 * multi: Multiple select TRUE or FALSE. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2122 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2123 * A handle to a listbox window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2124 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2125 HWND API dw_listbox_new(ULONG cid, int multi) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2126 { |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2127 JNIEnv *env; |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2128 |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2129 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2130 { |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2131 // First get the class that contains the method you need to call |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2132 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2133 // Get the method that you want to call |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2134 jmethodID listBoxNew = env->GetMethodID(clazz, "listBoxNew", |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2135 "(II)Lorg/dbsoft/dwindows/DWListBox;"); |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2136 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2137 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, listBoxNew, (int)cid, multi), _DW_REFERENCE_WEAK); |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2138 return result; |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2139 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2140 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2141 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2142 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2143 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2144 * Appends the specified text to the listbox's (or combobox) entry list. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2145 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2146 * handle: Handle to the listbox to be appended to. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2147 * text: Text to append into listbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2148 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2149 void API dw_listbox_append(HWND handle, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2150 { |
2515
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2151 JNIEnv *env; |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2152 |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2153 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2154 { |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2155 // Construct a String |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2156 jstring jstr = env->NewStringUTF(text); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2157 // First get the class that contains the method you need to call |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2158 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2159 // Get the method that you want to call |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2160 jmethodID listOrComboBoxAppend = env->GetMethodID(clazz, "listOrComboBoxAppend", |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2161 "(Landroid/view/View;Ljava/lang/String;)V"); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2162 // Call the method on the object |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2163 env->CallVoidMethod(_dw_obj, listOrComboBoxAppend, handle, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2164 _dw_jni_check_exception(env); |
2515
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2165 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2166 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2167 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2168 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2169 * Inserts the specified text into the listbox's (or combobox) entry list. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2170 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2171 * handle: Handle to the listbox to be inserted into. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2172 * text: Text to insert into listbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2173 * pos: 0-based position to insert text |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2174 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2175 void API dw_listbox_insert(HWND handle, const char *text, int pos) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2176 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2177 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2178 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2179 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2180 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2181 // Construct a String |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2182 jstring jstr = env->NewStringUTF(text); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2183 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2184 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2185 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2186 jmethodID listOrComboBoxInsert = env->GetMethodID(clazz, "listOrComboBoxInsert", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2187 "(Landroid/view/View;Ljava/lang/String;I)V"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2188 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2189 env->CallVoidMethod(_dw_obj, listOrComboBoxInsert, handle, jstr, pos); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2190 _dw_jni_check_exception(env); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2191 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2192 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2193 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2194 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2195 * Appends the specified text items to the listbox's (or combobox) entry list. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2196 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2197 * handle: Handle to the listbox to be appended to. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2198 * text: Text strings to append into listbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2199 * count: Number of text strings to append |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2200 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2201 void API dw_listbox_list_append(HWND handle, char **text, int count) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2202 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2203 int x; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2204 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2205 /* TODO: this would be more efficient passing in an array */ |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2206 for(x=0;x<count;x++) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2207 dw_listbox_append(handle, text[x]); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2208 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2209 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2210 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2211 * Clears the listbox's (or combobox) list of all entries. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2212 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2213 * handle: Handle to the listbox to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2214 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2215 void API dw_listbox_clear(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2216 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2217 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2218 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2219 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2220 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2221 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2222 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2223 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2224 jmethodID listOrComboBoxClear = env->GetMethodID(clazz, "listOrComboBoxClear", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2225 "(Landroid/view/View;)V"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2226 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2227 env->CallVoidMethod(_dw_obj, listOrComboBoxClear, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2228 _dw_jni_check_exception(env); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2229 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2230 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2231 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2232 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2233 * Returns the listbox's item count. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2234 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2235 * handle: Handle to the listbox to be counted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2236 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2237 * The number of items in the listbox. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2238 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2239 int API dw_listbox_count(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2240 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2241 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2242 int retval = 0; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2243 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2244 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2245 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2246 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2247 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2248 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2249 jmethodID listOrComboBoxCount = env->GetMethodID(clazz, "listOrComboBoxCount", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2250 "(Landroid/view/View;)I"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2251 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2252 retval = env->CallIntMethod(_dw_obj, listOrComboBoxCount, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2253 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2254 retval = 0; |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2255 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2256 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2257 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2258 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2259 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2260 * Sets the topmost item in the viewport. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2261 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2262 * handle: Handle to the listbox to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2263 * top: Index to the top item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2264 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2265 void API dw_listbox_set_top(HWND handle, int top) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2266 { |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2267 JNIEnv *env; |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2268 |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2269 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2270 { |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2271 // First get the class that contains the method you need to call |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2272 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2273 // Get the method that you want to call |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2274 jmethodID listBoxSetTop = env->GetMethodID(clazz, "listBoxSetTop", |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2275 "(Landroid/view/View;I)V"); |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2276 // Call the method on the object |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2277 env->CallVoidMethod(_dw_obj, listBoxSetTop, handle, top); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2278 _dw_jni_check_exception(env); |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
2279 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2280 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2281 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2282 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2283 * Copies the given index item's text into buffer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2284 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2285 * handle: Handle to the listbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2286 * index: Index into the list to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2287 * buffer: Buffer where text will be copied. |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2288 * length: Length of the buffer (including nullptr). |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2289 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2290 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2291 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2292 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2293 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2294 if(buffer && length > 0 && handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2295 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2296 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2297 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2298 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2299 jmethodID listOrComboBoxGetText = env->GetMethodID(clazz, "listOrComboBoxGetText", |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2300 "(Landroid/view/View;I)Ljava/lang/String;"); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2301 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2302 jstring result = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, listOrComboBoxGetText, handle, index), _DW_REFERENCE_NONE); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2303 // Get the UTF8 string result |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2304 if(result) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2305 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
2306 const char *utf8 = env->GetStringUTFChars(result, nullptr); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2307 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2308 strncpy(buffer, utf8, length); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2309 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2310 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2311 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2312 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2313 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2314 * Sets the text of a given listbox entry. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2315 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2316 * handle: Handle to the listbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2317 * index: Index into the list to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2318 * buffer: Buffer where text will be copied. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2319 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2320 void API dw_listbox_set_text(HWND handle, unsigned int index, const char *buffer) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2321 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2322 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2323 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2324 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2325 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2326 // Construct a String |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2327 jstring jstr = env->NewStringUTF(buffer); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2328 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2329 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2330 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2331 jmethodID listOrComboBoxSetText = env->GetMethodID(clazz, "listOrComboBoxSetText", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2332 "(Landroid/view/View;ILjava/lang/String;)V"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2333 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2334 env->CallVoidMethod(_dw_obj, listOrComboBoxSetText, handle, index, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2335 _dw_jni_check_exception(env); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2336 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2337 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2338 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2339 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2340 * Returns the index to the item in the list currently selected. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2341 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2342 * handle: Handle to the listbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2343 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2344 * The selected item index or DW_ERROR_UNKNOWN (-1) on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2345 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2346 int API dw_listbox_selected(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2347 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2348 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2349 int retval = DW_ERROR_UNKNOWN; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2350 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2351 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2352 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2353 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2354 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2355 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2356 jmethodID listOrComboBoxGetSelected = env->GetMethodID(clazz, "listOrComboBoxGetSelected", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2357 "(Landroid/view/View;)I"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2358 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2359 retval = env->CallIntMethod(_dw_obj, listOrComboBoxGetSelected, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2360 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2361 retval = DW_ERROR_UNKNOWN; |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2362 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2363 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2364 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2365 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2366 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2367 * Returns the index to the current selected item or -1 when done. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2368 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2369 * handle: Handle to the listbox to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2370 * where: Either the previous return or -1 to restart. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2371 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2372 * The next selected item or DW_ERROR_UNKNOWN (-1) on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2373 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2374 int API dw_listbox_selected_multi(HWND handle, int where) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2375 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2376 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2377 int retval = DW_ERROR_UNKNOWN; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2378 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2379 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2380 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2381 // First get the class that contains the method you need to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2382 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2383 // Get the method that you want to call |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2384 jmethodID listBoxSelectedMulti = env->GetMethodID(clazz, "listBoxSelectedMulti", |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2385 "(Landroid/view/View;I)I"); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2386 // Call the method on the object |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2387 retval = env->CallIntMethod(_dw_obj, listBoxSelectedMulti, handle, where); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2388 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2389 retval = DW_ERROR_UNKNOWN; |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2390 } |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
2391 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2392 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2393 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2394 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2395 * Sets the selection state of a given index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2396 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2397 * handle: Handle to the listbox to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2398 * index: Item index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2399 * state: TRUE if selected FALSE if unselected. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2400 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2401 void API dw_listbox_select(HWND handle, int index, int state) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2402 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2403 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2404 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2405 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2406 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2407 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2408 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2409 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2410 jmethodID listOrComboBoxSelect = env->GetMethodID(clazz, "listOrComboBoxSelect", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2411 "(Landroid/view/View;II)V"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2412 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2413 env->CallVoidMethod(_dw_obj, listOrComboBoxSelect, handle, index, state); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2414 _dw_jni_check_exception(env); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2415 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2416 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2417 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2418 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2419 * Deletes the item with given index from the list. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2420 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2421 * handle: Handle to the listbox to be set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2422 * index: Item index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2423 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2424 void API dw_listbox_delete(HWND handle, int index) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2425 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2426 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2427 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2428 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2429 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2430 // First get the class that contains the method you need to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2431 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2432 // Get the method that you want to call |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2433 jmethodID listOrComboBoxDelete = env->GetMethodID(clazz, "listOrComboBoxDelete", |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2434 "(Landroid/view/View;I)V"); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2435 // Call the method on the object |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2436 env->CallVoidMethod(_dw_obj, listOrComboBoxDelete, handle, index); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2437 _dw_jni_check_exception(env); |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
2438 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2439 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2440 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2441 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2442 * Create a new Combobox window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2443 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2444 * text: The default text to be in the combpbox widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2445 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2446 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2447 * A handle to a combobox window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2448 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2449 HWND API dw_combobox_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2450 { |
2515
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2451 JNIEnv *env; |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2452 |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2453 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2454 { |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2455 // Construct a String |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2456 jstring jstr = env->NewStringUTF(text); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2457 // First get the class that contains the method you need to call |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2458 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2459 // Get the method that you want to call |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2460 jmethodID comboBoxNew = env->GetMethodID(clazz, "comboBoxNew", |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2461 "(Ljava/lang/String;I)Lorg/dbsoft/dwindows/DWComboBox;"); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2462 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2463 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, comboBoxNew, jstr, (int)cid), _DW_REFERENCE_WEAK); |
2515
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2464 return result; |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
2465 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2466 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2467 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2468 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2469 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2470 * Create a new Multiline Editbox window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2471 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2472 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2473 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2474 * A handle to a MLE window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2475 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2476 HWND API dw_mle_new(ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2477 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2478 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2479 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2480 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2481 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2482 // First get the class that contains the method you need to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2483 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2484 // Get the method that you want to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2485 jmethodID mleNew = env->GetMethodID(clazz, "mleNew", |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2486 "(I)Landroid/widget/EditText;"); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2487 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2488 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, mleNew, (int)cid), _DW_REFERENCE_WEAK); |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2489 return result; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2490 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2491 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2492 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2493 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2494 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2495 * Adds text to an MLE box and returns the current point. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2496 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2497 * handle: Handle to the MLE to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2498 * buffer: Text buffer to be imported. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2499 * startpoint: Point to start entering text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2500 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2501 * Current position in the buffer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2502 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2503 unsigned int API dw_mle_import(HWND handle, const char *buffer, int startpoint) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2504 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2505 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2506 int retval = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2507 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2508 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2509 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2510 // Construct a String |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2511 jstring jstr = env->NewStringUTF(buffer); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2512 // First get the class that contains the method you need to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2513 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2514 // Get the method that you want to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2515 jmethodID mleImport = env->GetMethodID(clazz, "mleImport", |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2516 "(Landroid/widget/EditText;Ljava/lang/String;I)I"); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2517 // Call the method on the object |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2518 retval = env->CallIntMethod(_dw_obj, mleImport, handle, jstr, startpoint); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2519 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2520 retval = 0; |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2521 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2522 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2523 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2524 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2525 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2526 * Grabs text from an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2527 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2528 * handle: Handle to the MLE to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2529 * buffer: Text buffer to be exported. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2530 * startpoint: Point to start grabbing text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2531 * length: Amount of text to be grabbed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2532 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2533 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2534 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2535 if(buffer && length > 0) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2536 char *text = dw_window_get_text(handle); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2537 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2538 if (text) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2539 int len = strlen(text); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2540 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2541 if (startpoint < len) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2542 strncpy(buffer, &text[startpoint], length); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2543 else |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2544 buffer[0] = '\0'; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2545 free(text); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2546 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2547 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2548 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2549 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2550 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2551 * Obtains information about an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2552 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2553 * handle: Handle to the MLE to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2554 * bytes: A pointer to a variable to return the total bytes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2555 * lines: A pointer to a variable to return the number of lines. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2556 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2557 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2558 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2559 char *text = dw_window_get_text(handle); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2560 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2561 if(bytes) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2562 if(text) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2563 *bytes = strlen(text); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2564 } else { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2565 *bytes = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2566 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2567 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2568 if(lines) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2569 if(text) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2570 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2571 int count = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2572 char *tmp = text; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2573 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2574 while((tmp = strchr(tmp, '\n'))) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2575 count++; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2576 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2577 *lines = count; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2578 } else { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2579 *lines = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2580 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2581 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2582 if(text) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2583 free(text); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2584 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2585 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2586 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2587 * Deletes text from an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2588 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2589 * handle: Handle to the MLE to be deleted from. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2590 * startpoint: Point to start deleting text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2591 * length: Amount of text to be deleted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2592 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2593 void API dw_mle_delete(HWND handle, int startpoint, int length) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2594 { |
2525
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2595 JNIEnv *env; |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2596 |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2597 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2598 { |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2599 // First get the class that contains the method you need to call |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2600 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2601 // Get the method that you want to call |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2602 jmethodID mleDelete = env->GetMethodID(clazz, "mleDelete", |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2603 "(Landroid/widget/EditText;II)V"); |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2604 // Call the method on the object |
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2605 env->CallVoidMethod(_dw_obj, mleDelete, handle, startpoint, length); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2606 _dw_jni_check_exception(env); |
2525
9fd26efff9da
Android: Implement dw_mle_delete() so that the tested output is correct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2523
diff
changeset
|
2607 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2608 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2609 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2610 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2611 * Clears all text from an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2612 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2613 * handle: Handle to the MLE to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2614 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2615 void API dw_mle_clear(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2616 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2617 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2618 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2619 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2620 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2621 // First get the class that contains the method you need to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2622 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2623 // Get the method that you want to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2624 jmethodID mleClear = env->GetMethodID(clazz, "mleClear", |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2625 "(Landroid/widget/EditText;)V"); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2626 // Call the method on the object |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2627 env->CallVoidMethod(_dw_obj, mleClear, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2628 _dw_jni_check_exception(env); |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2629 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2630 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2631 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2632 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2633 * Sets the visible line of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2634 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2635 * handle: Handle to the MLE to be positioned. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2636 * line: Line to be visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2637 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2638 void API dw_mle_set_visible(HWND handle, int line) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2639 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2640 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2641 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2642 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2643 * Sets the editablity of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2644 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2645 * handle: Handle to the MLE. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2646 * state: TRUE if it can be edited, FALSE for readonly. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2647 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2648 void API dw_mle_set_editable(HWND handle, int state) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2649 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2650 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2651 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2652 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2653 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2654 // First get the class that contains the method you need to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2655 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2656 // Get the method that you want to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2657 jmethodID mleSetEditable = env->GetMethodID(clazz, "mleSetEditable", |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2658 "(Landroid/widget/EditText;I)V"); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2659 // Call the method on the object |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2660 env->CallVoidMethod(_dw_obj, mleSetEditable, handle, state); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2661 _dw_jni_check_exception(env); |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2662 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2663 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2664 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2665 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2666 * Sets the word wrap state of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2667 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2668 * handle: Handle to the MLE. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2669 * state: TRUE if it wraps, FALSE if it doesn't. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2670 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2671 void API dw_mle_set_word_wrap(HWND handle, int state) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2672 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2673 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2674 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2675 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2676 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2677 // First get the class that contains the method you need to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2678 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2679 // Get the method that you want to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2680 jmethodID mleSetWordWrap = env->GetMethodID(clazz, "mleSetWordWrap", |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2681 "(Landroid/widget/EditText;I)V"); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2682 // Call the method on the object |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2683 env->CallVoidMethod(_dw_obj, mleSetWordWrap, handle, state); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2684 _dw_jni_check_exception(env); |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2685 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2686 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2687 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2688 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2689 * Sets the current cursor position of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2690 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2691 * handle: Handle to the MLE to be positioned. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2692 * point: Point to position cursor. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2693 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2694 void API dw_mle_set_cursor(HWND handle, int point) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2695 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2696 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2697 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2698 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2699 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2700 // First get the class that contains the method you need to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2701 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2702 // Get the method that you want to call |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2703 jmethodID mleSetWordWrap = env->GetMethodID(clazz, "mleSetWordWrap", |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2704 "(Landroid/widget/EditText;I)V"); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2705 // Call the method on the object |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2706 env->CallVoidMethod(_dw_obj, mleSetWordWrap, handle, point); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2707 _dw_jni_check_exception(env); |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2708 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2709 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2710 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2711 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2712 * Sets the word auto complete state of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2713 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2714 * handle: Handle to the MLE. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2715 * state: Bitwise combination of DW_MLE_COMPLETE_TEXT/DASH/QUOTE |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2716 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2717 void API dw_mle_set_auto_complete(HWND handle, int state) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2718 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2719 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2720 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2721 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2722 * Finds text in an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2723 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2724 * handle: Handle to the MLE to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2725 * text: Text to search for. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2726 * point: Start point of search. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2727 * flags: Search specific flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2728 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2729 * Position in buffer or DW_ERROR_UNKNOWN (-1) on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2730 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2731 int API dw_mle_search(HWND handle, const char *text, int point, unsigned long flags) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2732 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2733 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2734 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2735 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2736 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2737 * Stops redrawing of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2738 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2739 * handle: Handle to the MLE to freeze. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2740 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2741 void API dw_mle_freeze(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2742 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2743 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2744 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2745 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2746 * Resumes redrawing of an MLE box. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2747 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2748 * handle: Handle to the MLE to thaw. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2749 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2750 void API dw_mle_thaw(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2751 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2752 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2753 |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2754 HWND _dw_text_new(const char *text, ULONG cid, int status) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2755 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2756 JNIEnv *env; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2757 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2758 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2759 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2760 // Construct a String |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2761 jstring jstr = env->NewStringUTF(text); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2762 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
2763 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2764 // Get the method that you want to call |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2765 jmethodID textNew = env->GetMethodID(clazz, "textNew", |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2766 "(Ljava/lang/String;II)Landroid/widget/TextView;"); |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2767 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2768 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, textNew, jstr, (int)cid, status), _DW_REFERENCE_WEAK); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2769 return result; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2770 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2771 return nullptr; |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2772 } |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2773 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2774 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2775 * Create a new status text window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2776 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2777 * text: The text to be display by the static text widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2778 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2779 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2780 * A handle to a status text window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2781 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2782 HWND API dw_status_text_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2783 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2784 return _dw_text_new(text, cid, TRUE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2785 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2786 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2787 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2788 * Create a new static text window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2789 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2790 * text: The text to be display by the static text widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2791 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2792 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2793 * A handle to a text window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2794 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2795 HWND API dw_text_new(const char *text, ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2796 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2797 return _dw_text_new(text, cid, FALSE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2798 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2799 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2800 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2801 * Creates a rendering context widget (window) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2802 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2803 * id: An id to be used with dw_window_from_id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2804 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
2805 * A handle to the widget or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2806 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2807 HWND API dw_render_new(unsigned long cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2808 { |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2809 JNIEnv *env; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2810 |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2811 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2812 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2813 // First get the class that contains the method you need to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2814 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2815 // Get the method that you want to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2816 jmethodID renderNew = env->GetMethodID(clazz, "renderNew", |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2817 "(I)Lorg/dbsoft/dwindows/DWRender;"); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2818 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2819 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, renderNew, (int)cid), _DW_REFERENCE_WEAK); |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2820 return result; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2821 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2822 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2823 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2824 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2825 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2826 * Invalidate the render widget triggering an expose event. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2827 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2828 * handle: A handle to a render widget to be redrawn. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2829 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2830 void API dw_render_redraw(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2831 { |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2832 JNIEnv *env; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2833 |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2834 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2835 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2836 // First get the class that contains the method you need to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2837 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2838 // Get the method that you want to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2839 jmethodID renderRedraw = env->GetMethodID(clazz, "renderRedraw", |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2840 "(Lorg/dbsoft/dwindows/DWRender;)V"); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2841 // Call the method on the object |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2842 env->CallVoidMethod(_dw_obj, renderRedraw, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2843 _dw_jni_check_exception(env); |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
2844 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2845 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2846 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2847 /* Sets the current foreground drawing color. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2848 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2849 * red: red value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2850 * green: green value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2851 * blue: blue value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2852 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2853 void API dw_color_foreground_set(unsigned long value) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2854 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2855 pthread_setspecific(_dw_fgcolor_key, (void *)value); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2856 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2857 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2858 /* Sets the current background drawing color. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2859 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2860 * red: red value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2861 * green: green value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2862 * blue: blue value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2863 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2864 void API dw_color_background_set(unsigned long value) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2865 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2866 pthread_setspecific(_dw_bgcolor_key, (void *)value); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2867 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2868 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2869 /* Allows the user to choose a color using the system's color chooser dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2870 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2871 * value: current color |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2872 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2873 * The selected color or the current color if cancelled. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2874 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2875 unsigned long API dw_color_choose(unsigned long value) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2876 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2877 return value; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2878 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2879 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2880 /* Draw a point on a window (preferably a render window). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2881 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2882 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2883 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2884 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2885 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2886 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2887 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2888 { |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2889 JNIEnv *env; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2890 |
2534
c4255630cade
Android: Fix the safety check in the dw_draw_*() functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2533
diff
changeset
|
2891 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2892 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2893 jlong fgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_fgcolor_key)); |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2894 jlong bgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_bgcolor_key)); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
2895 |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2896 // First get the class that contains the method you need to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2897 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2898 // Get the method that you want to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2899 jmethodID drawPoint = env->GetMethodID(clazz, "drawPoint", |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
2900 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIJJ)V"); |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2901 // Call the method on the object |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
2902 env->CallVoidMethod(_dw_obj, drawPoint, handle, pixmap ? pixmap->bitmap : nullptr, x, y, fgcolor, bgcolor); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2903 _dw_jni_check_exception(env); |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2904 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2905 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2906 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2907 /* Draw a line on a window (preferably a render window). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2908 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2909 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2910 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2911 * x1: First X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2912 * y1: First Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2913 * x2: Second X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2914 * y2: Second Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2915 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2916 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2917 { |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2918 JNIEnv *env; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2919 |
2534
c4255630cade
Android: Fix the safety check in the dw_draw_*() functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2533
diff
changeset
|
2920 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2921 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2922 jlong fgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_fgcolor_key)); |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2923 jlong bgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_bgcolor_key)); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
2924 |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2925 // First get the class that contains the method you need to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2926 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2927 // Get the method that you want to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2928 jmethodID drawLine = env->GetMethodID(clazz, "drawLine", |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
2929 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIIIJJ)V"); |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2930 // Call the method on the object |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
2931 env->CallVoidMethod(_dw_obj, drawLine, handle, pixmap ? pixmap->bitmap : nullptr, x1, y1, x2, y2, fgcolor, bgcolor); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2932 _dw_jni_check_exception(env); |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
2933 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2934 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2935 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2936 /* Draw text on a window (preferably a render window). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2937 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2938 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2939 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2940 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2941 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2942 * text: Text to be displayed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2943 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2944 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2945 { |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2946 JNIEnv *env; |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2947 |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2948 if((handle || pixmap) && text && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2949 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2950 jlong fgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_fgcolor_key)); |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
2951 jlong bgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_bgcolor_key)); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
2952 |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2953 // Construct the string |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2954 jstring jstr = env->NewStringUTF(text); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2955 // First get the class that contains the method you need to call |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2956 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2957 // Get the method that you want to call |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2958 jmethodID drawLine = env->GetMethodID(clazz, "drawText", |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
2959 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IILjava/lang/String;Landroid/graphics/Typeface;ILandroid/view/View;JJ)V"); |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2960 // Call the method on the object |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2961 env->CallVoidMethod(_dw_obj, drawLine, handle, pixmap ? pixmap->bitmap : nullptr, x, y, jstr, |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
2962 pixmap ? pixmap->typeface : nullptr, pixmap ? pixmap->fontsize : 0, |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
2963 pixmap ? pixmap->handle : nullptr, fgcolor, bgcolor); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2964 _dw_jni_check_exception(env); |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
2965 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2966 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2967 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2968 /* Query the width and height of a text string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2969 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2970 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2971 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2972 * text: Text to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2973 * width: Pointer to a variable to be filled in with the width. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2974 * height: Pointer to a variable to be filled in with the height. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2975 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2976 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2977 { |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2978 JNIEnv *env; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2979 |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2980 if((handle || pixmap) && text && (width || height) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2981 { |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2982 // Construct the string |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2983 jstring jstr = env->NewStringUTF(text); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2984 // First get the class that contains the method you need to call |
2548
c4d75d30430c
Android: Minor fixes to that last commit... missed dw.h changes and remove test code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2547
diff
changeset
|
2985 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2986 // Get the method that you want to call |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2987 jmethodID fontTextExtentsGet = env->GetMethodID(clazz, "fontTextExtentsGet", |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2988 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;Ljava/lang/String;Landroid/graphics/Typeface;ILandroid/view/View;)J"); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2989 // Call the method on the object |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2990 jlong dimensions = env->CallLongMethod(_dw_obj, fontTextExtentsGet, handle, pixmap ? pixmap->bitmap : nullptr, jstr, |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2991 pixmap ? pixmap->typeface : nullptr, pixmap ? pixmap->fontsize : 0, pixmap ? pixmap->handle : nullptr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2992 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
2993 dimensions = 0; |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2994 |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2995 if(width) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2996 *width = dimensions & 0xFFFF; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2997 if(height) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2998 *height = (dimensions >> 32) & 0xFFFF; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
2999 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3000 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3001 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3002 /* Draw a polygon on a window (preferably a render window). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3003 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3004 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3005 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3006 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3007 * npoints: Number of points passed in. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3008 * x: Pointer to array of X coordinates. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3009 * y: Pointer to array of Y coordinates. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3010 */ |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3011 void API dw_draw_polygon(HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y) |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3012 { |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3013 JNIEnv *env; |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3014 |
2537
cd9d2ba251d5
Android: Reimplement drawPolygon() using drawPath() instead of drawLines/Points().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2535
diff
changeset
|
3015 if((handle || pixmap) && npoints > 0 && x && y && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3016 { |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3017 jintArray jx = env->NewIntArray(npoints); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3018 jintArray jy = env->NewIntArray(npoints); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3019 |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3020 if(jx && jy) |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3021 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
3022 jlong fgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_fgcolor_key)); |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
3023 jlong bgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_bgcolor_key)); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
3024 |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3025 // Construct the integer arrays |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3026 env->SetIntArrayRegion(jx, 0, npoints, x); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3027 env->SetIntArrayRegion(jy, 0, npoints, y); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3028 // First get the class that contains the method you need to call |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3029 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3030 // Get the method that you want to call |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3031 jmethodID drawPolygon = env->GetMethodID(clazz, "drawPolygon", |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3032 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;II[I[IJJ)V"); |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3033 // Call the method on the object |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3034 env->CallVoidMethod(_dw_obj, drawPolygon, handle, pixmap ? pixmap->bitmap : nullptr, flags, npoints, jx, jy, fgcolor, bgcolor); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3035 _dw_jni_check_exception(env); |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3036 } |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3037 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3038 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3039 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3040 /* Draw a rectangle on a window (preferably a render window). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3041 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3042 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3043 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3044 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3045 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3046 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3047 * width: Width of rectangle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3048 * height: Height of rectangle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3049 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3050 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3051 { |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3052 JNIEnv *env; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3053 |
2534
c4255630cade
Android: Fix the safety check in the dw_draw_*() functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2533
diff
changeset
|
3054 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3055 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
3056 jlong fgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_fgcolor_key)); |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
3057 jlong bgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_bgcolor_key)); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
3058 |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3059 // First get the class that contains the method you need to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3060 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3061 // Get the method that you want to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3062 jmethodID drawLine = env->GetMethodID(clazz, "drawRect", |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3063 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIIIJJ)V"); |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3064 // Call the method on the object |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3065 env->CallVoidMethod(_dw_obj, drawLine, handle, pixmap ? pixmap->bitmap : nullptr, x, y, width, height, fgcolor, bgcolor); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3066 _dw_jni_check_exception(env); |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
3067 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3068 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3069 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3070 /* Draw an arc on a window (preferably a render window). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3071 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3072 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3073 * pixmap: Handle to the pixmap. (choose only one of these) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3074 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3075 * DW_DRAW_FULL will draw a complete circle/elipse. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3076 * xorigin: X coordinate of center of arc. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3077 * yorigin: Y coordinate of center of arc. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3078 * x1: X coordinate of first segment of arc. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3079 * y1: Y coordinate of first segment of arc. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3080 * x2: X coordinate of second segment of arc. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3081 * y2: Y coordinate of second segment of arc. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3082 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3083 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3084 { |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3085 JNIEnv *env; |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3086 |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3087 if((handle || pixmap) && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3088 { |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
3089 jlong fgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_fgcolor_key)); |
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
3090 jlong bgcolor = _dw_get_color((unsigned long)pthread_getspecific(_dw_bgcolor_key)); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
3091 |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3092 // First get the class that contains the method you need to call |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3093 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3094 // Get the method that you want to call |
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3095 jmethodID drawLine = env->GetMethodID(clazz, "drawArc", |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3096 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIIIIIIJJ)V"); |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3097 // Call the method on the object |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3098 env->CallVoidMethod(_dw_obj, drawLine, handle, pixmap ? pixmap->bitmap : nullptr, flags, xorigin, yorigin, x1, y1, x2, y2, fgcolor, bgcolor); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3099 _dw_jni_check_exception(env); |
2535
d862d9e4069b
Android: Implement most of the rest of drawing except for fonts...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2534
diff
changeset
|
3100 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3101 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3102 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3103 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3104 * Create a tree object to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3105 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3106 * id: An ID to be used for getting the resource from the |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3107 * resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3108 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3109 * A handle to a tree window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3110 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3111 HWND API dw_tree_new(ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3112 { |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3113 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3114 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3115 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3116 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3117 * Inserts an item into a tree window (widget) after another item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3118 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3119 * handle: Handle to the tree to be inserted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3120 * item: Handle to the item to be positioned after. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3121 * title: The text title of the entry. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3122 * icon: Handle to coresponding icon. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3123 * parent: Parent handle or 0 if root. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3124 * itemdata: Item specific data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3125 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3126 * A handle to a tree item or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3127 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3128 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3129 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3130 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3131 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3132 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3133 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3134 * Inserts an item into a tree window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3135 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3136 * handle: Handle to the tree to be inserted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3137 * title: The text title of the entry. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3138 * icon: Handle to coresponding icon. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3139 * parent: Parent handle or 0 if root. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3140 * itemdata: Item specific data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3141 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3142 * A handle to a tree item or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3143 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3144 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3145 { |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3146 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3147 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3148 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3149 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3150 * Gets the text an item in a tree window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3151 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3152 * handle: Handle to the tree containing the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3153 * item: Handle of the item to be modified. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3154 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3155 * A malloc()ed buffer of item text to be dw_free()ed or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3156 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3157 char * API dw_tree_get_title(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3158 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3159 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3160 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3161 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3162 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3163 * Gets the text an item in a tree window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3164 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3165 * handle: Handle to the tree containing the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3166 * item: Handle of the item to be modified. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3167 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3168 * A handle to a tree item or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3169 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3170 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3171 { |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3172 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3173 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3174 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3175 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3176 * Sets the text and icon of an item in a tree window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3177 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3178 * handle: Handle to the tree containing the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3179 * item: Handle of the item to be modified. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3180 * title: The text title of the entry. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3181 * icon: Handle to coresponding icon. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3182 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3183 void API dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3184 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3185 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3186 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3187 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3188 * Sets the item data of a tree item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3189 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3190 * handle: Handle to the tree containing the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3191 * item: Handle of the item to be modified. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3192 * itemdata: User defined data to be associated with item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3193 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3194 void API dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3195 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3196 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3197 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3198 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3199 * Gets the item data of a tree item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3200 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3201 * handle: Handle to the tree containing the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3202 * item: Handle of the item to be modified. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3203 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3204 * A pointer to tree item data or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3205 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3206 void * API dw_tree_item_get_data(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3207 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3208 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3209 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3210 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3211 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3212 * Sets this item as the active selection. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3213 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3214 * handle: Handle to the tree window (widget) to be selected. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3215 * item: Handle to the item to be selected. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3216 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3217 void API dw_tree_item_select(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3218 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3219 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3220 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3221 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3222 * Removes all nodes from a tree. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3223 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3224 * handle: Handle to the window (widget) to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3225 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3226 void API dw_tree_clear(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3227 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3228 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3229 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3230 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3231 * Expands a node on a tree. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3232 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3233 * handle: Handle to the tree window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3234 * item: Handle to node to be expanded. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3235 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3236 void API dw_tree_item_expand(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3237 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3238 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3239 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3240 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3241 * Collapses a node on a tree. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3242 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3243 * handle: Handle to the tree window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3244 * item: Handle to node to be collapsed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3245 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3246 void API dw_tree_item_collapse(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3247 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3248 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3249 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3250 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3251 * Removes a node from a tree. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3252 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3253 * handle: Handle to the window (widget) to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3254 * item: Handle to node to be deleted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3255 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3256 void API dw_tree_item_delete(HWND handle, HTREEITEM item) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3257 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3258 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3259 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3260 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3261 * Create a container object to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3262 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3263 * id: An ID to be used for getting the resource from the |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3264 * resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3265 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3266 * A handle to a container window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3267 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3268 HWND API dw_container_new(ULONG cid, int multi) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3269 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3270 JNIEnv *env; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3271 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3272 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3273 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3274 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3275 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3276 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3277 jmethodID containerNew = env->GetMethodID(clazz, "containerNew", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3278 "(II)Landroid/widget/ListView;"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3279 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3280 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, containerNew, (int)cid, multi), _DW_REFERENCE_WEAK); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3281 return result; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3282 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3283 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3284 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3285 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3286 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3287 * Sets up the container columns. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3288 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3289 * handle: Handle to the container to be configured. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3290 * flags: An array of unsigned longs with column flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3291 * titles: An array of strings with column text titles. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3292 * count: The number of columns (this should match the arrays). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3293 * separator: The column number that contains the main separator. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3294 * (this item may only be used in OS/2) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3295 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3296 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3297 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3298 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3299 { |
2559
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3300 int retval = DW_ERROR_GENERAL; |
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3301 |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3302 if(handle && flags && titles && count > 0) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3303 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3304 int z; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3305 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3306 for(z=0;z<count;z++) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3307 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3308 JNIEnv *env; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3309 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3310 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3311 { |
2559
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3312 retval = DW_ERROR_NONE; |
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3313 |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3314 // Generate a string |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3315 jstring jstr = env->NewStringUTF(titles[z]); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3316 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3317 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3318 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3319 jmethodID containerNew = env->GetMethodID(clazz, "containerAddColumn", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3320 "(Landroid/widget/ListView;Ljava/lang/String;I)V"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3321 // Call the method on the object |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3322 env->CallVoidMethod(_dw_obj, containerNew, handle, jstr, (int)flags[z]); |
2559
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3323 if(_dw_jni_check_exception(env)) |
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3324 retval = DW_ERROR_GENERAL; |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3325 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3326 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3327 } |
2559
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
3328 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3329 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3330 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3331 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3332 * Configures the main filesystem column title for localization. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3333 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3334 * handle: Handle to the container to be configured. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3335 * title: The title to be displayed in the main column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3336 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3337 void API dw_filesystem_set_column_title(HWND handle, const char *title) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3338 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3339 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3340 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3341 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3342 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3343 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3344 * handle: Handle to the container to be configured. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3345 * flags: An array of unsigned longs with column flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3346 * titles: An array of strings with column text titles. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3347 * count: The number of columns (this should match the arrays). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3348 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3349 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3350 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3351 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3352 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3353 unsigned long fsflags[2] = { DW_CFA_BITMAPORICON, DW_CFA_STRING }; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3354 char *fstitles[2] = { (char *)"Icon", (char *)"Filename" }; |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3355 int retval = dw_container_setup(handle, fsflags, fstitles, 2, 0); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3356 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3357 if(retval == DW_ERROR_NONE) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3358 retval = dw_container_setup(handle, flags, titles, count, 0); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3359 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3360 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3361 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3362 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3363 * Allocates memory used to populate a container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3364 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3365 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3366 * rowcount: The number of items to be populated. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3367 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3368 * Handle to container items allocated or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3369 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3370 void * API dw_container_alloc(HWND handle, int rowcount) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3371 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3372 JNIEnv *env; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3373 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3374 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3375 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3376 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3377 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3378 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3379 jmethodID containerAlloc = env->GetMethodID(clazz, "containerAlloc", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3380 "(Landroid/widget/ListView;I)Landroid/widget/ListView;"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3381 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3382 return (void *)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, containerAlloc, handle, rowcount), _DW_REFERENCE_WEAK); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3383 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3384 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3385 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3386 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3387 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3388 * Sets an item in specified row and column to the given data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3389 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3390 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3391 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3392 * column: Zero based column of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3393 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3394 * data: Pointer to the data to be added. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3395 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3396 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3397 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3398 int rowstart = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_rowstart")); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3399 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3400 dw_container_change_item(handle, column, row + rowstart, data); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3401 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3402 |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3403 /* Internal version that doesn't update the list immediately */ |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3404 void API _dw_container_change_item(HWND handle, int column, int row, void *data) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3405 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3406 JNIEnv *env; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3407 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3408 if(handle && data && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3409 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3410 int columntype = dw_container_get_column_type(handle, column); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3411 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3412 if((columntype & DW_CFA_BITMAPORICON)) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3413 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3414 jobject icon = *((jobject *)data); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3415 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3416 if(icon) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3417 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3418 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3419 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3420 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3421 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemIcon", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3422 "(Landroid/widget/ListView;IILandroid/graphics/drawable/Drawable;)V"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3423 // Call the method on the object |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3424 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, icon); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3425 _dw_jni_check_exception(env); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3426 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3427 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3428 else if((columntype & DW_CFA_STRING)) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3429 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3430 const char *tmp = *((const char **)data); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3431 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3432 if(tmp) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3433 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3434 jstring jstr = env->NewStringUTF(tmp); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3435 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3436 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3437 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3438 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemString", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3439 "(Landroid/widget/ListView;IILjava/lang/String;)V"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3440 // Call the method on the object |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3441 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3442 _dw_jni_check_exception(env); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3443 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3444 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3445 else if((columntype & DW_CFA_ULONG)) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3446 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3447 ULONG num = *((ULONG *)data); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3448 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3449 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3450 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3451 jmethodID containerChangeItem = env->GetMethodID(clazz, "containerChangeItemInt", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3452 "(Landroid/widget/ListView;III)V"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3453 // Call the method on the object |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3454 env->CallVoidMethod(_dw_obj, containerChangeItem, handle, column, row, (int)num); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3455 _dw_jni_check_exception(env); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3456 } |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3457 // TODO: Handle DATE and TIME |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3458 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3459 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3460 |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3461 /* Notify that the data changed, causing the container to refresh */ |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3462 void _dw_container_refresh(HWND handle) |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3463 { |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3464 JNIEnv *env; |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3465 |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3466 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3467 { |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3468 // First get the class that contains the method you need to call |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3469 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3470 // Get the method that you want to call |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3471 jmethodID containerRefresh = env->GetMethodID(clazz, "containerRefresh", |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3472 "(Landroid/widget/ListView;)V"); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3473 // Call the method on the object |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3474 env->CallVoidMethod(_dw_obj, containerRefresh, handle); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3475 _dw_jni_check_exception(env); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3476 } |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3477 } |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3478 |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3479 /* |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3480 * Changes an existing item in specified row and column to the given data. |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3481 * Parameters: |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3482 * handle: Handle to the container window (widget). |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3483 * column: Zero based column of data being set. |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3484 * row: Zero based row of data being set. |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3485 * data: Pointer to the data to be added. |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3486 */ |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3487 void API dw_container_change_item(HWND handle, int column, int row, void *data) |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3488 { |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3489 _dw_container_change_item(handle, column, row, data); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3490 _dw_container_refresh(handle); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3491 } |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3492 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3493 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3494 * Changes an existing item in specified row and column to the given data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3495 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3496 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3497 * column: Zero based column of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3498 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3499 * data: Pointer to the data to be added. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3500 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3501 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3502 { |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3503 _dw_container_change_item(handle, column + 2, row, data); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3504 _dw_container_refresh(handle); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3505 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3506 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3507 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3508 * Changes an item in specified row and column to the given data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3509 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3510 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3511 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3512 * column: Zero based column of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3513 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3514 * data: Pointer to the data to be added. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3515 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3516 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3517 { |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3518 _dw_container_change_item(handle, 0, row, (void *)&icon); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3519 _dw_container_change_item(handle, 1, row, (void *)&filename); |
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3520 _dw_container_refresh(handle); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3521 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3522 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3523 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3524 * Sets an item in specified row and column to the given data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3525 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3526 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3527 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3528 * column: Zero based column of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3529 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3530 * data: Pointer to the data to be added. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3531 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3532 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, const char *filename, HICN icon) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3533 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3534 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3535 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3536 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3537 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3538 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3539 * Sets an item in specified row and column to the given data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3540 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3541 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3542 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3543 * column: Zero based column of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3544 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3545 * data: Pointer to the data to be added. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3546 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3547 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3548 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3549 dw_container_set_item(handle, pointer, column + 2, row, data); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3550 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3551 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3552 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3553 * Sets the data of a row in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3554 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3555 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3556 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3557 * data: Data pointer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3558 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3559 void API dw_container_set_row_data(void *pointer, int row, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3560 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3561 HWND handle = (HWND)pointer; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3562 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3563 if(handle) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3564 { |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3565 int rowstart = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_rowstart")); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3566 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3567 dw_container_change_row_data(handle, row + rowstart, data); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3568 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3569 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3570 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3571 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3572 * Changes the data of a row already inserted in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3573 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3574 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3575 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3576 * data: Data pointer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3577 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3578 void API dw_container_change_row_data(HWND handle, int row, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3579 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3580 JNIEnv *env; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3581 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3582 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3583 { |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3584 // First get the class that contains the method you need to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3585 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3586 // Get the method that you want to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3587 jmethodID containerChangeRowData = env->GetMethodID(clazz, "containerChangeRowData", |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3588 "(Landroid/widget/ListView;IJ)V"); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3589 // Call the method on the object |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3590 env->CallVoidMethod(_dw_obj, containerChangeRowData, handle, row, (jlong)data); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3591 _dw_jni_check_exception(env); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3592 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3593 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3594 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3595 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3596 * Gets column type for a container column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3597 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3598 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3599 * column: Zero based column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3600 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3601 * Constant identifying the the column type. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3602 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3603 int API dw_container_get_column_type(HWND handle, int column) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3604 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3605 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3606 int retval = 0; |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3607 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3608 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3609 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3610 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3611 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3612 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3613 jmethodID containerGetColumnType = env->GetMethodID(clazz, "containerGetColumnType", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3614 "(Landroid/widget/ListView;I)I"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3615 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3616 retval = env->CallIntMethod(_dw_obj, containerGetColumnType, handle, column); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3617 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3618 retval = 0; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3619 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3620 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3621 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3622 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3623 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3624 * Gets column type for a filesystem container column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3625 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3626 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3627 * column: Zero based column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3628 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3629 * Constant identifying the the column type. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3630 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3631 int API dw_filesystem_get_column_type(HWND handle, int column) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3632 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3633 return dw_container_get_column_type(handle, column + 2); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3634 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3635 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3636 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3637 * Sets the alternating row colors for container window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3638 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3639 * handle: The window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3640 * oddcolor: Odd row background color in DW_RGB format or a default color index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3641 * evencolor: Even row background color in DW_RGB format or a default color index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3642 * DW_RGB_TRANSPARENT will disable coloring rows. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3643 * DW_CLR_DEFAULT will use the system default alternating row colors. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3644 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3645 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3646 { |
2580
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3647 JNIEnv *env; |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3648 |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3649 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3650 { |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3651 jlong odd = _dw_get_color(oddcolor); |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3652 jlong even = _dw_get_color(evencolor); |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3653 |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3654 // First get the class that contains the method you need to call |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3655 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3656 // Get the method that you want to call |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3657 jmethodID containerSetStripe = env->GetMethodID(clazz, "containerSetStripe", |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3658 "(Landroid/widget/ListView;JJ)V"); |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3659 if(oddcolor == DW_RGB_TRANSPARENT) |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3660 odd = -1; |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3661 else if(oddcolor == DW_CLR_DEFAULT) |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3662 odd = -2; |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3663 if(evencolor == DW_RGB_TRANSPARENT) |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3664 even = -1; |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3665 else if(evencolor == DW_CLR_DEFAULT) |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3666 even = -2; |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3667 |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3668 // Call the method on the object |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3669 env->CallVoidMethod(_dw_obj, containerSetStripe, handle, odd, even); |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3670 _dw_jni_check_exception(env); |
473eb9ff3f04
Android: Implement dw_container_set_stripe() and center the images in the rows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2578
diff
changeset
|
3671 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3672 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3673 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3674 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3675 * Sets the width of a column in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3676 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3677 * handle: Handle to window (widget) of container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3678 * column: Zero based column of width being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3679 * width: Width of column in pixels. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3680 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3681 void API dw_container_set_column_width(HWND handle, int column, int width) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3682 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3683 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3684 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3685 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3686 * Sets the title of a row in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3687 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3688 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3689 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3690 * title: String title of the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3691 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3692 void API dw_container_set_row_title(void *pointer, int row, const char *title) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3693 { |
2560
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3694 HWND handle = (HWND)pointer; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3695 |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3696 if(handle) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3697 { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3698 int rowstart = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_rowstart")); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3699 |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3700 dw_container_change_row_title(handle, row + rowstart, title); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3701 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3702 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3703 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3704 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3705 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3706 * Sets the title of a row in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3707 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3708 * handle: Handle to window (widget) of container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3709 * row: Zero based row of data being set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3710 * title: String title of the item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3711 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3712 void API dw_container_change_row_title(HWND handle, int row, const char *title) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3713 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3714 JNIEnv *env; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3715 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3716 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3717 { |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3718 // Generate a string |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3719 jstring jstr = title ? env->NewStringUTF(title) : nullptr; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3720 // First get the class that contains the method you need to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3721 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3722 // Get the method that you want to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3723 jmethodID containerChangeRowTitle = env->GetMethodID(clazz, "containerChangeRowTitle", |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3724 "(Landroid/widget/ListView;ILjava/lang/String;)V"); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3725 // Call the method on the object |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3726 env->CallVoidMethod(_dw_obj, containerChangeRowTitle, handle, row, jstr); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3727 _dw_jni_check_exception(env); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3728 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3729 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3730 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3731 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3732 * Sets the title of a row in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3733 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3734 * handle: Handle to the container window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3735 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3736 * rowcount: The number of rows to be inserted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3737 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3738 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3739 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3740 JNIEnv *env; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3741 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3742 if(pointer && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3743 env->DeleteWeakGlobalRef((jobject)pointer); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3744 dw_window_set_data(handle, "_dw_rowstart", NULL); |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3745 _dw_container_refresh(handle); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3746 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3747 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3748 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3749 * Removes all rows from a container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3750 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3751 * handle: Handle to the window (widget) to be cleared. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3752 * redraw: TRUE to cause the container to redraw immediately. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3753 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3754 void API dw_container_clear(HWND handle, int redraw) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3755 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3756 JNIEnv *env; |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3757 |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3758 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3759 { |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3760 // First get the class that contains the method you need to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3761 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3762 // Get the method that you want to call |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3763 jmethodID containerClear = env->GetMethodID(clazz, "containerClear", |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3764 "(Landroid/widget/ListView;)V"); |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3765 // Call the method on the object |
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3766 env->CallVoidMethod(_dw_obj, containerClear, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
3767 _dw_jni_check_exception(env); |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3768 _dw_container_refresh(handle); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
3769 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3770 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3771 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3772 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3773 * Removes the first x rows from a container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3774 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3775 * handle: Handle to the window (widget) to be deleted from. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3776 * rowcount: The number of rows to be deleted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3777 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3778 void API dw_container_delete(HWND handle, int rowcount) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3779 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3780 JNIEnv *env; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3781 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3782 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3783 { |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3784 // First get the class that contains the method you need to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3785 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3786 // Get the method that you want to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3787 jmethodID containerDelete = env->GetMethodID(clazz, "containerDelete", |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3788 "(Landroid/widget/ListView;I)V"); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3789 // Call the method on the object |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3790 env->CallVoidMethod(_dw_obj, containerDelete, handle, rowcount); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3791 _dw_jni_check_exception(env); |
2561
f28d7d0ca5ed
Android: Attempt at implementing updating the container after insertion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2560
diff
changeset
|
3792 _dw_container_refresh(handle); |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3793 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3794 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3795 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3796 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3797 * Scrolls container up or down. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3798 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3799 * handle: Handle to the window (widget) to be scrolled. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3800 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3801 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3802 * rows: The number of rows to be scrolled. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3803 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3804 void API dw_container_scroll(HWND handle, int direction, long rows) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3805 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3806 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3807 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3808 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3809 * Starts a new query of a container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3810 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3811 * handle: Handle to the window (widget) to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3812 * flags: If this parameter is DW_CRA_SELECTED it will only |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3813 * return items that are currently selected. Otherwise |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3814 * it will return all records in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3815 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3816 * Pointer to data associated with first entry or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3817 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3818 char * API dw_container_query_start(HWND handle, unsigned long flags) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3819 { |
2560
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3820 JNIEnv *env; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3821 char *retval = nullptr; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3822 |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3823 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3824 { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3825 if(flags & DW_CR_RETDATA) { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3826 // First get the class that contains the method you need to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3827 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3828 // Get the method that you want to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3829 jmethodID containerGetDataStart = env->GetMethodID(clazz, "containerGetDataStart", |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3830 "(Landroid/widget/ListView;I)J"); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3831 // Call the method on the object |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3832 jlong data = env->CallLongMethod(_dw_obj, containerGetDataStart, handle, (int)flags); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3833 if(!_dw_jni_check_exception(env)) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3834 retval = (char *)data; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3835 } else { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3836 // First get the class that contains the method you need to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3837 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3838 // Get the method that you want to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3839 jmethodID containerGetDataStart = env->GetMethodID(clazz, "containerGetTitleStart", |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3840 "(Landroid/widget/ListView;I)Ljava/lang/String;"); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3841 // Call the method on the object |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3842 jstring jstr = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, containerGetDataStart, handle, (int)flags), _DW_REFERENCE_NONE); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3843 if(jstr) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3844 retval = (char *)env->GetStringUTFChars(jstr, nullptr); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3845 } |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3846 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3847 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3848 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3849 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3850 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3851 * Continues an existing query of a container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3852 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3853 * handle: Handle to the window (widget) to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3854 * flags: If this parameter is DW_CRA_SELECTED it will only |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3855 * return items that are currently selected. Otherwise |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3856 * it will return all records in the container. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3857 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3858 * Pointer to data associated with next entry or nullptr on error or completion. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3859 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3860 char * API dw_container_query_next(HWND handle, unsigned long flags) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3861 { |
2560
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3862 JNIEnv *env; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3863 char *retval = nullptr; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3864 |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3865 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3866 { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3867 if(flags & DW_CR_RETDATA) { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3868 // First get the class that contains the method you need to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3869 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3870 // Get the method that you want to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3871 jmethodID containerGetDataStart = env->GetMethodID(clazz, "containerGetDataNext", |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3872 "(Landroid/widget/ListView;I)J"); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3873 // Call the method on the object |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3874 jlong data = env->CallLongMethod(_dw_obj, containerGetDataStart, handle, (int)flags); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3875 if(!_dw_jni_check_exception(env)) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3876 retval = (char *)data; |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3877 } else { |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3878 // First get the class that contains the method you need to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3879 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3880 // Get the method that you want to call |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3881 jmethodID containerGetDataStart = env->GetMethodID(clazz, "containerGetTitleNext", |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3882 "(Landroid/widget/ListView;I)Ljava/lang/String;"); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3883 // Call the method on the object |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3884 jstring jstr = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, containerGetDataStart, handle, (int)flags), _DW_REFERENCE_NONE); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3885 if(jstr) |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3886 retval = (char *)env->GetStringUTFChars(jstr, nullptr); |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3887 } |
3da35cd91ca7
Android: Implement querying containers and ENTER and CONTEXT callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2559
diff
changeset
|
3888 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
3889 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3890 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3891 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3892 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3893 * Cursors the item with the text speficied, and scrolls to that item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3894 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3895 * handle: Handle to the window (widget) to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3896 * text: Text usually returned by dw_container_query(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3897 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3898 void API dw_container_cursor(HWND handle, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3899 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3900 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3901 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3902 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3903 * Cursors the item with the data speficied, and scrolls to that item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3904 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3905 * handle: Handle to the window (widget) to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3906 * data: Data usually returned by dw_container_query(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3907 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3908 void API dw_container_cursor_by_data(HWND handle, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3909 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3910 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3911 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3912 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3913 * Deletes the item with the text speficied. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3914 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3915 * handle: Handle to the window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3916 * text: Text usually returned by dw_container_query(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3917 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3918 void API dw_container_delete_row(HWND handle, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3919 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3920 JNIEnv *env; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3921 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3922 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3923 { |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3924 // Generate a string |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3925 jstring jstr = text ? env->NewStringUTF(text) : nullptr; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3926 // First get the class that contains the method you need to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3927 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3928 // Get the method that you want to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3929 jmethodID containerRowDeleteByTitle = env->GetMethodID(clazz, "containerRowDeleteByTitle", |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3930 "(Landroid/widget/ListView;Ljava/lang/String;)V"); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3931 // Call the method on the object |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3932 env->CallVoidMethod(_dw_obj, containerRowDeleteByTitle, handle, jstr); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3933 _dw_jni_check_exception(env); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3934 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3935 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3936 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3937 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3938 * Deletes the item with the data speficied. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3939 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3940 * handle: Handle to the window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3941 * data: Data usually returned by dw_container_query(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3942 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3943 void API dw_container_delete_row_by_data(HWND handle, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3944 { |
2558
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3945 JNIEnv *env; |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3946 |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3947 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3948 { |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3949 // First get the class that contains the method you need to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3950 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3951 // Get the method that you want to call |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3952 jmethodID containerRowDeleteByData = env->GetMethodID(clazz, "containerRowDeleteByData", |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3953 "(Landroid/widget/ListView;J)V"); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3954 // Call the method on the object |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3955 env->CallVoidMethod(_dw_obj, containerRowDeleteByData, handle, (jlong)data); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3956 _dw_jni_check_exception(env); |
ebc6a4ff5f1f
Android: Implement container row data and titles, required for the callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2557
diff
changeset
|
3957 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3958 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3959 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3960 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3961 * Optimizes the column widths so that all data is visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3962 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3963 * handle: Handle to the window (widget) to be optimized. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3964 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3965 void API dw_container_optimize(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3966 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3967 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3968 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3969 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3970 * Inserts an icon into the taskbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3971 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3972 * handle: Window handle that will handle taskbar icon messages. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3973 * icon: Icon handle to display in the taskbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3974 * bubbletext: Text to show when the mouse is above the icon. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3975 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3976 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3977 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3978 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3979 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3980 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3981 * Deletes an icon from the taskbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3982 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3983 * handle: Window handle that was used with dw_taskbar_insert(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3984 * icon: Icon handle that was used with dw_taskbar_insert(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3985 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3986 void API dw_taskbar_delete(HWND handle, HICN icon) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3987 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3988 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3989 |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3990 HICN _dw_icon_load(const char *filename, const char *data, int len, int resid) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3991 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3992 JNIEnv *env; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3993 |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3994 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3995 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3996 // Construct a string |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3997 jstring file = nullptr; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3998 if(filename) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
3999 file = env->NewStringUTF(filename); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4000 // Construct a byte array |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4001 jbyteArray bytearray = nullptr; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4002 if(data && len > 0) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4003 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4004 bytearray = env->NewByteArray(len); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4005 env->SetByteArrayRegion(bytearray, 0, len, reinterpret_cast<const jbyte *>(data)); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4006 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4007 // First get the class that contains the method you need to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4008 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4009 // Get the method that you want to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4010 jmethodID iconNew = env->GetMethodID(clazz, "iconNew", |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4011 "(Ljava/lang/String;[BII)Landroid/graphics/drawable/Drawable;"); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4012 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4013 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, iconNew, |
2559
b5e8a319fde6
Android: Fix logic error in dw_container_setup() causing return from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2558
diff
changeset
|
4014 file, bytearray, len, resid), _DW_REFERENCE_STRONG); |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4015 // Clean up after the array now that we are finished |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4016 //if(bytearray) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4017 //env->ReleaseByteArrayElements(bytearray, (jbyte *) data, 0); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4018 return result; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4019 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4020 return nullptr; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4021 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4022 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4023 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4024 * Obtains an icon from a module (or header in GTK). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4025 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4026 * module: Handle to module (DLL) in OS/2 and Windows. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4027 * id: A unsigned long id int the resources on OS/2 and |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4028 * Windows, on GTK this is converted to a pointer |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4029 * to an embedded XPM. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4030 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4031 * Handle to the created icon or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4032 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4033 HICN API dw_icon_load(unsigned long module, unsigned long resid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4034 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
4035 return _dw_icon_load(nullptr, nullptr, 0, resid); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4036 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4037 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4038 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4039 * Obtains an icon from a file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4040 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4041 * filename: Name of the file, omit extention to have |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4042 * DW pick the appropriate file extension. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4043 * (ICO on OS/2 or Windows, XPM on Unix) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4044 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4045 * Handle to the created icon or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4046 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4047 HICN API dw_icon_load_from_file(const char *filename) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4048 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
4049 return _dw_icon_load(filename, nullptr, 0, 0); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4050 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4051 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4052 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4053 * Obtains an icon from data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4054 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4055 * data: Data for the icon (ICO on OS/2 or Windows, XPM on Unix, PNG on Mac) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4056 * len: Length of the passed in data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4057 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4058 * Handle to the created icon or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4059 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4060 HICN API dw_icon_load_from_data(const char *data, int len) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4061 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
4062 return _dw_icon_load(nullptr, data, len, 0); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4063 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4064 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4065 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4066 * Frees a loaded icon resource. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4067 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4068 * handle: Handle to icon returned by dw_icon_load(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4069 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4070 void API dw_icon_free(HICN handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4071 { |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4072 if(handle) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4073 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4074 JNIEnv *env; |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4075 |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4076 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4077 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4078 env->DeleteGlobalRef(handle); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4079 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4080 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4081 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4082 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4083 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4084 * Create a new MDI Frame to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4085 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4086 * id: An ID to be used with dw_window_from_id or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4087 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4088 * Handle to the created MDI widget or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4089 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4090 HWND API dw_mdi_new(unsigned long cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4091 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4092 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4093 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4094 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4095 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4096 * Creates a splitbar window (widget) with given parameters. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4097 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4098 * type: Value can be DW_VERT or DW_HORZ. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4099 * topleft: Handle to the window to be top or left. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4100 * bottomright: Handle to the window to be bottom or right. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4101 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4102 * A handle to a splitbar window or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4103 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4104 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4105 { |
2650
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4106 JNIEnv *env; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4107 |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4108 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4109 { |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4110 // First get the class that contains the method you need to call |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4111 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4112 // Get the method that you want to call |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4113 jmethodID splitBarNew = env->GetMethodID(clazz, "splitBarNew", |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4114 "(ILandroid/view/View;Landroid/view/View;I)Landroidx/constraintlayout/widget/ConstraintLayout;"); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4115 // Call the method on the object |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4116 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, splitBarNew, type, topleft, bottomright, (int)cid), _DW_REFERENCE_WEAK); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4117 return result; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4118 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4119 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4120 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4121 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4122 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4123 * Sets the position of a splitbar (pecentage). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4124 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4125 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4126 * percent: The position of the splitbar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4127 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4128 void API dw_splitbar_set(HWND handle, float percent) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4129 { |
2650
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4130 JNIEnv *env; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4131 |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4132 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4133 { |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4134 jfloat position = (jfloat)percent; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4135 // First get the class that contains the method you need to call |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4136 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4137 // Get the method that you want to call |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4138 jmethodID splitBarSet = env->GetMethodID(clazz, "splitBarSet", |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4139 "(Landroidx/constraintlayout/widget/ConstraintLayout;F)V"); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4140 // Call the method on the object |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4141 env->CallVoidMethod(_dw_obj, splitBarSet, handle, position); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4142 _dw_jni_check_exception(env); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4143 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4144 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4145 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4146 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4147 * Gets the position of a splitbar (pecentage). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4148 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4149 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4150 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4151 * Position of the splitbar (percentage). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4152 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4153 float API dw_splitbar_get(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4154 { |
2650
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4155 JNIEnv *env; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4156 float retval = 0; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4157 |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4158 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4159 { |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4160 // First get the class that contains the method you need to call |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4161 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4162 // Get the method that you want to call |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4163 jmethodID splitBarGet = env->GetMethodID(clazz, "splitBarGet", |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4164 "(Landroidx/constraintlayout/widget/ConstraintLayout;)F"); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4165 // Call the method on the object |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4166 retval = (float)env->CallFloatMethod(_dw_obj, splitBarGet, handle); |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4167 if(_dw_jni_check_exception(env)) |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4168 retval = 0; |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4169 } |
7101b5692601
Android: Attempt at implementing splitbar using ConstraintLayout.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2637
diff
changeset
|
4170 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4171 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4172 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4173 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4174 * Create a bitmap object to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4175 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4176 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4177 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4178 * Handle to the created bitmap widget or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4179 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4180 HWND API dw_bitmap_new(ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4181 { |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4182 JNIEnv *env; |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4183 |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4184 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4185 { |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4186 // First get the class that contains the method you need to call |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4187 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4188 // Get the method that you want to call |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4189 jmethodID mleNew = env->GetMethodID(clazz, "bitmapNew", |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4190 "(I)Landroid/widget/ImageView;"); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4191 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4192 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, mleNew, (int)cid), _DW_REFERENCE_WEAK); |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4193 return result; |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
4194 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4195 return nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4196 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4197 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4198 /* Unified internal function to create an Android internal Bitmap */ |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4199 jobject _dw_jbitmap_new(unsigned long width, unsigned long height, const char *filename, const char *data, int len, int resid) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4200 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4201 JNIEnv *env; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4202 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4203 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4204 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4205 // Construct a string |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4206 jstring file = nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4207 if(filename) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4208 file = env->NewStringUTF(filename); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4209 // Construct a byte array |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4210 jbyteArray bytearray = nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4211 if(data && len > 0) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4212 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4213 bytearray = env->NewByteArray(len); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4214 env->SetByteArrayRegion(bytearray, 0, len, reinterpret_cast<const jbyte *>(data)); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4215 } |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4216 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4217 { |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4218 // First get the class that contains the method you need to call |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4219 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4220 // Get the method that you want to call |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4221 jmethodID pixmapNew = env->GetMethodID(clazz, "pixmapNew", |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4222 "(IILjava/lang/String;[BII)Landroid/graphics/Bitmap;"); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4223 // Call the method on the object |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4224 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, pixmapNew, |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4225 (jint) width, |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4226 (jint) height, |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4227 file, bytearray, len, |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4228 resid), |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4229 _DW_REFERENCE_STRONG); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4230 // Clean up after the array now that we are finished |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4231 //if(bytearray) |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4232 //env->ReleaseByteArrayElements(bytearray, (jbyte *) data, 0); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4233 return result; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4234 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4235 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4236 return nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4237 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4238 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4239 void _dw_pixmap_get_dimensions(HPIXMAP pixmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4240 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4241 JNIEnv *env; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4242 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4243 if(pixmap && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4244 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4245 // First get the class that contains the method you need to call |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4246 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4247 // Get the method that you want to call |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4248 jmethodID pixmapGetDimensions = env->GetMethodID(clazz, "pixmapGetDimensions", |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4249 "(Landroid/graphics/Bitmap;)J"); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4250 // Call the method on the object |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4251 jlong dimensions = env->CallLongMethod(_dw_obj, pixmapGetDimensions, pixmap->bitmap); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4252 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4253 dimensions = 0; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4254 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4255 pixmap->width = dimensions & 0xFFFF; |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
4256 pixmap->height = (dimensions >> 32) & 0xFFFF; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4257 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4258 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4259 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4260 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4261 * Creates a pixmap with given parameters. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4262 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4263 * handle: Window handle the pixmap is associated with. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4264 * width: Width of the pixmap in pixels. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4265 * height: Height of the pixmap in pixels. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4266 * depth: Color depth of the pixmap. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4267 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4268 * A handle to a pixmap or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4269 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4270 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4271 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4272 jobject jbitmap = _dw_jbitmap_new(width, height, nullptr, nullptr, 0, 0); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4273 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4274 if(jbitmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4275 { |
2539
822f814a54f4
Android: Fix memory corruption issue due to incorrectly allocating HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2537
diff
changeset
|
4276 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4277 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4278 if(pixmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4279 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4280 pixmap->width = width; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4281 pixmap->height = height; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4282 pixmap->bitmap = jbitmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4283 pixmap->handle = handle; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4284 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4285 return pixmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4286 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4287 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4288 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4289 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4290 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4291 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4292 * Creates a pixmap from a file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4293 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4294 * handle: Window handle the pixmap is associated with. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4295 * filename: Name of the file, omit extention to have |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4296 * DW pick the appropriate file extension. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4297 * (BMP on OS/2 or Windows, XPM on Unix) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4298 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4299 * A handle to a pixmap or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4300 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4301 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4302 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4303 jobject jbitmap = _dw_jbitmap_new(0, 0, filename, nullptr, 0, 0); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4304 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4305 if(jbitmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4306 { |
2539
822f814a54f4
Android: Fix memory corruption issue due to incorrectly allocating HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2537
diff
changeset
|
4307 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4308 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4309 if(pixmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4310 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4311 pixmap->bitmap = jbitmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4312 pixmap->handle = handle; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4313 _dw_pixmap_get_dimensions(pixmap); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4314 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4315 return pixmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4316 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4317 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4318 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4319 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4320 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4321 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4322 * Creates a pixmap from data in memory. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4323 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4324 * handle: Window handle the pixmap is associated with. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4325 * data: Source of the image data |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4326 * (BMP on OS/2 or Windows, XPM on Unix) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4327 * len: Length of data |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4328 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4329 * A handle to a pixmap or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4330 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4331 HPIXMAP API dw_pixmap_new_from_data(HWND handle, const char *data, int len) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4332 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4333 jobject jbitmap = _dw_jbitmap_new(0, 0, nullptr, data, len, 0); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4334 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4335 if(jbitmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4336 { |
2539
822f814a54f4
Android: Fix memory corruption issue due to incorrectly allocating HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2537
diff
changeset
|
4337 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4338 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4339 if(pixmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4340 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4341 pixmap->bitmap = jbitmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4342 pixmap->handle = handle; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4343 _dw_pixmap_get_dimensions(pixmap); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4344 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4345 return pixmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4346 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4347 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4348 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4349 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4350 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4351 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4352 * Sets the transparent color for a pixmap. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4353 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4354 * pixmap: Handle to a pixmap returned by |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4355 * dw_pixmap_new.. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4356 * color: Transparent RGB color |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4357 * Note: This is only necessary on platforms that |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4358 * don't handle transparency automatically |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4359 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4360 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color ) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4361 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4362 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4363 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4364 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4365 * Creates a pixmap from internal resource graphic specified by id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4366 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4367 * handle: Window handle the pixmap is associated with. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4368 * id: Resource ID associated with requested pixmap. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4369 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4370 * A handle to a pixmap or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4371 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4372 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG resid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4373 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4374 jobject jbitmap = _dw_jbitmap_new(0, 0, nullptr, nullptr, 0, (int)resid); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4375 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4376 if(jbitmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4377 { |
2539
822f814a54f4
Android: Fix memory corruption issue due to incorrectly allocating HPIXMAP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2537
diff
changeset
|
4378 HPIXMAP pixmap = (HPIXMAP)calloc(1, sizeof(struct _hpixmap)); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4379 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4380 if(pixmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4381 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4382 pixmap->bitmap = jbitmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4383 pixmap->handle = handle; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4384 _dw_pixmap_get_dimensions(pixmap); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4385 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4386 return pixmap; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4387 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4388 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4389 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4390 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4391 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4392 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4393 * Sets the font used by a specified pixmap. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4394 * Normally the pixmap font is obtained from the associated window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4395 * However this can be used to override that, or for pixmaps with no window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4396 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4397 * pixmap: Handle to a pixmap returned by dw_pixmap_new() or |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4398 * passed to the application via a callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4399 * fontname: Name and size of the font in the form "size.fontname" |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4400 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4401 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4402 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4403 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4404 { |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4405 JNIEnv *env; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4406 |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4407 if(pixmap && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4408 { |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4409 // Construct a string |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4410 jstring jstr = env->NewStringUTF(fontname); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4411 // First get the class that contains the method you need to call |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4412 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4413 // Get the method that you want to call |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4414 jmethodID typefaceFromFontName = env->GetMethodID(clazz, "typefaceFromFontName", |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4415 "(Ljava/lang/String;)Landroid/graphics/Typeface;"); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4416 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4417 jobject typeface = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, typefaceFromFontName, jstr), _DW_REFERENCE_STRONG); |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4418 if(typeface) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4419 { |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4420 jobject oldtypeface = pixmap->typeface; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4421 pixmap->typeface = typeface; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4422 if(oldtypeface) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4423 env->DeleteGlobalRef(oldtypeface); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4424 pixmap->fontsize = atoi(fontname); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4425 } |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4426 return DW_ERROR_NONE; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
4427 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4428 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4429 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4430 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4431 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4432 * Destroys an allocated pixmap. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4433 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4434 * pixmap: Handle to a pixmap returned by |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4435 * dw_pixmap_new.. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4436 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4437 void API dw_pixmap_destroy(HPIXMAP pixmap) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4438 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4439 if(pixmap) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4440 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4441 JNIEnv *env; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4442 |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4443 if(pixmap && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4444 { |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4445 env->DeleteGlobalRef(pixmap->bitmap); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4446 if(pixmap->typeface) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4447 env->DeleteGlobalRef(pixmap->typeface); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4448 free(pixmap); |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4449 } |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4450 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4451 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4452 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4453 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4454 * Copies from one item to another. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4455 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4456 * dest: Destination window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4457 * destp: Destination pixmap. (choose only one). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4458 * xdest: X coordinate of destination. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4459 * ydest: Y coordinate of destination. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4460 * width: Width of area to copy. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4461 * height: Height of area to copy. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4462 * src: Source window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4463 * srcp: Source pixmap. (choose only one). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4464 * xsrc: X coordinate of source. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4465 * ysrc: Y coordinate of source. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4466 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4467 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4468 { |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4469 dw_pixmap_stretch_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, -1, -1); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4470 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4471 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4472 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4473 * Copies from one surface to another allowing for stretching. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4474 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4475 * dest: Destination window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4476 * destp: Destination pixmap. (choose only one). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4477 * xdest: X coordinate of destination. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4478 * ydest: Y coordinate of destination. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4479 * width: Width of the target area. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4480 * height: Height of the target area. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4481 * src: Source window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4482 * srcp: Source pixmap. (choose only one). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4483 * xsrc: X coordinate of source. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4484 * ysrc: Y coordinate of source. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4485 * srcwidth: Width of area to copy. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4486 * srcheight: Height of area to copy. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4487 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4488 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4489 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4490 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4491 { |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4492 JNIEnv *env; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4493 int retval = DW_ERROR_GENERAL; |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4494 |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4495 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4496 { |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4497 // First get the class that contains the method you need to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4498 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4499 // Get the method that you want to call |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4500 jmethodID pixmapBitBlt = env->GetMethodID(clazz, "pixmapBitBlt", |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4501 "(Lorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIIILorg/dbsoft/dwindows/DWRender;Landroid/graphics/Bitmap;IIII)I"); |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4502 // Call the method on the object |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
4503 retval = env->CallIntMethod(_dw_obj, pixmapBitBlt, dest, destp ? destp->bitmap : nullptr, xdest, ydest, width, height, src, srcp ? srcp->bitmap : nullptr, xsrc, ysrc, srcwidth, srcheight); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4504 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4505 retval = DW_ERROR_GENERAL; |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4506 } |
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
4507 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4508 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4509 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4510 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4511 * Create a new calendar window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4512 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4513 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4514 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4515 * Handle to the created calendar or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4516 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4517 HWND API dw_calendar_new(ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4518 { |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4519 JNIEnv *env; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4520 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4521 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4522 { |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4523 // First get the class that contains the method you need to call |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4524 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4525 // Get the method that you want to call |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4526 jmethodID calendarNew = env->GetMethodID(clazz, "calendarNew", |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4527 "(I)Landroid/widget/CalendarView;"); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4528 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4529 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, calendarNew, (int)cid), _DW_REFERENCE_WEAK); |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4530 return result; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4531 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4532 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4533 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4534 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4535 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4536 * Sets the current date of a calendar. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4537 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4538 * handle: The handle to the calendar returned by dw_calendar_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4539 * year, month, day: To set the calendar to display. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4540 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4541 void API dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4542 { |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4543 JNIEnv *env; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4544 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4545 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4546 { |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4547 time_t date; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4548 struct tm ts = {0}; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4549 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4550 // Convert to Unix time |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4551 ts.tm_year = year - 1900; |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
4552 ts.tm_mon = month - 1; |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4553 ts.tm_mday = day; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4554 date = mktime(&ts); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4555 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4556 // First get the class that contains the method you need to call |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4557 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4558 // Get the method that you want to call |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4559 jmethodID calendarSetDate = env->GetMethodID(clazz, "calendarSetDate", |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4560 "(Landroid/widget/CalendarView;J)V"); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4561 // Call the method on the object |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4562 env->CallVoidMethod(_dw_obj, calendarSetDate, handle, (jlong)date); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4563 _dw_jni_check_exception(env); |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4564 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4565 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4566 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4567 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4568 * Gets the year, month and day set in the calendar widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4569 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4570 * handle: The handle to the calendar returned by dw_calendar_new(). |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4571 * year: Variable to store the year or nullptr. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4572 * month: Variable to store the month or nullptr. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4573 * day: Variable to store the day or nullptr. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4574 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4575 void API dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4576 { |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4577 JNIEnv *env; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4578 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4579 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4580 { |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4581 time_t date; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4582 struct tm ts; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4583 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4584 // First get the class that contains the method you need to call |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4585 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4586 // Get the method that you want to call |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4587 jmethodID calendarGetDate = env->GetMethodID(clazz, "calendarGetDate", |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4588 "(Landroid/widget/CalendarView;)J"); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4589 // Call the method on the object |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4590 date = (time_t)env->CallLongMethod(_dw_obj, calendarGetDate, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4591 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4592 date = 0; |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4593 ts = *localtime(&date); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4594 if(year) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4595 *year = ts.tm_year + 1900; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4596 if(month) |
2526
d3f09b3f3703
Android: Initial dw_file_browse() implementation, still needs some work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2525
diff
changeset
|
4597 *month = ts.tm_mon + 1; |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4598 if(day) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4599 *day = ts.tm_mday; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
4600 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4601 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4602 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4603 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4604 * Causes the embedded HTML widget to take action. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4605 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4606 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4607 * action: One of the DW_HTML_* constants. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4608 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4609 void API dw_html_action(HWND handle, int action) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4610 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4611 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4612 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4613 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4614 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4615 // First get the class that contains the method you need to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4616 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4617 // Get the method that you want to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4618 jmethodID htmlAction = env->GetMethodID(clazz, "htmlAction", |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4619 "(Landroid/webkit/WebView;I)V"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4620 // Call the method on the object |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4621 env->CallVoidMethod(_dw_obj, htmlAction, handle, action); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4622 _dw_jni_check_exception(env); |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4623 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4624 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4625 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4626 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4627 * Render raw HTML code in the embedded HTML widget.. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4628 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4629 * handle: Handle to the window. |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4630 * string: String buffer containing HTML code to |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4631 * be rendered. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4632 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4633 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4634 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4635 int API dw_html_raw(HWND handle, const char *string) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4636 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4637 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4638 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4639 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4640 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4641 // Construct a String |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4642 jstring jstr = env->NewStringUTF(string); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4643 // First get the class that contains the method you need to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4644 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4645 // Get the method that you want to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4646 jmethodID htmlRaw = env->GetMethodID(clazz, "htmlRaw", |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4647 "(Landroid/webkit/WebView;Ljava/lang/String;)V"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4648 // Call the method on the object |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4649 env->CallVoidMethod(_dw_obj, htmlRaw, handle, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4650 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4651 return DW_ERROR_NONE; |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4652 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4653 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4654 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4655 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4656 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4657 * Render file or web page in the embedded HTML widget.. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4658 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4659 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4660 * url: Universal Resource Locator of the web or |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4661 * file object to be rendered. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4662 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4663 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4664 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4665 int API dw_html_url(HWND handle, const char *url) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4666 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4667 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4668 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4669 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4670 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4671 // Construct a String |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4672 jstring jstr = env->NewStringUTF(url); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4673 // First get the class that contains the method you need to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4674 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4675 // Get the method that you want to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4676 jmethodID htmlLoadURL = env->GetMethodID(clazz, "htmlLoadURL", |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4677 "(Landroid/webkit/WebView;Ljava/lang/String;)V"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4678 // Call the method on the object |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4679 env->CallVoidMethod(_dw_obj, htmlLoadURL, handle, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4680 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4681 return DW_ERROR_NONE; |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4682 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4683 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4684 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4685 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4686 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4687 * Executes the javascript contained in "script" in the HTML window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4688 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4689 * handle: Handle to the HTML window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4690 * script: Javascript code to execute. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4691 * scriptdata: Data passed to the signal handler. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4692 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4693 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4694 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4695 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4696 int API dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4697 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4698 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4699 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4700 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4701 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4702 // Construct a String |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4703 jstring jstr = env->NewStringUTF(script); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4704 // First get the class that contains the method you need to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4705 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4706 // Get the method that you want to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4707 jmethodID htmlJavascriptRun = env->GetMethodID(clazz, "htmlJavascriptRun", |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4708 "(Landroid/webkit/WebView;Ljava/lang/String;J)V"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4709 // Call the method on the object |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4710 env->CallVoidMethod(_dw_obj, htmlJavascriptRun, handle, jstr, (jlong)scriptdata); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4711 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4712 return DW_ERROR_NONE; |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4713 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4714 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4715 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4716 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4717 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4718 * Create a new HTML window (widget) to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4719 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4720 * id: An ID to be used with dw_window_from_id() or 0L. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4721 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4722 * Handle to the created html widget or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4723 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4724 HWND API dw_html_new(unsigned long cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4725 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4726 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4727 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4728 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4729 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4730 // First get the class that contains the method you need to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4731 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4732 // Get the method that you want to call |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4733 jmethodID htmlNew = env->GetMethodID(clazz, "htmlNew", |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4734 "(I)Landroid/webkit/WebView;"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4735 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4736 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, htmlNew, (int)cid), _DW_REFERENCE_WEAK); |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4737 return result; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
4738 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4739 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4740 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4741 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4742 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4743 * Returns the current X and Y coordinates of the mouse pointer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4744 * Parameters: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4745 * x: Pointer to variable to store X coordinate or nullptr. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4746 * y: Pointer to variable to store Y coordinate or nullptr. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4747 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4748 void API dw_pointer_query_pos(long *x, long *y) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4749 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4750 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4751 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4752 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4753 * Sets the X and Y coordinates of the mouse pointer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4754 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4755 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4756 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4757 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4758 void API dw_pointer_set_pos(long x, long y) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4759 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4760 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4761 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4762 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4763 * Create a menu object to be popped up. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4764 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4765 * id: An ID to be used associated with this menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4766 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4767 * Handle to the created menu or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4768 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4769 HMENUI API dw_menu_new(ULONG cid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4770 { |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4771 JNIEnv *env; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4772 |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4773 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4774 { |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4775 // First get the class that contains the method you need to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4776 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4777 // Get the method that you want to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4778 jmethodID menuNew = env->GetMethodID(clazz, "menuNew", |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4779 "(I)Lorg/dbsoft/dwindows/DWMenu;"); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4780 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4781 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, menuNew, (int)cid), _DW_REFERENCE_WEAK); |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4782 return result; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4783 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4784 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4785 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4786 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4787 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4788 * Create a menubar on a window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4789 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4790 * location: Handle of a window frame to be attached to. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4791 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4792 * Handle to the created menu bar or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4793 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4794 HMENUI API dw_menubar_new(HWND location) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4795 { |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4796 JNIEnv *env; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4797 |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4798 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4799 { |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4800 // First get the class that contains the method you need to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4801 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4802 // Get the method that you want to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4803 jmethodID menuBarNew = env->GetMethodID(clazz, "menuBarNew", |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4804 "(Landroid/view/View;)Lorg/dbsoft/dwindows/DWMenu;"); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4805 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4806 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, menuBarNew, location), _DW_REFERENCE_WEAK); |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4807 return result; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4808 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4809 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4810 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4811 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4812 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4813 * Destroys a menu created with dw_menubar_new or dw_menu_new. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4814 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4815 * menu: Handle of a menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4816 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4817 void API dw_menu_destroy(HMENUI *menu) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4818 { |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4819 JNIEnv *env; |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4820 |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4821 if(menu && *menu && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4822 { |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4823 // First get the class that contains the method you need to call |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4824 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4825 // Get the method that you want to call |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4826 jmethodID menuDestroy = env->GetMethodID(clazz, "menuDestroy", |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4827 "(Lorg/dbsoft/dwindows/DWMenu;)V"); |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4828 // Call the method on the object |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4829 env->CallVoidMethod(_dw_obj, menuDestroy, *menu); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4830 _dw_jni_check_exception(env); |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4831 *menu = nullptr; |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4832 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4833 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4834 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4835 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4836 * Deletes the menu item specified. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4837 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4838 * menu: The handle to the menu in which the item was appended. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4839 * id: Menuitem id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4840 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4841 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4842 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4843 int API dw_menu_delete_item(HMENUI menux, unsigned long id) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4844 { |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4845 JNIEnv *env; |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4846 |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4847 if(menux && id > 0 && id < 30000 && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4848 { |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4849 // First get the class that contains the method you need to call |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4850 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4851 // Get the method that you want to call |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4852 jmethodID menuDeleteItem = env->GetMethodID(clazz, "menuDeleteItem", |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4853 "(Lorg/dbsoft/dwindows/DWMenu;I)V"); |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4854 // Call the method on the object |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4855 env->CallVoidMethod(_dw_obj, menuDeleteItem, menux, (int)id); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4856 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4857 return DW_ERROR_NONE; |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4858 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4859 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4860 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4861 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4862 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4863 * Pops up a context menu at given x and y coordinates. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4864 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4865 * menu: The handle the the existing menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4866 * parent: Handle to the window initiating the popup. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4867 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4868 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4869 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4870 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4871 { |
2607
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4872 JNIEnv *env; |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4873 |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4874 if(menu && *menu && parent && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4875 { |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4876 // First get the class that contains the method you need to call |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4877 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4878 // Get the method that you want to call |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4879 jmethodID menuPopup = env->GetMethodID(clazz, "menuPopup", |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4880 "(Lorg/dbsoft/dwindows/DWMenu;Landroid/view/View;II)V"); |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4881 // Call the method on the object |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4882 env->CallVoidMethod(_dw_obj, menuPopup, *menu, parent, x, y); |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4883 _dw_jni_check_exception(env); |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4884 *menu = nullptr; |
3b9bbd69bb9c
Android: Implement dw_menu_popup() ... still need to implement the context events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2596
diff
changeset
|
4885 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4886 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4887 |
2544
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4888 char _dw_removetilde(char *dest, const char *src) |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4889 { |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4890 int z, cur=0; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4891 char accel = '\0'; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4892 |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4893 for(z=0;z<strlen(src);z++) |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4894 { |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4895 if(src[z] != '~') |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4896 { |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4897 dest[cur] = src[z]; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4898 cur++; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4899 } |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4900 else |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4901 { |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4902 accel = src[z+1]; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4903 } |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4904 } |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4905 dest[cur] = 0; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4906 return accel; |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4907 } |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4908 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4909 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4910 * Adds a menuitem or submenu to an existing menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4911 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4912 * menu: The handle the the existing menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4913 * title: The title text on the menu item to be added. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4914 * id: An ID to be used for message passing. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4915 * flags: Extended attributes to set on the menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4916 * end: If TRUE memu is positioned at the end of the menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4917 * check: If TRUE menu is "check"able. |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4918 * submenu: Handle to an existing menu to be a submenu or nullptr. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4919 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4920 * Handle to the created menu item or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4921 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4922 HWND API dw_menu_append_item(HMENUI menux, const char *title, ULONG itemid, ULONG flags, int end, int check, HMENUI submenux) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4923 { |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4924 JNIEnv *env; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4925 |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4926 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4927 { |
2544
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4928 char *newtitle = (char *)alloca(strlen(title)+1); |
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4929 char accel = _dw_removetilde(newtitle, title); |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4930 // Create a string |
2544
dbfcc0e357d6
Android: Clean up the menus... add separator, remove tildes and implement callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2543
diff
changeset
|
4931 jstring jstr = env->NewStringUTF(newtitle); |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4932 // First get the class that contains the method you need to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4933 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4934 // Get the method that you want to call |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4935 jmethodID menuAppendItem = env->GetMethodID(clazz, "menuAppendItem", |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4936 "(Lorg/dbsoft/dwindows/DWMenu;Ljava/lang/String;IIIILorg/dbsoft/dwindows/DWMenu;)Lorg/dbsoft/dwindows/DWMenuItem;"); |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4937 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4938 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, menuAppendItem, menux, jstr, (int)itemid, (int)flags, end, check, submenux), _DW_REFERENCE_WEAK); |
2543
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4939 return result; |
f9367eb9a6e7
Android: Initial menu support, incomplete but basics functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2542
diff
changeset
|
4940 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
4941 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4942 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4943 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4944 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4945 * Sets the state of a menu item check. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4946 * Deprecated; use dw_menu_item_set_state() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4947 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4948 * menu: The handle the the existing menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4949 * id: Menuitem id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4950 * check: TRUE for checked FALSE for not checked. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4951 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4952 void API dw_menu_item_set_check(HMENUI menux, unsigned long itemid, int check) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4953 { |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4954 dw_menu_item_set_state(menux, itemid, check ? DW_MIS_CHECKED : DW_MIS_UNCHECKED); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4955 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4956 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4957 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4958 * Sets the state of a menu item. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4959 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4960 * menu: The handle to the existing menu. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4961 * id: Menuitem id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4962 * flags: DW_MIS_ENABLED/DW_MIS_DISABLED |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4963 * DW_MIS_CHECKED/DW_MIS_UNCHECKED |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4964 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4965 void API dw_menu_item_set_state(HMENUI menux, unsigned long itemid, unsigned long state) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4966 { |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4967 JNIEnv *env; |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4968 |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4969 if(menux && itemid > 0 && itemid < 30000 && state && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4970 { |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4971 // First get the class that contains the method you need to call |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4972 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4973 // Get the method that you want to call |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4974 jmethodID menuSetState = env->GetMethodID(clazz, "menuSetState", |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4975 "(Lorg/dbsoft/dwindows/DWMenu;II)V"); |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4976 // Call the method on the object |
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4977 env->CallVoidMethod(_dw_obj, menuSetState, menux, (int)itemid, (int)state); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
4978 _dw_jni_check_exception(env); |
2545
f803f3b164cf
Android: Implement dw_menu_item_set_state/check() dw_menu_item_delete() and dw_menu_destroy().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2544
diff
changeset
|
4979 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4980 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4981 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4982 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4983 * Create a notebook object to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4984 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4985 * id: An ID to be used for getting the resource from the |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4986 * resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4987 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
4988 * Handle to the created notebook or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4989 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4990 HWND API dw_notebook_new(ULONG cid, int top) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4991 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4992 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4993 |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4994 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4995 { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4996 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4997 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4998 // Get the method that you want to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
4999 jmethodID notebookNew = env->GetMethodID(clazz, "notebookNew", |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5000 "(II)Landroid/widget/RelativeLayout;"); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5001 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5002 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, notebookNew, (int)cid, top), _DW_REFERENCE_WEAK); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5003 return result; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5004 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
5005 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5006 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5007 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5008 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5009 * Adds a new page to specified notebook. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5010 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5011 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5012 * flags: Any additional page creation flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5013 * front: If TRUE page is added at the beginning. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5014 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5015 * ID of newly created notebook page. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5016 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5017 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5018 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5019 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5020 unsigned long result = 0; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5021 |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5022 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5023 { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5024 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5025 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5026 // Get the method that you want to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5027 jmethodID notebookPageNew = env->GetMethodID(clazz, "notebookPageNew", |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5028 "(Landroid/widget/RelativeLayout;JI)J"); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5029 // Call the method on the object |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5030 result = (unsigned long)env->CallLongMethod(_dw_obj, notebookPageNew, handle, (jlong)flags, front); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5031 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5032 result = 0; |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5033 } |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5034 return result; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5035 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5036 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5037 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5038 * Remove a page from a notebook. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5039 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5040 * handle: Handle to the notebook widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5041 * pageid: ID of the page to be destroyed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5042 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5043 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5044 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5045 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5046 |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5047 if(handle && pageid && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5048 { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5049 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5050 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5051 // Get the method that you want to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5052 jmethodID notebookPageDestroy = env->GetMethodID(clazz, "notebookPageDestroy", |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5053 "(Landroid/widget/RelativeLayout;J)V"); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5054 // Call the method on the object |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5055 env->CallVoidMethod(_dw_obj, notebookPageDestroy, handle, (jlong)pageid); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5056 _dw_jni_check_exception(env); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5057 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5058 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5059 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5060 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5061 * Queries the currently visible page ID. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5062 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5063 * handle: Handle to the notebook widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5064 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5065 * ID of visible notebook page. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5066 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5067 unsigned long API dw_notebook_page_get(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5068 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5069 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5070 unsigned long result = 0; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5071 |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5072 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5073 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5074 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5075 // Get the method that you want to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5076 jmethodID notebookPageGet = env->GetMethodID(clazz, "notebookPageGet", |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5077 "(Landroid/widget/RelativeLayout;)J"); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5078 // Call the method on the object |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5079 result = (unsigned long)env->CallLongMethod(_dw_obj, notebookPageGet, handle); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5080 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5081 result = 0; |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5082 } |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5083 return result; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5084 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5085 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5086 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5087 * Sets the currently visible page ID. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5088 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5089 * handle: Handle to the notebook widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5090 * pageid: ID of the page to be made visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5091 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5092 void API dw_notebook_page_set(HWND handle, unsigned int pageid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5093 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5094 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5095 |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5096 if(handle && pageid && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5097 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5098 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5099 // Get the method that you want to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5100 jmethodID notebookPageSet = env->GetMethodID(clazz, "notebookPageSet", |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5101 "(Landroid/widget/RelativeLayout;J)V"); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5102 // Call the method on the object |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5103 env->CallVoidMethod(_dw_obj, notebookPageSet, handle, (jlong)pageid); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5104 _dw_jni_check_exception(env); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5105 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5106 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5107 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5108 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5109 * Sets the text on the specified notebook tab. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5110 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5111 * handle: Notebook handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5112 * pageid: Page ID of the tab to set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5113 * text: Pointer to the text to set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5114 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5115 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5116 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5117 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5118 |
2502
b6319aed3298
Android: Massive thread safety overhaul. Not quite back to fully functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2501
diff
changeset
|
5119 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5120 { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5121 // Construct a String |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5122 jstring jstr = env->NewStringUTF(text); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5123 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5124 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5125 // Get the method that you want to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5126 jmethodID notebookPageSetText = env->GetMethodID(clazz, "notebookPageSetText", |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5127 "(Landroid/widget/RelativeLayout;JLjava/lang/String;)V"); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5128 // Call the method on the object |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5129 env->CallVoidMethod(_dw_obj, notebookPageSetText, handle, (jlong)pageid, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5130 _dw_jni_check_exception(env); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5131 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5132 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5133 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5134 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5135 * Sets the text on the specified notebook tab status area. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5136 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5137 * handle: Notebook handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5138 * pageid: Page ID of the tab to set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5139 * text: Pointer to the text to set. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5140 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5141 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5142 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5143 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5144 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5145 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5146 * Packs the specified box into the notebook page. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5147 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5148 * handle: Handle to the notebook to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5149 * pageid: Page ID in the notebook which is being packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5150 * page: Box handle to be packed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5151 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5152 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5153 { |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5154 JNIEnv *env; |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5155 |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5156 if(handle && pageid && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5157 { |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5158 // First get the class that contains the method you need to call |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5159 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5160 // Get the method that you want to call |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5161 jmethodID notebookPagePack = env->GetMethodID(clazz, "notebookPagePack", |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5162 "(Landroid/widget/RelativeLayout;JLandroid/widget/LinearLayout;)V"); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5163 // Call the method on the object |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5164 env->CallVoidMethod(_dw_obj, notebookPagePack, handle, (jlong)pageid, page); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5165 _dw_jni_check_exception(env); |
2493
bca7e0ab0ccc
Android: Work on the notebook control, doesn't work yet but everything filled in.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2492
diff
changeset
|
5166 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5167 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5168 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5169 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5170 * Create a new Window Frame. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5171 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5172 * owner: The Owner's window handle or HWND_DESKTOP. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5173 * title: The Window title. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5174 * flStyle: Style flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5175 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5176 * Handle to the created window or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5177 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5178 HWND API dw_window_new(HWND hwndOwner, const char *title, ULONG flStyle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5179 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5180 JNIEnv *env; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5181 |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5182 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5183 { |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5184 // Construct a String |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5185 jstring jstr = env->NewStringUTF(title); |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5186 // First get the class that contains the method you need to call |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
5187 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5188 // Get the method that you want to call |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
5189 jmethodID windowNew = env->GetMethodID(clazz, "windowNew", |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
5190 "(Ljava/lang/String;I)Landroid/widget/LinearLayout;"); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5191 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5192 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, windowNew, jstr, (int)flStyle), _DW_REFERENCE_WEAK); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5193 return result; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5194 } |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
5195 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5196 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5197 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5198 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5199 * Call a function from the window (widget)'s context (typically the message loop thread). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5200 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5201 * handle: Window handle of the widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5202 * function: Function pointer to be called. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5203 * data: Pointer to the data to be passed to the function. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5204 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5205 void API dw_window_function(HWND handle, void *function, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5206 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5207 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5208 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5209 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5210 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5211 * Changes the appearance of the mouse pointer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5212 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5213 * handle: Handle to widget for which to change. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5214 * cursortype: ID of the pointer you want. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5215 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5216 void API dw_window_set_pointer(HWND handle, int pointertype) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5217 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5218 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5219 |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5220 int _dw_window_hide_show(HWND handle, int state) |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5221 { |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5222 JNIEnv *env; |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5223 |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5224 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5225 { |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5226 // First get the class that contains the method you need to call |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5227 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5228 // Get the method that you want to call |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5229 jmethodID windowHideShow = env->GetMethodID(clazz, "windowHideShow", |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5230 "(Landroid/view/View;I)V"); |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5231 // Call the method on the object |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5232 env->CallVoidMethod(_dw_obj, windowHideShow, handle, state); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5233 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5234 return DW_ERROR_NONE; |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5235 } |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5236 return DW_ERROR_GENERAL; |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5237 } |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5238 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5239 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5240 * Makes the window visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5241 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5242 * handle: The window handle to make visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5243 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5244 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5245 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5246 int API dw_window_show(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5247 { |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5248 return _dw_window_hide_show(handle, TRUE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5249 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5250 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5251 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5252 * Makes the window invisible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5253 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5254 * handle: The window handle to hide. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5255 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5256 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5257 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5258 int API dw_window_hide(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5259 { |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
5260 return _dw_window_hide_show(handle, FALSE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5261 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5262 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5263 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5264 * Sets the colors used by a specified window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5265 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5266 * handle: The window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5267 * fore: Foreground color in DW_RGB format or a default color index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5268 * back: Background color in DW_RGB format or a default color index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5269 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5270 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5271 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5272 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5273 { |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5274 JNIEnv *env; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5275 |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5276 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5277 { |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5278 unsigned long _fore = _dw_get_color(fore); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5279 unsigned long _back = _dw_get_color(back); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5280 |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5281 // First get the class that contains the method you need to call |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5282 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5283 // Get the method that you want to call |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5284 jmethodID windowSetColor = env->GetMethodID(clazz, "windowSetColor", |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
5285 "(Landroid/view/View;IIIIIIIIII)V"); |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5286 // Call the method on the object |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5287 env->CallVoidMethod(_dw_obj, windowSetColor, handle, |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
5288 (jint)fore, 0, (jint)DW_RED_VALUE(_fore), (jint)DW_GREEN_VALUE(_fore), (jint)DW_BLUE_VALUE(_fore), |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
5289 (jint)back, 0, (jint)DW_RED_VALUE(_back), (jint)DW_GREEN_VALUE(_back), (jint)DW_BLUE_VALUE(_back)); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5290 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5291 return DW_ERROR_NONE; |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5292 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5293 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5294 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5295 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5296 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5297 * Sets the border size of a specified window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5298 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5299 * handle: The window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5300 * border: Size of the window border in pixels. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5301 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5302 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5303 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5304 int API dw_window_set_border(HWND handle, int border) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5305 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5306 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5307 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5308 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5309 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5310 * Sets the style of a given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5311 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5312 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5313 * style: Style features enabled or disabled. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5314 * mask: Corresponding bitmask of features to be changed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5315 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5316 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5317 { |
2578
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5318 JNIEnv *env; |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5319 |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5320 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5321 { |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5322 // First get the class that contains the method you need to call |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5323 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5324 // Get the method that you want to call |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5325 jmethodID windowSetStyle = env->GetMethodID(clazz, "windowSetStyle", |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5326 "(Landroid/view/View;II)V"); |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5327 // Call the method on the object |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5328 env->CallVoidMethod(_dw_obj, windowSetStyle, handle, (jint)style, (jint)mask); |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5329 _dw_jni_check_exception(env); |
a36448beb7f7
Android: Implement dw_window_set_style() for static text widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2577
diff
changeset
|
5330 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5331 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5332 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5333 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5334 * Sets the current focus item for a window/dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5335 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5336 * handle: Handle to the dialog item to be focused. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5337 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5338 * This is for use after showing the window/dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5339 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5340 void API dw_window_set_focus(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5341 { |
2582
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5342 JNIEnv *env; |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5343 |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5344 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5345 { |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5346 // First get the class that contains the method you need to call |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5347 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5348 // Get the method that you want to call |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5349 jmethodID windowSetFocus = env->GetMethodID(clazz, "windowSetFocus", |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5350 "(Landroid/view/View;)V"); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5351 // Call the method on the object |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5352 env->CallVoidMethod(_dw_obj, windowSetFocus, handle); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5353 _dw_jni_check_exception(env); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5354 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5355 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5356 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5357 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5358 * Sets the default focus item for a window/dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5359 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5360 * window: Toplevel window or dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5361 * defaultitem: Handle to the dialog item to be default. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5362 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5363 * This is for use before showing the window/dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5364 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5365 void API dw_window_default(HWND handle, HWND defaultitem) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5366 { |
2582
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5367 JNIEnv *env; |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5368 |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5369 if(handle && defaultitem && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5370 { |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5371 // First get the class that contains the method you need to call |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5372 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5373 // Get the method that you want to call |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5374 jmethodID windowDefault = env->GetMethodID(clazz, "windowDefault", |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5375 "(Landroid/view/View;Landroid/view/View;)V"); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5376 // Call the method on the object |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5377 env->CallVoidMethod(_dw_obj, windowDefault, handle, defaultitem); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5378 _dw_jni_check_exception(env); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5379 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5380 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5381 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5382 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5383 * Sets window to click the default dialog item when an ENTER is pressed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5384 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5385 * window: Window (widget) to look for the ENTER press. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5386 * next: Window (widget) to move to next (or click) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5387 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5388 void API dw_window_click_default(HWND handle, HWND next) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5389 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5390 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5391 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5392 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5393 * Captures the mouse input to this window even if it is outside the bounds. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5394 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5395 * handle: Handle to receive mouse input. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5396 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5397 void API dw_window_capture(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5398 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5399 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5400 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5401 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5402 * Releases previous mouse capture. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5403 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5404 void API dw_window_release(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5405 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5406 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5407 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5408 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5409 * Changes a window's parent to newparent. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5410 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5411 * handle: The window handle to destroy. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5412 * newparent: The window's new parent window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5413 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5414 void API dw_window_reparent(HWND handle, HWND newparent) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5415 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5416 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5417 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5418 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5419 * Sets the font used by a specified window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5420 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5421 * handle: The window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5422 * fontname: Name and size of the font in the form "size.fontname" |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5423 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5424 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5425 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5426 int API dw_window_set_font(HWND handle, const char *fontname) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5427 { |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5428 JNIEnv *env; |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5429 |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5430 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5431 { |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5432 // Construct a string |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5433 jstring jstr = env->NewStringUTF(fontname); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5434 // First get the class that contains the method you need to call |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5435 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5436 // Get the method that you want to call |
2582
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5437 jmethodID windowSetFont = env->GetMethodID(clazz, "windowSetFont", |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5438 "(Landroid/view/View;Ljava/lang/String;)V"); |
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5439 // Call the method on the object |
2582
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5440 env->CallVoidMethod(_dw_obj, windowSetFont, handle, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5441 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5442 return DW_ERROR_NONE; |
2547
dbd15c13f5bb
Android: Implement most of the font functions and control/widget color.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2545
diff
changeset
|
5443 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5444 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5445 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5446 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5447 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5448 * Returns the current font for the specified window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5449 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5450 * handle: The window handle from which to obtain the font. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5451 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5452 * A malloc()ed font name string to be dw_free()ed or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5453 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5454 char * API dw_window_get_font(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5455 { |
2582
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5456 JNIEnv *env; |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5457 char *fontname = nullptr; |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5458 |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5459 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5460 { |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5461 // First get the class that contains the method you need to call |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5462 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5463 // Get the method that you want to call |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5464 jmethodID windowGetFont = env->GetMethodID(clazz, "windowGetFont", |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5465 "(Landroid/view/View;)Ljava/lang/String;"); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5466 // Call the method on the object |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5467 jstring jstr = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, windowGetFont, handle), _DW_REFERENCE_NONE); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5468 |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5469 if(jstr) |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5470 fontname = strdup(env->GetStringUTFChars(jstr, nullptr)); |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5471 } |
01fca1937806
Android: Implement dw_window_set_focus(), dw_window_default() and dw_window_get_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2580
diff
changeset
|
5472 return fontname; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5473 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5474 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5475 /* Allows the user to choose a font using the system's font chooser dialog. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5476 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5477 * currfont: current font |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5478 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5479 * A malloced buffer with the selected font or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5480 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5481 char * API dw_font_choose(const char *currfont) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5482 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5483 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5484 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5485 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5486 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5487 * Sets the default font used on text based widgets. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5488 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5489 * fontname: Font name in Dynamic Windows format. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5490 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5491 void API dw_font_set_default(const char *fontname) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5492 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5493 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5494 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5495 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5496 * Destroys a window and all of it's children. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5497 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5498 * handle: The window handle to destroy. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5499 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5500 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5501 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5502 int API dw_window_destroy(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5503 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5504 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5505 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5506 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5507 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5508 * Gets the text used for a given window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5509 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5510 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5511 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5512 * The text associsated with a given window or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5513 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5514 char * API dw_window_get_text(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5515 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5516 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5517 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5518 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5519 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5520 const char *utf8 = nullptr; |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5521 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5522 // First get the class that contains the method you need to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5523 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5524 // Get the method that you want to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5525 jmethodID windowGetText = env->GetMethodID(clazz, "windowGetText", |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5526 "(Landroid/view/View;)Ljava/lang/String;"); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5527 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5528 jstring result = (jstring)_dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, windowGetText, handle), _DW_REFERENCE_NONE); |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5529 // Get the UTF8 string result |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5530 if(result) |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
5531 utf8 = env->GetStringUTFChars(result, nullptr); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5532 return utf8 ? strdup(utf8) : nullptr; |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5533 } |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5534 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5535 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5536 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5537 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5538 * Sets the text used for a given window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5539 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5540 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5541 * text: The text associsated with a given window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5542 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5543 void API dw_window_set_text(HWND handle, const char *text) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5544 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5545 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5546 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5547 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5548 { |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5549 // Construct a String |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5550 jstring jstr = env->NewStringUTF(text); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5551 // First get the class that contains the method you need to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5552 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5553 // Get the method that you want to call |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5554 jmethodID windowSetText = env->GetMethodID(clazz, "windowSetText", |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5555 "(Landroid/view/View;Ljava/lang/String;)V"); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5556 // Call the method on the object |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5557 env->CallVoidMethod(_dw_obj, windowSetText, handle, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5558 _dw_jni_check_exception(env); |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
5559 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5560 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5561 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5562 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5563 * Sets the text used for a given window's floating bubble help. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5564 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5565 * handle: Handle to the window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5566 * bubbletext: The text in the floating bubble tooltip. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5567 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5568 void API dw_window_set_tooltip(HWND handle, const char *bubbletext) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5569 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5570 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5571 |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5572 void _dw_window_set_enabled(HWND handle, jboolean state) |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5573 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5574 JNIEnv *env; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5575 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5576 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5577 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5578 // First get the class that contains the method you need to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5579 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5580 // Get the method that you want to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5581 jmethodID windowSetEnabled = env->GetMethodID(clazz, "windowSetEnabled", |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5582 "(Landroid/view/View;Z)V"); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5583 // Call the method on the object |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5584 env->CallVoidMethod(_dw_obj, windowSetEnabled, handle, state); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5585 _dw_jni_check_exception(env); |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5586 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5587 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5588 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5589 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5590 * Disables given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5591 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5592 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5593 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5594 void API dw_window_disable(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5595 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5596 _dw_window_set_enabled(handle, JNI_FALSE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5597 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5598 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5599 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5600 * Enables given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5601 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5602 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5603 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5604 void API dw_window_enable(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5605 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5606 _dw_window_set_enabled(handle, JNI_TRUE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5607 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5608 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5609 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5610 * Sets the bitmap used for a given static window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5611 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5612 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5613 * id: An ID to be used to specify the icon, |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5614 * (pass 0 if you use the filename param) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5615 * data: memory buffer containing image (Bitmap on OS/2 or |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5616 * Windows and a pixmap on Unix, pass |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5617 * nullptr if you use the id param) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5618 * len: Length of data passed |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5619 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5620 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, const char *data, int len) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5621 { |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5622 JNIEnv *env; |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5623 |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5624 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5625 { |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5626 // Construct a byte array |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5627 jbyteArray bytearray = nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5628 if(data && len > 0) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5629 { |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5630 bytearray = env->NewByteArray(len); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5631 env->SetByteArrayRegion(bytearray, 0, len, reinterpret_cast<const jbyte *>(data)); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5632 } |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5633 // First get the class that contains the method you need to call |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5634 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5635 // Get the method that you want to call |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5636 jmethodID windowSetBitmapFromData = env->GetMethodID(clazz, "windowSetBitmapFromData", |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5637 "(Landroid/view/View;I[BI)V"); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5638 // Call the method on the object |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5639 env->CallVoidMethod(_dw_obj, windowSetBitmapFromData, handle, (int)cid, bytearray, len); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5640 _dw_jni_check_exception(env); |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5641 // Clean up after the array now that we are finished |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5642 //if(bytearray) |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5643 //env->ReleaseByteArrayElements(bytearray, (jbyte *) data, 0); |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5644 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5645 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5646 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5647 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5648 * Sets the bitmap used for a given static window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5649 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5650 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5651 * id: An ID to be used to specify the icon, |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5652 * (pass 0 if you use the filename param) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5653 * filename: a path to a file (Bitmap on OS/2 or |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5654 * Windows and a pixmap on Unix, pass |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5655 * nullptr if you use the id param) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5656 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5657 void API dw_window_set_bitmap(HWND handle, unsigned long resid, const char *filename) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5658 { |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5659 JNIEnv *env; |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5660 |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5661 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5662 { |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5663 // Construct a string |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5664 jstring jstr = nullptr; |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5665 if(filename) { |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5666 jstr = env->NewStringUTF(filename); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5667 } |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5668 // First get the class that contains the method you need to call |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5669 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5670 // Get the method that you want to call |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5671 jmethodID windowSetBitmapFromData = env->GetMethodID(clazz, "windowSetBitmap", |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5672 "(Landroid/view/View;ILjava/lang/String;)V"); |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5673 // Call the method on the object |
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5674 env->CallVoidMethod(_dw_obj, windowSetBitmapFromData, handle, (int)resid, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5675 _dw_jni_check_exception(env); |
2528
03f6870bcfcc
Android: Implement dw_bitmap_new(), dw_dwindow_set_bitmap() and dw_window_set_bitmap_from_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2526
diff
changeset
|
5676 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5677 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5678 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5679 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5680 * Sets the icon used for a given window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5681 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5682 * handle: Handle to the window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5683 * icon: Handle to icon to be used. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5684 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5685 void API dw_window_set_icon(HWND handle, HICN icon) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5686 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5687 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5688 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5689 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5690 * Gets the child window handle with specified ID. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5691 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5692 * handle: Handle to the parent window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5693 * id: Integer ID of the child. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5694 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5695 * HWND of window with ID or nullptr on error. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5696 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5697 HWND API dw_window_from_id(HWND handle, int id) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5698 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5699 JNIEnv *env; |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
5700 HWND retval = nullptr; |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5701 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5702 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5703 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5704 // First get the class that contains the method you need to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5705 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5706 // Get the method that you want to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5707 jmethodID windowFromId = env->GetMethodID(clazz, "windowFromId", |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5708 "(Landroid/view/View;I)Landroid/view/View;"); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5709 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5710 retval = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, windowFromId, handle, id), _DW_REFERENCE_NONE); |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5711 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5712 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5713 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5714 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5715 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5716 * Minimizes or Iconifies a top-level window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5717 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5718 * handle: The window handle to minimize. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5719 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5720 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5721 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5722 int API dw_window_minimize(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5723 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5724 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5725 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5726 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5727 /* Causes entire window to be invalidated and redrawn. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5728 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5729 * handle: Toplevel window handle to be redrawn. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5730 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5731 void API dw_window_redraw(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5732 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5733 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5734 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5735 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5736 * Makes the window topmost. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5737 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5738 * handle: The window handle to make topmost. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5739 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5740 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5741 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5742 int API dw_window_raise(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5743 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5744 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5745 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5746 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5747 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5748 * Makes the window bottommost. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5749 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5750 * handle: The window handle to make bottommost. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5751 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5752 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5753 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5754 int API dw_window_lower(HWND handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5755 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5756 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5757 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5758 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5759 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5760 * Sets the size of a given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5761 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5762 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5763 * width: New width in pixels. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5764 * height: New height in pixels. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5765 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5766 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5767 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5768 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5769 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5770 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5771 * Gets the size the system thinks the widget should be. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5772 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5773 * handle: Window (widget) handle of the item to query. |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5774 * width: Width in pixels of the item or nullptr if not needed. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5775 * height: Height in pixels of the item or nullptr if not needed. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5776 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5777 void API dw_window_get_preferred_size(HWND handle, int *width, int *height) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5778 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5779 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5780 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5781 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5782 * Sets the gravity of a given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5783 * Gravity controls which corner of the screen and window the position is relative to. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5784 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5785 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5786 * horz: DW_GRAV_LEFT (default), DW_GRAV_RIGHT or DW_GRAV_CENTER. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5787 * vert: DW_GRAV_TOP (default), DW_GRAV_BOTTOM or DW_GRAV_CENTER. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5788 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5789 void API dw_window_set_gravity(HWND handle, int horz, int vert) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5790 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5791 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5792 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5793 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5794 * Sets the position of a given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5795 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5796 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5797 * x: X location from the bottom left. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5798 * y: Y location from the bottom left. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5799 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5800 void API dw_window_set_pos(HWND handle, LONG x, LONG y) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5801 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5802 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5803 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5804 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5805 * Sets the position and size of a given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5806 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5807 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5808 * x: X location from the bottom left. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5809 * y: Y location from the bottom left. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5810 * width: Width of the widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5811 * height: Height of the widget. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5812 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5813 void API dw_window_set_pos_size(HWND handle, LONG x, LONG y, ULONG width, ULONG height) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5814 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5815 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5816 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5817 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5818 * Gets the position and size of a given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5819 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5820 * handle: Window (widget) handle. |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5821 * x: X location from the bottom left or nullptr. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5822 * y: Y location from the bottom left or nullptr. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5823 * width: Width of the widget or nullptr. |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5824 * height: Height of the widget or nullptr. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5825 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5826 void API dw_window_get_pos_size(HWND handle, LONG *x, LONG *y, ULONG *width, ULONG *height) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5827 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5828 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5829 |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5830 static jlong _dw_screen_dimensions = 0; |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5831 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5832 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5833 * Returns the width of the screen. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5834 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5835 int API dw_screen_width(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5836 { |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5837 if(!_dw_screen_dimensions) |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5838 { |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5839 JNIEnv *env; |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5840 |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5841 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5842 { |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5843 // First get the class that contains the method you need to call |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5844 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5845 // Get the method that you want to call |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5846 jmethodID screenGetDimensions = env->GetMethodID(clazz, "screenGetDimensions", |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5847 "()J"); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5848 // Call the method on the object |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5849 _dw_screen_dimensions = env->CallLongMethod(_dw_obj, screenGetDimensions); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5850 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5851 _dw_screen_dimensions = 0; |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5852 } |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5853 } |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5854 return _dw_screen_dimensions & 0xFFFF; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5855 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5856 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5857 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5858 * Returns the height of the screen. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5859 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5860 int API dw_screen_height(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5861 { |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5862 if(!_dw_screen_dimensions) |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5863 { |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5864 JNIEnv *env; |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5865 |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5866 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5867 { |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5868 // First get the class that contains the method you need to call |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5869 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5870 // Get the method that you want to call |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5871 jmethodID screenGetDimensions = env->GetMethodID(clazz, "screenGetDimensions", |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5872 "()J"); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5873 // Call the method on the object |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5874 _dw_screen_dimensions = env->CallLongMethod(_dw_obj, screenGetDimensions); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5875 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5876 _dw_screen_dimensions = 0; |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5877 } |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5878 } |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5879 return (_dw_screen_dimensions >> 32) & 0xFFFF; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5880 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5881 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5882 /* This should return the current color depth. */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5883 unsigned long API dw_color_depth_get(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5884 { |
2531
f45ebd96ebe5
Android: First attempts at implementing drawing functions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2530
diff
changeset
|
5885 return 32; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5886 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5887 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5888 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5889 * Returns some information about the current operating environment. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5890 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5891 * env: Pointer to a DWEnv struct. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5892 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5893 void API dw_environment_query(DWEnv *env) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5894 { |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5895 static char osName[_DW_ENV_STRING_SIZE+1] = { 0 }; |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5896 |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5897 if(!osName[0]) |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5898 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
5899 JNIEnv *jenv; |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5900 const char *release = nullptr; |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5901 |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
5902 if((jenv = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5903 { |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5904 // First get the class that contains the method you need to call |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
5905 jclass clazz = _dw_find_class(jenv, DW_CLASS_NAME); |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5906 // Get the method that you want to call |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
5907 jmethodID androidGetRelease = jenv->GetMethodID(clazz, "androidGetRelease", |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5908 "()Ljava/lang/String;"); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5909 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5910 jstring jstr = (jstring)_dw_jni_check_result(jenv, jenv->CallObjectMethod(_dw_obj, androidGetRelease), _DW_REFERENCE_NONE); |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5911 |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5912 if(jstr) |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
5913 release = jenv->GetStringUTFChars(jstr, nullptr); |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5914 } |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5915 snprintf(osName, _DW_ENV_STRING_SIZE-1, "Android%s%s", |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5916 release ? " " : "", release ? release : ""); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5917 } |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5918 memset(env, '\0', sizeof(DWEnv)); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5919 |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5920 strncpy(env->osName, osName, sizeof(env->osName)-1); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5921 strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5922 strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5923 strncpy(env->htmlEngine, "CHROME", sizeof(env->htmlEngine)-1); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5924 env->DWMajorVersion = DW_MAJOR_VERSION; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5925 env->DWMinorVersion = DW_MINOR_VERSION; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5926 env->DWSubVersion = DW_SUB_VERSION; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5927 |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5928 /* Operating system major */ |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5929 env->MajorVersion = _dw_android_api; |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5930 /* Operating system minor */ |
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
5931 env->MinorVersion = 0; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5932 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5933 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5934 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5935 * Emits a beep. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5936 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5937 * freq: Frequency. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5938 * dur: Duration. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5939 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5940 void API dw_beep(int freq, int dur) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5941 { |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5942 JNIEnv *env; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5943 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5944 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5945 { |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5946 // First get the class that contains the method you need to call |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5947 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5948 // Get the method that you want to call |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5949 jmethodID doBeep = env->GetMethodID(clazz, "doBeep", "(I)V"); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5950 // Call the method on the object |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5951 env->CallVoidMethod(_dw_obj, doBeep, dur); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5952 _dw_jni_check_exception(env); |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
5953 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5954 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5955 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5956 /* Call this after drawing to the screen to make sure |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5957 * anything you have drawn is visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5958 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5959 void API dw_flush(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5960 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5961 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5962 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5963 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5964 * Add a named user data item to a window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5965 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5966 * window: Window handle to save data to. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5967 * dataname: A string pointer identifying which data to be saved. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5968 * data: User data to be saved to the window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5969 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5970 void API dw_window_set_data(HWND window, const char *dataname, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5971 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5972 JNIEnv *env; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5973 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5974 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5975 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5976 // Construct a String |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5977 jstring jstr = env->NewStringUTF(dataname); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5978 // First get the class that contains the method you need to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5979 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5980 // Get the method that you want to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5981 jmethodID windowSetData = env->GetMethodID(clazz, "windowSetData", |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5982 "(Landroid/view/View;Ljava/lang/String;J)V"); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5983 // Call the method on the object |
2518
c4e90a623437
Android: Fix not actually passing the data in dw_window_set_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2517
diff
changeset
|
5984 env->CallVoidMethod(_dw_obj, windowSetData, window, jstr, (jlong)data); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
5985 _dw_jni_check_exception(env); |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5986 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5987 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5988 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5989 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5990 * Gets a named user data item from a window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5991 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5992 * window: Window handle to get data from. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5993 * dataname: A string pointer identifying which data to get. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5994 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
5995 * Pointer to data or nullptr if no data is available. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5996 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5997 void * API dw_window_get_data(HWND window, const char *dataname) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5998 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
5999 JNIEnv *env; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6000 void *retval = nullptr; |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6001 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6002 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6003 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6004 // Construct a String |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6005 jstring jstr = env->NewStringUTF(dataname); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6006 // First get the class that contains the method you need to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6007 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6008 // Get the method that you want to call |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6009 jmethodID windowGetData = env->GetMethodID(clazz, "windowGetData", |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6010 "(Landroid/view/View;Ljava/lang/String;)J"); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6011 // Call the method on the object |
2518
c4e90a623437
Android: Fix not actually passing the data in dw_window_set_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2517
diff
changeset
|
6012 retval = (void *)env->CallLongMethod(_dw_obj, windowGetData, window, jstr); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6013 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6014 retval = nullptr; |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6015 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
6016 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6017 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6018 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6019 /* |
2532
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6020 * Compare two window handles. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6021 * Parameters: |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6022 * window1: First window handle to compare. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6023 * window2: Second window handle to compare. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6024 * Returns: |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6025 * TRUE if the windows are the same object, FALSE if not. |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6026 */ |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6027 int API dw_window_compare(HWND window1, HWND window2) |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6028 { |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6029 JNIEnv *env; |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6030 void *retval = nullptr; |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6031 |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6032 if(window1 && window2 && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6033 { |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6034 if(env->IsSameObject(window1, window2)) |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6035 return TRUE; |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6036 } |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6037 return FALSE; |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6038 } |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6039 |
457c91634881
Added dw_window_compare() to check if two window handles refer to the same object.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2531
diff
changeset
|
6040 /* |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6041 * Add a callback to a timer event. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6042 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6043 * interval: Milliseconds to delay between calls. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6044 * sigfunc: The pointer to the function to be used as the callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6045 * data: User data to be passed to the handler function. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6046 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6047 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6048 */ |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
6049 HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6050 { |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6051 JNIEnv *env; |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
6052 HTIMER retval = 0; |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6053 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6054 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6055 { |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6056 // Use a long paramater |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6057 jlong longinterval = (jlong)interval; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6058 // First get the class that contains the method you need to call |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6059 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6060 // Get the method that you want to call |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6061 jmethodID timerConnect = env->GetMethodID(clazz, "timerConnect", |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6062 "(JJJ)Ljava/util/Timer;"); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6063 // Call the method on the object |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
6064 retval = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, |
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
6065 timerConnect, longinterval, (jlong)sigfunc, (jlong)data), _DW_REFERENCE_STRONG); |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6066 } |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6067 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6068 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6069 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6070 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6071 * Removes timer callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6072 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6073 * id: Timer ID returned by dw_timer_connect(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6074 */ |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
6075 void API dw_timer_disconnect(HTIMER timerid) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6076 { |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6077 JNIEnv *env; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6078 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6079 if(timerid && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6080 { |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6081 // First get the class that contains the method you need to call |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6082 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6083 // Get the method that you want to call |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6084 jmethodID timerDisconnect = env->GetMethodID(clazz, "timerDisconnect", |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6085 "(Ljava/util/Timer;)V"); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6086 // Call the method on the object |
2584
2acc7ba5dea0
Add HTIMER type and change dw_timer_() functions to use it.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2582
diff
changeset
|
6087 env->CallVoidMethod(_dw_obj, timerDisconnect, timerid); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6088 _dw_jni_check_exception(env); |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
6089 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6090 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6091 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6092 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6093 * Add a callback to a window event. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6094 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6095 * window: Window handle of signal to be called back. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6096 * signame: A string pointer identifying which signal to be hooked. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6097 * sigfunc: The pointer to the function to be used as the callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6098 * data: User data to be passed to the handler function. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6099 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6100 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6101 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6102 dw_signal_connect_data(window, signame, sigfunc, nullptr, data); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6103 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6104 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6105 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6106 * Add a callback to a window event with a closure callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6107 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6108 * window: Window handle of signal to be called back. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6109 * signame: A string pointer identifying which signal to be hooked. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6110 * sigfunc: The pointer to the function to be used as the callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6111 * discfunc: The pointer to the function called when this handler is removed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6112 * data: User data to be passed to the handler function. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6113 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6114 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6115 { |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6116 ULONG message = 0, msgid = 0; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6117 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6118 if(window && signame && sigfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6119 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6120 if((message = _dw_findsigmessage(signame)) != 0) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6121 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6122 _dw_new_signal(message, window, (int)msgid, sigfunc, discfunc, data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6123 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6124 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6125 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6126 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6127 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6128 * Removes callbacks for a given window with given name. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6129 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6130 * window: Window handle of callback to be removed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6131 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6132 void API dw_signal_disconnect_by_name(HWND window, const char *signame) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6133 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
6134 DWSignalHandler *prev = nullptr, *tmp = DWRoot; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6135 ULONG message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6136 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6137 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6138 return; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6139 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6140 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6141 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6142 if(tmp->window == window && tmp->message == message) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6143 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6144 void (*discfunc)(HWND, void *) = (void (*)(HWND, void*))tmp->discfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6145 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6146 if(discfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6147 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6148 discfunc(tmp->window, tmp->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6149 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6150 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6151 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6152 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6153 prev->next = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6154 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6155 tmp = prev->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6156 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6157 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6158 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6159 DWRoot = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6160 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6161 tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6162 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6163 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6164 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6165 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6166 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6167 tmp = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6168 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6169 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6170 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6171 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6172 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6173 * Removes all callbacks for a given window. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6174 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6175 * window: Window handle of callback to be removed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6176 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6177 void API dw_signal_disconnect_by_window(HWND window) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6178 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
6179 DWSignalHandler *prev = nullptr, *tmp = DWRoot; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6180 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6181 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6182 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6183 if(tmp->window == window) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6184 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6185 void (*discfunc)(HWND, void *) = (void (*)(HWND, void*))tmp->discfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6186 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6187 if(discfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6188 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6189 discfunc(tmp->window, tmp->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6190 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6191 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6192 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6193 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6194 prev->next = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6195 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6196 tmp = prev->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6197 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6198 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6199 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6200 DWRoot = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6201 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6202 tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6203 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6204 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6205 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6206 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6207 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6208 tmp = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6209 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6210 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6211 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6212 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6213 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6214 * Removes all callbacks for a given window with specified data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6215 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6216 * window: Window handle of callback to be removed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6217 * data: Pointer to the data to be compared against. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6218 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6219 void API dw_signal_disconnect_by_data(HWND window, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6220 { |
2626
401a3b9f21ba
Massive continuation of code style standardization.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2620
diff
changeset
|
6221 DWSignalHandler *prev = nullptr, *tmp = DWRoot; |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6222 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6223 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6224 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6225 if(tmp->window == window && tmp->data == data) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6226 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6227 void (*discfunc)(HWND, void *) = (void (*)(HWND, void*))tmp->discfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6228 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6229 if(discfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6230 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6231 discfunc(tmp->window, tmp->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6232 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6233 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6234 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6235 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6236 prev->next = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6237 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6238 tmp = prev->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6239 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6240 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6241 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6242 DWRoot = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6243 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6244 tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6245 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6246 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6247 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6248 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6249 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6250 tmp = tmp->next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6251 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
6252 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6253 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6254 |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6255 void _dw_strlwr(char *buf) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6256 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6257 int z, len = strlen(buf); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6258 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6259 for(z=0;z<len;z++) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6260 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6261 if(buf[z] >= 'A' && buf[z] <= 'Z') |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6262 buf[z] -= 'A' - 'a'; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6263 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6264 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6265 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6266 /* Open a shared library and return a handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6267 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6268 * name: Base name of the shared library. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6269 * handle: Pointer to a module handle, |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6270 * will be filled in with the handle. |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6271 */ |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6272 int API dw_module_load(const char *name, HMOD *handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6273 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6274 int len; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6275 char *newname; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6276 char errorbuf[1025] = {0}; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6277 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6278 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6279 if(!handle) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6280 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6281 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6282 if((len = strlen(name)) == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6283 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6284 |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6285 /* Lenth + "lib" + ".so" + nullptr */ |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6286 newname = (char *)malloc(len + 7); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6287 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6288 if(!newname) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6289 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6290 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6291 sprintf(newname, "lib%s.so", name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6292 _dw_strlwr(newname); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6293 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6294 *handle = dlopen(newname, RTLD_NOW); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6295 if(*handle == nullptr) |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6296 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6297 strncpy(errorbuf, dlerror(), 1024); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6298 printf("%s\n", errorbuf); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6299 sprintf(newname, "lib%s.so", name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6300 *handle = dlopen(newname, RTLD_NOW); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6301 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6302 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6303 free(newname); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6304 |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6305 return (nullptr == *handle) ? -1 : 0; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6306 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6307 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6308 /* Queries the address of a symbol within open handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6309 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6310 * handle: Module handle returned by dw_module_load() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6311 * name: Name of the symbol you want the address of. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6312 * func: A pointer to a function pointer, to obtain |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6313 * the address. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6314 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6315 int API dw_module_symbol(HMOD handle, const char *name, void**func) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6316 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6317 if(!func || !name) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6318 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6319 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6320 if(strlen(name) == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6321 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6322 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6323 *func = (void*)dlsym(handle, name); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6324 return (nullptr == *func); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6325 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6326 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6327 /* Frees the shared library previously opened. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6328 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6329 * handle: Module handle returned by dw_module_load() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6330 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6331 int API dw_module_close(HMOD handle) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6332 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6333 if(handle) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6334 return dlclose(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6335 return 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6336 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6337 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6338 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6339 * Returns the handle to an unnamed mutex semaphore. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6340 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6341 HMTX API dw_mutex_new(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6342 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6343 HMTX mutex = (HMTX)malloc(sizeof(pthread_mutex_t)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6344 |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6345 pthread_mutex_init(mutex, nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6346 return mutex; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6347 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6348 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6349 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6350 * Closes a semaphore created by dw_mutex_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6351 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6352 * mutex: The handle to the mutex returned by dw_mutex_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6353 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6354 void API dw_mutex_close(HMTX mutex) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6355 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6356 if(mutex) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6357 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6358 pthread_mutex_destroy(mutex); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6359 free(mutex); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6360 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6361 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6362 |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6363 /* Check if we are on the UI thread */ |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6364 int _dw_is_ui_thread(void) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6365 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6366 JNIEnv *env; |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6367 int retval = FALSE; |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6368 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6369 { |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6370 // First get the class that contains the method you need to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6371 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6372 // Get the method that you want to call |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6373 jmethodID isUIThread = env->GetMethodID(clazz, "isUIThread", |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6374 "()Z"); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6375 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6376 retval = env->CallBooleanMethod(_dw_obj, isUIThread); |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6377 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6378 retval = FALSE; |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6379 } |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
6380 return retval; |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6381 } |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6382 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6383 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6384 * Tries to gain access to the semaphore, if it can't it blocks. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6385 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6386 * mutex: The handle to the mutex returned by dw_mutex_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6387 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6388 void API dw_mutex_lock(HMTX mutex) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6389 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6390 /* We need to handle locks from the main thread differently... |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6391 * since we can't stop message processing... otherwise we |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6392 * will deadlock... so try to acquire the lock and continue |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6393 * processing messages in between tries. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6394 */ |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6395 if(_dw_is_ui_thread()) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6396 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6397 while(pthread_mutex_trylock(mutex) != 0) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6398 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6399 /* Process any pending events */ |
2530
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6400 dw_main_iteration(); |
b9923432cb1f
Android: Implement View based render widget and icon support with Drawable.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2529
diff
changeset
|
6401 sched_yield(); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6402 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6403 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6404 else |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6405 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6406 pthread_mutex_lock(mutex); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6407 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6408 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6409 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6410 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6411 * Tries to gain access to the semaphore. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6412 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6413 * mutex: The handle to the mutex returned by dw_mutex_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6414 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6415 * DW_ERROR_NONE on success, DW_ERROR_TIMEOUT if it is already locked. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6416 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6417 int API dw_mutex_trylock(HMTX mutex) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6418 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6419 if(pthread_mutex_trylock(mutex) == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6420 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6421 return DW_ERROR_TIMEOUT; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6422 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6423 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6424 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6425 * Reliquishes the access to the semaphore. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6426 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6427 * mutex: The handle to the mutex returned by dw_mutex_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6428 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6429 void API dw_mutex_unlock(HMTX mutex) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6430 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6431 pthread_mutex_unlock(mutex); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6432 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6433 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6434 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6435 * Returns the handle to an unnamed event semaphore. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6436 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6437 HEV API dw_event_new(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6438 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6439 HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6440 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6441 if(!eve) |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6442 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6443 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6444 /* We need to be careful here, mutexes on Linux are |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6445 * FAST by default but are error checking on other |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6446 * systems such as FreeBSD and OS/2, perhaps others. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6447 */ |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6448 pthread_mutex_init (&(eve->mutex), nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6449 pthread_mutex_lock (&(eve->mutex)); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6450 pthread_cond_init (&(eve->event), nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6451 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6452 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6453 eve->alive = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6454 eve->posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6455 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6456 return eve; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6457 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6458 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6459 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6460 * Resets a semaphore created by dw_event_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6461 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6462 * eve: The handle to the event returned by dw_event_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6463 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6464 int API dw_event_reset (HEV eve) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6465 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6466 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6467 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6468 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6469 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6470 pthread_cond_broadcast (&(eve->event)); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6471 pthread_cond_init (&(eve->event), nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6472 eve->posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6473 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6474 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6475 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6476 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6477 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6478 * Posts a semaphore created by dw_event_new(). Causing all threads |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6479 * waiting on this event in dw_event_wait to continue. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6480 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6481 * eve: The handle to the event returned by dw_event_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6482 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6483 int API dw_event_post (HEV eve) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6484 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6485 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6486 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6487 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6488 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6489 pthread_cond_broadcast (&(eve->event)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6490 eve->posted = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6491 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6492 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6493 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6494 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6495 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6496 * Waits on a semaphore created by dw_event_new(), until the |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6497 * event gets posted or until the timeout expires. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6498 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6499 * eve: The handle to the event returned by dw_event_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6500 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6501 int API dw_event_wait(HEV eve, unsigned long timeout) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6502 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6503 int rc; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6504 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6505 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6506 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6507 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6508 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6509 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6510 if(eve->posted) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6511 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6512 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6513 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6514 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6515 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6516 if(timeout != -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6517 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6518 struct timeval now; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6519 struct timespec timeo; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6520 |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
6521 gettimeofday(&now, nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6522 timeo.tv_sec = now.tv_sec + (timeout / 1000); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6523 timeo.tv_nsec = now.tv_usec * 1000; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6524 rc = pthread_cond_timedwait(&(eve->event), &(eve->mutex), &timeo); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6525 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6526 else |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6527 rc = pthread_cond_wait(&(eve->event), &(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6528 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6529 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6530 if(!rc) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6531 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6532 if(rc == ETIMEDOUT) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6533 return DW_ERROR_TIMEOUT; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6534 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6535 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6536 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6537 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6538 * Closes a semaphore created by dw_event_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6539 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6540 * eve: The handle to the event returned by dw_event_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6541 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6542 int API dw_event_close(HEV *eve) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6543 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6544 if(!eve || !(*eve)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6545 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6546 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6547 pthread_mutex_lock (&((*eve)->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6548 pthread_cond_destroy (&((*eve)->event)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6549 pthread_mutex_unlock (&((*eve)->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6550 pthread_mutex_destroy (&((*eve)->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6551 free(*eve); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6552 *eve = nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6553 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6554 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6555 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6556 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6557 struct _dw_seminfo { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6558 int fd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6559 int waiting; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6560 }; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6561 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6562 static void _dw_handle_sem(int *tmpsock) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6563 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6564 fd_set rd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6565 struct _dw_seminfo *array = (struct _dw_seminfo *)malloc(sizeof(struct _dw_seminfo)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6566 int listenfd = tmpsock[0]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6567 int bytesread, connectcount = 1, maxfd, z, posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6568 char command; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6569 sigset_t mask; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6570 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6571 sigfillset(&mask); /* Mask all allowed signals */ |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6572 pthread_sigmask(SIG_BLOCK, &mask, nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6573 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6574 /* problems */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6575 if(tmpsock[1] == -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6576 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6577 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6578 return; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6579 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6580 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6581 array[0].fd = tmpsock[1]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6582 array[0].waiting = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6583 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6584 /* Free the memory allocated in dw_named_event_new. */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6585 free(tmpsock); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6586 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6587 while(1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6588 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6589 FD_ZERO(&rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6590 FD_SET(listenfd, &rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6591 int DW_UNUSED(result); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6592 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6593 maxfd = listenfd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6594 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6595 /* Added any connections to the named event semaphore */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6596 for(z=0;z<connectcount;z++) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6597 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6598 if(array[z].fd > maxfd) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6599 maxfd = array[z].fd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6600 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6601 FD_SET(array[z].fd, &rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6602 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6603 |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6604 if(select(maxfd+1, &rd, nullptr, nullptr, nullptr) == -1) |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6605 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6606 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6607 return; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6608 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6609 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6610 if(FD_ISSET(listenfd, &rd)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6611 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6612 struct _dw_seminfo *newarray; |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
6613 int newfd = accept(listenfd, nullptr, nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6614 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6615 if(newfd > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6616 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6617 /* Add new connections to the set */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6618 newarray = (struct _dw_seminfo *)malloc(sizeof(struct _dw_seminfo)*(connectcount+1)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6619 memcpy(newarray, array, sizeof(struct _dw_seminfo)*(connectcount)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6620 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6621 newarray[connectcount].fd = newfd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6622 newarray[connectcount].waiting = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6623 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6624 connectcount++; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6625 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6626 /* Replace old array with new one */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6627 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6628 array = newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6629 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6630 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6631 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6632 /* Handle any events posted to the semaphore */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6633 for(z=0;z<connectcount;z++) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6634 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6635 if(FD_ISSET(array[z].fd, &rd)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6636 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6637 if((bytesread = read(array[z].fd, &command, 1)) < 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6638 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6639 struct _dw_seminfo *newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6640 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6641 /* Remove this connection from the set */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6642 newarray = (struct _dw_seminfo *)malloc(sizeof(struct _dw_seminfo)*(connectcount-1)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6643 if(!z) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6644 memcpy(newarray, &array[1], sizeof(struct _dw_seminfo)*(connectcount-1)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6645 else |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6646 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6647 memcpy(newarray, array, sizeof(struct _dw_seminfo)*z); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6648 if(z!=(connectcount-1)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6649 memcpy(&newarray[z], &array[z+1], sizeof(struct _dw_seminfo)*(z-connectcount-1)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6650 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6651 connectcount--; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6652 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6653 /* Replace old array with new one */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6654 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6655 array = newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6656 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6657 else if(bytesread == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6658 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6659 switch(command) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6660 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6661 case 0: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6662 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6663 /* Reset */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6664 posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6665 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6666 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6667 case 1: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6668 /* Post */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6669 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6670 int s; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6671 char tmp = (char)0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6672 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6673 posted = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6674 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6675 for(s=0;s<connectcount;s++) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6676 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6677 /* The semaphore has been posted so |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6678 * we tell all the waiting threads to |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6679 * continue. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6680 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6681 if(array[s].waiting) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6682 result = write(array[s].fd, &tmp, 1); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6683 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6684 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6685 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6686 case 2: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6687 /* Wait */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6688 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6689 char tmp = (char)0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6690 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6691 array[z].waiting = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6692 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6693 /* If we are posted exit immeditately */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6694 if(posted) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6695 result = write(array[z].fd, &tmp, 1); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6696 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6697 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6698 case 3: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6699 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6700 /* Done Waiting */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6701 array[z].waiting = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6702 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6703 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6704 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6705 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6706 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6707 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6708 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6709 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6710 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6711 /* Using domain sockets on unix for IPC */ |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6712 /* Create a named event semaphore which can be |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6713 * opened from other processes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6714 * Parameters: |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6715 * eve: Pointer to an event handle to receive handle. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6716 * name: Name given to semaphore which can be opened |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6717 * by other processes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6718 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6719 HEV API dw_named_event_new(const char *name) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6720 { |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
6721 struct sockaddr_un un = {0}; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6722 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6723 DWTID dwthread; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6724 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6725 if(!tmpsock) |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6726 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6727 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6728 tmpsock[0] = socket(AF_UNIX, SOCK_STREAM, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6729 ev = socket(AF_UNIX, SOCK_STREAM, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6730 un.sun_family=AF_UNIX; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6731 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6732 strcpy(un.sun_path, "/tmp/.dw/"); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6733 strcat(un.sun_path, name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6734 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6735 /* just to be safe, this should be changed |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6736 * to support multiple instances. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6737 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6738 remove(un.sun_path); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6739 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6740 bind(tmpsock[0], (struct sockaddr *)&un, sizeof(un)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6741 listen(tmpsock[0], 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6742 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
6743 tmpsock[1] = accept(tmpsock[0], nullptr, nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6744 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6745 if(tmpsock[0] < 0 || tmpsock[1] < 0 || ev < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6746 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6747 if(tmpsock[0] > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6748 close(tmpsock[0]); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6749 if(tmpsock[1] > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6750 close(tmpsock[1]); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6751 if(ev > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6752 close(ev); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6753 free(tmpsock); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6754 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6755 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6756 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6757 /* Create a thread to handle this event semaphore */ |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6758 pthread_create(&dwthread, nullptr, (void *(*)(void *))_dw_handle_sem, (void *)tmpsock); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6759 return (HEV)DW_INT_TO_POINTER(ev); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6760 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6761 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6762 /* Open an already existing named event semaphore. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6763 * Parameters: |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6764 * eve: Pointer to an event handle to receive handle. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6765 * name: Name given to semaphore which can be opened |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6766 * by other processes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6767 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6768 HEV API dw_named_event_get(const char *name) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6769 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6770 struct sockaddr_un un; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6771 int ev = socket(AF_UNIX, SOCK_STREAM, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6772 if(ev < 0) |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6773 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6774 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6775 un.sun_family=AF_UNIX; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6776 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6777 strcpy(un.sun_path, "/tmp/.dw/"); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6778 strcat(un.sun_path, name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6779 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6780 return (HEV)DW_INT_TO_POINTER(ev); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6781 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6782 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6783 /* Resets the event semaphore so threads who call wait |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6784 * on this semaphore will block. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6785 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6786 * eve: Handle to the semaphore obtained by |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6787 * an open or create call. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6788 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6789 int API dw_named_event_reset(HEV eve) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6790 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6791 /* signal reset */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6792 char tmp = (char)0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6793 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6794 if(DW_POINTER_TO_INT(eve) < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6795 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6796 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6797 if(write(DW_POINTER_TO_INT(eve), &tmp, 1) == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6798 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6799 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6800 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6801 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6802 /* Sets the posted state of an event semaphore, any threads |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6803 * waiting on the semaphore will no longer block. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6804 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6805 * eve: Handle to the semaphore obtained by |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6806 * an open or create call. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6807 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6808 int API dw_named_event_post(HEV eve) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6809 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6810 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6811 /* signal post */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6812 char tmp = (char)1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6813 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6814 if(DW_POINTER_TO_INT(eve) < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6815 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6816 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6817 if(write(DW_POINTER_TO_INT(eve), &tmp, 1) == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6818 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6819 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6820 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6821 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6822 /* Waits on the specified semaphore until it becomes |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6823 * posted, or returns immediately if it already is posted. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6824 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6825 * eve: Handle to the semaphore obtained by |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6826 * an open or create call. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6827 * timeout: Number of milliseconds before timing out |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6828 * or -1 if indefinite. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6829 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6830 int API dw_named_event_wait(HEV eve, unsigned long timeout) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6831 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6832 fd_set rd; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6833 struct timeval tv, *useme = nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6834 int retval = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6835 char tmp; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6836 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6837 if(DW_POINTER_TO_INT(eve) < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6838 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6839 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6840 /* Set the timout or infinite */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6841 if(timeout != -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6842 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6843 tv.tv_sec = timeout / 1000; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6844 tv.tv_usec = timeout % 1000; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6845 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6846 useme = &tv; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6847 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6848 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6849 FD_ZERO(&rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6850 FD_SET(DW_POINTER_TO_INT(eve), &rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6851 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6852 /* Signal wait */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6853 tmp = (char)2; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6854 retval = write(DW_POINTER_TO_INT(eve), &tmp, 1); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6855 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6856 if(retval == 1) |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6857 retval = select(DW_POINTER_TO_INT(eve)+1, &rd, nullptr, nullptr, useme); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6858 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6859 /* Signal done waiting. */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6860 tmp = (char)3; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6861 if(retval == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6862 retval = write(DW_POINTER_TO_INT(eve), &tmp, 1); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6863 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6864 if(retval == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6865 return DW_ERROR_TIMEOUT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6866 else if(retval == -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6867 return DW_ERROR_INTERRUPT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6868 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6869 /* Clear the entry from the pipe so |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6870 * we don't loop endlessly. :) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6871 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6872 if(read(DW_POINTER_TO_INT(eve), &tmp, 1) == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6873 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6874 return DW_ERROR_GENERAL; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6875 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6876 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6877 /* Release this semaphore, if there are no more open |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6878 * handles on this semaphore the semaphore will be destroyed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6879 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6880 * eve: Handle to the semaphore obtained by |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6881 * an open or create call. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6882 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6883 int API dw_named_event_close(HEV eve) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6884 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6885 /* Finally close the domain socket, |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6886 * cleanup will continue in _dw_handle_sem. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6887 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6888 close(DW_POINTER_TO_INT(eve)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6889 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6890 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6891 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6892 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6893 * Generally an internal function called from a newly created |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6894 * thread to setup the Dynamic Windows environment for the thread. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6895 * However it is exported so language bindings can call it when |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6896 * they create threads that require access to Dynamic Windows. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6897 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6898 void API _dw_init_thread(void) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6899 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
6900 JNIEnv *env; |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
6901 |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6902 _dw_jvm->AttachCurrentThread(&env, nullptr); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
6903 pthread_setspecific(_dw_env_key, env); |
2572
bbe693293be5
Android: New color handling system, save the color in the C API and pass
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2571
diff
changeset
|
6904 pthread_setspecific(_dw_fgcolor_key, nullptr); |
2637
22105f99dd6a
Android: Add support for transparent background color for text drawing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2633
diff
changeset
|
6905 pthread_setspecific(_dw_bgcolor_key, (void *)DW_RGB_TRANSPARENT); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6906 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6907 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6908 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6909 * Generally an internal function called from a terminating |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6910 * thread to cleanup the Dynamic Windows environment for the thread. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6911 * However it is exported so language bindings can call it when |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6912 * they exit threads that require access to Dynamic Windows. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6913 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6914 void API _dw_deinit_thread(void) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6915 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
6916 _dw_jvm->DetachCurrentThread(); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6917 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6918 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6919 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6920 * Setup thread independent color sets. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6921 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6922 void _dwthreadstart(void *data) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6923 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6924 void (*threadfunc)(void *) = nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6925 void **tmp = (void **)data; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6926 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6927 threadfunc = (void (*)(void *))tmp[0]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6928 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6929 /* Initialize colors */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6930 _dw_init_thread(); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6931 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6932 threadfunc(tmp[1]); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6933 free(tmp); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6934 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6935 /* Free colors */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6936 _dw_deinit_thread(); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6937 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6938 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6939 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6940 * Allocates a shared memory region with a name. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6941 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6942 * handle: A pointer to receive a SHM identifier. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6943 * dest: A pointer to a pointer to receive the memory address. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6944 * size: Size in bytes of the shared memory region to allocate. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6945 * name: A string pointer to a unique memory name. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6946 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6947 HSHM API dw_named_memory_new(void **dest, int size, const char *name) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6948 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6949 char namebuf[1025]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6950 struct _dw_unix_shm *handle = (struct _dw_unix_shm *)malloc(sizeof(struct _dw_unix_shm)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6951 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6952 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6953 snprintf(namebuf, 1024, "/tmp/.dw/%s", name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6954 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6955 if((handle->fd = open(namebuf, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6956 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6957 free(handle); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6958 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6959 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6960 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6961 if(ftruncate(handle->fd, size)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6962 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6963 close(handle->fd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6964 free(handle); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6965 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6966 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6967 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6968 /* attach the shared memory segment to our process's address space. */ |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6969 *dest = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6970 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6971 if(*dest == MAP_FAILED) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6972 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6973 close(handle->fd); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6974 *dest = nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6975 free(handle); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
6976 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6977 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6978 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6979 handle->size = size; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6980 handle->sid = getsid(0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6981 handle->path = strdup(namebuf); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6982 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6983 return handle; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6984 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6985 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6986 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6987 * Aquires shared memory region with a name. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6988 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6989 * dest: A pointer to a pointer to receive the memory address. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6990 * size: Size in bytes of the shared memory region to requested. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6991 * name: A string pointer to a unique memory name. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6992 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6993 HSHM API dw_named_memory_get(void **dest, int size, const char *name) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6994 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6995 char namebuf[1025]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6996 struct _dw_unix_shm *handle = (struct _dw_unix_shm *)malloc(sizeof(struct _dw_unix_shm)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6997 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6998 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
6999 snprintf(namebuf, 1024, "/tmp/.dw/%s", name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7000 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7001 if((handle->fd = open(namebuf, O_RDWR)) < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7002 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7003 free(handle); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7004 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7005 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7006 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7007 /* attach the shared memory segment to our process's address space. */ |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7008 *dest = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7009 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7010 if(*dest == MAP_FAILED) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7011 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7012 close(handle->fd); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7013 *dest = nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7014 free(handle); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7015 return nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7016 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7017 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7018 handle->size = size; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7019 handle->sid = -1; |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7020 handle->path = nullptr; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7021 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7022 return handle; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7023 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7024 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7025 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7026 * Frees a shared memory region previously allocated. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7027 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7028 * handle: Handle obtained from DB_named_memory_allocate. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7029 * ptr: The memory address aquired with DB_named_memory_allocate. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7030 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7031 int API dw_named_memory_free(HSHM handle, void *ptr) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7032 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7033 struct _dw_unix_shm *h = (struct _dw_unix_shm *)handle; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7034 int rc = munmap(ptr, h->size); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7035 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7036 close(h->fd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7037 if(h->path) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7038 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7039 /* Only remove the actual file if we are the |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7040 * creator of the file. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7041 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7042 if(h->sid != -1 && h->sid == getsid(0)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7043 remove(h->path); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7044 free(h->path); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7045 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7046 return rc; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7047 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7048 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7049 * Creates a new thread with a starting point of func. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7050 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7051 * func: Function which will be run in the new thread. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7052 * data: Parameter(s) passed to the function. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7053 * stack: Stack size of new thread (OS/2 and Windows only). |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7054 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7055 DWTID API dw_thread_new(void *func, void *data, int stack) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7056 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7057 DWTID dwthread; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7058 void **tmp = (void **)malloc(sizeof(void *) * 2); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7059 int rc; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7060 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7061 tmp[0] = func; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7062 tmp[1] = data; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7063 |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7064 rc = pthread_create(&dwthread, nullptr, (void *(*)(void *))_dwthreadstart, (void *)tmp); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7065 if(rc == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7066 return dwthread; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7067 return (DWTID)DW_ERROR_UNKNOWN; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7068 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7069 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7070 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7071 * Ends execution of current thread immediately. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7072 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7073 void API dw_thread_end(void) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7074 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7075 pthread_exit(nullptr); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7076 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7077 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7078 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7079 * Returns the current thread's ID. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7080 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7081 DWTID API dw_thread_id(void) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7082 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7083 return (DWTID)pthread_self(); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7084 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7085 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7086 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7087 * Initializes the Dynamic Windows engine. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7088 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7089 * newthread: True if this is the only thread. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7090 * False if there is already a message loop running. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7091 * argc: Passed in from main() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7092 * argv: Passed in from main() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7093 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7094 * DW_ERROR_NONE (0) on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7095 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7096 int API dw_init(int newthread, int argc, char *argv[]) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7097 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7098 JNIEnv *env; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7099 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7100 if(!_dw_app_id[0]) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7101 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7102 /* Generate an Application ID based on the PID if all else fails. */ |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7103 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7104 } |
2633
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7105 if(!_dw_app_name[0]) |
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7106 { |
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7107 const char *name = getprogname(); |
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7108 |
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7109 if(name) |
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7110 strncpy(_dw_app_name, name, _DW_APP_ID_SIZE); |
3d20fcfd8583
Android: Fix startup failure when not calling dw_app_id_set().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2632
diff
changeset
|
7111 } |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7112 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7113 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7114 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7115 // Construct a String |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7116 jstring appid = env->NewStringUTF(_dw_app_id); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7117 jstring appname = env->NewStringUTF(_dw_app_name); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7118 // First get the class that contains the method you need to call |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7119 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7120 // Get the method that you want to call |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7121 jmethodID dwInit = env->GetMethodID(clazz, "dwInit", |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
7122 "(Ljava/lang/String;Ljava/lang/String;)I"); |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7123 // Call the method on the object |
2542
bb75e64e6138
Android: Implement dw_screen_* and dw_environment_query().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2539
diff
changeset
|
7124 _dw_android_api = env->CallIntMethod(_dw_obj, dwInit, appid, appname); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
7125 if(_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
7126 _dw_android_api = 0; |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7127 } |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7128 return DW_ERROR_NONE; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7129 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7130 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7131 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7132 * Cleanly terminates a DW session, should be signal handler safe. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7133 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7134 void API dw_shutdown(void) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7135 { |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7136 JNIEnv *env; |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7137 |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7138 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7139 { |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7140 // First get the class that contains the method you need to call |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7141 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7142 // Get the method that you want to call |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7143 jmethodID dwindowsShutdown = env->GetMethodID(clazz, "dwindowsShutdown", |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7144 "()V"); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7145 // Call the method on the object |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7146 env->CallVoidMethod(_dw_obj, dwindowsShutdown); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
7147 _dw_jni_check_exception(env); |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7148 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7149 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7150 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7151 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7152 * Execute and external program in a seperate session. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7153 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7154 * program: Program name with optional path. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7155 * type: Either DW_EXEC_CON or DW_EXEC_GUI. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7156 * params: An array of pointers to string arguements. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7157 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7158 * Process ID on success or DW_ERROR_UNKNOWN (-1) on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7159 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7160 int API dw_exec(const char *program, int type, char **params) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7161 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7162 int ret = DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7163 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7164 return ret; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7165 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7166 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7167 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7168 * Loads a web browser pointed at the given URL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7169 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7170 * url: Uniform resource locator. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7171 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7172 * DW_ERROR_UNKNOWN (-1) on error; DW_ERROR_NONE (0) or a positive Process ID on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7173 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7174 int API dw_browse(const char *url) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7175 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7176 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7177 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7178 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7179 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7180 * Creates a new print object. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7181 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7182 * jobname: Name of the print job to show in the queue. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7183 * flags: Flags to initially configure the print object. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7184 * pages: Number of pages to print. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7185 * drawfunc: The pointer to the function to be used as the callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7186 * drawdata: User data to be passed to the handler function. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7187 * Returns: |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7188 * A handle to the print object or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7189 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7190 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7191 { |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7192 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7193 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7194 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7195 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7196 * Runs the print job, causing the draw page callbacks to fire. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7197 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7198 * print: Handle to the print object returned by dw_print_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7199 * flags: Flags to run the print job. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7200 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7201 * DW_ERROR_UNKNOWN on error or DW_ERROR_NONE on success. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7202 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7203 int API dw_print_run(HPRINT print, unsigned long flags) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7204 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7205 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7206 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7207 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7208 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7209 * Cancels the print job, typically called from a draw page callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7210 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7211 * print: Handle to the print object returned by dw_print_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7212 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7213 void API dw_print_cancel(HPRINT print) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7214 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7215 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7216 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7217 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7218 * Creates a new system notification if possible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7219 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7220 * title: The short title of the notification. |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7221 * imagepath: Path to an image to display or nullptr if none. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7222 * description: A longer description of the notification, |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7223 * or nullptr if none is necessary. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7224 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7225 * A handle to the notification which can be used to attach a "clicked" event if desired, |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7226 * or nullptr if it fails or notifications are not supported by the system. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7227 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7228 * This will create a system notification that will show in the notifaction panel |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7229 * on supported systems, which may be clicked to perform another task. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7230 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7231 HWND API dw_notification_new(const char *title, const char *imagepath, const char *description, ...) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7232 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7233 JNIEnv *env; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7234 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7235 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7236 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7237 // Construct a String |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7238 jstring appid = env->NewStringUTF(_dw_app_id); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7239 jstring ntitle = env->NewStringUTF(title); |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7240 jstring ndesc = nullptr; |
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7241 jstring image = nullptr; |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7242 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7243 if(description) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7244 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7245 va_list args; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7246 char outbuf[1025] = {0}; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7247 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7248 va_start(args, description); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7249 vsnprintf(outbuf, 1024, description, args); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7250 va_end(args); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7251 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7252 ndesc = env->NewStringUTF(outbuf); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7253 } |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7254 if(imagepath) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7255 image = env->NewStringUTF(imagepath); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7256 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7257 // First get the class that contains the method you need to call |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7258 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7259 // Get the method that you want to call |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7260 jmethodID notificationNew = env->GetMethodID(clazz, "notificationNew", |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7261 "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroidx/core/app/NotificationCompat$Builder;"); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7262 // Call the method on the object |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
7263 jobject result = _dw_jni_check_result(env, env->CallObjectMethod(_dw_obj, notificationNew, ntitle, image, ndesc, appid), _DW_REFERENCE_WEAK); |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7264 return result; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7265 } |
2556
d2d8c66ad062
Android: Initial container implementation... getting a NullPointerException crash in dwtest...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2551
diff
changeset
|
7266 return nullptr; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7267 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7268 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7269 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7270 * Sends a notification created by dw_notification_new() after attaching signal handler. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7271 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7272 * notification: The handle to the notification returned by dw_notification_new(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7273 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7274 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7275 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7276 int API dw_notification_send(HWND notification) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7277 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7278 JNIEnv *env; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7279 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7280 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7281 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7282 // First get the class that contains the method you need to call |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7283 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7284 // Get the method that you want to call |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7285 jmethodID notificationNew = env->GetMethodID(clazz, "notificationSend", |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7286 "(Landroidx/core/app/NotificationCompat$Builder;)V"); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7287 // Call the method on the object |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7288 env->CallVoidMethod(_dw_obj, notificationNew, notification); |
2557
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
7289 if(!_dw_jni_check_exception(env)) |
756331246f94
Android: Implement Java exception handling, make sure all return values from JNI are sane.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2556
diff
changeset
|
7290 return DW_ERROR_NONE; |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
7291 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7292 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7293 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7294 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7295 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7296 * Converts a UTF-8 encoded string into a wide string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7297 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7298 * utf8string: UTF-8 encoded source string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7299 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7300 * Wide string that needs to be freed with dw_free() |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7301 * or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7302 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7303 wchar_t * API dw_utf8_to_wchar(const char *utf8string) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7304 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7305 size_t buflen = strlen(utf8string) + 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7306 wchar_t *temp = (wchar_t *)malloc(buflen * sizeof(wchar_t)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7307 if(temp) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7308 mbstowcs(temp, utf8string, buflen); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7309 return temp; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7310 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7311 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7312 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7313 * Converts a wide string into a UTF-8 encoded string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7314 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7315 * wstring: Wide source string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7316 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7317 * UTF-8 encoded string that needs to be freed with dw_free() |
2529
060fdb2d807d
Android: Initial pixmap implmentation using Android Bitmap.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2528
diff
changeset
|
7318 * or nullptr on failure. |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7319 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7320 char * API dw_wchar_to_utf8(const wchar_t *wstring) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7321 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7322 size_t bufflen = 8 * wcslen(wstring) + 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7323 char *temp = (char *)malloc(bufflen); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7324 if(temp) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7325 wcstombs(temp, wstring, bufflen); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
7326 return temp; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7327 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7328 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7329 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7330 * Gets the state of the requested library feature. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7331 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7332 * feature: The requested feature for example DW_FEATURE_DARK_MODE |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7333 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7334 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7335 * DW_FEATURE_DISABLED if the feature is supported but disabled. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7336 * DW_FEATURE_ENABLED if the feature is supported and enabled. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7337 * Other value greater than 1, same as enabled but with extra info. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7338 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7339 int API dw_feature_get(DWFEATURE feature) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7340 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7341 switch(feature) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7342 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7343 case DW_FEATURE_HTML: /* Supports the HTML Widget */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7344 case DW_FEATURE_HTML_RESULT: /* Supports the DW_SIGNAL_HTML_RESULT callback */ |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7345 case DW_FEATURE_NOTIFICATION: /* Supports sending system notifications */ |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7346 case DW_FEATURE_UTF8_UNICODE: /* Supports UTF8 encoded Unicode text */ |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7347 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7348 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7349 return DW_FEATURE_ENABLED; |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7350 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7351 { |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7352 /* Dark Mode on Android requires Android 10 (API 29) */ |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7353 if(_dw_android_api >= 29) { |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7354 return _dw_dark_mode_detected(); |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7355 } |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7356 return DW_FEATURE_UNSUPPORTED; |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7357 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7358 default: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7359 return DW_FEATURE_UNSUPPORTED; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7360 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7361 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7362 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7363 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7364 * Sets the state of the requested library feature. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7365 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7366 * feature: The requested feature for example DW_FEATURE_DARK_MODE |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7367 * state: DW_FEATURE_DISABLED, DW_FEATURE_ENABLED or any value greater than 1. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7368 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7369 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7370 * DW_ERROR_NONE if the feature is supported and successfully configured. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7371 * DW_ERROR_GENERAL if the feature is supported but could not be configured. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7372 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7373 * These settings are typically used during dw_init() so issue before |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7374 * setting up the library with dw_init(). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7375 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7376 int API dw_feature_set(DWFEATURE feature, int state) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7377 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7378 switch(feature) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7379 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7380 /* These features are supported but not configurable */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7381 case DW_FEATURE_HTML: /* Supports the HTML Widget */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7382 case DW_FEATURE_HTML_RESULT: /* Supports the DW_SIGNAL_HTML_RESULT callback */ |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7383 case DW_FEATURE_NOTIFICATION: /* Supports sending system notifications */ |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
7384 case DW_FEATURE_UTF8_UNICODE: /* Supports UTF8 encoded Unicode text */ |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7385 case DW_FEATURE_MLE_WORD_WRAP: /* Supports word wrapping in Multi-line Edit boxes */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7386 case DW_FEATURE_CONTAINER_STRIPE: /* Supports striped line display in container widgets */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7387 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7388 /* These features are supported and configurable */ |
2551
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7389 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7390 { |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7391 /* Dark Mode on Android requires 10 (API 29) */ |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7392 if(_dw_android_api >= 29) { |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7393 /* While technically configurable.... |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7394 * for now just return DW_ERROR_GENERAL |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7395 */ |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7396 return DW_ERROR_GENERAL; |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7397 } |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7398 return DW_FEATURE_UNSUPPORTED; |
127779860ac1
Android: Implement DW_CLR_DEFAULT and some basic dark mode support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2548
diff
changeset
|
7399 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7400 default: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7401 return DW_FEATURE_UNSUPPORTED; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7402 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7403 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7404 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7405 #ifdef __cplusplus |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7406 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7407 #endif |