Mercurial > dwindows
annotate android/dw.cpp @ 2523:82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
For some reason it is not actually displaying the correct date.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 09 May 2021 21:17:32 +0000 |
parents | 66c490aa719d |
children | 9fd26efff9da |
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 * |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 #include "dw.h" |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 #include <stdlib.h> |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #include <string.h> |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
13 #include <sys/utsname.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
14 #include <sys/socket.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
15 #include <sys/un.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
16 #include <sys/mman.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
17 #include <sys/types.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
18 #include <sys/stat.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
19 #include <dlfcn.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
20 #include <errno.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
21 #include <fcntl.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
22 #include <unistd.h> |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
23 #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
|
24 #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
|
25 |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
26 /* 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
|
27 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
|
28 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
29 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
|
30 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
31 #endif |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
32 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
33 #ifdef __cplusplus |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 extern "C" { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 #endif |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 |
2484
cb5b67154399
Android: The DWindows class should be org.dbsoft.dwindows, remove dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2483
diff
changeset
|
37 #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
|
38 |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
39 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
|
40 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
|
41 static char _dw_exec_dir[MAX_PATH+1] = {0}; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
42 |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
43 static pthread_key_t _dw_env_key; |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
50 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
|
51 { |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
52 JNIEnv *env; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
53 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
|
54 jmethodID getClassLoaderMethod; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
55 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
56 /* 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
|
57 _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
|
58 _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
|
59 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 "()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
|
65 _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
|
66 _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
|
67 "(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
|
68 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
69 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
|
70 } |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
71 |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
72 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
|
73 { |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
74 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
|
75 } |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
76 |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
77 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
78 /* 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
|
79 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
|
80 { |
2511
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
81 static HEV startup = 0; |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
82 |
2496
3bf2f08fdc45
Android: Remove ugly workaround for initialization issues.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2495
diff
changeset
|
83 /* 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
|
84 if(startup) |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
85 { |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
86 /* 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
|
87 * so we stop waiting. |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
88 */ |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
89 dw_event_post(startup); |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
90 return; |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
91 } |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
92 else |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
93 { |
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
|
94 char *argv[2] = {arg, NULL}; |
2511
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
95 |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
96 /* 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
|
97 * 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
|
98 * 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
|
99 */ |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
100 startup = dw_event_new(); |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
101 /* 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
|
102 dw_event_wait(startup, 10000); |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
103 |
0945d0428dfe
Android: New workaround for activity relaunch at startup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2510
diff
changeset
|
104 /* 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
|
105 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
|
106 } |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
107 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
|
108 } |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
109 |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
110 /* 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
|
111 * 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
|
112 * 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
|
113 * 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
|
114 * 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
|
115 */ |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
116 JNIEXPORT void JNICALL |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
117 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path, jstring appID) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
118 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
119 char *arg = strdup(env->GetStringUTFChars((jstring)path, NULL)); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
120 const char *appid = env->GetStringUTFChars((jstring)appID, NULL); |
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
|
121 |
0fa54c340902
Android: Second try at that new fix... move it into _dw_main_launch()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2511
diff
changeset
|
122 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
|
123 { |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
124 /* 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
|
125 _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
|
126 |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
127 /* Save the JNIEnv for the main thread */ |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
128 pthread_key_create(&_dw_env_key, NULL); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
129 pthread_setspecific(_dw_env_key, env); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
130 |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
131 /* 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
|
132 _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
|
133 } |
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
|
134 |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
135 if(arg) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
136 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
137 /* Store the passed in path for dw_app_dir() */ |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
138 strncpy(_dw_exec_dir, arg, MAX_PATH); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
139 } |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
140 if(appid) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
141 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
142 /* Store our reported Android AppID */ |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
143 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
|
144 } |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
145 |
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
|
146 /* 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
|
147 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
|
148 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
149 |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
150 typedef struct _sighandler |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
151 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
152 struct _sighandler *next; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
153 ULONG message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
154 HWND window; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
155 int id; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
156 void *signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
157 void *discfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
158 void *data; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
159 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
160 } SignalHandler; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
161 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
162 static SignalHandler *DWRoot = NULL; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
163 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
164 SignalHandler *_dw_get_handler(HWND window, int messageid) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
165 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
166 SignalHandler *tmp = DWRoot; |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
167 JNIEnv *env; |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
168 |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
169 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
|
170 /* 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
|
171 while (tmp) { |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
172 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
|
173 return tmp; |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
174 } |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
175 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
|
176 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
177 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
178 return NULL; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
179 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
180 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
181 typedef struct |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
182 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
183 ULONG message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
184 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
|
185 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
186 } DWSignalList; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
187 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
188 /* 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
|
189 #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
|
190 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
191 static DWSignalList DWSignalTranslate[SIGNALMAX] = { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
192 { 1, DW_SIGNAL_CONFIGURE }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
193 { 2, DW_SIGNAL_KEY_PRESS }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
194 { 3, DW_SIGNAL_BUTTON_PRESS }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
195 { 4, DW_SIGNAL_BUTTON_RELEASE }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
196 { 5, DW_SIGNAL_MOTION_NOTIFY }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
197 { 6, DW_SIGNAL_DELETE }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
198 { 7, DW_SIGNAL_EXPOSE }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
199 { 8, DW_SIGNAL_CLICKED }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
200 { 9, DW_SIGNAL_ITEM_ENTER }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
201 { 10, DW_SIGNAL_ITEM_CONTEXT }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
202 { 11, DW_SIGNAL_LIST_SELECT }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
203 { 12, DW_SIGNAL_ITEM_SELECT }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
204 { 13, DW_SIGNAL_SET_FOCUS }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
205 { 14, DW_SIGNAL_VALUE_CHANGED }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
206 { 15, DW_SIGNAL_SWITCH_PAGE }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
207 { 16, DW_SIGNAL_TREE_EXPAND }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
208 { 17, DW_SIGNAL_COLUMN_CLICK }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
209 { 18, DW_SIGNAL_HTML_RESULT }, |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
210 { 19, DW_SIGNAL_HTML_CHANGED } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
211 }; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
212 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
213 int _dw_event_handler(jobject object, void **params, int message) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
214 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
215 SignalHandler *handler = _dw_get_handler(object, message); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
216 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
217 if(handler) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
218 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
219 switch(message) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
220 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
221 /* Timer event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
222 case 0: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
223 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
224 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
|
225 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
226 if(!timerfunc(handler->data)) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
227 dw_timer_disconnect(handler->id); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
228 return 0; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
229 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
230 /* Configure/Resize event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
231 case 1: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
232 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
233 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
|
234 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
|
235 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
|
236 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
237 if(width > 0 && height > 0) |
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 return sizefunc(object, width, height, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
240 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
241 return 0; |
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 case 2: |
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 int (*keypressfunc)(HWND, char, int, int, void *, char *) = (int (* API)(HWND, char, int, int, void *, char *))handler->signalfunction; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
246 char *utf8 = (char *)params[1], ch = utf8 ? utf8[0] : '\0'; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
247 int vk = 0, special = 0; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
248 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
249 return keypressfunc(handler->window, ch, (int)vk, special, handler->data, utf8); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
250 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
251 /* Button press and release event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
252 case 3: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
253 case 4: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
254 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
255 int (* API buttonfunc)(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
|
256 int button = 1; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
257 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
258 return buttonfunc(object, DW_POINTER_TO_INT(params[3]), DW_POINTER_TO_INT(params[4]), button, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
259 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
260 /* Motion notify event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
261 case 5: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
262 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
263 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
|
264 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
265 return motionfunc(object, DW_POINTER_TO_INT(params[3]), DW_POINTER_TO_INT(params[4]), DW_POINTER_TO_INT(params[5]), handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
266 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
267 /* Window close event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
268 case 6: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
269 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
270 int (* API closefunc)(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
|
271 return closefunc(object, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
272 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
273 /* Window expose/draw event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
274 case 7: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
275 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
276 DWExpose exp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
277 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
|
278 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 exp.height = DW_POINTER_TO_INT(params[6]); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
283 int result = exposefunc(object, &exp, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
284 return result; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
285 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
286 /* Clicked event for buttons and menu items */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
287 case 8: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
288 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
289 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
|
290 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
291 return clickfunc(object, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
292 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
293 /* Container class selection event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
294 case 9: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
295 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
296 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
|
297 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
298 return containerselectfunc(handler->window, (char *)params[1], handler->data, params[7]); |
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 /* Container context menu event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
301 case 10: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
302 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
309 return containercontextfunc(handler->window, text, x, y, handler->data, user); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
310 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
311 /* Generic selection changed event for several classes */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
312 case 11: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
313 case 14: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
314 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
315 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
|
316 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
|
317 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
318 return valuechangedfunc(handler->window, selected, handler->data);; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
319 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
320 /* Tree class selection event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
321 case 12: |
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 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
|
324 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
|
325 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
|
326 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
327 return treeselectfunc(handler->window, params[0], text, handler->data, user); |
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 /* Set Focus event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
330 case 13: |
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 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
|
333 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
334 return setfocusfunc(handler->window, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
335 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
336 /* Notebook page change event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
337 case 15: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
338 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
339 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
|
340 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
|
341 |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
342 return switchpagefunc(handler->window, pageID, handler->data); |
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 /* Tree expand event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
345 case 16: |
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 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
|
348 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
349 return treeexpandfunc(handler->window, (HTREEITEM)params[0], handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
350 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
351 /* Column click event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
352 case 17: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
353 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
354 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
|
355 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
|
356 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
357 return clickcolumnfunc(handler->window, column_num, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
358 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
359 /* HTML result event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
360 case 18: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
361 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
362 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
|
363 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
|
364 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
365 return htmlresultfunc(handler->window, result ? DW_ERROR_NONE : DW_ERROR_UNKNOWN, result, params[7], handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
366 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
367 /* HTML changed event */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
368 case 19: |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
369 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
370 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
|
371 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
|
372 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
373 return htmlchangedfunc(handler->window, DW_POINTER_TO_INT(params[3]), uri, handler->data); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
374 } |
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 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
377 return -1; |
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 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
380 /* |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
381 * 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
|
382 */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 jint inta, jint intb, jint intc, jint intd) { |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
387 const char *utf81 = str1 ? env->GetStringUTFChars(str1, NULL) : NULL; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
388 const char *utf82 = str2 ? env->GetStringUTFChars(str2, NULL) : NULL; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
389 void *params[8] = { (void *)obj2, (void *)utf81, (void *)utf82, |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
390 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
391 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), NULL }; |
2482
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
392 |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
393 return _dw_event_handler(obj1, params, message); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
394 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
395 |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
396 /* 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
|
397 JNIEXPORT void JNICALL |
2484
cb5b67154399
Android: The DWindows class should be org.dbsoft.dwindows, remove dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2483
diff
changeset
|
398 Java_org_dbsoft_dwindows_DWindows_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) { |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
399 void *params[8] = { NULL }; |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
400 |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
401 _dw_event_handler(obj1, params, message); |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
402 } |
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
403 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
404 /* 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
|
405 JNIEXPORT void JNICALL |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
406 Java_org_dbsoft_dwindows_DWindows_eventHandlerNotebook(JNIEnv* env, jobject obj, jobject obj1, jint message, jlong pageID) { |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
407 void *params[8] = { NULL }; |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
408 |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
409 params[3] = DW_INT_TO_POINTER(pageID); |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
410 _dw_event_handler(obj1, params, message); |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
411 } |
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
412 |
2505
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
413 /* Handlers for HTML events */ |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
414 JNIEXPORT void JNICALL |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
415 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
|
416 jint message, jstring htmlResult, jlong data) { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
417 const char *result = env->GetStringUTFChars(htmlResult, NULL); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
418 void *params[8] = { NULL, DW_POINTER(result), NULL, 0, 0, 0, 0, DW_INT_TO_POINTER(data) }; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
419 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
420 _dw_event_handler(obj1, params, message); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
421 } |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
422 |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
423 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
|
424 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
|
425 jint message, jstring URI, jint status) { |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
426 const char *uri = env->GetStringUTFChars(URI, NULL); |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
427 void *params[8] = { NULL, DW_POINTER(uri), NULL, DW_INT_TO_POINTER(status), 0, 0, 0, 0 }; |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
428 |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
429 _dw_event_handler(obj1, params, message); |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
430 } |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
431 |
a149dabf6a1f
Android: HTML touchups, implement DW_SIGNAL_HTML_CHANGED: STARTED and COMPLETE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2503
diff
changeset
|
432 JNIEXPORT void JNICALL |
2499
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
433 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
|
434 jint inta, jint intb, jint intc, jint intd) { |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
435 void *params[8] = { NULL, NULL, NULL, |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
436 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
437 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), NULL }; |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
438 |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
439 _dw_event_handler(obj1, params, message); |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
440 } |
ff3310fa6d72
Android: Implment DW_SIGNA_CONFIGURE on orientation change.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2498
diff
changeset
|
441 |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
442 JNIEXPORT void JNICALL |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
443 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
|
444 jint inta, jint intb, jint intc, jint intd) { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
445 void *params[8] = { NULL, NULL, NULL, |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
446 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
447 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), NULL }; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
448 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
449 _dw_event_handler(obj, params, message); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
450 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
451 |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
452 JNIEXPORT void JNICALL |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
453 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
|
454 jint inta, jint intb, jint intc, jint intd) { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
455 void *params[8] = { NULL, NULL, NULL, |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
456 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
457 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), NULL }; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
458 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
459 _dw_event_handler(obj, params, message); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
460 } |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
461 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
462 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
|
463 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
|
464 jint inta, jint intb, jint intc, jint intd) { |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
465 void *params[8] = { NULL, NULL, NULL, |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
466 DW_INT_TO_POINTER(inta), DW_INT_TO_POINTER(intb), |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
467 DW_INT_TO_POINTER(intc), DW_INT_TO_POINTER(intd), NULL }; |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
468 |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
469 _dw_event_handler(obj, params, message); |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
470 } |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
471 |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
472 /* Handler for Timer events */ |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
473 JNIEXPORT jint JNICALL |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
474 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
|
475 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
|
476 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
477 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
|
478 return timerfunc((void *)data); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
479 } |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
480 |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
481 /* 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
|
482 */ |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
483 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
|
484 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
485 SignalHandler *newsig = (SignalHandler *)malloc(sizeof(SignalHandler)); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
486 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
487 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
|
488 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
|
489 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
|
490 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
|
491 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
|
492 newsig->data = data; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
493 newsig->next = NULL; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
494 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
495 if (!DWRoot) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
496 DWRoot = newsig; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
497 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
498 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
499 SignalHandler *prev = NULL, *tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
500 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
501 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
502 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
|
503 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
|
504 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
|
505 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
|
506 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
507 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
|
508 free(newsig); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
509 return; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
510 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
511 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
512 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
|
513 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
514 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
515 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
|
516 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
517 DWRoot = newsig; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
518 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
519 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
520 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
521 /* 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
|
522 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
|
523 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
524 int z; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
525 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
526 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
|
527 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
528 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
|
529 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
|
530 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
531 return 0L; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
532 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
533 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
534 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
535 * 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
|
536 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
537 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
|
538 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
539 /* 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
|
540 * 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
|
541 * 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
|
542 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
543 dw_event_wait(_dw_main_event, DW_TIMEOUT_INFINITE); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
544 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
545 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
546 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
547 * 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
|
548 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
549 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
|
550 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
551 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
|
552 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
553 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
554 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
555 * 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
|
556 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
557 * 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
|
558 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
559 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
|
560 { |
2514
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
561 JNIEnv *env; |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
562 |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
563 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
|
564 { |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
565 // 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
|
566 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
|
567 // 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
|
568 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
|
569 "(I)V"); |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
570 // 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
|
571 env->CallVoidMethod(_dw_obj, mainSleep, milliseconds); |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
572 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
573 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
574 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
575 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
576 * 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
|
577 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
578 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
|
579 { |
2514
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
580 /* 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
|
581 * 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
|
582 */ |
5f711e86a211
Android: Implement dw_main_sleep() and dw_main_iteration().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2513
diff
changeset
|
583 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
|
584 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
585 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
586 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
587 * 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
|
588 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
589 * 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
|
590 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
591 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
|
592 { |
2487
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
593 JNIEnv *env; |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
594 |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
595 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
|
596 { |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
597 // 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
|
598 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
|
599 // 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
|
600 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
|
601 "(I)V"); |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
602 // 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
|
603 env->CallVoidMethod(_dw_obj, dwindowsExit, exitcode); |
83f8f4f58a98
Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2486
diff
changeset
|
604 } |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
605 // 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
|
606 exit(exitcode); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
607 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
608 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
609 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
610 * 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
|
611 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
612 * 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
|
613 * 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
|
614 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
615 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
|
616 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
617 free(ptr); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
618 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
619 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
620 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
621 * 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
|
622 * 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
|
623 * not be determined. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
624 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
625 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
|
626 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
627 static char _dw_user_dir[MAX_PATH+1] = {0}; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
628 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
629 if(!_dw_user_dir[0]) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
630 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
631 char *home = getenv("HOME"); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
632 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
633 if(home) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
634 strcpy(_dw_user_dir, home); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
635 else |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
636 strcpy(_dw_user_dir, "/"); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
637 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
638 return _dw_user_dir; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
639 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
640 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
641 /* |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
642 * 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
|
643 * private application data directory. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
644 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
645 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
|
646 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
647 /* 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
|
648 return _dw_exec_dir; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
649 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
650 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
651 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
652 * 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
|
653 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
654 * appid: A string typically in the form: com.company.division.application |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
655 * appname: The application name used on Windows or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
656 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
657 * 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
|
658 * 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
|
659 * 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
|
660 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
661 * 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
|
662 * 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
|
663 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
664 * The appname is used on Windows and Android. If NULL is passed the |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
665 * 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
|
666 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
667 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
|
668 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
669 if(appid) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
670 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
|
671 if(appname) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
672 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
|
673 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
|
674 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
675 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
676 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
677 * 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
|
678 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
679 * 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
|
680 * ...: 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
|
681 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
682 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
|
683 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
684 va_list args; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
685 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
|
686 JNIEnv *env; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
687 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
688 va_start(args, format); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
689 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
|
690 va_end(args); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
691 |
2482
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
692 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
|
693 { |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
694 // Construct a String |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
695 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
|
696 // 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
|
697 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
|
698 // 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
|
699 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
|
700 "(Ljava/lang/String;)V"); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
701 // 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
|
702 env->CallVoidMethod(_dw_obj, debugMessage, jstr); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
703 } |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
704 else { |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
705 /* 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
|
706 * 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
|
707 */ |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
708 fprintf(stderr, "%s", outbuf); |
4888503c3e3e
Android: Implement dw_debug() using the Android Log class.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2481
diff
changeset
|
709 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
710 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
711 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
712 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
713 * 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
|
714 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
715 * 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
|
716 * 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
|
717 * 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
|
718 * ...: 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
|
719 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
720 * 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
|
721 * 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
|
722 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
723 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
|
724 { |
2486
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
725 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
|
726 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
|
727 JNIEnv *env; |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
728 |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
729 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
|
730 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
|
731 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
|
732 |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
733 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
|
734 { |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
735 // 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
|
736 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
|
737 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
|
738 // 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
|
739 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
|
740 // 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
|
741 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
|
742 "(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
|
743 // Call the method on the object |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
744 return env->CallIntMethod(_dw_obj, messageBox, jstrtitle, jstr, flags); |
cec43818bd3e
Android: Implement dw_messagebox() ... seems we can't just cleanly exit().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2484
diff
changeset
|
745 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
746 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
747 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
748 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
749 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
750 * 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
|
751 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
752 * 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
|
753 * 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
|
754 * ext: Default file extention. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
755 * 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
|
756 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
757 * NULL on error. A malloced buffer containing |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
758 * 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
|
759 * |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
760 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
761 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
|
762 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
763 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
764 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
765 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
766 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
767 * 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
|
768 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
769 * None. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
770 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
771 * Pointer to an allocated string of text or NULL if clipboard empty or contents could not |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
772 * be converted to text. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
773 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
774 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
|
775 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
776 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
777 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
778 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
|
779 { |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
780 const char *utf8 = NULL; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
781 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
782 // 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
|
783 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
|
784 // 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
|
785 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
|
786 "()Ljava/lang/String;"); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
787 // 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
|
788 jstring result = (jstring)env->CallObjectMethod(_dw_obj, clipboardGetText); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
789 // 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
|
790 if(result) |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
791 utf8 = env->GetStringUTFChars(result, 0); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
792 return utf8 ? strdup(utf8) : NULL; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
793 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
794 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
795 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
796 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
797 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
798 * 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
|
799 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
800 * 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
|
801 * 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
|
802 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
803 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
|
804 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
805 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
806 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
807 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
|
808 { |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
809 // Construct a String |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
810 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
|
811 // 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
|
812 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
|
813 // 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
|
814 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
|
815 "(Ljava/lang/String;)V"); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
816 // 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
|
817 env->CallVoidMethod(_dw_obj, clipboardSetText, jstr); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
818 } |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
819 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
820 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
821 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
822 * 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
|
823 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
824 * 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
|
825 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
826 * A handle to a dialog or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
827 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
828 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
|
829 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
830 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
|
831 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
832 if(tmp) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
833 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
834 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
|
835 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
|
836 tmp->data = data; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
837 tmp->done = FALSE; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
838 tmp->result = NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
839 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
840 return tmp; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
841 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
842 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
843 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
844 * 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
|
845 * 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
|
846 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
847 * 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
|
848 * 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
|
849 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
850 * 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
|
851 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
852 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
|
853 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
854 dialog->result = result; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
855 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
|
856 dialog->done = TRUE; |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
857 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
|
858 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
859 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
860 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
861 * 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
|
862 * 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
|
863 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
864 * 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
|
865 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
866 * 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
|
867 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
868 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
|
869 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
870 void *tmp = NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
871 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
872 while(!dialog->done) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
873 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
874 dw_main_iteration(); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
875 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
876 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
|
877 tmp = dialog->result; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
878 free(dialog); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
879 return tmp; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
880 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
883 * 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
|
884 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
885 * 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
|
886 * 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
|
887 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
888 * A handle to a box or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
889 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
890 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
|
891 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
892 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
|
893 |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
894 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
|
895 { |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
896 // 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
|
897 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
|
898 // 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
|
899 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
|
900 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
901 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, boxNew, type, pad)); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
902 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
|
903 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
904 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
905 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
906 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
907 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
908 * 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
|
909 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
910 * 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
|
911 * 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
|
912 * 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
|
913 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
914 * A handle to a groupbox window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
915 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
916 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
|
917 { |
2500
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
918 /* 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
|
919 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
|
920 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
921 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
922 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
923 * 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
|
924 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
925 * 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
|
926 * 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
|
927 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
928 * A handle to a scrollbox or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
929 */ |
2495
5664c91d03fb
Android: Attempts to sort out the various issues... still not working but...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2494
diff
changeset
|
930 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
|
931 { |
2500
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
932 JNIEnv *env; |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
933 |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
934 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
|
935 { |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
936 // 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
|
937 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
|
938 // 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
|
939 jmethodID scrollBoxNew = env->GetMethodID(clazz, "scrollBoxNew", |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
940 "(II)Landroid/widget/ScrollView;"); |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
941 // Call the method on the object |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
942 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, scrollBoxNew, type, pad)); |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
943 return result; |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
944 } |
ac0b7e579229
Android: Implement dw_scrollbox_new() using ScrollView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2499
diff
changeset
|
945 return 0; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
946 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
947 |
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 * 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
|
950 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
951 * 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
|
952 * 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
|
953 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
954 * 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
|
955 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
956 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
|
957 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
958 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
959 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
960 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
961 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
962 * 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
|
963 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
964 * 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
|
965 * 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
|
966 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
967 * 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
|
968 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
969 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
|
970 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
971 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
972 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
973 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
974 /* 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
|
975 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
|
976 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
977 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
|
978 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
979 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
|
980 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
981 // 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
|
982 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
|
983 // 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
|
984 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
|
985 // 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
|
986 env->CallVoidMethod(_dw_obj, boxPack, box, item, index, width, height, hsize, vsize, pad); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
987 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
988 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
989 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
990 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
991 * 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
|
992 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
993 * 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
|
994 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
995 * 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
|
996 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
997 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
|
998 { |
2477
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
999 JNIEnv *env; |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1000 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1001 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
|
1002 { |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1003 // 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
|
1004 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
|
1005 // 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
|
1006 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
|
1007 // 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
|
1008 env->CallVoidMethod(_dw_obj, boxUnpack, handle); |
3fbf8783122d
Android: First functional version. Notebook-less first page of dwtest works.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2476
diff
changeset
|
1009 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
|
1010 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1011 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1012 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1013 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1014 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1015 * 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
|
1016 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1017 * 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
|
1018 * 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
|
1019 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1020 * 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
|
1021 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1022 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
|
1023 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1024 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
|
1025 HWND retval = 0; |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1026 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1027 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
|
1028 // 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
|
1029 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
|
1030 // 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
|
1031 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
|
1032 "(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
|
1033 // 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
|
1034 retval = env->CallObjectMethod(_dw_obj, boxUnpackAtIndex, box, index); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1035 } |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1036 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1037 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1038 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1039 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1040 * 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
|
1041 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1042 * 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
|
1043 * 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
|
1044 * 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
|
1045 * 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
|
1046 * 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
|
1047 * 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
|
1048 * 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
|
1049 * 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
|
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_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
|
1052 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1053 _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
|
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 * 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
|
1058 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1059 * 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
|
1060 * 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
|
1061 * 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
|
1062 * 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
|
1063 * 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
|
1064 * 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
|
1065 * 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
|
1066 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1067 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
|
1068 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1069 /* 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
|
1070 * 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
|
1071 */ |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
1072 _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
|
1073 } |
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 * 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
|
1077 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1078 * 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
|
1079 * 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
|
1080 * 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
|
1081 * 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
|
1082 * 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
|
1083 * 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
|
1084 * 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
|
1085 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1086 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
|
1087 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1088 _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
|
1089 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1090 |
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 * 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
|
1093 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1094 * 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
|
1095 * 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
|
1096 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1097 * A handle to a button window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1098 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1099 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
|
1100 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1101 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
|
1102 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1103 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
|
1104 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1105 // 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
|
1106 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
|
1107 // 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
|
1108 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
|
1109 // 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
|
1110 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
|
1111 "(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
|
1112 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
1113 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, buttonNew, jstr, (int)cid)); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1114 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
|
1115 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1116 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1117 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1118 |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1119 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
|
1120 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1121 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
|
1122 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1123 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
|
1124 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1125 // 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
|
1126 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
|
1127 // 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
|
1128 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
|
1129 // 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
|
1130 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
|
1131 "(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
|
1132 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
1133 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, entryfieldNew, jstr, (int)cid, password)); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1134 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
|
1135 } |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1136 return 0; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1137 } |
2473
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 * 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
|
1140 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1141 * 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
|
1142 * 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
|
1143 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1144 * A handle to an entryfield window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1145 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1146 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
|
1147 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1148 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
|
1149 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1150 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1151 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1152 * 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
|
1153 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1154 * 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
|
1155 * 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
|
1156 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1157 * A handle to an entryfield password window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1158 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1159 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
|
1160 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1161 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
|
1162 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1163 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1164 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1165 * 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
|
1166 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1167 * 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
|
1168 * 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
|
1169 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1170 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
|
1171 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1172 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
|
1173 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1174 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
|
1175 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1176 // 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
|
1177 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
|
1178 // 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
|
1179 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
|
1180 "(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
|
1181 // 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
|
1182 env->CallVoidMethod(_dw_obj, entryfieldSetLimit, handle, (jlong)limit); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1183 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1184 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1185 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1186 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1187 * 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
|
1188 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1189 * 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
|
1190 * 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
|
1191 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1192 * A handle to a bitmap button window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1193 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1194 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
|
1195 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1196 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1197 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1198 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
|
1199 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1200 // Construct a String |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1201 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
|
1202 // 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
|
1203 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
|
1204 // 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
|
1205 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
|
1206 "(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
|
1207 // 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
|
1208 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, bitmapButtonNew, jstr, (int)resid)); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1209 return result; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1210 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1211 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1212 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1213 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1214 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1215 * 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
|
1216 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1217 * 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
|
1218 * 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
|
1219 * 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
|
1220 * 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
|
1221 * (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
|
1222 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1223 * A handle to a bitmap button window or NULL on failure. |
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 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
|
1226 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1227 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1228 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1229 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
|
1230 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1231 // Construct a String |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1232 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
|
1233 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
|
1234 // 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
|
1235 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
|
1236 // 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
|
1237 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
|
1238 "(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
|
1239 // 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
|
1240 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, bitmapButtonNewFromFile, jstr, (int)cid, path)); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1241 return result; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1242 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1243 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1244 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1245 |
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 * 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
|
1248 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1249 * 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
|
1250 * 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
|
1251 * 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
|
1252 * (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
|
1253 * len: length of str |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1254 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1255 * A handle to a bitmap button window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1256 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1257 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
|
1258 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1259 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1260 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1261 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
|
1262 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1263 // Construct a String |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1264 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
|
1265 // Construct a byte array |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1266 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
|
1267 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
|
1268 // 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
|
1269 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
|
1270 // 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
|
1271 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
|
1272 "(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
|
1273 // 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
|
1274 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, bitmapButtonNewFromData, jstr, (int)cid, bytearray, len)); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1275 // 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
|
1276 //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
|
1277 return result; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1278 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1279 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1280 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1281 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1282 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1283 * 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
|
1284 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1285 * 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
|
1286 * 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
|
1287 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1288 * A handle to a spinbutton window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1289 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1290 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
|
1291 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1292 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1293 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1294 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1295 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1296 // Construct a String |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1297 jstring jstr = env->NewStringUTF(text); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1298 // 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
|
1299 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
|
1300 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1301 jmethodID spinButtonNew = env->GetMethodID(clazz, "spinButtonNew", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1302 "(Ljava/lang/String;I)Lorg/dbsoft/dwindows/DWSpinButton;"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1303 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1304 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, spinButtonNew, jstr, (int)cid)); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1305 return result; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1306 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1307 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1308 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1309 |
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 * Sets the spinbutton value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1312 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1313 * 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
|
1314 * 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
|
1315 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1316 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
|
1317 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1318 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1319 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1320 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1321 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1322 // 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
|
1323 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
|
1324 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1325 jmethodID spinButtonSetPos = env->GetMethodID(clazz, "spinButtonSetPos", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1326 "(Lorg/dbsoft/dwindows/DWSpinButton;J)V"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1327 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1328 env->CallVoidMethod(_dw_obj, spinButtonSetPos, handle, (jlong)position); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1329 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1330 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1331 |
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 * Sets the spinbutton limits. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1334 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1335 * 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
|
1336 * upper: Upper limit. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1337 * lower: Lower limit. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1338 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1339 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
|
1340 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1341 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1342 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1343 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1344 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1345 // 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
|
1346 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
|
1347 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1348 jmethodID spinButtonSetLimits = env->GetMethodID(clazz, "spinButtonSetLimits", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1349 "(Lorg/dbsoft/dwindows/DWSpinButton;JJ)V"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1350 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1351 env->CallVoidMethod(_dw_obj, spinButtonSetLimits, handle, (jlong)upper, (jlong)lower); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1352 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1353 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1354 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1355 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1356 * 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
|
1357 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1358 * 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
|
1359 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1360 * 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
|
1361 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1362 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
|
1363 { |
2520
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1364 JNIEnv *env; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1365 long retval = 0; |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1366 |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1367 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1368 { |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1369 // 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
|
1370 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
|
1371 // Get the method that you want to call |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1372 jmethodID spinButtonGetPos = env->GetMethodID(clazz, "spinButtonGetPos", |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1373 "(Lorg/dbsoft/dwindows/DWSpinButton;)J"); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1374 // Call the method on the object |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1375 retval = env->CallLongMethod(_dw_obj, spinButtonGetPos, handle); |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1376 } |
167af4b0004b
Android: Implement spinbuttons and callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2519
diff
changeset
|
1377 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1378 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1379 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1380 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1381 * 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
|
1382 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1383 * 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
|
1384 * 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
|
1385 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1386 * A handle to a radio button window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1387 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1388 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
|
1389 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1390 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
|
1391 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1392 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
|
1393 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1394 // 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
|
1395 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
|
1396 // 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
|
1397 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
|
1398 // 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
|
1399 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
|
1400 "(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
|
1401 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
1402 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, radioButtonNew, jstr, (int)cid)); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1403 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
|
1404 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1405 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1406 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1409 * 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
|
1410 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1411 * 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
|
1412 * 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
|
1413 * 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
|
1414 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1415 * A handle to a slider window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1416 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1417 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
|
1418 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1419 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
|
1420 |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1421 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
|
1422 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1423 // 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
|
1424 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
|
1425 // 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
|
1426 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
|
1427 // 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
|
1428 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, sliderNew, vertical, increments, (jint)cid)); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1429 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
|
1430 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1431 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1432 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1433 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1434 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1435 * 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
|
1436 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1437 * 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
|
1438 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1439 * 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
|
1440 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1441 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
|
1442 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1443 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
|
1444 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1445 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
|
1446 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1447 // 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
|
1448 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
|
1449 // 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
|
1450 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
|
1451 "(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
|
1452 // 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
|
1453 return env->CallIntMethod(_dw_obj, percentGetPos, handle); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1454 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1455 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1456 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1457 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1458 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1459 * Sets the slider position. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1460 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1461 * 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
|
1462 * 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
|
1463 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1464 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
|
1465 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1466 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
|
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1470 * 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
|
1471 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1472 * 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
|
1473 * 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
|
1474 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1475 * A handle to a scrollbar window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1476 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1477 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
|
1478 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1479 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
|
1480 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1481 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1482 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1483 * 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
|
1484 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1485 * 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
|
1486 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1487 * 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
|
1488 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1489 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
|
1490 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1491 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
|
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1495 * Sets the scrollbar position. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1496 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1497 * 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
|
1498 * 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
|
1499 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1500 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
|
1501 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1502 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
|
1503 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1506 * Sets the scrollbar range. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1507 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1508 * 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
|
1509 * range: Maximum range value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1510 * 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
|
1511 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1512 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
|
1513 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1514 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
|
1515 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1516 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
|
1517 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1518 // 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
|
1519 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
|
1520 // 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
|
1521 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
|
1522 "(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
|
1523 // 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
|
1524 env->CallVoidMethod(_dw_obj, percentSetRange, handle, (jint)range); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1525 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1526 } |
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 * 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
|
1530 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1531 * 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
|
1532 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1533 * A handle to a percent bar window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1534 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1535 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
|
1536 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1537 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
|
1538 |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1539 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
|
1540 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1541 // 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
|
1542 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
|
1543 // 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
|
1544 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
|
1545 "(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
|
1546 // 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
|
1547 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, percentNew, (jint)cid)); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1548 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
|
1549 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1550 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1551 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1554 * 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
|
1555 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1556 * 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
|
1557 * 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
|
1558 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1559 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
|
1560 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1561 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
|
1562 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1563 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
|
1564 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1565 // 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
|
1566 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
|
1567 // 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
|
1568 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
|
1569 "(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
|
1570 // 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
|
1571 env->CallVoidMethod(_dw_obj, percentSetPos, handle, (jint)position); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1572 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1573 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1574 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1575 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1576 * 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
|
1577 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1578 * 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
|
1579 * 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
|
1580 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1581 * A handle to a checkbox window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1582 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1583 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
|
1584 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1585 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
|
1586 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1587 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
|
1588 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1589 // 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
|
1590 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
|
1591 // 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
|
1592 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
|
1593 // 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
|
1594 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
|
1595 "(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
|
1596 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
1597 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, checkboxNew, jstr, (int)cid)); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
1598 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
|
1599 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1600 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1601 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1602 |
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 * 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
|
1605 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1606 * 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
|
1607 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1608 * 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
|
1609 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1610 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
|
1611 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1612 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
|
1613 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1614 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
|
1615 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1616 // 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
|
1617 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
|
1618 // 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
|
1619 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
|
1620 "(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
|
1621 // 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
|
1622 return env->CallBooleanMethod(_dw_obj, checkOrRadioGetChecked, handle); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1623 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1624 return FALSE; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1625 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1626 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1627 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1628 * 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
|
1629 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1630 * 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
|
1631 * 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
|
1632 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1633 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
|
1634 { |
2492
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1635 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
|
1636 |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
1637 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
|
1638 { |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1639 // 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
|
1640 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
|
1641 // 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
|
1642 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
|
1643 "(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
|
1644 // 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
|
1645 env->CallVoidMethod(_dw_obj, checkOrRadioSetChecked, handle, value); |
e2ca6c1a4661
Android: Implement: slider, percent, scrollbar, checkbox_set/get box_unpack_at_index(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2490
diff
changeset
|
1646 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1647 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1650 * 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
|
1651 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1652 * 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
|
1653 * 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
|
1654 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1655 * A handle to a listbox window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1656 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1657 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
|
1658 { |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1659 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
|
1660 |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1661 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
|
1662 { |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1663 // 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
|
1664 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
|
1665 // 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
|
1666 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
|
1667 "(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
|
1668 // Call the method on the object |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1669 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, listBoxNew, (int)cid, multi)); |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1670 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
|
1671 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1672 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1673 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1674 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1675 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1676 * 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
|
1677 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1678 * 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
|
1679 * 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
|
1680 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1681 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
|
1682 { |
2515
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1683 JNIEnv *env; |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1684 |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1685 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
|
1686 { |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1687 // 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
|
1688 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
|
1689 // 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
|
1690 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
|
1691 // 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
|
1692 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
|
1693 "(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
|
1694 // 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
|
1695 env->CallVoidMethod(_dw_obj, listOrComboBoxAppend, handle, jstr); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1696 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1697 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1698 |
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 * 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
|
1701 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1702 * 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
|
1703 * 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
|
1704 * 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
|
1705 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1706 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
|
1707 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1708 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1709 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1710 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
|
1711 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1712 // Construct a String |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1713 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
|
1714 // 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
|
1715 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
|
1716 // 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
|
1717 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
|
1718 "(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
|
1719 // 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
|
1720 env->CallVoidMethod(_dw_obj, listOrComboBoxInsert, handle, jstr, pos); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1721 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1722 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1723 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1724 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1725 * 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
|
1726 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1727 * 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
|
1728 * 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
|
1729 * 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
|
1730 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1731 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
|
1732 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1733 int x; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1734 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1735 /* 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
|
1736 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
|
1737 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
|
1738 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1739 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1740 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1741 * 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
|
1742 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1743 * 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
|
1744 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1745 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
|
1746 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1747 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1748 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1749 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
|
1750 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1751 // 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
|
1752 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
|
1753 // 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
|
1754 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
|
1755 "(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
|
1756 // 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
|
1757 env->CallVoidMethod(_dw_obj, listOrComboBoxClear, handle); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1758 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1759 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1760 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1761 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1762 * 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
|
1763 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1764 * 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
|
1765 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1766 * 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
|
1767 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1768 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
|
1769 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1770 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1771 int retval = 0; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1772 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1773 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
|
1774 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1775 // 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
|
1776 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
|
1777 // 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
|
1778 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
|
1779 "(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
|
1780 // 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
|
1781 retval = env->CallIntMethod(_dw_obj, listOrComboBoxCount, handle); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1782 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1783 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1784 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1785 |
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 * 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
|
1788 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1789 * 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
|
1790 * 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
|
1791 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1792 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
|
1793 { |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1794 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
|
1795 |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1796 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
|
1797 { |
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1798 // 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
|
1799 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
|
1800 // 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
|
1801 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
|
1802 "(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
|
1803 // 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
|
1804 env->CallVoidMethod(_dw_obj, listBoxSetTop, handle, top); |
2519
551313c064f2
Android: Implement ListBox with ListView and fill in the missing listbox functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2518
diff
changeset
|
1805 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1806 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1807 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1808 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1809 * 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
|
1810 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1811 * 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
|
1812 * 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
|
1813 * 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
|
1814 * length: Length of the buffer (including NULL). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1815 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1816 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
|
1817 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1818 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1819 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1820 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
|
1821 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1822 // 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
|
1823 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
|
1824 // 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
|
1825 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
|
1826 "(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
|
1827 // 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
|
1828 jstring result = (jstring)env->CallObjectMethod(_dw_obj, listOrComboBoxGetText, handle, index); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1829 // 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
|
1830 if(result) |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1831 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1832 const char *utf8 = env->GetStringUTFChars(result, 0); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1833 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1834 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
|
1835 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1836 } |
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 * 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
|
1841 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1842 * 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
|
1843 * 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
|
1844 * 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
|
1845 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1846 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
|
1847 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1848 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1849 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1850 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
|
1851 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1852 // Construct a String |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1853 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
|
1854 // 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
|
1855 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
|
1856 // 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
|
1857 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
|
1858 "(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
|
1859 // 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
|
1860 env->CallVoidMethod(_dw_obj, listOrComboBoxSetText, handle, index, jstr); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1861 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1862 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1863 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1864 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1865 * 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
|
1866 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1867 * 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
|
1868 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1869 * 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
|
1870 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1871 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
|
1872 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1873 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1874 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
|
1875 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1876 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
|
1877 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1878 // 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
|
1879 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
|
1880 // 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
|
1881 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
|
1882 "(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
|
1883 // 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
|
1884 retval = env->CallIntMethod(_dw_obj, listOrComboBoxGetSelected, handle); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1885 } |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1886 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1887 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1888 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1889 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1890 * 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
|
1891 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1892 * 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
|
1893 * 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
|
1894 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1895 * 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
|
1896 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1897 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
|
1898 { |
2521
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1899 JNIEnv *env; |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1900 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
|
1901 |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1902 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
|
1903 { |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1904 // 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
|
1905 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
|
1906 // 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
|
1907 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
|
1908 "(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
|
1909 // 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
|
1910 retval = env->CallIntMethod(_dw_obj, listBoxSelectedMulti, handle, where); |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1911 } |
5f92284e2b08
Android: Implement bitmap buttons, implement dw_listbox_selected_multi().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2520
diff
changeset
|
1912 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1913 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1914 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1915 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1916 * 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
|
1917 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1918 * 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
|
1919 * index: Item index. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1920 * 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
|
1921 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1922 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
|
1923 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1924 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1925 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1926 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
|
1927 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1928 // 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
|
1929 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
|
1930 // 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
|
1931 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
|
1932 "(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
|
1933 // 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
|
1934 env->CallVoidMethod(_dw_obj, listOrComboBoxSelect, handle, index, state); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1935 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1936 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1937 |
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 * 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
|
1940 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1941 * 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
|
1942 * index: Item index. |
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 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
|
1945 { |
2517
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1946 JNIEnv *env; |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1947 |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1948 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
|
1949 { |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1950 // 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
|
1951 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
|
1952 // 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
|
1953 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
|
1954 "(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
|
1955 // 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
|
1956 env->CallVoidMethod(_dw_obj, listOrComboBoxDelete, handle, index); |
d746323f2841
Android: Implement most of the dw_listbox_*() functions for ComboBoxes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2515
diff
changeset
|
1957 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1958 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1959 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1960 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1961 * 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
|
1962 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1963 * 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
|
1964 * 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
|
1965 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1966 * A handle to a combobox window or NULL on failure. |
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 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
|
1969 { |
2515
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1970 JNIEnv *env; |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1971 |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1972 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
|
1973 { |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1974 // 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
|
1975 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
|
1976 // 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
|
1977 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
|
1978 // 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
|
1979 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
|
1980 "(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
|
1981 // 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
|
1982 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, comboBoxNew, jstr, (int)cid)); |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1983 return result; |
211044d98e86
Android: Initial attempt at our own ComboBox class, EditText with PopupList.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2514
diff
changeset
|
1984 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1985 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1986 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1987 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1988 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1989 * 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
|
1990 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1991 * 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
|
1992 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1993 * A handle to a MLE window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1994 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1995 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
|
1996 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
1997 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
1998 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
1999 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
|
2000 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2001 // 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
|
2002 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
|
2003 // 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
|
2004 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
|
2005 "(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
|
2006 // 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
|
2007 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, mleNew, (int)cid)); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2008 return result; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2009 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2010 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2011 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2012 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2013 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2014 * 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
|
2015 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2016 * 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
|
2017 * 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
|
2018 * 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
|
2019 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2020 * 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
|
2021 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2022 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
|
2023 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2024 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2025 int retval = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2026 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2027 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
|
2028 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2029 // Construct a String |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2030 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
|
2031 // 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
|
2032 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
|
2033 // 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
|
2034 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
|
2035 "(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
|
2036 // 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
|
2037 retval = env->CallIntMethod(_dw_obj, mleImport, handle, jstr, startpoint); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2038 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2039 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2040 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2041 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2042 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2043 * 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
|
2044 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2045 * 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
|
2046 * 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
|
2047 * 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
|
2048 * 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
|
2049 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2050 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
|
2051 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2052 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
|
2053 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
|
2054 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2055 if (text) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2056 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
|
2057 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2058 if (startpoint < len) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2059 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
|
2060 else |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2061 buffer[0] = '\0'; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2062 free(text); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2063 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2064 } |
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 * 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
|
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 MLE to be queried. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2071 * 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
|
2072 * 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
|
2073 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2074 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
|
2075 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2076 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
|
2077 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2078 if(bytes) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2079 if(text) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2080 *bytes = strlen(text); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2081 } else { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2082 *bytes = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2083 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2084 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2085 if(lines) { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2086 if(text) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2087 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2088 int count = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2089 char *tmp = text; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2090 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2091 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
|
2092 count++; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2093 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2094 *lines = count; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2095 } else { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2096 *lines = 0; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2097 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2098 } |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2099 if(text) |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2100 free(text); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2101 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2102 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2103 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2104 * 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
|
2105 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2106 * 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
|
2107 * 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
|
2108 * 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
|
2109 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2110 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
|
2111 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2112 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2113 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2114 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2115 * 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
|
2116 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2117 * 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
|
2118 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2119 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
|
2120 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2121 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2122 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2123 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
|
2124 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2125 // 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
|
2126 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
|
2127 // 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
|
2128 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
|
2129 "(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
|
2130 // 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
|
2131 env->CallVoidMethod(_dw_obj, mleClear, handle); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2132 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2133 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2134 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2135 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2136 * 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
|
2137 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2138 * 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
|
2139 * 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
|
2140 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2141 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
|
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2145 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2146 * 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
|
2147 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2148 * 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
|
2149 * 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
|
2150 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2151 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
|
2152 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2153 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2154 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2155 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
|
2156 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2157 // 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
|
2158 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
|
2159 // 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
|
2160 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
|
2161 "(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
|
2162 // 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
|
2163 env->CallVoidMethod(_dw_obj, mleSetEditable, handle, state); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2164 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2165 } |
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 * 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
|
2169 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2170 * 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
|
2171 * 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
|
2172 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2173 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
|
2174 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2175 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2176 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2177 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
|
2178 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2179 // 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
|
2180 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
|
2181 // 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
|
2182 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
|
2183 "(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
|
2184 // 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
|
2185 env->CallVoidMethod(_dw_obj, mleSetWordWrap, handle, state); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2186 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2187 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2188 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2189 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2190 * 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
|
2191 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2192 * 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
|
2193 * 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
|
2194 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2195 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
|
2196 { |
2510
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2197 JNIEnv *env; |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2198 |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2199 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
|
2200 { |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2201 // 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
|
2202 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
|
2203 // 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
|
2204 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
|
2205 "(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
|
2206 // 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
|
2207 env->CallVoidMethod(_dw_obj, mleSetWordWrap, handle, point); |
f54051c3f2a5
Android: Implement MLE functions. Fix issues with checkboxes and sliders.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2505
diff
changeset
|
2208 } |
2473
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2212 * 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
|
2213 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2214 * 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
|
2215 * 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
|
2216 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2217 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
|
2218 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2219 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2220 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2221 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2222 * 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
|
2223 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2224 * 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
|
2225 * 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
|
2226 * 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
|
2227 * flags: Search specific flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2228 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2229 * 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
|
2230 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2231 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
|
2232 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2233 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2234 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2235 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2236 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2237 * 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
|
2238 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2239 * 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
|
2240 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2241 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
|
2242 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2243 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2244 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2245 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2246 * 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
|
2247 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2248 * 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
|
2249 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2250 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
|
2251 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2252 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2253 |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2254 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
|
2255 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2256 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
|
2257 |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2258 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
|
2259 { |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2260 // 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
|
2261 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
|
2262 // 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
|
2263 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
|
2264 // 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
|
2265 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
|
2266 "(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
|
2267 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
2268 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, textNew, jstr, (int)cid, status)); |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2269 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
|
2270 } |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2271 return 0; |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2272 } |
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2273 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2274 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2275 * 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
|
2276 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2277 * 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
|
2278 * 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
|
2279 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2280 * A handle to a status text window or NULL on failure. |
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 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
|
2283 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2284 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
|
2285 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2286 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2287 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2288 * 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
|
2289 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2290 * 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
|
2291 * 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
|
2292 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2293 * A handle to a text window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2294 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2295 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
|
2296 { |
2476
20c9e83cba2a
Android: Implement dw_entryfield_new, dw_entryfield_password_new() dw_button_new(),
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2475
diff
changeset
|
2297 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
|
2298 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2299 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2300 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2301 * 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
|
2302 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2303 * 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
|
2304 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2305 * A handle to the widget or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2306 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2307 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
|
2308 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2309 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2310 } |
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 * 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
|
2314 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2315 * 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
|
2316 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2317 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
|
2318 { |
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2321 /* 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
|
2322 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2323 * red: red value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2324 * green: green value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2325 * blue: blue value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2326 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2327 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
|
2328 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2329 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2330 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2331 /* 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
|
2332 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2333 * red: red value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2334 * green: green value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2335 * blue: blue value. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2336 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2337 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
|
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2341 /* 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
|
2342 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2343 * value: current color |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2344 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2345 * 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
|
2346 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2347 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
|
2348 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2349 return value; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2350 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2351 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2352 /* 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
|
2353 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2354 * 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
|
2355 * 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
|
2356 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2357 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2358 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2359 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
|
2360 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2361 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2362 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2363 /* 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
|
2364 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2365 * 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
|
2366 * 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
|
2367 * x1: First X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2368 * y1: First Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2369 * x2: Second X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2370 * y2: Second Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2371 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2372 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
|
2373 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2374 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2375 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2376 /* 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
|
2377 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2378 * 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
|
2379 * 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
|
2380 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2381 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2382 * 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
|
2383 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2384 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
|
2385 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2386 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2387 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2388 /* 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
|
2389 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2390 * 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
|
2391 * 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
|
2392 * 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
|
2393 * 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
|
2394 * 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
|
2395 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2396 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
|
2397 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2398 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2399 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2400 /* 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
|
2401 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2402 * 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
|
2403 * 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
|
2404 * 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
|
2405 * 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
|
2406 * 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
|
2407 * 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
|
2408 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2409 void API dw_draw_polygon( HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y ) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2410 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2411 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2412 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2413 /* 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
|
2414 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2415 * 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
|
2416 * 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
|
2417 * 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
|
2418 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2419 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2420 * width: Width of rectangle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2421 * height: Height of rectangle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2422 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2423 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
|
2424 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2425 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2426 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2427 /* 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
|
2428 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2429 * 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
|
2430 * 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
|
2431 * 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
|
2432 * 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
|
2433 * 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
|
2434 * 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
|
2435 * 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
|
2436 * 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
|
2437 * 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
|
2438 * 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
|
2439 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2440 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
|
2441 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2442 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2443 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2444 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2445 * 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
|
2446 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2447 * 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
|
2448 * resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2449 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2450 * A handle to a tree window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2451 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2452 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
|
2453 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2454 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2455 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2456 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2457 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2458 * 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
|
2459 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2460 * 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
|
2461 * 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
|
2462 * 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
|
2463 * 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
|
2464 * 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
|
2465 * itemdata: Item specific data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2466 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2467 * A handle to a tree item or NULL on failure. |
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 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
|
2470 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2471 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2472 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2473 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2474 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2475 * 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
|
2476 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2477 * 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
|
2478 * 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
|
2479 * 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
|
2480 * 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
|
2481 * itemdata: Item specific data. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2482 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2483 * A handle to a tree item or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2484 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2485 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
|
2486 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2487 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2488 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2489 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2490 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2491 * 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
|
2492 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2493 * 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
|
2494 * 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
|
2495 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2496 * A malloc()ed buffer of item text to be dw_free()ed or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2497 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2498 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
|
2499 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2500 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2501 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2504 * 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
|
2505 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2506 * 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
|
2507 * 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
|
2508 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2509 * A handle to a tree item or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2510 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2511 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
|
2512 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2513 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2514 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2515 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2516 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2517 * 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
|
2518 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2519 * 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
|
2520 * 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
|
2521 * 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
|
2522 * 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
|
2523 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2524 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
|
2525 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2526 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2527 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2528 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2529 * 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
|
2530 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2531 * 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
|
2532 * 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
|
2533 * 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
|
2534 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2535 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
|
2536 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2537 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2538 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2539 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2540 * 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
|
2541 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2542 * 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
|
2543 * 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
|
2544 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2545 * A pointer to tree item data or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2546 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2547 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
|
2548 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2549 return NULL; |
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2552 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2553 * 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
|
2554 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2555 * 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
|
2556 * 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
|
2557 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2558 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
|
2559 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2560 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2561 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2562 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2563 * 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
|
2564 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2565 * 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
|
2566 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2567 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
|
2568 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2569 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2570 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2571 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2572 * 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
|
2573 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2574 * 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
|
2575 * 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
|
2576 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2577 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
|
2578 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2579 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2580 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2581 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2582 * 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
|
2583 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2584 * 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
|
2585 * 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
|
2586 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2587 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
|
2588 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2589 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2590 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2591 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2592 * 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
|
2593 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2594 * 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
|
2595 * 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
|
2596 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2597 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
|
2598 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2599 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2600 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2601 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2602 * 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
|
2603 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2604 * 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
|
2605 * resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2606 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2607 * A handle to a container window or NULL on failure. |
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 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
|
2610 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2611 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2612 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2613 |
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 * 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
|
2616 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2617 * 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
|
2618 * 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
|
2619 * 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
|
2620 * 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
|
2621 * 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
|
2622 * (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
|
2623 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2624 * 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
|
2625 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2626 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
|
2627 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2628 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2629 } |
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 * 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
|
2633 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2634 * 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
|
2635 * 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
|
2636 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2637 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
|
2638 { |
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 * 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
|
2643 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2644 * 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
|
2645 * 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
|
2646 * 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
|
2647 * 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
|
2648 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2649 * 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
|
2650 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2651 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
|
2652 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2653 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2654 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2655 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2656 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2657 * 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
|
2658 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2659 * 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
|
2660 * 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
|
2661 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2662 * Handle to container items allocated or NULL on error. |
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 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
|
2665 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2666 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2667 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2668 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2669 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2670 * 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
|
2671 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2672 * 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
|
2673 * 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
|
2674 * 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
|
2675 * 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
|
2676 * 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
|
2677 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2678 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
|
2679 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2680 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2681 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2682 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2683 * 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
|
2684 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2685 * 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
|
2686 * 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
|
2687 * 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
|
2688 * 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
|
2689 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2690 void API dw_container_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
|
2691 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2692 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2695 * 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
|
2696 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2697 * 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
|
2698 * 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
|
2699 * 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
|
2700 * 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
|
2701 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2702 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
|
2703 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2704 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2705 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2706 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2707 * 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
|
2708 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2709 * 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
|
2710 * 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
|
2711 * 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
|
2712 * 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
|
2713 * 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
|
2714 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2715 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
|
2716 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2717 } |
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 * 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
|
2721 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2722 * 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
|
2723 * 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
|
2724 * 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
|
2725 * 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
|
2726 * 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
|
2727 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2728 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
|
2729 { |
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 |
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 * 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
|
2734 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2735 * 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
|
2736 * 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
|
2737 * 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
|
2738 * 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
|
2739 * 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
|
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_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
|
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 * 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
|
2747 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2748 * 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
|
2749 * 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
|
2750 * data: Data pointer. |
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 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
|
2753 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2754 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2755 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2756 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2757 * 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
|
2758 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2759 * 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
|
2760 * 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
|
2761 * data: Data pointer. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2762 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2763 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
|
2764 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2765 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2766 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2767 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2768 * 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
|
2769 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2770 * 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
|
2771 * column: Zero based column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2772 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2773 * 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
|
2774 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2775 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
|
2776 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2777 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2778 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2779 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2780 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2781 * 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
|
2782 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2783 * 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
|
2784 * column: Zero based column. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2785 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2786 * 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
|
2787 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2788 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
|
2789 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2790 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2791 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2792 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2793 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2794 * 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
|
2795 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2796 * 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
|
2797 * 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
|
2798 * 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
|
2799 * 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
|
2800 * 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
|
2801 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2802 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
|
2803 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2804 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2805 |
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 * 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
|
2808 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2809 * 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
|
2810 * 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
|
2811 * 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
|
2812 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2813 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
|
2814 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2815 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2816 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2817 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2818 * 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
|
2819 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2820 * 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
|
2821 * 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
|
2822 * 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
|
2823 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2824 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
|
2825 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2826 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2827 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2828 |
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 * 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
|
2831 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2832 * 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
|
2833 * 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
|
2834 * 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
|
2835 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2836 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
|
2837 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2838 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2839 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2840 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2841 * 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
|
2842 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2843 * 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
|
2844 * 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
|
2845 * 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
|
2846 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2847 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
|
2848 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2849 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2850 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2851 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2852 * 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
|
2853 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2854 * 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
|
2855 * 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
|
2856 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2857 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
|
2858 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2859 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2860 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2861 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2862 * 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
|
2863 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2864 * 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
|
2865 * 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
|
2866 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2867 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
|
2868 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2869 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2870 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2871 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2872 * 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
|
2873 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2874 * 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
|
2875 * 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
|
2876 * 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
|
2877 * 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
|
2878 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2879 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
|
2880 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2881 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2882 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2883 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2884 * 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
|
2885 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2886 * 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
|
2887 * 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
|
2888 * 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
|
2889 * 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
|
2890 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2891 * Pointer to data associated with first entry or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2892 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2893 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
|
2894 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2895 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2896 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2897 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2898 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2899 * 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
|
2900 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2901 * 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
|
2902 * 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
|
2903 * 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
|
2904 * 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
|
2905 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2906 * Pointer to data associated with next entry or NULL on error or completion. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2907 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2908 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
|
2909 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2910 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2911 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2912 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2913 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2914 * 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
|
2915 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2916 * 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
|
2917 * 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
|
2918 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2919 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
|
2920 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2921 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2922 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2923 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2924 * 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
|
2925 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2926 * 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
|
2927 * 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
|
2928 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2929 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
|
2930 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2931 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2932 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2933 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2934 * 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
|
2935 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2936 * 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
|
2937 * 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
|
2938 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2939 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
|
2940 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2941 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2942 |
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 * 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
|
2945 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2946 * 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
|
2947 * 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
|
2948 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2949 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
|
2950 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2951 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2952 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2953 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2954 * 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
|
2955 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2956 * 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
|
2957 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2958 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
|
2959 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2960 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2961 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2962 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2963 * 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
|
2964 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2965 * 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
|
2966 * 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
|
2967 * 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
|
2968 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2969 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
|
2970 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2971 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2972 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2973 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2974 * 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
|
2975 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2976 * 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
|
2977 * 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
|
2978 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2979 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
|
2980 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2981 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2982 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2983 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2984 * 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
|
2985 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2986 * 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
|
2987 * 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
|
2988 * 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
|
2989 * to an embedded XPM. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2990 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2991 * Handle to the created icon or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2992 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2993 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
|
2994 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2995 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2996 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2997 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2998 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2999 * 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
|
3000 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3001 * 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
|
3002 * 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
|
3003 * (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
|
3004 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3005 * Handle to the created icon or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3006 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3007 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
|
3008 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3009 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3010 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3011 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3012 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3013 * 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
|
3014 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3015 * 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
|
3016 * 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
|
3017 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3018 * Handle to the created icon or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3019 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3020 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
|
3021 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3022 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3023 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3024 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3025 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3026 * 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
|
3027 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3028 * 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
|
3029 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3030 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
|
3031 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3032 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3033 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3034 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3035 * 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
|
3036 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3037 * 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
|
3038 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3039 * Handle to the created MDI widget or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3040 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3041 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
|
3042 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3043 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3044 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3045 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3046 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3047 * 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
|
3048 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3049 * 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
|
3050 * 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
|
3051 * 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
|
3052 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3053 * A handle to a splitbar window or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3054 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3055 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
|
3056 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3057 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3058 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3059 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3060 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3061 * 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
|
3062 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3063 * 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
|
3064 * 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
|
3065 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3066 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
|
3067 { |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3071 * 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
|
3072 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3073 * 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
|
3074 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3075 * 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
|
3076 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3077 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
|
3078 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3079 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3080 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3081 |
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 * 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
|
3084 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3085 * 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
|
3086 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3087 * Handle to the created bitmap widget or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3088 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3089 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
|
3090 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3091 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3092 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3093 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3094 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3095 * 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
|
3096 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3097 * 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
|
3098 * 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
|
3099 * 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
|
3100 * 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
|
3101 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3102 * A handle to a pixmap or NULL on failure. |
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 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
|
3105 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3106 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3107 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3108 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3109 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3110 * 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
|
3111 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3112 * 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
|
3113 * 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
|
3114 * 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
|
3115 * (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
|
3116 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3117 * A handle to a pixmap or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3118 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3119 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
|
3120 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3121 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3122 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3123 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3124 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3125 * 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
|
3126 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3127 * 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
|
3128 * 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
|
3129 * (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
|
3130 * len: Length of data |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3131 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3132 * A handle to a pixmap or NULL on failure. |
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 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
|
3135 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3136 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3137 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3138 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3139 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3140 * 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
|
3141 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3142 * 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
|
3143 * dw_pixmap_new.. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3144 * color: Transparent RGB color |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3145 * 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
|
3146 * 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
|
3147 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3148 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
|
3149 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3150 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3151 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3152 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3153 * 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
|
3154 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3155 * 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
|
3156 * 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
|
3157 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3158 * A handle to a pixmap or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3159 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3160 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
|
3161 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3162 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3163 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3164 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3165 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3166 * 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
|
3167 * 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
|
3168 * 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
|
3169 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3170 * 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
|
3171 * 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
|
3172 * 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
|
3173 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3174 * 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
|
3175 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3176 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
|
3177 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3178 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3179 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3180 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3181 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3182 * Destroys an allocated pixmap. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3183 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3184 * 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
|
3185 * dw_pixmap_new.. |
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 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
|
3188 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3189 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3190 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3191 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3192 * 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
|
3193 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3194 * dest: Destination window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3195 * 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
|
3196 * 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
|
3197 * 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
|
3198 * 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
|
3199 * 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
|
3200 * src: Source window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3201 * 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
|
3202 * 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
|
3203 * 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
|
3204 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3205 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
|
3206 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3207 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3208 |
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 * 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
|
3211 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3212 * dest: Destination window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3213 * 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
|
3214 * 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
|
3215 * 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
|
3216 * 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
|
3217 * 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
|
3218 * src: Source window handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3219 * 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
|
3220 * 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
|
3221 * 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
|
3222 * 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
|
3223 * 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
|
3224 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3225 * 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
|
3226 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3227 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
|
3228 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3229 return DW_ERROR_GENERAL; |
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3232 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3233 * 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
|
3234 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3235 * 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
|
3236 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3237 * Handle to the created calendar or NULL on error. |
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 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
|
3240 { |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3241 JNIEnv *env; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3242 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3243 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
|
3244 { |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3245 // 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
|
3246 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
|
3247 // 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
|
3248 jmethodID calendarNew = env->GetMethodID(clazz, "calendarNew", |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3249 "(I)Landroid/widget/CalendarView;"); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3250 // Call the method on the object |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3251 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, calendarNew, (int)cid)); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3252 return result; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3253 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3254 return 0; |
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 |
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 * 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
|
3259 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3260 * 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
|
3261 * 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
|
3262 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3263 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
|
3264 { |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3265 JNIEnv *env; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3266 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3267 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
|
3268 { |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3269 time_t date; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3270 struct tm ts = {0}; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3271 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3272 // Convert to Unix time |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3273 ts.tm_year = year - 1900; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3274 ts.tm_mon = month; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3275 ts.tm_mday = day; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3276 date = mktime(&ts); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3277 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3278 // 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
|
3279 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
|
3280 // 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
|
3281 jmethodID calendarSetDate = env->GetMethodID(clazz, "calendarSetDate", |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3282 "(Landroid/widget/CalendarView;J)V"); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3283 // Call the method on the object |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3284 env->CallVoidMethod(_dw_obj, calendarSetDate, handle, (jlong)date); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3285 } |
2473
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3288 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3289 * 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
|
3290 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3291 * 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
|
3292 * year: Variable to store the year or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3293 * month: Variable to store the month or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3294 * day: Variable to store the day or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3295 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3296 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
|
3297 { |
2523
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3298 JNIEnv *env; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3299 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3300 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
|
3301 { |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3302 time_t date; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3303 struct tm ts; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3304 |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3305 // 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
|
3306 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
|
3307 // 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
|
3308 jmethodID calendarGetDate = env->GetMethodID(clazz, "calendarGetDate", |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3309 "(Landroid/widget/CalendarView;)J"); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3310 // Call the method on the object |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3311 date = (time_t)env->CallLongMethod(_dw_obj, calendarGetDate, handle); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3312 ts = *localtime(&date); |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3313 if(year) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3314 *year = ts.tm_year + 1900; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3315 if(month) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3316 *month = ts.tm_mon; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3317 if(day) |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3318 *day = ts.tm_mday; |
82cdb3ad7c25
Android: Implement the calendar widget using CalendarView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2522
diff
changeset
|
3319 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3320 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3321 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3322 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3323 * 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
|
3324 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3325 * 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
|
3326 * 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
|
3327 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3328 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
|
3329 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3330 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3331 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3332 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
|
3333 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3334 // 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
|
3335 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
|
3336 // 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
|
3337 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
|
3338 "(Landroid/webkit/WebView;I)V"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3339 // 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
|
3340 env->CallVoidMethod(_dw_obj, htmlAction, handle, action); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3341 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3342 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3343 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3344 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3345 * 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
|
3346 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3347 * 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
|
3348 * 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
|
3349 * be rendered. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3350 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3351 * 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
|
3352 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3353 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
|
3354 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3355 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3356 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3357 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
|
3358 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3359 // Construct a String |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3360 jstring jstr = env->NewStringUTF(string); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3361 // 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
|
3362 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
|
3363 // 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
|
3364 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
|
3365 "(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
|
3366 // 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
|
3367 env->CallVoidMethod(_dw_obj, htmlRaw, handle, jstr); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3368 return DW_ERROR_NONE; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3369 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3370 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3371 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3372 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3373 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3374 * 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
|
3375 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3376 * 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
|
3377 * 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
|
3378 * 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
|
3379 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3380 * 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
|
3381 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3382 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
|
3383 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3384 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3385 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3386 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
|
3387 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3388 // Construct a String |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3389 jstring jstr = env->NewStringUTF(url); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3390 // 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
|
3391 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
|
3392 // 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
|
3393 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
|
3394 "(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
|
3395 // 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
|
3396 env->CallVoidMethod(_dw_obj, htmlLoadURL, handle, jstr); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3397 return DW_ERROR_NONE; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3398 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3399 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3400 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3403 * 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
|
3404 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3405 * 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
|
3406 * 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
|
3407 * 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
|
3408 * 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
|
3409 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3410 * 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
|
3411 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3412 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
|
3413 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3414 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3415 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3416 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
|
3417 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3418 // Construct a String |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3419 jstring jstr = env->NewStringUTF(script); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3420 // 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
|
3421 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
|
3422 // 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
|
3423 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
|
3424 "(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
|
3425 // 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
|
3426 env->CallVoidMethod(_dw_obj, htmlJavascriptRun, handle, jstr, (jlong)scriptdata); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3427 return DW_ERROR_NONE; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3428 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3429 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3430 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3431 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3432 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3433 * 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
|
3434 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3435 * 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
|
3436 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3437 * Handle to the created html widget or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3438 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3439 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
|
3440 { |
2501
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3441 JNIEnv *env; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3442 |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3443 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
|
3444 { |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3445 // 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
|
3446 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
|
3447 // 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
|
3448 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
|
3449 "(I)Landroid/webkit/WebView;"); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3450 // 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
|
3451 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, htmlNew, (int)cid)); |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3452 return result; |
41984ffb5ca2
Android: Initial implement of HTML control with WebView.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2500
diff
changeset
|
3453 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3454 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3455 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3456 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3457 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3458 * 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
|
3459 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3460 * x: Pointer to variable to store X coordinate or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3461 * y: Pointer to variable to store Y coordinate or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3462 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3463 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
|
3464 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3465 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3466 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3467 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3468 * 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
|
3469 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3470 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3471 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3472 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3473 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
|
3474 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3475 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3476 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3477 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3478 * 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
|
3479 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3480 * 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
|
3481 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3482 * Handle to the created menu or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3483 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3484 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
|
3485 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3486 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3487 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3488 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3489 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3490 * 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
|
3491 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3492 * 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
|
3493 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3494 * Handle to the created menu bar or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3495 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3496 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
|
3497 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3498 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3499 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3502 * 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
|
3503 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3504 * 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
|
3505 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3506 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
|
3507 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3508 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3509 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3510 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3511 * 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
|
3512 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3513 * 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
|
3514 * id: Menuitem id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3515 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3516 * 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
|
3517 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3518 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
|
3519 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3520 return DW_ERROR_UNKNOWN; |
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 * 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
|
3525 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3526 * 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
|
3527 * 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
|
3528 * x: X coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3529 * y: Y coordinate. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3530 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3531 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
|
3532 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3533 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3534 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3535 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3536 * 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
|
3537 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3538 * 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
|
3539 * 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
|
3540 * 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
|
3541 * 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
|
3542 * 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
|
3543 * check: If TRUE menu is "check"able. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3544 * submenu: Handle to an existing menu to be a submenu or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3545 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3546 * Handle to the created menu item or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3547 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3548 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
|
3549 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3550 return 0; |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3554 * 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
|
3555 * 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
|
3556 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3557 * 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
|
3558 * id: Menuitem id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3559 * 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
|
3560 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3561 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
|
3562 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3563 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3564 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3565 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3566 * 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
|
3567 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3568 * 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
|
3569 * id: Menuitem id. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3570 * 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
|
3571 * 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
|
3572 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3573 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
|
3574 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3575 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3576 |
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 * 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
|
3579 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3580 * 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
|
3581 * resource file. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3582 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3583 * Handle to the created notebook or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3584 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3585 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
|
3586 { |
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
|
3587 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
|
3588 |
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
|
3589 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
|
3590 { |
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
|
3591 // 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
|
3592 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
|
3593 // 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
|
3594 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
|
3595 "(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
|
3596 // Call the method on the object |
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
|
3597 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, notebookNew, (int)cid, top)); |
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
|
3598 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
|
3599 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3600 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3601 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3604 * 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
|
3605 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3606 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3607 * 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
|
3608 * 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
|
3609 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3610 * 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
|
3611 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3612 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
|
3613 { |
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
|
3614 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
|
3615 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
|
3616 |
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
|
3617 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
|
3618 { |
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
|
3619 // 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
|
3620 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
|
3621 // 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
|
3622 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
|
3623 "(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
|
3624 // 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
|
3625 result = (unsigned long)env->CallLongMethod(_dw_obj, notebookPageNew, handle, (jlong)flags, front); |
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
|
3626 } |
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
|
3627 return result; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3628 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3629 |
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 * 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
|
3632 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3633 * 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
|
3634 * 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
|
3635 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3636 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
|
3637 { |
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
|
3638 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
|
3639 |
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
|
3640 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
|
3641 { |
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
|
3642 // 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
|
3643 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
|
3644 // 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
|
3645 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
|
3646 "(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
|
3647 // 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
|
3648 env->CallVoidMethod(_dw_obj, notebookPageDestroy, handle, (jlong)pageid); |
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
|
3649 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3650 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3651 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3652 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3653 * 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
|
3654 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3655 * 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
|
3656 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3657 * 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
|
3658 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3659 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
|
3660 { |
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
|
3661 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
|
3662 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
|
3663 |
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
|
3664 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
|
3665 // 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
|
3666 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
|
3667 // 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
|
3668 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
|
3669 "(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
|
3670 // 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
|
3671 result = (unsigned long)env->CallLongMethod(_dw_obj, notebookPageGet, handle); |
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
|
3672 } |
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
|
3673 return result; |
2473
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3676 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3677 * 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
|
3678 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3679 * 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
|
3680 * 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
|
3681 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3682 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
|
3683 { |
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
|
3684 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
|
3685 |
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
|
3686 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
|
3687 // 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
|
3688 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
|
3689 // 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
|
3690 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
|
3691 "(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
|
3692 // 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
|
3693 env->CallVoidMethod(_dw_obj, notebookPageSet, handle, (jlong)pageid); |
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
|
3694 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3695 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3696 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3697 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3698 * 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
|
3699 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3700 * handle: Notebook handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3701 * 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
|
3702 * 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
|
3703 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3704 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
|
3705 { |
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
|
3706 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
|
3707 |
2502
b6319aed3298
Android: Massive thread safety overhaul. Not quite back to fully functional.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2501
diff
changeset
|
3708 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
|
3709 { |
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
|
3710 // 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
|
3711 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
|
3712 // 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
|
3713 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
|
3714 // 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
|
3715 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
|
3716 "(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
|
3717 // 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
|
3718 env->CallVoidMethod(_dw_obj, notebookPageSetText, handle, (jlong)pageid, jstr); |
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
|
3719 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3720 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3721 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3722 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3723 * 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
|
3724 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3725 * handle: Notebook handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3726 * 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
|
3727 * 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
|
3728 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3729 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
|
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3733 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3734 * 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
|
3735 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3736 * 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
|
3737 * 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
|
3738 * 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
|
3739 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3740 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
|
3741 { |
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
|
3742 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
|
3743 |
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
|
3744 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
|
3745 { |
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
|
3746 // 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
|
3747 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
|
3748 // 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
|
3749 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
|
3750 "(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
|
3751 // 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
|
3752 env->CallVoidMethod(_dw_obj, notebookPagePack, handle, (jlong)pageid, page); |
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
|
3753 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3754 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3755 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3756 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3757 * 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
|
3758 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3759 * 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
|
3760 * title: The Window title. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3761 * flStyle: Style flags. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3762 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3763 * Handle to the created window or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3764 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3765 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
|
3766 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
3767 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
|
3768 |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
3769 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
|
3770 { |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
3771 // 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
|
3772 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
|
3773 // 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
|
3774 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
|
3775 // 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
|
3776 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
|
3777 "(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
|
3778 // Call the method on the object |
2483
9f7af6d8c6a4
Android: Fix signal handlers so they actually work.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2482
diff
changeset
|
3779 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, windowNew, jstr, (int)flStyle)); |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
3780 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
|
3781 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3782 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3783 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3784 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3785 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3786 * 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
|
3787 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3788 * 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
|
3789 * 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
|
3790 * 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
|
3791 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3792 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
|
3793 { |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3798 * 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
|
3799 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3800 * 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
|
3801 * 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
|
3802 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3803 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
|
3804 { |
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 |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3807 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
|
3808 { |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3809 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
|
3810 |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3811 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
|
3812 { |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3813 // 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
|
3814 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
|
3815 // 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
|
3816 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
|
3817 "(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
|
3818 // 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
|
3819 env->CallVoidMethod(_dw_obj, windowHideShow, handle, state); |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3820 return DW_ERROR_NONE; |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3821 } |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3822 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
|
3823 } |
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3824 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3825 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3826 * Makes the window visible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3827 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3828 * 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
|
3829 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3830 * 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
|
3831 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3832 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
|
3833 { |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3834 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
|
3835 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3836 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3837 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3838 * Makes the window invisible. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3839 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3840 * 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
|
3841 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3842 * 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
|
3843 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3844 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
|
3845 { |
2503
1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2502
diff
changeset
|
3846 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
|
3847 } |
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 * 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
|
3851 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3852 * 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
|
3853 * 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
|
3854 * 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
|
3855 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3856 * 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
|
3857 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3858 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
|
3859 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3860 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3861 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3862 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3863 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3864 * 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
|
3865 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3866 * 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
|
3867 * 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
|
3868 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3869 * 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
|
3870 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3871 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
|
3872 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3873 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3874 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3875 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3876 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3877 * 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
|
3878 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3879 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3880 * 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
|
3881 * 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
|
3882 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3883 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
|
3884 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3885 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3886 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3887 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3888 * 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
|
3889 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3890 * 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
|
3891 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3892 * 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
|
3893 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3894 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
|
3895 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3896 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3899 * 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
|
3900 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3901 * 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
|
3902 * 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
|
3903 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3904 * 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
|
3905 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3906 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
|
3907 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3908 } |
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 * 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
|
3912 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3913 * 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
|
3914 * 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
|
3915 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3916 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
|
3917 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3918 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3919 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3920 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3921 * 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
|
3922 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3923 * 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
|
3924 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3925 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
|
3926 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3927 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3928 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3929 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3930 * Releases previous mouse capture. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3931 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3932 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
|
3933 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3934 } |
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 * 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
|
3938 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3939 * 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
|
3940 * 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
|
3941 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3942 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
|
3943 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3944 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3945 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3946 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3947 * 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
|
3948 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3949 * 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
|
3950 * 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
|
3951 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3952 * 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
|
3953 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3954 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
|
3955 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3956 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3957 } |
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 * 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
|
3961 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3962 * 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
|
3963 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3964 * A malloc()ed font name string to be dw_free()ed or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3965 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3966 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
|
3967 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3968 return NULL; |
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3971 /* 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
|
3972 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3973 * currfont: current font |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3974 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3975 * A malloced buffer with the selected font or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3976 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3977 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
|
3978 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3979 return NULL; |
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3982 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3983 * 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
|
3984 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3985 * 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
|
3986 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3987 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
|
3988 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3989 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3990 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3991 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3992 * 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
|
3993 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3994 * 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
|
3995 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3996 * 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
|
3997 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3998 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
|
3999 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4000 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4001 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4002 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4003 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4004 * 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
|
4005 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4006 * 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
|
4007 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4008 * The text associsated with a given window or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4009 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4010 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
|
4011 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4012 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4013 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4014 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
|
4015 { |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4016 const char *utf8 = NULL; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4017 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4018 // 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
|
4019 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
|
4020 // 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
|
4021 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
|
4022 "(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
|
4023 // 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
|
4024 jstring result = (jstring)env->CallObjectMethod(_dw_obj, windowGetText, handle); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4025 // 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
|
4026 if(result) |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4027 utf8 = env->GetStringUTFChars(result, 0); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4028 return utf8 ? strdup(utf8) : NULL; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4029 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4030 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4031 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4034 * 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
|
4035 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4036 * 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
|
4037 * 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
|
4038 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4039 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
|
4040 { |
2489
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4041 JNIEnv *env; |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4042 |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4043 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
|
4044 { |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4045 // Construct a String |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4046 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
|
4047 // 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
|
4048 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
|
4049 // 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
|
4050 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
|
4051 "(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
|
4052 // 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
|
4053 env->CallVoidMethod(_dw_obj, windowSetText, handle, jstr); |
6c01b0132813
Android: Implement window and clipboard text setter and getters.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2488
diff
changeset
|
4054 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4055 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4056 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4057 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4058 * 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
|
4059 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4060 * 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
|
4061 * 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
|
4062 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4063 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
|
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 |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4067 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
|
4068 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4069 JNIEnv *env; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4070 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4071 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
|
4072 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4073 // 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
|
4074 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
|
4075 // 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
|
4076 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
|
4077 "(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
|
4078 // 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
|
4079 env->CallVoidMethod(_dw_obj, windowSetEnabled, handle, state); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4080 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4081 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4082 |
2473
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 * Disables given window (widget). |
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 * 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
|
4087 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4088 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
|
4089 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4090 _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
|
4091 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4092 |
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 * Enables given window (widget). |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4095 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4096 * 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
|
4097 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4098 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
|
4099 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4100 _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
|
4101 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4102 |
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 * 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
|
4105 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4106 * 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
|
4107 * 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
|
4108 * (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
|
4109 * 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
|
4110 * Windows and a pixmap on Unix, pass |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4111 * NULL if you use the id param) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4112 * 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
|
4113 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4114 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
|
4115 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4116 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4117 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4118 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4119 * 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
|
4120 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4121 * 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
|
4122 * 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
|
4123 * (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
|
4124 * 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
|
4125 * Windows and a pixmap on Unix, pass |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4126 * NULL if you use the id param) |
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_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
|
4129 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4130 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4131 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4132 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4133 * 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
|
4134 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4135 * 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
|
4136 * 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
|
4137 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4138 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
|
4139 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4140 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4141 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4142 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4143 * 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
|
4144 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4145 * 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
|
4146 * 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
|
4147 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4148 * HWND of window with ID or NULL on error. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4149 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4150 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
|
4151 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4152 JNIEnv *env; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4153 HWND retval = 0; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4154 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4155 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
|
4156 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4157 // 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
|
4158 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
|
4159 // 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
|
4160 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
|
4161 "(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
|
4162 // 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
|
4163 retval = env->CallObjectMethod(_dw_obj, windowFromId, handle, id); |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4164 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4165 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4166 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4167 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4168 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4169 * 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
|
4170 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4171 * 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
|
4172 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4173 * 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
|
4174 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4175 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
|
4176 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4177 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4178 } |
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 /* 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
|
4181 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4182 * 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
|
4183 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4184 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
|
4185 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4186 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4187 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4188 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4189 * Makes the window topmost. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4190 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4191 * 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
|
4192 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4193 * 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
|
4194 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4195 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
|
4196 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4197 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4198 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4199 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4200 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4201 * Makes the window bottommost. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4202 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4203 * 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
|
4204 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4205 * 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
|
4206 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4207 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
|
4208 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4209 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4210 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4211 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4212 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4213 * 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
|
4214 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4215 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4216 * 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
|
4217 * 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
|
4218 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4219 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
|
4220 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4221 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4222 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4223 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4224 * 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
|
4225 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4226 * handle: Window (widget) handle of the item to query. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4227 * width: Width in pixels of the item or NULL if not needed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4228 * height: Height in pixels of the item or NULL if not needed. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4229 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4230 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
|
4231 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4232 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4233 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4234 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4235 * 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
|
4236 * 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
|
4237 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4238 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4239 * 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
|
4240 * 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
|
4241 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4242 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
|
4243 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4244 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4245 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4246 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4247 * 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
|
4248 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4249 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4250 * 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
|
4251 * 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
|
4252 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4253 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
|
4254 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4255 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4256 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4257 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4258 * 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
|
4259 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4260 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4261 * 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
|
4262 * 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
|
4263 * 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
|
4264 * 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
|
4265 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4266 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
|
4267 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4268 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4271 * 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
|
4272 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4273 * handle: Window (widget) handle. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4274 * x: X location from the bottom left or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4275 * y: Y location from the bottom left or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4276 * width: Width of the widget or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4277 * height: Height of the widget or NULL. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4278 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4279 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
|
4280 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4281 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4282 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4283 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4284 * 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
|
4285 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4286 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
|
4287 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4288 return 0; |
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 * 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
|
4293 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4294 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
|
4295 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4296 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4297 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4298 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4299 /* 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
|
4300 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
|
4301 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4302 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4303 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4304 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4305 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4306 * 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
|
4307 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4308 * 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
|
4309 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4310 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
|
4311 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
4312 strcpy(env->osName, "Android"); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4313 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4314 strcpy(env->buildDate, __DATE__); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4315 strcpy(env->buildTime, __TIME__); |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4316 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
|
4317 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
|
4318 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
|
4319 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4320 env->MajorVersion = 0; /* Operating system major */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4321 env->MinorVersion = 0; /* Operating system minor */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4322 env->MajorBuild = 0; /* Build versions... if available */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4323 env->MinorBuild = 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4324 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4325 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4326 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4327 * Emits a beep. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4328 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4329 * freq: Frequency. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4330 * dur: Duration. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4331 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4332 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
|
4333 { |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4334 JNIEnv *env; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4335 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4336 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
|
4337 { |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4338 // 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
|
4339 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
|
4340 // 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
|
4341 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
|
4342 // 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
|
4343 env->CallVoidMethod(_dw_obj, doBeep, dur); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4344 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4345 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4346 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4347 /* 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
|
4348 * 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
|
4349 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4350 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
|
4351 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4352 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4353 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4354 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4355 * 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
|
4356 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4357 * 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
|
4358 * 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
|
4359 * 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
|
4360 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4361 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
|
4362 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4363 JNIEnv *env; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4364 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4365 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
|
4366 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4367 // 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
|
4368 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
|
4369 // 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
|
4370 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
|
4371 // 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
|
4372 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
|
4373 "(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
|
4374 // 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
|
4375 env->CallVoidMethod(_dw_obj, windowSetData, window, jstr, (jlong)data); |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4376 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4377 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4378 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4379 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4380 * 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
|
4381 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4382 * 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
|
4383 * 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
|
4384 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4385 * Pointer to data or NULL if no data is available. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4386 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4387 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
|
4388 { |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4389 JNIEnv *env; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4390 void *retval = NULL; |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4391 |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4392 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
|
4393 { |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4394 // 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
|
4395 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
|
4396 // 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
|
4397 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
|
4398 // 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
|
4399 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
|
4400 "(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
|
4401 // 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
|
4402 retval = (void *)env->CallLongMethod(_dw_obj, windowGetData, window, jstr); |
2488
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4403 } |
666af45f33b5
Android: Implment a bunch of window functions: enable/disable/data/id
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2487
diff
changeset
|
4404 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4405 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4406 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4407 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4408 * 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
|
4409 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4410 * 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
|
4411 * 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
|
4412 * 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
|
4413 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4414 * 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
|
4415 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4416 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4417 { |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4418 JNIEnv *env; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4419 int retval = 0; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4420 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4421 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
|
4422 { |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4423 // Use a long paramater |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4424 jlong longinterval = (jlong)interval; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4425 // 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
|
4426 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
|
4427 // 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
|
4428 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
|
4429 "(JJJ)Ljava/util/Timer;"); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4430 // 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
|
4431 retval = DW_POINTER_TO_INT(env->NewGlobalRef(env->CallObjectMethod(_dw_obj, |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4432 timerConnect, longinterval, (jlong)sigfunc, (jlong)data))); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4433 } |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4434 return retval; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4435 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4438 * Removes timer callback. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4439 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4440 * 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
|
4441 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4442 void API dw_timer_disconnect(int timerid) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4443 { |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4444 JNIEnv *env; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4445 |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4446 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
|
4447 { |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
4448 // Use a long parameter |
2490
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4449 jobject timer = (jobject)timerid; |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4450 // 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
|
4451 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
|
4452 // 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
|
4453 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
|
4454 "(Ljava/util/Timer;)V"); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4455 // 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
|
4456 env->CallVoidMethod(_dw_obj, timerDisconnect, timer); |
62e124eecd82
Android: Implement timers and beep. Some general code cleanup.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2489
diff
changeset
|
4457 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4458 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4459 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4460 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4461 * 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
|
4462 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4463 * 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
|
4464 * 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
|
4465 * 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
|
4466 * 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
|
4467 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4468 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
|
4469 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4470 dw_signal_connect_data(window, signame, sigfunc, NULL, data); |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4474 * 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
|
4475 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4476 * 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
|
4477 * 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
|
4478 * 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
|
4479 * 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
|
4480 * 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
|
4481 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4482 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
|
4483 { |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4484 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
|
4485 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4486 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
|
4487 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4488 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
|
4489 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4490 _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
|
4491 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4492 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4493 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4494 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4495 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4496 * 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
|
4497 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4498 * 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
|
4499 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4500 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
|
4501 { |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4502 SignalHandler *prev = NULL, *tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4503 ULONG message; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4504 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4505 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
|
4506 return; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4507 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4508 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4509 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4510 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
|
4511 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4512 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
|
4513 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4514 if(discfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4515 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4516 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
|
4517 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4518 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4519 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4520 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4521 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
|
4522 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4523 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
|
4524 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4525 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4526 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4527 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
|
4528 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4529 tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4530 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4531 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4532 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4533 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4534 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4535 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
|
4536 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4537 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4538 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4539 |
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 * 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
|
4542 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4543 * 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
|
4544 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4545 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
|
4546 { |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4547 SignalHandler *prev = NULL, *tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4548 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4549 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4550 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4551 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
|
4552 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4553 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
|
4554 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4555 if(discfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4556 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4557 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
|
4558 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4559 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4560 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4561 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4562 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
|
4563 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4564 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
|
4565 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4566 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4567 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4568 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
|
4569 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4570 tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4571 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4572 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4573 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4574 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4575 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4576 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
|
4577 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4578 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4579 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4580 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4581 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4582 * 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
|
4583 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4584 * 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
|
4585 * 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
|
4586 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4587 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
|
4588 { |
2481
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4589 SignalHandler *prev = NULL, *tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4590 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4591 while(tmp) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4592 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4593 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
|
4594 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4595 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
|
4596 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4597 if(discfunc) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4598 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4599 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
|
4600 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4601 |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4602 if(prev) |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4603 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4604 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
|
4605 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4606 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
|
4607 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4608 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4609 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4610 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
|
4611 free(tmp); |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4612 tmp = DWRoot; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4613 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4614 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4615 else |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4616 { |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4617 prev = tmp; |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4618 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
|
4619 } |
94f0d61d6953
Android: Initial commit of signal handlers, connecting buttons to the new
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2477
diff
changeset
|
4620 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4621 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4622 |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4623 void _dw_strlwr(char *buf) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4624 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4625 int z, len = strlen(buf); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4626 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4627 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
|
4628 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4629 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
|
4630 buf[z] -= 'A' - 'a'; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4631 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4632 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4633 |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4634 /* 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
|
4635 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4636 * 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
|
4637 * 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
|
4638 * 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
|
4639 */ |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4640 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
|
4641 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4642 int len; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4643 char *newname; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4644 char errorbuf[1025] = {0}; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4645 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4646 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4647 if(!handle) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4648 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4649 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4650 if((len = strlen(name)) == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4651 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4652 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4653 /* Lenth + "lib" + ".so" + NULL */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4654 newname = (char *)malloc(len + 7); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4655 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4656 if(!newname) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4657 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4658 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4659 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
|
4660 _dw_strlwr(newname); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4661 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4662 *handle = dlopen(newname, RTLD_NOW); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4663 if(*handle == NULL) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4664 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4665 strncpy(errorbuf, dlerror(), 1024); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4666 printf("%s\n", errorbuf); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4667 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
|
4668 *handle = dlopen(newname, RTLD_NOW); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4669 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4670 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4671 free(newname); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4672 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4673 return (NULL == *handle) ? -1 : 0; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4674 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4675 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4676 /* 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
|
4677 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4678 * 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
|
4679 * 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
|
4680 * 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
|
4681 * the address. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4682 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4683 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
|
4684 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4685 if(!func || !name) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4686 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4687 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4688 if(strlen(name) == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4689 return -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4690 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4691 *func = (void*)dlsym(handle, name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4692 return (NULL == *func); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4693 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4694 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4695 /* 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
|
4696 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4697 * 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
|
4698 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4699 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
|
4700 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4701 if(handle) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4702 return dlclose(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4703 return 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4704 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4705 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4706 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4707 * 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
|
4708 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4709 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
|
4710 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4711 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
|
4712 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4713 pthread_mutex_init(mutex, NULL); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4714 return mutex; |
2473
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 * 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
|
4719 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4720 * 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
|
4721 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4722 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
|
4723 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4724 if(mutex) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4725 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4726 pthread_mutex_destroy(mutex); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4727 free(mutex); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4728 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4729 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4730 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4731 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4732 * 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
|
4733 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4734 * 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
|
4735 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4736 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
|
4737 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4738 /* 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
|
4739 * 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
|
4740 * 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
|
4741 * 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
|
4742 */ |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4743 #if 0 /* TODO: Not sure how to do this on Android yet */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4744 if(_dw_thread == pthread_self()) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4745 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4746 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
|
4747 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4748 /* Process any pending events */ |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4749 if(g_main_context_pending(NULL)) |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4750 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4751 do |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4752 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4753 g_main_context_iteration(NULL, FALSE); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4754 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4755 while(g_main_context_pending(NULL)); |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4756 } |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4757 else |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4758 sched_yield(); |
2473
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 else |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4762 #endif |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4763 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4764 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
|
4765 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4766 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4767 |
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 * 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
|
4770 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4771 * 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
|
4772 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4773 * 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
|
4774 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4775 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
|
4776 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4777 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
|
4778 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4779 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
|
4780 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4781 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4782 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4783 * 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
|
4784 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4785 * 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
|
4786 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4787 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
|
4788 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4789 pthread_mutex_unlock(mutex); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4790 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4791 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4792 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4793 * 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
|
4794 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4795 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
|
4796 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4797 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
|
4798 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4799 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4800 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4801 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4802 /* 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
|
4803 * 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
|
4804 * 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
|
4805 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4806 pthread_mutex_init (&(eve->mutex), NULL); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4807 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4808 pthread_cond_init (&(eve->event), NULL); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4809 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4810 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4811 eve->alive = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4812 eve->posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4813 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4814 return eve; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4815 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4818 * 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
|
4819 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4820 * 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
|
4821 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4822 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
|
4823 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4824 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4825 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4826 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4827 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4828 pthread_cond_broadcast (&(eve->event)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4829 pthread_cond_init (&(eve->event), NULL); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4830 eve->posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4831 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4832 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
|
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 * 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
|
4837 * 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
|
4838 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4839 * 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
|
4840 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4841 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
|
4842 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4843 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4844 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4845 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4846 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4847 pthread_cond_broadcast (&(eve->event)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4848 eve->posted = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4849 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4850 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
|
4851 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4852 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4853 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4854 * 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
|
4855 * 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
|
4856 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4857 * 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
|
4858 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4859 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
|
4860 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4861 int rc; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4862 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4863 if(!eve) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4864 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4865 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4866 pthread_mutex_lock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4867 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4868 if(eve->posted) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4869 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4870 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4871 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4872 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4873 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4874 if(timeout != -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4875 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4876 struct timeval now; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4877 struct timespec timeo; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4878 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4879 gettimeofday(&now, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4880 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
|
4881 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
|
4882 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
|
4883 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4884 else |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4885 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
|
4886 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4887 pthread_mutex_unlock (&(eve->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4888 if(!rc) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4889 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4890 if(rc == ETIMEDOUT) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4891 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
|
4892 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4893 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4894 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4895 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4896 * 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
|
4897 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4898 * 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
|
4899 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4900 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
|
4901 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4902 if(!eve || !(*eve)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4903 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4904 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4905 pthread_mutex_lock (&((*eve)->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4906 pthread_cond_destroy (&((*eve)->event)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4907 pthread_mutex_unlock (&((*eve)->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4908 pthread_mutex_destroy (&((*eve)->mutex)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4909 free(*eve); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4910 *eve = NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4911 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4912 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4913 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4914 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4915 struct _dw_seminfo { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4916 int fd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4917 int waiting; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4918 }; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4919 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4920 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
|
4921 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4922 fd_set rd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4923 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
|
4924 int listenfd = tmpsock[0]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4925 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
|
4926 char command; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4927 sigset_t mask; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4928 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4929 sigfillset(&mask); /* Mask all allowed signals */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4930 pthread_sigmask(SIG_BLOCK, &mask, NULL); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4931 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4932 /* problems */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4933 if(tmpsock[1] == -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4934 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4935 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4936 return; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4937 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4938 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4939 array[0].fd = tmpsock[1]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4940 array[0].waiting = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4941 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4942 /* 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
|
4943 free(tmpsock); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4944 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4945 while(1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4946 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4947 FD_ZERO(&rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4948 FD_SET(listenfd, &rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4949 int DW_UNUSED(result); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4950 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4951 maxfd = listenfd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4952 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4953 /* 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
|
4954 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
|
4955 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4956 if(array[z].fd > maxfd) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4957 maxfd = array[z].fd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4958 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4959 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
|
4960 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4961 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4962 if(select(maxfd+1, &rd, NULL, NULL, NULL) == -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4963 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4964 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4965 return; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4966 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4967 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4968 if(FD_ISSET(listenfd, &rd)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4969 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4970 struct _dw_seminfo *newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4971 int newfd = accept(listenfd, 0, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4972 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4973 if(newfd > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4974 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4975 /* 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
|
4976 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
|
4977 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
|
4978 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4979 newarray[connectcount].fd = newfd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4980 newarray[connectcount].waiting = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4981 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4982 connectcount++; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4983 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4984 /* 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
|
4985 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4986 array = newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4987 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4988 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4989 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4990 /* 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
|
4991 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
|
4992 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4993 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
|
4994 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4995 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
|
4996 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4997 struct _dw_seminfo *newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4998 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
4999 /* 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
|
5000 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
|
5001 if(!z) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5002 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
|
5003 else |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5004 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5005 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
|
5006 if(z!=(connectcount-1)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5007 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
|
5008 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5009 connectcount--; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5010 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5011 /* 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
|
5012 free(array); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5013 array = newarray; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5014 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5015 else if(bytesread == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5016 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5017 switch(command) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5018 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5019 case 0: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5020 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5021 /* Reset */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5022 posted = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5023 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5024 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5025 case 1: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5026 /* Post */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5027 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5028 int s; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5029 char tmp = (char)0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5030 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5031 posted = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5032 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5033 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
|
5034 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5035 /* 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
|
5036 * 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
|
5037 * continue. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5038 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5039 if(array[s].waiting) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5040 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
|
5041 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5042 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5043 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5044 case 2: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5045 /* Wait */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5046 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5047 char tmp = (char)0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5048 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5049 array[z].waiting = 1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5050 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5051 /* 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
|
5052 if(posted) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5053 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
|
5054 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5055 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5056 case 3: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5057 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5058 /* Done Waiting */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5059 array[z].waiting = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5060 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5061 break; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5062 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5063 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5064 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5065 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5066 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5067 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5068 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5069 /* 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
|
5070 /* 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
|
5071 * opened from other processes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5072 * Parameters: |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5073 * 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
|
5074 * 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
|
5075 * by other processes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5076 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5077 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
|
5078 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5079 struct sockaddr_un un; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5080 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
|
5081 DWTID dwthread; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5082 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5083 if(!tmpsock) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5084 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5085 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5086 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
|
5087 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
|
5088 memset(&un, 0, sizeof(un)); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5089 un.sun_family=AF_UNIX; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5090 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
|
5091 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
|
5092 strcat(un.sun_path, name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5093 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5094 /* 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
|
5095 * to support multiple instances. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5096 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5097 remove(un.sun_path); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5098 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5099 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
|
5100 listen(tmpsock[0], 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5101 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
|
5102 tmpsock[1] = accept(tmpsock[0], 0, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5103 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5104 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
|
5105 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5106 if(tmpsock[0] > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5107 close(tmpsock[0]); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5108 if(tmpsock[1] > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5109 close(tmpsock[1]); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5110 if(ev > -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5111 close(ev); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5112 free(tmpsock); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5113 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5114 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5115 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5116 /* Create a thread to handle this event semaphore */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5117 pthread_create(&dwthread, NULL, (void *(*)(void *))_dw_handle_sem, (void *)tmpsock); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5118 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
|
5119 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5120 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5121 /* 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
|
5122 * Parameters: |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5123 * 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
|
5124 * 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
|
5125 * by other processes. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5126 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5127 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
|
5128 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5129 struct sockaddr_un un; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5130 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
|
5131 if(ev < 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5132 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5133 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5134 un.sun_family=AF_UNIX; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5135 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
|
5136 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
|
5137 strcat(un.sun_path, name); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5138 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
|
5139 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
|
5140 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5141 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5142 /* 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
|
5143 * 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
|
5144 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5145 * 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
|
5146 * 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
|
5147 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5148 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
|
5149 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5150 /* signal reset */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5151 char tmp = (char)0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5152 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5153 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
|
5154 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5155 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5156 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
|
5157 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
|
5158 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5159 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5160 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5161 /* 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
|
5162 * 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
|
5163 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5164 * 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
|
5165 * 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
|
5166 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5167 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
|
5168 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5169 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5170 /* signal post */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5171 char tmp = (char)1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5172 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5173 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
|
5174 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5175 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5176 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
|
5177 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
|
5178 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5179 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5180 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5181 /* 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
|
5182 * 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
|
5183 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5184 * 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
|
5185 * 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
|
5186 * 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
|
5187 * or -1 if indefinite. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5188 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5189 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
|
5190 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5191 fd_set rd; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5192 struct timeval tv, *useme = NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5193 int retval = 0; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5194 char tmp; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5195 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5196 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
|
5197 return DW_ERROR_NON_INIT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5198 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5199 /* Set the timout or infinite */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5200 if(timeout != -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5201 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5202 tv.tv_sec = timeout / 1000; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5203 tv.tv_usec = timeout % 1000; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5204 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5205 useme = &tv; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5206 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5207 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5208 FD_ZERO(&rd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5209 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
|
5210 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5211 /* Signal wait */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5212 tmp = (char)2; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5213 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
|
5214 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5215 if(retval == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5216 retval = select(DW_POINTER_TO_INT(eve)+1, &rd, NULL, NULL, useme); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5217 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5218 /* Signal done waiting. */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5219 tmp = (char)3; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5220 if(retval == 1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5221 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
|
5222 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5223 if(retval == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5224 return DW_ERROR_TIMEOUT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5225 else if(retval == -1) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5226 return DW_ERROR_INTERRUPT; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5227 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5228 /* 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
|
5229 * we don't loop endlessly. :) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5230 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5231 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
|
5232 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5233 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
|
5234 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5235 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5236 /* 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
|
5237 * 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
|
5238 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5239 * 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
|
5240 * 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
|
5241 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5242 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
|
5243 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5244 /* Finally close the domain socket, |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5245 * 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
|
5246 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5247 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
|
5248 return DW_ERROR_NONE; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5249 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5250 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5251 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5252 * 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
|
5253 * 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
|
5254 * 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
|
5255 * 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
|
5256 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5257 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
|
5258 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5259 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
|
5260 |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5261 _dw_jvm->AttachCurrentThread(&env, NULL); |
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5262 pthread_setspecific(_dw_env_key, env); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5263 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5264 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5265 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5266 * 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
|
5267 * 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
|
5268 * 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
|
5269 * 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
|
5270 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5271 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
|
5272 { |
2475
16d195d46f2a
Android: Implement dw_window_new(), dw_box_new() and dw_box_pack().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2474
diff
changeset
|
5273 _dw_jvm->DetachCurrentThread(); |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5274 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5275 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5276 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5277 * Setup thread independent color sets. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5278 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5279 void _dwthreadstart(void *data) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5280 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5281 void (*threadfunc)(void *) = NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5282 void **tmp = (void **)data; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5283 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5284 threadfunc = (void (*)(void *))tmp[0]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5285 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5286 /* Initialize colors */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5287 _dw_init_thread(); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5288 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5289 threadfunc(tmp[1]); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5290 free(tmp); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5291 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5292 /* Free colors */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5293 _dw_deinit_thread(); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5294 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5295 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5296 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5297 * 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
|
5298 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5299 * 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
|
5300 * 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
|
5301 * 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
|
5302 * 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
|
5303 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5304 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
|
5305 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5306 char namebuf[1025]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5307 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
|
5308 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5309 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
|
5310 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
|
5311 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5312 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
|
5313 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5314 free(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5315 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5316 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5317 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5318 if(ftruncate(handle->fd, size)) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5319 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5320 close(handle->fd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5321 free(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5322 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5323 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5324 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5325 /* attach the shared memory segment to our process's address space. */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5326 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5327 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5328 if(*dest == MAP_FAILED) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5329 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5330 close(handle->fd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5331 *dest = NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5332 free(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5333 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5334 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5335 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5336 handle->size = size; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5337 handle->sid = getsid(0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5338 handle->path = strdup(namebuf); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5339 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5340 return handle; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5341 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5342 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5343 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5344 * 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
|
5345 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5346 * 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
|
5347 * 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
|
5348 * 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
|
5349 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5350 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
|
5351 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5352 char namebuf[1025]; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5353 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
|
5354 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5355 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
|
5356 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
|
5357 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5358 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
|
5359 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5360 free(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5361 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5362 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5363 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5364 /* attach the shared memory segment to our process's address space. */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5365 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5366 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5367 if(*dest == MAP_FAILED) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5368 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5369 close(handle->fd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5370 *dest = NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5371 free(handle); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5372 return NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5373 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5374 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5375 handle->size = size; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5376 handle->sid = -1; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5377 handle->path = NULL; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5378 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5379 return handle; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5380 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5381 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5382 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5383 * 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
|
5384 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5385 * 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
|
5386 * 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
|
5387 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5388 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
|
5389 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5390 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
|
5391 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
|
5392 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5393 close(h->fd); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5394 if(h->path) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5395 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5396 /* 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
|
5397 * creator of the file. |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5398 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5399 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
|
5400 remove(h->path); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5401 free(h->path); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5402 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5403 return rc; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5404 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5405 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5406 * 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
|
5407 * Parameters: |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5408 * 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
|
5409 * 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
|
5410 * 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
|
5411 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5412 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
|
5413 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5414 DWTID dwthread; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5415 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
|
5416 int rc; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5417 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5418 tmp[0] = func; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5419 tmp[1] = data; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5420 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5421 rc = pthread_create(&dwthread, NULL, (void *(*)(void *))_dwthreadstart, (void *)tmp); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5422 if(rc == 0) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5423 return dwthread; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5424 return (DWTID)DW_ERROR_UNKNOWN; |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5425 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5426 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5427 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5428 * 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
|
5429 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5430 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
|
5431 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5432 pthread_exit(NULL); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5433 } |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5434 |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5435 /* |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5436 * 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
|
5437 */ |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5438 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
|
5439 { |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5440 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
|
5441 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5442 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5443 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5444 * 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
|
5445 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5446 * 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
|
5447 * 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
|
5448 * 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
|
5449 * 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
|
5450 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5451 * 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
|
5452 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5453 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
|
5454 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5455 JNIEnv *env; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5456 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5457 if(!_dw_app_id[0]) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5458 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5459 /* 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
|
5460 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
|
5461 } |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5462 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5463 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
|
5464 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5465 // Construct a String |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5466 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
|
5467 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
|
5468 // 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
|
5469 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
|
5470 // 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
|
5471 jmethodID dwInit = env->GetMethodID(clazz, "dwInit", |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5472 "(Ljava/lang/String;Ljava/lang/String;)V"); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5473 // Call the method on the object |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5474 env->CallVoidMethod(_dw_obj, dwInit, appid, appname); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5475 } |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5476 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
|
5477 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5478 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5479 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5480 * 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
|
5481 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5482 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
|
5483 { |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5484 JNIEnv *env; |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5485 |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5486 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
|
5487 { |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5488 // 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
|
5489 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
|
5490 // 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
|
5491 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
|
5492 "()V"); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5493 // 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
|
5494 env->CallVoidMethod(_dw_obj, dwindowsShutdown); |
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5495 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5496 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5497 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5498 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5499 * 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
|
5500 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5501 * 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
|
5502 * 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
|
5503 * 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
|
5504 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5505 * 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
|
5506 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5507 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
|
5508 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5509 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
|
5510 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5511 return ret; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5512 } |
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 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5515 * 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
|
5516 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5517 * url: Uniform resource locator. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5518 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5519 * 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
|
5520 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5521 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
|
5522 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5523 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5524 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5525 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5526 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5527 * 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
|
5528 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5529 * 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
|
5530 * 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
|
5531 * 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
|
5532 * 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
|
5533 * 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
|
5534 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5535 * A handle to the print object or NULL on failure. |
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 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
|
5538 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5539 return NULL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5540 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5541 |
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 * 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
|
5544 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5545 * 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
|
5546 * 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
|
5547 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5548 * 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
|
5549 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5550 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
|
5551 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5552 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5553 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5554 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5555 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5556 * 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
|
5557 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5558 * 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
|
5559 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5560 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
|
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5564 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5565 * 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
|
5566 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5567 * title: The short title of the notification. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5568 * imagepath: Path to an image to display or NULL if none. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5569 * description: A longer description of the notification, |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5570 * or NULL if none is necessary. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5571 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5572 * A handle to the notification which can be used to attach a "clicked" event if desired, |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5573 * or NULL if it fails or notifications are not supported by the system. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5574 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5575 * 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
|
5576 * 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
|
5577 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5578 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
|
5579 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5580 JNIEnv *env; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5581 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5582 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
|
5583 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5584 // Construct a String |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5585 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
|
5586 jstring ntitle = env->NewStringUTF(title); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5587 jstring ndesc = NULL; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5588 jstring image = NULL; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5589 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5590 if(description) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5591 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5592 va_list args; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5593 char outbuf[1025] = {0}; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5594 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5595 va_start(args, description); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5596 vsnprintf(outbuf, 1024, description, args); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5597 va_end(args); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5598 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5599 ndesc = env->NewStringUTF(outbuf); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5600 } |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5601 if(imagepath) |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5602 image = env->NewStringUTF(imagepath); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5603 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5604 // 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
|
5605 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
|
5606 // 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
|
5607 jmethodID notificationNew = env->GetMethodID(clazz, "notificationNew", |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5608 "(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
|
5609 // Call the method on the object |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5610 jobject result = env->NewWeakGlobalRef(env->CallObjectMethod(_dw_obj, notificationNew, ntitle, image, ndesc, appid)); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5611 return result; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5612 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5613 return 0; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5614 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5615 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5616 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5617 * 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
|
5618 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5619 * 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
|
5620 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5621 * 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
|
5622 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5623 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
|
5624 { |
2522
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5625 JNIEnv *env; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5626 |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5627 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
|
5628 { |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5629 // 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
|
5630 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
|
5631 // 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
|
5632 jmethodID notificationNew = env->GetMethodID(clazz, "notificationSend", |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5633 "(Landroidx/core/app/NotificationCompat$Builder;)V"); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5634 // Call the method on the object |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5635 env->CallVoidMethod(_dw_obj, notificationNew, notification); |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5636 return DW_ERROR_NONE; |
66c490aa719d
Android: Implement notifications, images on notifications incomplete.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2521
diff
changeset
|
5637 } |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5638 return DW_ERROR_UNKNOWN; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5639 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5640 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5641 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5642 * 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
|
5643 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5644 * 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
|
5645 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5646 * Wide string that needs to be freed with dw_free() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5647 * or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5648 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5649 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
|
5650 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5651 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
|
5652 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
|
5653 if(temp) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5654 mbstowcs(temp, utf8string, buflen); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5655 return temp; |
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 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5658 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5659 * 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
|
5660 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5661 * wstring: Wide source string. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5662 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5663 * UTF-8 encoded string that needs to be freed with dw_free() |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5664 * or NULL on failure. |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5665 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5666 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
|
5667 { |
2474
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5668 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
|
5669 char *temp = (char *)malloc(bufflen); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5670 if(temp) |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5671 wcstombs(temp, wstring, bufflen); |
a13e6db064f4
Android: Implement thread, semaphore, shared memory API functions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2473
diff
changeset
|
5672 return temp; |
2473
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5673 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5674 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5675 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5676 * 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
|
5677 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5678 * 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
|
5679 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5680 * 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
|
5681 * 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
|
5682 * 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
|
5683 * 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
|
5684 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5685 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
|
5686 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5687 switch(feature) |
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 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
|
5690 case DW_FEATURE_HTML_RESULT: /* Supports the DW_SIGNAL_HTML_RESULT callback */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5691 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5692 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
|
5693 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
|
5694 case DW_FEATURE_MLE_AUTO_COMPLETE: /* Supports auto completion 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
|
5695 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
|
5696 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
|
5697 return DW_FEATURE_ENABLED; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5698 default: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5699 return DW_FEATURE_UNSUPPORTED; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5700 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5701 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5702 |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5703 /* |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5704 * 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
|
5705 * Parameters: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5706 * 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
|
5707 * 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
|
5708 * Returns: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5709 * 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
|
5710 * 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
|
5711 * 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
|
5712 * Remarks: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5713 * 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
|
5714 * 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
|
5715 */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5716 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
|
5717 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5718 switch(feature) |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5719 { |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5720 /* 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
|
5721 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
|
5722 case DW_FEATURE_HTML_RESULT: /* Supports the DW_SIGNAL_HTML_RESULT callback */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5723 case DW_FEATURE_DARK_MODE: /* Supports Dark Mode user interface */ |
2494
b3e28eed0e50
Android: Fix the basics of notebook control... return actual page IDs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2493
diff
changeset
|
5724 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
|
5725 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
|
5726 case DW_FEATURE_MLE_AUTO_COMPLETE: /* Supports auto completion 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
|
5727 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
|
5728 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
|
5729 return DW_ERROR_GENERAL; |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5730 /* These features are supported and configurable */ |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5731 default: |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5732 return DW_FEATURE_UNSUPPORTED; |
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 #ifdef __cplusplus |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5737 } |
aa420e366b2b
Android: Initial skeletal commit for Android support, almost nothing implemented...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5738 #endif |