Mercurial > dwindows
annotate ios/dw.m @ 2384:32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 21 Mar 2021 22:48:28 +0000 |
parents | a410d42d9e36 |
children | a126b04b9996 |
rev | line source |
---|---|
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2 * Dynamic Windows: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3 * A GTK like implementation of the iOS GUI |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 * |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 * (C) 2011-2021 Brian Smith <brian@dbsoft.org> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 * (C) 2011-2018 Mark Hessling <mark@rexx.org> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7 * |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 * Requires 10.0 or later. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9 * clang -g -o dwtest -D__IOS__ -I. dwtest.c ios/dw.m -framework UIKit -framework WebKit -framework Foundation -framework UserNotifications |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 #import <Foundation/Foundation.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #import <UIKit/UIKit.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #import <WebKit/WebKit.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 #import <UserNotifications/UserNotifications.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
15 #include "dw.h" |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 #include <sys/utsname.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
17 #include <sys/socket.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
18 #include <sys/un.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 #include <sys/mman.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 #include <sys/time.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 #include <sys/stat.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 #include <math.h> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
24 /* Macros to handle local auto-release pools */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
25 #define DW_LOCAL_POOL_IN NSAutoreleasePool *localpool = nil; \ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
26 if(DWThread != (DWTID)-1 && pthread_self() != DWThread) \ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
27 localpool = [[NSAutoreleasePool alloc] init]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
28 #define DW_LOCAL_POOL_OUT if(localpool) [localpool drain]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
29 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
30 /* Macros to encapsulate running functions on the main thread */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
31 #define DW_FUNCTION_INIT |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
32 #define DW_FUNCTION_DEFINITION(func, rettype, ...) void _##func(NSPointerArray *_args); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
33 rettype API func(__VA_ARGS__) { \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 DW_LOCAL_POOL_IN; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 NSPointerArray *_args = [[NSPointerArray alloc] initWithOptions:NSPointerFunctionsOpaqueMemory]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 [_args addPointer:(void *)_##func]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 #define DW_FUNCTION_ADD_PARAM1(param1) [_args addPointer:(void *)¶m1]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 #define DW_FUNCTION_ADD_PARAM2(param1, param2) [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
39 [_args addPointer:(void *)¶m2]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
40 #define DW_FUNCTION_ADD_PARAM3(param1, param2, param3) [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
41 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
42 [_args addPointer:(void *)¶m3]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
43 #define DW_FUNCTION_ADD_PARAM4(param1, param2, param3, param4) [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
44 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
45 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
46 [_args addPointer:(void *)¶m4]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
47 #define DW_FUNCTION_ADD_PARAM5(param1, param2, param3, param4, param5) [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
48 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
49 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
50 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
51 [_args addPointer:(void *)¶m5]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
52 #define DW_FUNCTION_ADD_PARAM6(param1, param2, param3, param4, param5, param6) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
53 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
54 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
56 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
57 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
58 [_args addPointer:(void *)¶m6]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 #define DW_FUNCTION_ADD_PARAM7(param1, param2, param3, param4, param5, param6, param7) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
65 [_args addPointer:(void *)¶m6]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
66 [_args addPointer:(void *)¶m7]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
67 #define DW_FUNCTION_ADD_PARAM8(param1, param2, param3, param4, param5, param6, param7, param8) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 [_args addPointer:(void *)¶m6]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 [_args addPointer:(void *)¶m7]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 [_args addPointer:(void *)¶m8]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
76 #define DW_FUNCTION_ADD_PARAM9(param1, param2, param3, param4, param5, param6, param7, param8, param9) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
77 [_args addPointer:(void *)¶m1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
78 [_args addPointer:(void *)¶m2]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
79 [_args addPointer:(void *)¶m3]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
80 [_args addPointer:(void *)¶m4]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
81 [_args addPointer:(void *)¶m5]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
82 [_args addPointer:(void *)¶m6]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
83 [_args addPointer:(void *)¶m7]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
84 [_args addPointer:(void *)¶m8]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
85 [_args addPointer:(void *)¶m9]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
86 #define DW_FUNCTION_RESTORE_PARAM1(param1, vartype1) vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
87 #define DW_FUNCTION_RESTORE_PARAM2(param1, vartype1, param2, vartype2) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
88 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
89 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
90 #define DW_FUNCTION_RESTORE_PARAM3(param1, vartype1, param2, vartype2, param3, vartype3) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
91 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
92 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
93 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
94 #define DW_FUNCTION_RESTORE_PARAM4(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
95 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
96 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
97 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
98 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
99 #define DW_FUNCTION_RESTORE_PARAM5(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
100 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
101 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
102 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
103 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
104 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
105 #define DW_FUNCTION_RESTORE_PARAM6(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
106 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
107 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
108 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
109 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
110 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
111 vartype6 param6 = *((vartype6 *)[_args pointerAtIndex:6]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
112 #define DW_FUNCTION_RESTORE_PARAM7(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
113 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
114 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
115 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
116 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
117 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
118 vartype6 param6 = *((vartype6 *)[_args pointerAtIndex:6]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
119 vartype7 param7 = *((vartype7 *)[_args pointerAtIndex:7]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
120 #define DW_FUNCTION_RESTORE_PARAM8(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7, param8, vartype8) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
121 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
122 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
123 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
124 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
125 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
126 vartype6 param6 = *((vartype6 *)[_args pointerAtIndex:6]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
127 vartype7 param7 = *((vartype7 *)[_args pointerAtIndex:7]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
128 vartype8 param8 = *((vartype8 *)[_args pointerAtIndex:8]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
129 #define DW_FUNCTION_RESTORE_PARAM9(param1, vartype1, param2, vartype2, param3, vartype3, param4, vartype4, param5, vartype5, param6, vartype6, param7, vartype7, param8, vartype8, param9, vartype9) \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
130 vartype1 param1 = *((vartype1 *)[_args pointerAtIndex:1]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
131 vartype2 param2 = *((vartype2 *)[_args pointerAtIndex:2]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
132 vartype3 param3 = *((vartype3 *)[_args pointerAtIndex:3]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
133 vartype4 param4 = *((vartype4 *)[_args pointerAtIndex:4]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
134 vartype5 param5 = *((vartype5 *)[_args pointerAtIndex:5]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
135 vartype6 param6 = *((vartype6 *)[_args pointerAtIndex:6]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
136 vartype7 param7 = *((vartype7 *)[_args pointerAtIndex:7]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
137 vartype8 param8 = *((vartype8 *)[_args pointerAtIndex:8]); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
138 vartype9 param9 = *((vartype9 *)[_args pointerAtIndex:9]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
139 #define DW_FUNCTION_END } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
140 #define DW_FUNCTION_NO_RETURN(func) [DWObj safeCall:@selector(callBack:) withObject:_args]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
141 [_args release]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
142 DW_LOCAL_POOL_OUT; } \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
143 void _##func(NSPointerArray *_args) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
144 #define DW_FUNCTION_RETURN(func, rettype) [DWObj safeCall:@selector(callBack:) withObject:_args]; {\ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
145 void *tmp = [_args pointerAtIndex:[_args count]-1]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
146 rettype myreturn = *((rettype *)tmp); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
147 free(tmp); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
148 return myreturn; } \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
149 [_args release]; \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
150 DW_LOCAL_POOL_OUT; } \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
151 void _##func(NSPointerArray *_args) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
152 #define DW_FUNCTION_RETURN_THIS(_retvar) { void *_myreturn = malloc(sizeof(_retvar)); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
153 memcpy(_myreturn, (void *)&_retvar, sizeof(_retvar)); \ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
154 [_args addPointer:_myreturn]; }} |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
155 #define DW_FUNCTION_RETURN_NOTHING } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
156 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
157 unsigned long _colors[] = |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
158 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
159 0x00000000, /* 0 black */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
160 0x000000bb, /* 1 red */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
161 0x0000bb00, /* 2 green */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
162 0x0000aaaa, /* 3 yellow */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
163 0x00cc0000, /* 4 blue */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
164 0x00bb00bb, /* 5 magenta */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
165 0x00bbbb00, /* 6 cyan */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
166 0x00bbbbbb, /* 7 white */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
167 0x00777777, /* 8 grey */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
168 0x000000ff, /* 9 bright red */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
169 0x0000ff00, /* 10 bright green */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
170 0x0000eeee, /* 11 bright yellow */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
171 0x00ff0000, /* 12 bright blue */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
172 0x00ff00ff, /* 13 bright magenta */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
173 0x00eeee00, /* 14 bright cyan */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
174 0x00ffffff, /* 15 bright white */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
175 0xff000000 /* 16 default color */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
176 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
177 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
178 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
179 * List those icons that have transparency first |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
180 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
181 #define NUM_EXTS 8 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
182 char *image_exts[NUM_EXTS] = |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
183 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
184 ".png", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
185 ".ico", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
186 ".icns", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
187 ".gif", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
188 ".jpg", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
189 ".jpeg", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
190 ".tiff", |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
191 ".bmp" |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
192 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
193 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
194 char *_dw_get_image_extension(const char *filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
195 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
196 char *file = alloca(strlen(filename) + 6); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
197 int found_ext = 0,i; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
198 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
199 /* Try various extentions */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
200 for ( i = 0; i < NUM_EXTS; i++ ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
201 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
202 strcpy( file, filename ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
203 strcat( file, image_exts[i] ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
204 if ( access( file, R_OK ) == 0 ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
205 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
206 found_ext = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
207 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
208 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
209 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
210 if ( found_ext == 1 ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
211 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
212 return image_exts[i]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
213 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
214 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
215 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
216 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
217 /* Return the RGB color regardless if a predefined color was passed */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
218 unsigned long _get_color(unsigned long thiscolor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
219 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
220 if(thiscolor & DW_RGB_COLOR) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
221 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
222 return thiscolor & ~DW_RGB_COLOR; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
223 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
224 else if(thiscolor < 17) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
225 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
226 return _colors[thiscolor]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
227 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
228 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
229 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
230 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
231 /* Thread specific storage */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
232 pthread_key_t _dw_pool_key; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
233 pthread_key_t _dw_fg_color_key; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
234 pthread_key_t _dw_bg_color_key; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
235 int DWOSMajor, DWOSMinor, DWOSBuild; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
236 static char _dw_bundle_path[PATH_MAX+1] = { 0 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
237 static char _dw_app_id[_DW_APP_ID_SIZE+1]= {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
238 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
239 /* Create a default colors for a thread */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
240 void _init_colors(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
241 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
242 UIColor *fgcolor = [[UIColor grayColor] retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
243 pthread_setspecific(_dw_fg_color_key, fgcolor); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
244 pthread_setspecific(_dw_bg_color_key, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
245 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
246 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
247 typedef struct _sighandler |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
248 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
249 struct _sighandler *next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
250 ULONG message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
251 HWND window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
252 int id; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
253 void *signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
254 void *discfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
255 void *data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
256 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
257 } SignalHandler; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
258 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
259 SignalHandler *Root = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
260 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
261 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
262 /* Some internal prototypes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
263 static void _do_resize(Box *thisbox, int x, int y); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
264 void _handle_resize_events(Box *thisbox); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
265 int _remove_userdata(UserData **root, const char *varname, int all); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
266 int _dw_main_iteration(NSDate *date); |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
267 CGContextRef _dw_draw_context(UIImage *image, bool antialias); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
268 typedef id (*DWIMP)(id, SEL, ...); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
269 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
270 /* Internal function to queue a window redraw */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
271 void _dw_redraw(id window, int skip) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
272 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
273 static id lastwindow = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
274 id redraw = lastwindow; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
275 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
276 if(skip && window == nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
277 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
278 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
279 lastwindow = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
280 if(redraw != lastwindow && redraw != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
281 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
282 dw_window_redraw(redraw); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
283 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
284 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
285 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
286 SignalHandler *_get_handler(HWND window, int messageid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
287 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
288 SignalHandler *tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
289 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
290 /* Find any callbacks for this function */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
291 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
292 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
293 if(tmp->message == messageid && window == tmp->window) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
294 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
295 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
296 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
297 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
298 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
299 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
300 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
301 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
302 typedef struct |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
303 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
304 ULONG message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
305 char name[30]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
306 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
307 } SignalList; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
308 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
309 /* List of signals */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
310 #define SIGNALMAX 19 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
311 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
312 SignalList SignalTranslate[SIGNALMAX] = { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
313 { 1, DW_SIGNAL_CONFIGURE }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
314 { 2, DW_SIGNAL_KEY_PRESS }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
315 { 3, DW_SIGNAL_BUTTON_PRESS }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
316 { 4, DW_SIGNAL_BUTTON_RELEASE }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
317 { 5, DW_SIGNAL_MOTION_NOTIFY }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
318 { 6, DW_SIGNAL_DELETE }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
319 { 7, DW_SIGNAL_EXPOSE }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
320 { 8, DW_SIGNAL_CLICKED }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
321 { 9, DW_SIGNAL_ITEM_ENTER }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
322 { 10, DW_SIGNAL_ITEM_CONTEXT }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
323 { 11, DW_SIGNAL_LIST_SELECT }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
324 { 12, DW_SIGNAL_ITEM_SELECT }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
325 { 13, DW_SIGNAL_SET_FOCUS }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
326 { 14, DW_SIGNAL_VALUE_CHANGED }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
327 { 15, DW_SIGNAL_SWITCH_PAGE }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
328 { 16, DW_SIGNAL_TREE_EXPAND }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
329 { 17, DW_SIGNAL_COLUMN_CLICK }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
330 { 18, DW_SIGNAL_HTML_RESULT }, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
331 { 19, DW_SIGNAL_HTML_CHANGED } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
332 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
333 |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
334 int _event_handler1(id object, UIEvent *event, int message) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
335 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
336 SignalHandler *handler = _get_handler(object, message); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
337 /* NSLog(@"Event handler - type %d\n", message); */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
338 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
339 if(handler) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
340 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
341 switch(message) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
342 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
343 /* Timer event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
344 case 0: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
345 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
346 int (* API timerfunc)(void *) = (int (* API)(void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
347 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
348 if(!timerfunc(handler->data)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
349 dw_timer_disconnect(handler->id); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
350 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
351 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
352 /* Configure/Resize event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
353 case 1: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
354 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
355 int (*sizefunc)(HWND, int, int, void *) = handler->signalfunction; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
356 CGSize size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
357 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
358 if([object isKindOfClass:[UIWindow class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
359 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
360 UIWindow *window = object; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
361 size = [window frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
362 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
363 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
364 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
365 UIView *view = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
366 size = [view frame].size; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
367 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
368 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
369 if(size.width > 0 && size.height > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
370 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
371 return sizefunc(object, size.width, size.height, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
372 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
373 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
374 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
375 case 2: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
376 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
377 int (*keypressfunc)(HWND, char, int, int, void *, char *) = handler->signalfunction; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
378 NSString *nchar = @""; /* [event charactersIgnoringModifiers]; */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
379 unichar vk = [nchar characterAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
380 char *utf8 = NULL, ch = '\0'; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
381 int special = 0; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
382 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
383 if(@available(iOS 13.4, *)) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
384 { |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
385 special = (int)[event modifierFlags]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
386 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
387 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
388 /* Handle a valid key */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
389 if([nchar length] == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
390 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
391 char *tmp = (char *)[nchar UTF8String]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
392 if(tmp && strlen(tmp) == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
393 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
394 ch = tmp[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
395 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
396 utf8 = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
397 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
398 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
399 return keypressfunc(handler->window, ch, (int)vk, special, handler->data, utf8); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
400 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
401 /* Button press and release event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
402 case 3: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
403 case 4: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
404 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
405 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
406 int button = 1; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
407 CGPoint p = {0}; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
408 |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
409 if([event isMemberOfClass:[UIEvent class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
410 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
411 UITouch *touch = [[event allTouches] anyObject]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
412 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
413 p = [touch locationInView:[touch view]]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
414 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
415 if(@available(ios 13.4, *)) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
416 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
417 if([event buttonMask] & UIEventButtonMaskSecondary) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
418 button = 2; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
419 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
420 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
421 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
422 return buttonfunc(object, (int)p.x, (int)p.y, button, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
423 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
424 /* Motion notify event */ |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
425 #if 0 /* Not sure if motion notify applies */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
426 case 5: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
427 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
428 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
429 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
430 return motionfunc(object, (int)p.x, (int)p.y, (int)buttonmask, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
431 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
432 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
433 /* Window close event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
434 case 6: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
435 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
436 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
437 return closefunc(object, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
438 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
439 /* Window expose/draw event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
440 case 7: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
441 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
442 DWExpose exp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
443 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))handler->signalfunction; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
444 CGRect rect = [object frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
445 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
446 exp.x = rect.origin.x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
447 exp.y = rect.origin.y; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
448 exp.width = rect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
449 exp.height = rect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
450 int result = exposefunc(object, &exp, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
451 return result; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
452 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
453 /* Clicked event for buttons and menu items */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
454 case 8: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
455 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
456 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
457 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
458 return clickfunc(object, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
459 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
460 /* Container class selection event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
461 case 9: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
462 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
463 int (*containerselectfunc)(HWND, char *, void *, void *) = handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
464 void **params = (void **)event; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
465 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
466 return containerselectfunc(handler->window, params[0], handler->data, params[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
467 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
468 /* Container context menu event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
469 case 10: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
470 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
471 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
472 char *text = (char *)event; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
473 void *user = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
474 LONG x,y; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
475 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
476 dw_pointer_query_pos(&x, &y); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
477 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
478 return containercontextfunc(handler->window, text, (int)x, (int)y, handler->data, user); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
479 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
480 /* Generic selection changed event for several classes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
481 case 11: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
482 case 14: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
483 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
484 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
485 int selected = DW_POINTER_TO_INT(event); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
486 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
487 return valuechangedfunc(handler->window, selected, handler->data);; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
488 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
489 /* Set Focus event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
490 case 13: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
491 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
492 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
493 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
494 return setfocusfunc(handler->window, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
495 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
496 /* Notebook page change event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
497 case 15: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
498 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
499 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
500 int pageid = DW_POINTER_TO_INT(event); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
501 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
502 return switchpagefunc(handler->window, pageid, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
503 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
504 /* Tree expand event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
505 case 16: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
506 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
507 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
508 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
509 return treeexpandfunc(handler->window, (HTREEITEM)event, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
510 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
511 /* Column click event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
512 case 17: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
513 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
514 int (* API clickcolumnfunc)(HWND, int, void *) = handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
515 int column_num = DW_POINTER_TO_INT(event); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
516 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
517 return clickcolumnfunc(handler->window, column_num, handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
518 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
519 /* HTML result event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
520 case 18: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
521 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
522 int (* API htmlresultfunc)(HWND, int, char *, void *, void *) = handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
523 void **params = (void **)event; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
524 NSString *result = params[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
525 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
526 return htmlresultfunc(handler->window, [result length] ? DW_ERROR_NONE : DW_ERROR_UNKNOWN, [result length] ? (char *)[result UTF8String] : NULL, params[1], handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
527 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
528 /* HTML changed event */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
529 case 19: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
530 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
531 int (* API htmlchangedfunc)(HWND, int, char *, void *) = handler->signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
532 void **params = (void **)event; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
533 NSString *uri = params[1]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
534 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
535 return htmlchangedfunc(handler->window, DW_POINTER_TO_INT(params[0]), (char *)[uri UTF8String], handler->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
536 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
537 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
538 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
539 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
540 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
541 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
542 /* Sub function to handle redraws */ |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
543 int _event_handler(id object, UIEvent *event, int message) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
544 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
545 int ret = _event_handler1(object, event, message); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
546 if(ret != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
547 _dw_redraw(nil, FALSE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
548 return ret; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
549 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
550 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
551 /* Subclass for the Timer type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
552 @interface DWTimerHandler : NSObject { } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
553 -(void)runTimer:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
554 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
555 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
556 @implementation DWTimerHandler |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
557 -(void)runTimer:(id)sender { _event_handler(sender, nil, 0); } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
558 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
559 |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
560 UIApplication *DWApp = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
561 UIFont *DWDefaultFont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
562 DWTimerHandler *DWHandler; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
563 NSAutoreleasePool *pool; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
564 NSMutableArray *_DWDirtyDrawables; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
565 DWTID DWThread = (DWTID)-1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
566 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
567 /* Used for doing bitblts from the main thread */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
568 typedef struct _bitbltinfo |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
569 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
570 id src; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
571 id dest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
572 int xdest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
573 int ydest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
574 int width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
575 int height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
576 int xsrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
577 int ysrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
578 int srcwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
579 int srcheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
580 } DWBitBlt; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
581 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
582 /* Subclass for a test object type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
583 @interface DWObject : NSObject {} |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
584 -(void)uselessThread:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
585 -(void)menuHandler:(id)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
586 -(void)doBitBlt:(id)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
587 -(void)doFlush:(id)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
588 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
589 |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
590 API_AVAILABLE(ios(13.0)) |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
591 @interface DWMenuItem : UICommand |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
592 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
593 int check; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
594 unsigned long tag; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
595 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
596 -(void)setCheck:(int)input; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
597 -(void)setTag:(unsigned long)input; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
598 -(int)check; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
599 -(unsigned long)tag; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
600 -(void)dealloc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
601 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
602 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
603 API_AVAILABLE(ios(13.0)) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
604 @interface DWMenu : NSObject |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
605 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
606 UIMenu *menu; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
607 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
608 -(void)setMenu:(UIMenu *)input; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
609 -(UIMenu *)menu; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
610 -(DWMenuItem *)itemWithTag:(unsigned long)tag; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
611 -(void)dealloc; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
612 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
613 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
614 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
615 /* So basically to implement our event handlers... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
616 * it looks like we are going to have to subclass |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
617 * basically everything. Was hoping to add methods |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
618 * to the superclasses but it looks like you can |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
619 * only add methods and no variables, which isn't |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
620 * going to work. -Brian |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
621 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
622 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
623 /* Subclass for a box type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
624 @interface DWBox : UIView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
625 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
626 Box *box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
627 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
628 UIColor *bgcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
629 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
630 -(id)init; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
631 -(void)dealloc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
632 -(Box *)box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
633 -(id)contentView; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
634 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
635 -(void)setUserdata:(void *)input; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
636 -(void)drawRect:(CGRect)rect; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
637 -(BOOL)isFlipped; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
638 -(void)mouseDown:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
639 -(void)mouseUp:(UIEvent *)theEvent; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
640 -(DWMenu *)menuForEvent:(UIEvent *)theEvent; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
641 -(void)rightMouseUp:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
642 -(void)otherMouseDown:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
643 -(void)otherMouseUp:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
644 -(void)keyDown:(UIEvent *)theEvent; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
645 -(void)setColor:(unsigned long)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
646 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
647 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
648 @implementation DWBox |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
649 -(id)init |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
650 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
651 self = [super init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
652 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
653 if (self) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
654 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
655 box = calloc(1, sizeof(Box)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
656 box->type = DW_VERT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
657 box->vsize = box->hsize = SIZEEXPAND; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
658 box->width = box->height = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
659 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
660 return self; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
661 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
662 -(void)dealloc |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
663 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
664 UserData *root = userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
665 if(box->items) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
666 free(box->items); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
667 free(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
668 _remove_userdata(&root, NULL, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
669 dw_signal_disconnect_by_window(self); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
670 [super dealloc]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
671 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
672 -(Box *)box { return box; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
673 -(id)contentView { return self; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
674 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
675 -(void)setUserdata:(void *)input { userdata = input; } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
676 -(void)drawRect:(CGRect)rect |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
677 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
678 if(bgcolor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
679 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
680 [bgcolor set]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
681 UIRectFill([self bounds]); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
682 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
683 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
684 -(BOOL)isFlipped { return YES; } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
685 -(void)mouseDown:(UIEvent *)theEvent { _event_handler(self, (void *)1, 3); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
686 -(void)mouseUp:(UIEvent *)theEvent { _event_handler(self, (void *)1, 4); } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
687 -(DWMenu *)menuForEvent:(UIEvent *)theEvent { _event_handler(self, (void *)2, 3); return nil; } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
688 -(void)rightMouseUp:(UIEvent *)theEvent { _event_handler(self, (void *)2, 4); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
689 -(void)otherMouseDown:(UIEvent *)theEvent { _event_handler(self, (void *)3, 3); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
690 -(void)otherMouseUp:(UIEvent *)theEvent { _event_handler(self, (void *)3, 4); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
691 -(void)keyDown:(UIEvent *)theEvent { _event_handler(self, theEvent, 2); } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
692 -(void)setColor:(unsigned long)input |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
693 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
694 id orig = bgcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
695 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
696 if(input == _colors[DW_CLR_DEFAULT]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
697 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
698 bgcolor = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
699 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
700 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
701 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
702 bgcolor = [[UIColor colorWithRed: DW_RED_VALUE(input)/255.0 green: DW_GREEN_VALUE(input)/255.0 blue: DW_BLUE_VALUE(input)/255.0 alpha: 1] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
703 if(UIGraphicsGetCurrentContext()) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
704 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
705 [bgcolor set]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
706 UIRectFill([self bounds]); |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
707 } |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
708 } |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
709 [self setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
710 [orig release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
711 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
712 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
713 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
714 @interface DWWindow : UIWindow |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
715 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
716 int redraw; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
717 int shown; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
718 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
719 -(void)sendEvent:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
720 -(void)keyDown:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
721 -(void)mouseDragged:(UIEvent *)theEvent; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
722 -(int)redraw; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
723 -(void)setRedraw:(int)val; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
724 -(int)shown; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
725 -(void)setShown:(int)val; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
726 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
727 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
728 @implementation DWWindow |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
729 -(void)sendEvent:(UIEvent *)theEvent |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
730 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
731 int rcode = -1; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
732 if([theEvent type] == UIEventTypePresses) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
733 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
734 rcode = _event_handler(self, theEvent, 2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
735 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
736 if ( rcode != TRUE ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
737 [super sendEvent:theEvent]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
738 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
739 -(void)keyDown:(UIEvent *)theEvent { } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
740 -(void)mouseDragged:(UIEvent *)theEvent { _event_handler(self, theEvent, 5); } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
741 -(int)redraw { return redraw; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
742 -(void)setRedraw:(int)val { redraw = val; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
743 -(int)shown { return shown; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
744 -(void)setShown:(int)val { shown = val; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
745 -(void)dealloc { dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
746 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
747 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
748 /* Subclass for a render area type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
749 @interface DWRender : UIControl |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
750 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
751 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
752 UIFont *font; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
753 CGSize size; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
754 UIImage *cachedDrawingRep; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
755 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
756 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
757 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
758 -(void)setFont:(UIFont *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
759 -(UIFont *)font; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
760 -(void)setSize:(CGSize)input; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
761 -(CGSize)size; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
762 -(UIImage *)cachedDrawingRep; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
763 -(void)mouseDown:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
764 -(void)mouseUp:(UIEvent *)theEvent; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
765 -(DWMenu *)menuForEvent:(UIEvent *)theEvent; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
766 -(void)rightMouseUp:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
767 -(void)otherMouseDown:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
768 -(void)otherMouseUp:(UIEvent *)theEvent; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
769 -(void)drawRect:(CGRect)rect; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
770 -(void)keyDown:(UIEvent *)theEvent; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
771 -(BOOL)isFlipped; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
772 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
773 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
774 @implementation DWRender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
775 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
776 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
777 -(void)setFont:(UIFont *)input { [font release]; font = input; [font retain]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
778 -(UIFont *)font { return font; } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
779 -(void)setSize:(CGSize)input { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
780 size = input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
781 if(cachedDrawingRep) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
782 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
783 UIImage *oldrep = cachedDrawingRep; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
784 UIGraphicsBeginImageContext(self.frame.size); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
785 [[self layer] renderInContext:UIGraphicsGetCurrentContext()]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
786 cachedDrawingRep = UIGraphicsGetImageFromCurrentImageContext(); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
787 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
788 [cachedDrawingRep retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
789 [oldrep release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
790 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
791 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
792 -(CGSize)size { return size; } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
793 -(UIImage *)cachedDrawingRep { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
794 if(!cachedDrawingRep) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
795 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
796 UIGraphicsBeginImageContext(self.frame.size); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
797 [[self layer] renderInContext:UIGraphicsGetCurrentContext()]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
798 cachedDrawingRep = UIGraphicsGetImageFromCurrentImageContext(); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
799 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
800 [cachedDrawingRep retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
801 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
802 /* Mark this render dirty if something is requesting it to draw */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
803 if(![_DWDirtyDrawables containsObject:self]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
804 [_DWDirtyDrawables addObject:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
805 return cachedDrawingRep; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
806 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
807 -(void)mouseDown:(UIEvent *)theEvent |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
808 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
809 if(![theEvent isMemberOfClass:[UIEvent class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
810 _event_handler(self, theEvent, 3); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
811 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
812 -(void)mouseUp:(UIEvent *)theEvent { _event_handler(self, theEvent, 4); } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
813 -(DWMenu *)menuForEvent:(UIEvent *)theEvent { _event_handler(self, theEvent, 3); return nil; } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
814 -(void)rightMouseUp:(UIEvent *)theEvent { _event_handler(self, theEvent, 4); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
815 -(void)otherMouseDown:(UIEvent *)theEvent { _event_handler(self, theEvent, 3); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
816 -(void)otherMouseUp:(UIEvent *)theEvent { _event_handler(self, theEvent, 4); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
817 -(void)mouseDragged:(UIEvent *)theEvent { _event_handler(self, theEvent, 5); } |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
818 -(void)drawRect:(CGRect)rect { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
819 _event_handler(self, nil, 7); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
820 if (cachedDrawingRep) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
821 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
822 [cachedDrawingRep drawInRect:self.bounds]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
823 [_DWDirtyDrawables removeObject:self]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
824 [self setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
825 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
826 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
827 -(void)keyDown:(UIEvent *)theEvent { _event_handler(self, theEvent, 2); } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
828 -(BOOL)isFlipped { return YES; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
829 -(void)dealloc { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
830 UserData *root = userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
831 _remove_userdata(&root, NULL, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
832 [font release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
833 dw_signal_disconnect_by_window(self); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
834 [cachedDrawingRep release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
835 [_DWDirtyDrawables removeObject:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
836 [super dealloc]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
837 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
838 -(BOOL)acceptsFirstResponder { return YES; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
839 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
840 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
841 @implementation DWObject |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
842 -(void)uselessThread:(id)sender { /* Thread only to initialize threading */ } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
843 -(void)menuHandler:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
844 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
845 _event_handler(param, nil, 8); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
846 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
847 -(void)callBack:(NSPointerArray *)params |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
848 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
849 void (*mycallback)(NSPointerArray *) = [params pointerAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
850 if(mycallback) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
851 mycallback(params); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
852 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
853 -(void)messageBox:(NSMutableArray *)params |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
854 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
855 __block NSInteger iResponse = 0; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
856 UIAlertController* alert = [UIAlertController alertControllerWithTitle:[params objectAtIndex:0] |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
857 message:[params objectAtIndex:1] |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
858 preferredStyle:[[params objectAtIndex:2] integerValue]]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
859 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
860 UIAlertAction* action = [UIAlertAction actionWithTitle:[params objectAtIndex:3] style:UIAlertActionStyleDefault |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
861 handler:^(UIAlertAction * action) { iResponse = 1; }]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
862 [alert addAction:action]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
863 if([params count] > 4) |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
864 action = [UIAlertAction actionWithTitle:[params objectAtIndex:4] style:UIAlertActionStyleDefault |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
865 handler:^(UIAlertAction * action) { iResponse = 2; }]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
866 if([params count] > 5) |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
867 action = [UIAlertAction actionWithTitle:[params objectAtIndex:5] style:UIAlertActionStyleDefault |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
868 handler:^(UIAlertAction * action) { iResponse = 3; }]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
869 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
870 [alert presentViewController:alert animated:YES completion:nil]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
871 [alert release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
872 [params addObject:[NSNumber numberWithInteger:iResponse]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
873 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
874 -(void)safeCall:(SEL)sel withObject:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
875 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
876 if([self respondsToSelector:sel]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
877 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
878 DWTID curr = pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
879 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
880 if(DWThread == (DWTID)-1 || DWThread == curr) |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
881 [self performSelector:sel withObject:param]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
882 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
883 [self performSelectorOnMainThread:sel withObject:param waitUntilDone:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
884 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
885 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
886 -(void)doBitBlt:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
887 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
888 NSValue *bi = (NSValue *)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
889 DWBitBlt *bltinfo = (DWBitBlt *)[bi pointerValue]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
890 id bltdest = bltinfo->dest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
891 id bltsrc = bltinfo->src; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
892 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
893 if([bltdest isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
894 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
895 DWRender *render = bltdest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
896 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
897 bltdest = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
898 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
899 if([bltdest isMemberOfClass:[UIImage class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
900 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
901 _dw_draw_context(bltdest, NO); |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
902 } |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
903 if(bltdest && [bltsrc isMemberOfClass:[UIImage class]]) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
904 { |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
905 UIImage *rep = bltsrc; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
906 UIImage *image = [[UIImage alloc] initWithCGImage:[rep CGImage]]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
907 CGBlendMode op = kCGBlendModeNormal; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
908 |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
909 if(bltinfo->srcwidth != -1) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
910 { |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
911 [image drawInRect:CGRectMake(bltinfo->xdest, bltinfo->ydest, bltinfo->width, bltinfo->height) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
912 /*fromRect:CGRectMake(bltinfo->xsrc, bltinfo->ysrc, bltinfo->srcwidth, bltinfo->srcheight)*/ |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
913 blendMode:op alpha:1.0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
914 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
915 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
916 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
917 [image drawAtPoint:CGPointMake(bltinfo->xdest, bltinfo->ydest) |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
918 /*fromRect:CGRectMake(bltinfo->xsrc, bltinfo->ysrc, bltinfo->width, bltinfo->height)*/ |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
919 blendMode:op alpha:1.0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
920 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
921 [bltsrc release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
922 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
923 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
924 if([bltdest isMemberOfClass:[UIImage class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
925 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
926 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
927 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
928 free(bltinfo); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
929 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
930 -(void)doFlush:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
931 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
932 NSEnumerator *enumerator = [_DWDirtyDrawables objectEnumerator]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
933 DWRender *rend; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
934 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
935 while (rend = [enumerator nextObject]) |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
936 [rend setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
937 [_DWDirtyDrawables removeAllObjects]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
938 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
939 -(void)doWindowFunc:(id)param |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
940 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
941 NSValue *v = (NSValue *)param; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
942 void **params = (void **)[v pointerValue]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
943 void (* windowfunc)(void *); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
944 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
945 if(params) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
946 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
947 windowfunc = params[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
948 if(windowfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
949 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
950 windowfunc(params[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
951 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
952 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
953 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
954 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
955 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
956 DWObject *DWObj; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
957 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
958 @interface DWWebView : WKWebView <WKNavigationDelegate> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
959 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
960 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
961 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
962 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
963 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
964 -(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
965 -(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
966 -(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
967 -(void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
968 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
969 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
970 @implementation DWWebView : WKWebView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
971 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
972 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
973 -(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
974 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
975 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_STARTED), [[self URL] absoluteString] }; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
976 _event_handler(self, (UIEvent *)params, 19); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
977 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
978 -(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
979 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
980 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_COMPLETE), [[self URL] absoluteString] }; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
981 _event_handler(self, (UIEvent *)params, 19); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
982 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
983 -(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
984 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
985 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_LOADING), [[self URL] absoluteString] }; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
986 _event_handler(self, (UIEvent *)params, 19); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
987 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
988 -(void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
989 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
990 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_REDIRECT), [[self URL] absoluteString] }; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
991 _event_handler(self, (UIEvent *)params, 19); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
992 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
993 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
994 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
995 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
996 /* Subclass for a top-level window */ |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
997 @interface DWView : DWBox /* <UIWindowDelegate> */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
998 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
999 DWMenu *windowmenu; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1000 CGSize oldsize; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1001 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1002 -(BOOL)windowShouldClose:(id)sender; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1003 -(void)setMenu:(DWMenu *)input; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1004 -(void)windowDidBecomeMain:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1005 -(void)menuHandler:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1006 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1007 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1008 @implementation DWView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1009 -(BOOL)windowShouldClose:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1010 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1011 if(_event_handler(sender, nil, 6) > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1012 return NO; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1013 return YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1014 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1015 -(void)viewDidMoveToWindow |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1016 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1017 #if 0 /* TODO */ |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1018 [[UINotificationCenter defaultCenter] addObserver:self selector:@selector(windowResized:) name:UIWindowDidResizeNotification object:[self window]]; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
1019 [[UINotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:UIWindowDidBecomeMainNotification object:[self window]]; |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1020 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1021 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1022 -(void)dealloc |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1023 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1024 if(windowmenu) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1025 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1026 [windowmenu release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1027 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1028 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1029 dw_signal_disconnect_by_window(self); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1030 [super dealloc]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1031 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1032 -(void)windowResized:(NSNotification *)notification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1033 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1034 CGSize size = [self frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1035 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1036 if(oldsize.width != size.width || oldsize.height != size.height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1037 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1038 _do_resize(box, size.width, size.height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1039 _event_handler([self window], nil, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1040 oldsize.width = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1041 oldsize.height = size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1042 _handle_resize_events(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1043 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1044 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1045 -(void)showWindow |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1046 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1047 CGSize size = [self frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1048 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1049 if(oldsize.width == size.width && oldsize.height == size.height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1050 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1051 _do_resize(box, size.width, size.height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1052 _handle_resize_events(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1053 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1054 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1055 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1056 -(void)windowDidBecomeMain:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1057 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1058 _event_handler([self window], nil, 13); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1059 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1060 -(void)setMenu:(DWMenu *)input { windowmenu = input; [windowmenu retain]; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1061 -(void)menuHandler:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1062 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1063 [DWObj menuHandler:sender]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1064 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1065 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1066 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1067 /* Subclass for a button type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1068 @interface DWButton : UIButton |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1069 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1070 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1071 UIButtonType buttonType; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1072 DWBox *parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1073 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1074 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1075 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1076 -(void)buttonClicked:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1077 -(UIButtonType)buttonType; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1078 -(void)setParent:(DWBox *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1079 -(DWBox *)parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1080 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1081 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1082 @implementation DWButton |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1083 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1084 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1085 -(void)buttonClicked:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1086 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1087 _event_handler(self, nil, 8); |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1088 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1089 -(UIButtonType)buttonType { return buttonType; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1090 -(void)setParent:(DWBox *)input { parent = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1091 -(DWBox *)parent { return parent; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1092 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1093 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1094 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1095 /* Subclass for a progress type */ |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1096 @interface DWPercent : UIProgressView |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1097 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1098 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1099 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1100 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1101 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1102 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1103 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1104 @implementation DWPercent |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1105 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1106 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1107 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1108 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1109 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1110 /* Subclass for a menu item type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1111 @implementation DWMenuItem |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1112 -(void)setCheck:(int)input { check = input; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1113 -(void)setTag:(unsigned long)input { tag = input; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1114 -(int)check { return check; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1115 -(unsigned long)tag { return tag; } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1116 -(void)dealloc { dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1117 @end |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1118 /* |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1119 * Encapsulate immutable objects in our own containers, |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1120 * so we can recreate the immutable subobjects as needed. |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1121 * Currently in this category: DWMenu and DWImage |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1122 */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1123 @implementation DWMenu |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1124 -(void)setMenu:(UIMenu *)input { menu = input; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1125 -(UIMenu *)menu { return menu; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1126 -(DWMenuItem *)itemWithTag:(unsigned long)tag |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1127 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1128 NSArray *children = [menu children]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1129 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1130 for(DWMenuItem *menuitem in children) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1131 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1132 if([menuitem tag] == tag) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1133 return menuitem; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1134 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1135 return nil; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1136 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1137 -(void)dealloc { [super dealloc]; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1138 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1139 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1140 @interface DWImage : NSObject |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1141 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1142 UIImage *image; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1143 CGImageRef cgimage; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1144 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1145 -(void)setImage:(UIImage *)input; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1146 -(void)setCGImage:(CGImageRef)input; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1147 -(UIImage *)image; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1148 -(CGImageRef)cgimage; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1149 -(void)dealloc; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1150 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1151 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1152 @implementation DWImage |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1153 -(void)setImage:(UIImage *)input { image = input; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1154 -(void)setCGImage:(CGImageRef)input { cgimage = input; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1155 -(UIImage *)image { return image; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1156 -(CGImageRef)cgimage { return cgimage; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1157 -(void)dealloc { if(cgimage) CGImageRelease(cgimage); if(image) [image release]; [super dealloc]; } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1158 @end |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1159 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1160 /* Subclass for a scrollbox type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1161 @interface DWScrollBox : UIScrollView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1162 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1163 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1164 id box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1165 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1166 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1167 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1168 -(void)setBox:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1169 -(id)box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1170 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1171 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1172 @implementation DWScrollBox |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1173 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1174 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1175 -(void)setBox:(void *)input { box = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1176 -(id)box { return box; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1177 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1178 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1179 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1180 @interface DWEntryFieldFormatter : NSFormatter |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1181 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1182 int maxLength; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1183 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1184 - (void)setMaximumLength:(int)len; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1185 - (int)maximumLength; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1186 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1187 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1188 /* This formatter subclass will allow us to limit |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1189 * the text length in an entryfield. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1190 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1191 @implementation DWEntryFieldFormatter |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1192 -(id)init |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1193 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1194 self = [super init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1195 maxLength = INT_MAX; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1196 return self; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1197 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1198 -(void)setMaximumLength:(int)len { maxLength = len; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1199 -(int)maximumLength { return maxLength; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1200 -(NSString *)stringForObjectValue:(id)object { return (NSString *)object; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1201 -(BOOL)getObjectValue:(id *)object forString:(NSString *)string errorDescription:(NSString **)error { *object = string; return YES; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1202 -(BOOL)isPartialStringValid:(NSString **)partialStringPtr |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1203 proposedSelectedRange:(NSRangePointer)proposedSelRangePtr |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1204 originalString:(NSString *)origString |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1205 originalSelectedRange:(NSRange)origSelRange |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1206 errorDescription:(NSString **)error |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1207 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1208 if([*partialStringPtr length] > maxLength) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1209 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1210 return NO; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1211 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1212 return YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1213 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1214 -(NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attributes { return nil; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1215 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1216 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1217 /* Subclass for a entryfield type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1218 @interface DWEntryField : UITextField |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1219 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1220 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1221 id clickDefault; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1222 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1223 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1224 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1225 -(void)setClickDefault:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1226 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1227 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1228 @implementation DWEntryField |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1229 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1230 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1231 -(void)setClickDefault:(id)input { clickDefault = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1232 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1233 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1234 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1235 /* Subclass for a text and status text type */ |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1236 @interface DWText : UILabel |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1237 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1238 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1239 id clickDefault; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1240 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1241 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1242 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1243 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1244 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1245 @implementation DWText |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1246 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1247 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1248 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1249 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1250 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1251 /* Subclass for a Notebook page type */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
1252 @interface DWNotebookPage : UIView |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1253 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1254 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1255 int pageid; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1256 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1257 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1258 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1259 -(int)pageid; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1260 -(void)setPageid:(int)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1261 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1262 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1263 /* Subclass for a Notebook control type */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1264 @interface DWNotebook : UISegmentedControl |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1265 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1266 void *userdata; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1267 int pageid; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1268 NSMutableArray<DWNotebookPage *> *views; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1269 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1270 -(void *)userdata; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1271 -(void)setUserdata:(void *)input; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1272 -(int)pageid; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1273 -(void)setPageid:(int)input; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1274 -(NSMutableArray<DWNotebookPage *> *)views; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1275 -(void)pageChanged:(id)sender; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1276 @end |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1277 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1278 @implementation DWNotebook |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1279 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1280 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1281 -(int)pageid { return pageid; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1282 -(void)setPageid:(int)input { pageid = input; } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1283 -(NSMutableArray<DWNotebookPage *> *)views { return views; }; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
1284 -(void)pageChanged:(id)sender |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1285 { |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1286 #if 0 /* TODO: Implement page/segment changed handler */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1287 id object = [notepage view]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1288 DWNotebookPage *page = (DWNotebookPage *)notepage; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1289 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1290 if([object isMemberOfClass:[DWBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1291 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1292 DWBox *view = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1293 Box *box = [view box]; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1294 CGSize size = [view frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1295 _do_resize(box, size.width, size.height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1296 _handle_resize_events(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1297 } |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1298 #endif |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
1299 _event_handler(self, DW_INT_TO_POINTER([self selectedSegmentIndex]), 15); |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1300 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1301 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1302 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1303 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1304 @implementation DWNotebookPage |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1305 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1306 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1307 -(int)pageid { return pageid; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1308 -(void)setPageid:(int)input { pageid = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1309 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1310 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1311 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1312 /* Subclass for a splitbar type */ |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1313 @interface DWSplitBar : UISplitViewController <UISplitViewControllerDelegate> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1314 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1315 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1316 float percent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1317 NSInteger Tag; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1318 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1319 -(void)splitViewDidResizeSubviews:(NSNotification *)aNotification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1320 -(void)setTag:(NSInteger)tag; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1321 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1322 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1323 -(float)percent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1324 -(void)setPercent:(float)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1325 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1326 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1327 @implementation DWSplitBar |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1328 -(void)splitViewDidResizeSubviews:(NSNotification *)aNotification |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1329 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1330 NSArray *views = [self.view subviews]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1331 id object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1332 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1333 for(object in views) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1334 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1335 if([object isMemberOfClass:[DWBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1336 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1337 DWBox *view = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1338 Box *box = [view box]; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1339 CGSize size = [view frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1340 _do_resize(box, size.width, size.height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1341 _handle_resize_events(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1342 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1343 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1344 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1345 -(void)setTag:(NSInteger)tag { Tag = tag; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1346 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1347 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1348 -(float)percent { return percent; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1349 -(void)setPercent:(float)input { percent = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1350 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1351 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1352 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1353 /* Subclass for a slider type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1354 @interface DWSlider : UISlider |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1355 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1356 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1357 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1358 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1359 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1360 -(void)sliderChanged:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1361 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1362 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1363 @implementation DWSlider |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1364 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1365 -(void)setUserdata:(void *)input { userdata = input; } |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1366 -(void)sliderChanged:(id)sender { int intVal = (int)[self value]; _event_handler(self, DW_INT_TO_POINTER(intVal), 14); } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1367 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1368 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1369 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1370 /* Subclass for a MLE type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1371 @interface DWMLE : UITextView |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1372 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1373 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1374 id scrollview; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1375 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1376 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1377 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1378 -(id)scrollview; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1379 -(void)setScrollview:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1380 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1381 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1382 @implementation DWMLE |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1383 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1384 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1385 -(id)scrollview { return scrollview; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1386 -(void)setScrollview:(id)input { scrollview = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1387 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1388 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1389 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1390 /* TODO: UITableView does not support variable columns... |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1391 * also OutlineView does not exist in iOS. |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1392 */ |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1393 UITableViewCell *_dw_table_cell_view_new(UIImage *icon, NSString *text) |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1394 { |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
1395 UITableViewCell *browsercell = [[[UITableViewCell alloc] init] autorelease]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1396 [browsercell setAutoresizesSubviews:YES]; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1397 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1398 if(icon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1399 { |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1400 if(@available(iOS 14.0, *)) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1401 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1402 UIListContentConfiguration *content = [browsercell defaultContentConfiguration]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1403 |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1404 [content setImage:icon]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1405 } |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1406 else |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1407 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1408 [browsercell setImage:icon]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1409 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1410 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1411 if(text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1412 { |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1413 if(@available(iOS 14.0, *)) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1414 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1415 UIListContentConfiguration *content = [browsercell defaultContentConfiguration]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1416 |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1417 [content setText:text]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1418 } |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1419 else |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1420 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1421 [browsercell setText:text]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1422 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1423 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1424 return browsercell; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1425 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1426 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1427 /* Subclass for a Container/List type */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1428 @interface DWContainer : UITableView <UITableViewDataSource,UITableViewDelegate> |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1429 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1430 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1431 NSMutableArray *tvcols; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1432 NSMutableArray *data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1433 NSMutableArray *types; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1434 NSPointerArray *titles; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1435 NSPointerArray *rowdatas; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1436 UIColor *fgcolor, *oddcolor, *evencolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1437 unsigned long dw_oddcolor, dw_evencolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1438 unsigned long _DW_COLOR_ROW_ODD, _DW_COLOR_ROW_EVEN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1439 int lastAddPoint, lastQueryPoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1440 id scrollview; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1441 int filesystem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1442 } |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1443 -(NSInteger)numberOfRowsInTableView:(UITableView *)aTable; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1444 #if 0 /* TODO: Switch to columnless versions */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1445 -(id)tableView:(UITableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1446 -(BOOL)tableView:(UITableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1447 -(void)tableView:(UITableView *)tableView didAddRowView:(UITableRowView *)rowView forRow:(NSInteger)row; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1448 -(UIView *)tableView:(UITableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1449 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1450 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1451 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1452 -(void)setFilesystem:(int)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1453 -(int)filesystem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1454 -(id)scrollview; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1455 -(void)setScrollview:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1456 -(int)addRow:(NSArray *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1457 -(int)addRows:(int)number; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1458 -(void)editCell:(id)input at:(int)row and:(int)col; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1459 -(void)removeRow:(int)row; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1460 -(void)setRow:(int)row title:(const char *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1461 -(void *)getRowTitle:(int)row; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1462 -(id)getRow:(int)row and:(int)col; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1463 -(int)cellType:(int)col; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1464 -(int)lastAddPoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1465 -(int)lastQueryPoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1466 -(void)setLastQueryPoint:(int)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1467 -(void)clear; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1468 -(void)setup; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1469 -(CGSize)getsize; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1470 -(void)setForegroundColor:(UIColor *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1471 -(void)doubleClicked:(id)sender; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1472 -(void)selectionChanged:(id)sender; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1473 -(DWMenu *)menuForEvent:(UIEvent *)event; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1474 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1475 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1476 @implementation DWContainer |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1477 -(NSInteger)numberOfRowsInTableView:(UITableView *)aTable |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1478 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1479 if(tvcols && data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1480 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1481 int cols = (int)[tvcols count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1482 int total = (int)[data count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1483 if(cols && total) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1484 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1485 return total / cols; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1486 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1487 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1488 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1489 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1490 #if 0 /* TODO: Switch to columnless versions */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1491 -(id)tableView:(UITableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1492 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1493 if(tvcols && data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1494 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1495 int z, col = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1496 int count = (int)[tvcols count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1497 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1498 for(z=0;z<count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1499 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1500 if([tvcols objectAtIndex:z] == aCol) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1501 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1502 col = z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1503 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1504 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1505 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1506 if(col != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1507 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1508 int index = (int)(aRow * count) + col; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1509 if(index < [data count]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1510 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1511 id this = [data objectAtIndex:index]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1512 return ([this isKindOfClass:[NSNull class]]) ? nil : this; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1513 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1514 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1515 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1516 return nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1517 } |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1518 -(BOOL)tableView:(UITableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { return NO; } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1519 -(void)tableView:(UITableView *)tableView didAddRowView:(UITableRowView *)rowView forRow:(NSInteger)row |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1520 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1521 /* Handle drawing alternating row colors if enabled */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1522 if ((row % 2) == 0) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1523 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1524 if(evencolor) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1525 [rowView setBackgroundColor:evencolor]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1526 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1527 else |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1528 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1529 if(oddcolor) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1530 [rowView setBackgroundColor:oddcolor]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1531 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1532 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1533 -(UIView *)tableView:(UITableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1534 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1535 /* Not reusing cell views, so get the cell from our array */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1536 int index = (int)(row * [tvcols count]) + (int)[tvcols indexOfObject:tableColumn]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1537 id celldata = [data objectAtIndex:index]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1538 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1539 /* The data is already a NSTableCellView so just return that */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1540 if([celldata isMemberOfClass:[UITableViewCell class]]) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1541 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1542 UITableViewCell *result = celldata; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1543 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1544 /* Copy the alignment setting from the column, |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1545 * and set the text color from the container. |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1546 */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1547 if(@available(iOS 14.0, *)) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1548 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1549 UIListContentConfiguration *content = [result defaultContentConfiguration]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1550 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1551 if(fgcolor) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1552 [[content textProperties] setColor:fgcolor]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1553 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1554 else |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1555 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1556 if(fgcolor) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1557 [result setTextColor:fgcolor]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1558 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1559 /* Return the result */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1560 return result; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1561 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1562 return nil; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1563 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1564 -(void)tableView:(NSTableView *)tableView didClickTableColumn:(NSTableColumn *)tableColumn |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1565 { |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1566 NSUInteger index = [tvcols indexOfObject:tableColumn]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1567 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1568 /* Handler for column click class */ |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1569 _event_handler(self, (UIEvent *)index, 17); |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1570 } |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1571 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1572 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1573 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1574 -(void)setFilesystem:(int)input { filesystem = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1575 -(int)filesystem { return filesystem; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1576 -(id)scrollview { return scrollview; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1577 -(void)setScrollview:(id)input { scrollview = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1578 -(void)refreshColors |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1579 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1580 UIColor *oldodd = oddcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1581 UIColor *oldeven = evencolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1582 unsigned long thisodd = dw_oddcolor == DW_CLR_DEFAULT ? _DW_COLOR_ROW_ODD : dw_oddcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1583 unsigned long _odd = _get_color(thisodd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1584 unsigned long thiseven = dw_evencolor == DW_CLR_DEFAULT ? _DW_COLOR_ROW_EVEN : dw_evencolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1585 unsigned long _even = _get_color(thiseven); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1586 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1587 /* Get the UIColor for non-default colors */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1588 if(thisodd != DW_RGB_TRANSPARENT) |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1589 oddcolor = [[UIColor colorWithRed: DW_RED_VALUE(_odd)/255.0 green: DW_GREEN_VALUE(_odd)/255.0 blue: DW_BLUE_VALUE(_odd)/255.0 alpha: 1] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1590 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1591 oddcolor = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1592 if(thiseven != DW_RGB_TRANSPARENT) |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1593 evencolor = [[UIColor colorWithRed: DW_RED_VALUE(_even)/255.0 green: DW_GREEN_VALUE(_even)/255.0 blue: DW_BLUE_VALUE(_even)/255.0 alpha: 1] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1594 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1595 evencolor = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1596 [oldodd release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1597 [oldeven release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1598 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1599 -(void)setRowBgOdd:(unsigned long)oddcol andEven:(unsigned long)evencol |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1600 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1601 /* Save the set colors in case we get a theme change */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1602 dw_oddcolor = oddcol; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1603 dw_evencolor = evencol; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1604 [self refreshColors]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1605 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1606 -(void)checkDark |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1607 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1608 /* Update any system colors based on the Dark Mode */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1609 _DW_COLOR_ROW_EVEN = DW_RGB_TRANSPARENT; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1610 _DW_COLOR_ROW_ODD = DW_RGB(230, 230, 230); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1611 /* Only refresh if we've been setup already */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1612 if(titles) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1613 [self refreshColors]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1614 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1615 -(void)viewDidChangeEffectiveAppearance { [self checkDark]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1616 -(int)insertRow:(NSArray *)input at:(int)index |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1617 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1618 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1619 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1620 unsigned long start = [tvcols count] * index; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1621 NSIndexSet *set = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(start, start + [tvcols count])]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1622 if(index < lastAddPoint) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1623 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1624 lastAddPoint++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1625 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1626 [data insertObjects:input atIndexes:set]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1627 [titles insertPointer:NULL atIndex:index]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1628 [rowdatas insertPointer:NULL atIndex:index]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1629 [set release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1630 return (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1631 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1632 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1633 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1634 -(int)addRow:(NSArray *)input |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1635 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1636 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1637 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1638 lastAddPoint = (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1639 [data addObjectsFromArray:input]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1640 [titles addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1641 [rowdatas addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1642 return (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1643 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1644 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1645 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1646 -(int)addRows:(int)number |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1647 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1648 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1649 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1650 int count = (int)(number * [tvcols count]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1651 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1652 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1653 lastAddPoint = (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1654 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1655 for(z=0;z<count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1656 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1657 [data addObject:[NSNull null]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1658 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1659 for(z=0;z<number;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1660 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1661 [titles addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1662 [rowdatas addPointer:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1663 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1664 return (int)[titles count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1665 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1666 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1667 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1668 -(void)editCell:(id)input at:(int)row and:(int)col |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1669 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1670 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1671 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1672 int index = (int)(row * [tvcols count]) + col; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1673 if(index < [data count]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1674 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1675 if(!input) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1676 input = [NSNull null]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1677 [data replaceObjectAtIndex:index withObject:input]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1678 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1679 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1680 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1681 -(void)removeRow:(int)row |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1682 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1683 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1684 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1685 int z, start, end; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1686 int count = (int)[tvcols count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1687 void *oldtitle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1688 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1689 start = (count * row); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1690 end = start + count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1691 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1692 for(z=start;z<end;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1693 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1694 [data removeObjectAtIndex:start]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1695 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1696 oldtitle = [titles pointerAtIndex:row]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1697 [titles removePointerAtIndex:row]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1698 [rowdatas removePointerAtIndex:row]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1699 if(lastAddPoint > 0 && lastAddPoint > row) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1700 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1701 lastAddPoint--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1702 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1703 if(oldtitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1704 free(oldtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1705 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1706 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1707 -(void)setRow:(int)row title:(const char *)input |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1708 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1709 if(titles && input) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1710 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1711 void *oldtitle = [titles pointerAtIndex:row]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1712 void *newtitle = input ? (void *)strdup(input) : NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1713 [titles replacePointerAtIndex:row withPointer:newtitle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1714 if(oldtitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1715 free(oldtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1716 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1717 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1718 -(void)setRowData:(int)row title:(void *)input { if(rowdatas && input) { [rowdatas replacePointerAtIndex:row withPointer:input]; } } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1719 -(void *)getRowTitle:(int)row { if(titles && row > -1) { return [titles pointerAtIndex:row]; } return NULL; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1720 -(void *)getRowData:(int)row { if(rowdatas && row > -1) { return [rowdatas pointerAtIndex:row]; } return NULL; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1721 -(id)getRow:(int)row and:(int)col { if(data) { int index = (int)(row * [tvcols count]) + col; return [data objectAtIndex:index]; } return nil; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1722 -(int)cellType:(int)col { return [[types objectAtIndex:col] intValue]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1723 -(int)lastAddPoint { return lastAddPoint; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1724 -(int)lastQueryPoint { return lastQueryPoint; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1725 -(void)setLastQueryPoint:(int)input { lastQueryPoint = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1726 -(void)clear |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1727 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1728 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1729 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1730 [data removeAllObjects]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1731 while([titles count]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1732 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1733 void *oldtitle = [titles pointerAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1734 [titles removePointerAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1735 [rowdatas removePointerAtIndex:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1736 if(oldtitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1737 free(oldtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1738 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1739 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1740 lastAddPoint = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1741 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1742 -(void)setup |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1743 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1744 SEL swopa = NSSelectorFromString(@"pointerArrayWithWeakObjects"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1745 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1746 if(![[NSPointerArray class] respondsToSelector:swopa]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1747 swopa = NSSelectorFromString(@"weakObjectsPointerArray"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1748 if(![[NSPointerArray class] respondsToSelector:swopa]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1749 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1750 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1751 DWIMP iwopa = (DWIMP)[[NSPointerArray class] methodForSelector:swopa]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1752 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1753 titles = iwopa([NSPointerArray class], swopa); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1754 [titles retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1755 rowdatas = iwopa([NSPointerArray class], swopa); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1756 [rowdatas retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1757 tvcols = [[[NSMutableArray alloc] init] retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1758 data = [[[NSMutableArray alloc] init] retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1759 types = [[[NSMutableArray alloc] init] retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1760 if(!dw_oddcolor && !dw_evencolor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1761 dw_oddcolor = dw_evencolor = DW_CLR_DEFAULT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1762 [self checkDark]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1763 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1764 -(CGSize)getsize |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1765 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1766 int cwidth = 0, cheight = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1767 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1768 #if 0 /* TODO: Figure out how to calculate the table size */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1769 if(tvcols) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1770 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1771 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1772 int colcount = (int)[tvcols count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1773 int rowcount = (int)[self numberOfRowsInTableView:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1774 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1775 for(z=0;z<colcount;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1776 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1777 NSTableColumn *column = [tvcols objectAtIndex:z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1778 int width = [column width]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1779 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1780 if(rowcount > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1781 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1782 int x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1783 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1784 for(x=0;x<rowcount;x++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1785 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1786 NSTableCellView *cell = [self viewAtColumn:z row:x makeIfNecessary:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1787 int thiswidth = 4, thisheight = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1788 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1789 if([cell imageView]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1790 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1791 thiswidth += [[cell imageView] image].size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1792 thisheight = [[cell imageView] image].size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1793 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1794 if([cell textField]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1795 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1796 int textheight = [[cell textField] intrinsicContentSize].width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1797 thiswidth += [[cell textField] intrinsicContentSize].width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1798 if(textheight > thisheight) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1799 thisheight = textheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1800 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1801 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1802 /* If on the first column... add up the heights */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1803 if(z == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1804 cheight += thisheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1805 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1806 if(thiswidth > width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1807 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1808 width = thiswidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1809 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1810 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1811 /* If the image is missing default the optimized width to 16. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1812 if(!width && [[types objectAtIndex:z] intValue] & DW_CFA_BITMAPORICON) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1813 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1814 width = 16; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1815 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1816 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1817 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1818 cwidth += width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1819 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1820 } |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1821 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1822 cwidth += 16; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1823 cheight += 16; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1824 return CGSizeMake(cwidth, cheight); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1825 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1826 -(void)setForegroundColor:(UIColor *)input |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1827 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1828 #if 0 /* TODO: Fix this without columns */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1829 int z, count = (int)[tvcols count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1830 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1831 fgcolor = input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1832 [fgcolor retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1833 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1834 for(z=0;z<count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1835 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1836 NSTableColumn *tableColumn = [tvcols objectAtIndex:z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1837 UITextFieldCell *cell = [tableColumn dataCell]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1838 [cell setTextColor:fgcolor]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1839 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1840 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1841 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1842 -(void)doubleClicked:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1843 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1844 void *params[2]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1845 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1846 params[0] = (void *)[self getRowTitle:(int)[self indexPathForSelectedRow].row]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1847 params[1] = (void *)[self getRowData:(int)[self indexPathForSelectedRow].row]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1848 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1849 /* Handler for container class */ |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1850 _event_handler(self, (UIEvent *)params, 9); |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1851 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1852 -(void)selectionChanged:(id)sender |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1853 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1854 void *params[2]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1855 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1856 params[0] = (void *)[self getRowTitle:(int)[self indexPathForSelectedRow].row]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1857 params[1] = (void *)[self getRowData:(int)[self indexPathForSelectedRow].row]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1858 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1859 /* Handler for container class */ |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1860 _event_handler(self, (UIEvent *)params, 12); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1861 /* Handler for listbox class */ |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1862 _event_handler(self, DW_INT_TO_POINTER((int)[self indexPathForSelectedRow].row), 11); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1863 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
1864 -(DWMenu *)menuForEvent:(UIEvent *)event |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1865 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1866 #if 0 /* TODO: Fix this */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1867 int row; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1868 CGPoint where = [self convertPoint:[event locationInWindow] fromView:nil]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1869 row = (int)[self rowAtPoint:where]; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
1870 _event_handler(self, (UIEvent *)[self getRowTitle:row], 10); |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
1871 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1872 return nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1873 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1874 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1875 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1876 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1877 /* Dive into the tree freeing all desired child nodes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1878 void _free_tree_recurse(NSMutableArray *node, NSMutableArray *item) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1879 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1880 if(node && ([node isKindOfClass:[NSArray class]])) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1881 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1882 int count = (int)[node count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1883 NSInteger index = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1884 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1885 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1886 if(item) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1887 index = [node indexOfObject:item]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1888 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1889 for(z=0;z<count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1890 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1891 NSMutableArray *pnt = [node objectAtIndex:z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1892 NSMutableArray *children = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1893 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1894 if(pnt && [pnt isKindOfClass:[NSArray class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1895 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1896 children = (NSMutableArray *)[pnt objectAtIndex:3]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1897 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1898 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1899 if(z == index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1900 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1901 _free_tree_recurse(children, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1902 [node removeObjectAtIndex:z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1903 count = (int)[node count]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1904 index = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1905 z--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1906 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1907 else if(item == NULL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1908 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1909 NSString *oldstr = [pnt objectAtIndex:1]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1910 [oldstr release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1911 _free_tree_recurse(children, item); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1912 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1913 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1914 _free_tree_recurse(children, item); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1915 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1916 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1917 if(!item) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1918 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1919 [node release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1920 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1921 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1922 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1923 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1924 /* Subclass for a Calendar type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1925 @interface DWCalendar : UIDatePicker |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1926 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1927 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1928 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1929 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1930 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1931 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1932 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1933 @implementation DWCalendar |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1934 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1935 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1936 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1937 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1938 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1939 /* Subclass for a stepper component of the spinbutton type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1940 /* This is a bad way of doing this... but I can't get the other methods to work */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1941 @interface DWStepper : UIStepper |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1942 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1943 id textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1944 id parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1945 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1946 -(void)setTextfield:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1947 -(id)textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1948 -(void)setParent:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1949 -(id)parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1950 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1951 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1952 @implementation DWStepper |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1953 -(void)setTextfield:(id)input { textfield = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1954 -(id)textfield { return textfield; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1955 -(void)setParent:(id)input { parent = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1956 -(id)parent { return parent; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1957 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1958 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1959 /* Subclass for a Spinbutton type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1960 @interface DWSpinButton : UIView <UITextFieldDelegate> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1961 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1962 void *userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1963 UITextField *textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1964 DWStepper *stepper; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1965 id clickDefault; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1966 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1967 -(id)init; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1968 -(void *)userdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1969 -(void)setUserdata:(void *)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1970 -(UITextField *)textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1971 -(UIStepper *)stepper; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1972 -(void)controlTextDidChange:(NSNotification *)aNotification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1973 -(void)setClickDefault:(id)input; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1974 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1975 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1976 @implementation DWSpinButton |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1977 -(id)init |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1978 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1979 self = [super init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1980 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1981 if(self) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1982 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1983 textfield = [[[UITextField alloc] init] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1984 [self addSubview:textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1985 stepper = [[[DWStepper alloc] init] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1986 [self addSubview:stepper]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1987 [stepper setParent:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1988 [stepper setTextfield:textfield]; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
1989 [textfield setText:[NSString stringWithFormat:@"%ld",(long)[stepper value]]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1990 [textfield setDelegate:self]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1991 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1992 return self; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1993 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1994 -(void *)userdata { return userdata; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1995 -(void)setUserdata:(void *)input { userdata = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1996 -(UITextField *)textfield { return textfield; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1997 -(UIStepper *)stepper { return stepper; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1998 -(void)controlTextDidChange:(NSNotification *)aNotification |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
1999 { |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
2000 long val = [[textfield text] intValue]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
2001 [stepper setValue:(float)val]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
2002 _event_handler(self, DW_INT_TO_POINTER(val), 14); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2003 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2004 -(void)setClickDefault:(id)input { clickDefault = input; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2005 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2006 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2007 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2008 API_AVAILABLE(ios(10.0)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2009 @interface DWUserNotificationCenterDelegate : NSObject <UNUserNotificationCenterDelegate> |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2010 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2011 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2012 @implementation DWUserNotificationCenterDelegate |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2013 /* Called when a notification is delivered to a foreground app. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2014 -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler API_AVAILABLE(macos(10.14)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2015 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2016 completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2017 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2018 /* Called to let your app know which action was selected by the user for a given notification. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2019 -(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler API_AVAILABLE(macos(10.14)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2020 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2021 NSScanner *objScanner = [NSScanner scannerWithString:response.notification.request.identifier]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2022 unsigned long long handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2023 HWND notification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2024 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2025 /* Skip the dw-notification- prefix */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2026 [objScanner scanString:@"dw-notification-" intoString:nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2027 [objScanner scanUnsignedLongLong:&handle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2028 notification = DW_UINT_TO_POINTER(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2029 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2030 if ([response.actionIdentifier isEqualToString:UNNotificationDismissActionIdentifier]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2031 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2032 /* The user dismissed the notification without taking action. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2033 dw_signal_disconnect_by_window(notification); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2034 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2035 else if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2036 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2037 /* The user launched the app. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2038 _event_handler(notification, nil, 8); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2039 dw_signal_disconnect_by_window(notification); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2040 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2041 completionHandler(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2042 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2043 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2044 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2045 /* Subclass for a MDI type |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2046 * This is just a box for display purposes... but it is a |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2047 * unique class so it can be identified when creating windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2048 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2049 @interface DWMDI : DWBox {} |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2050 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2051 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2052 @implementation DWMDI |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2053 @end |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2054 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2055 /* This function adds a signal handler callback into the linked list. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2056 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2057 void _new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *discfunc, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2058 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2059 SignalHandler *new = malloc(sizeof(SignalHandler)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2060 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2061 new->message = message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2062 new->window = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2063 new->id = msgid; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2064 new->signalfunction = signalfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2065 new->discfunction = discfunc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2066 new->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2067 new->next = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2068 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2069 if (!Root) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2070 Root = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2071 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2072 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2073 SignalHandler *prev = NULL, *tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2074 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2075 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2076 if(tmp->message == message && |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2077 tmp->window == window && |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2078 tmp->id == msgid && |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2079 tmp->signalfunction == signalfunction) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2080 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2081 tmp->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2082 free(new); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2083 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2084 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2085 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2086 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2087 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2088 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2089 prev->next = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2090 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2091 Root = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2092 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2093 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2094 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2095 /* Finds the message number for a given signal name */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2096 ULONG _findsigmessage(const char *signame) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2097 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2098 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2099 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2100 for(z=0;z<SIGNALMAX;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2101 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2102 if(strcasecmp(signame, SignalTranslate[z].name) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2103 return SignalTranslate[z].message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2104 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2105 return 0L; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2106 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2107 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2108 unsigned long _foreground = 0xAAAAAA, _background = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2109 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2110 void _handle_resize_events(Box *thisbox) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2111 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2112 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2113 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2114 for(z=0;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2115 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2116 id handle = thisbox->items[z].hwnd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2117 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2118 if(thisbox->items[z].type == TYPEBOX) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2119 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2120 Box *tmp = (Box *)[handle box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2121 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2122 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2123 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2124 _handle_resize_events(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2125 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2126 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2127 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2128 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2129 if([handle isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2130 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2131 DWRender *render = (DWRender *)handle; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2132 CGSize oldsize = [render size]; |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2133 CGSize newsize = [render frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2134 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2135 /* Eliminate duplicate configure requests */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2136 if(oldsize.width != newsize.width || oldsize.height != newsize.height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2137 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2138 if(newsize.width > 0 && newsize.height > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2139 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2140 [render setSize:newsize]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2141 _event_handler(handle, nil, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2142 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2143 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2144 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2145 /* Special handling for notebook controls */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2146 #if 0 /* TODO: Segmented control might not have subviews */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2147 else if([handle isMemberOfClass:[DWNotebook class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2148 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2149 DWNotebook *notebook = (DWNotebook *)handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2150 NSInteger index = [notebook selectedSegmentIndex]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2151 id view = [notepage view]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2152 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2153 if([view isMemberOfClass:[DWBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2154 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2155 Box *box = (Box *)[view box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2156 _handle_resize_events(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2157 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2158 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2159 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2160 /* Handle laying out scrollviews... if required space is less |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2161 * than available space, then expand. Otherwise use required space. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2162 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2163 else if([handle isMemberOfClass:[DWScrollBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2164 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2165 DWScrollBox *scrollbox = (DWScrollBox *)handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2166 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2167 DWBox *contentbox = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2168 Box *thisbox = [contentbox box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2169 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2170 /* Get the required space for the box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2171 _handle_resize_events(thisbox); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2172 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2173 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2174 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2175 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2176 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2177 /* This function calculates how much space the widgets and boxes require |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2178 * and does expansion as necessary. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2179 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2180 static void _resize_box(Box *thisbox, int *depth, int x, int y, int pass) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2181 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2182 /* Current item position */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2183 int z, currentx = thisbox->pad, currenty = thisbox->pad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2184 /* Used x, y and padding maximum values... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2185 * These will be used to find the widest or |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2186 * tallest items in a box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2187 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2188 int uymax = 0, uxmax = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2189 int upymax = 0, upxmax = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2190 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2191 /* Reset the box sizes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2192 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2193 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2194 /* Count up all the space for all items in the box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2195 for(z=0;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2196 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2197 int itempad, itemwidth, itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2198 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2199 if(thisbox->items[z].type == TYPEBOX) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2200 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2201 id box = thisbox->items[z].hwnd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2202 Box *tmp = (Box *)[box box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2203 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2204 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2205 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2206 /* On the first pass calculate the box contents */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2207 if(pass == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2208 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2209 (*depth)++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2210 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2211 /* Save the newly calculated values on the box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2212 _resize_box(tmp, depth, x, y, pass); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2213 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2214 /* Duplicate the values in the item list for use below */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2215 thisbox->items[z].width = tmp->minwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2216 thisbox->items[z].height = tmp->minheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2217 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2218 /* If the box has no contents but is expandable... default the size to 1 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2219 if(!thisbox->items[z].width && thisbox->items[z].hsize) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2220 thisbox->items[z].width = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2221 if(!thisbox->items[z].height && thisbox->items[z].vsize) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2222 thisbox->items[z].height = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2223 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2224 (*depth)--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2225 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2226 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2227 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2228 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2229 /* Precalculate these values, since they will |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2230 * be used used repeatedly in the next section. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2231 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2232 itempad = thisbox->items[z].pad * 2; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2233 itemwidth = thisbox->items[z].width + itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2234 itemheight = thisbox->items[z].height + itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2235 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2236 /* Calculate the totals and maximums */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2237 if(thisbox->type == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2238 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2239 if(itemwidth > uxmax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2240 uxmax = itemwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2241 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2242 if(thisbox->items[z].hsize != SIZEEXPAND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2243 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2244 if(itemwidth > upxmax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2245 upxmax = itemwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2246 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2247 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2248 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2249 if(itempad > upxmax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2250 upxmax = itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2251 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2252 thisbox->minheight += itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2253 if(thisbox->items[z].vsize != SIZEEXPAND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2254 thisbox->usedpady += itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2255 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2256 thisbox->usedpady += itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2258 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2259 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2260 if(itemheight > uymax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2261 uymax = itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2262 if(thisbox->items[z].vsize != SIZEEXPAND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2263 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2264 if(itemheight > upymax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2265 upymax = itemheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2266 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2267 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2268 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2269 if(itempad > upymax) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2270 upymax = itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2271 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2272 thisbox->minwidth += itemwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2273 if(thisbox->items[z].hsize != SIZEEXPAND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2274 thisbox->usedpadx += itemwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2275 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2276 thisbox->usedpadx += itempad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2277 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2278 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2279 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2280 /* Add the maximums which were calculated in the previous loop */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2281 thisbox->minwidth += uxmax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2282 thisbox->minheight += uymax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2283 thisbox->usedpadx += upxmax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2284 thisbox->usedpady += upymax; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2285 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2286 /* The second pass is for actual placement. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2287 if(pass > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2288 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2289 for(z=0;z<(thisbox->count);z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2290 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2291 int height = thisbox->items[z].height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2292 int width = thisbox->items[z].width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2293 int itempad = thisbox->items[z].pad * 2; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2294 int thispad = thisbox->pad * 2; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2295 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2296 /* Calculate the new sizes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2297 if(thisbox->items[z].hsize == SIZEEXPAND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2298 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2299 if(thisbox->type == DW_HORZ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2300 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2301 int expandablex = thisbox->minwidth - thisbox->usedpadx; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2302 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2303 if(expandablex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2304 width = (int)(((float)width / (float)expandablex) * (float)(x - thisbox->usedpadx)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2305 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2306 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2307 width = x - (itempad + thispad + thisbox->grouppadx); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2308 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2309 if(thisbox->items[z].vsize == SIZEEXPAND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2310 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2311 if(thisbox->type == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2312 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2313 int expandabley = thisbox->minheight - thisbox->usedpady; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2314 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2315 if(expandabley) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2316 height = (int)(((float)height / (float)expandabley) * (float)(y - thisbox->usedpady)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2317 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2318 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2319 height = y - (itempad + thispad + thisbox->grouppady); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2320 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2321 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2322 /* If the calculated size is valid... */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2323 if(height > 0 && width > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2324 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2325 int pad = thisbox->items[z].pad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2326 UIView *handle = thisbox->items[z].hwnd; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2327 CGRect rect; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2328 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2329 rect.origin.x = currentx + pad; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2330 rect.origin.y = currenty + pad; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2331 rect.size.width = width; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2332 rect.size.height = height; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2333 [handle setFrame:rect]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2334 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2335 /* After placing a box... place its components */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2336 if(thisbox->items[z].type == TYPEBOX) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2337 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2338 id box = thisbox->items[z].hwnd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2339 Box *tmp = (Box *)[box box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2340 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2341 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2342 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2343 (*depth)++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2344 _resize_box(tmp, depth, width, height, pass); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2345 (*depth)--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2346 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2347 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2348 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2349 #if 0 /* TODO: Segemented control may not have subviews */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2350 /* Special handling for notebook controls */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2351 if([handle isMemberOfClass:[DWNotebook class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2352 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2353 DWNotebook *notebook = (DWNotebook *)handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2354 NSInteger index = [notebook selectedSegmentIndex]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2355 id view = [notepage view]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2356 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2357 if([view isMemberOfClass:[DWBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2358 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2359 Box *box = (Box *)[view box]; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2360 CGSize size = [view frame].size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2361 _do_resize(box, size.width, size.height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2362 _handle_resize_events(box); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2363 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2364 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2365 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2366 /* Handle laying out scrollviews... if required space is less |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2367 * than available space, then expand. Otherwise use required space. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2368 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2369 else if([handle isMemberOfClass:[DWScrollBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2370 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2371 int depth = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2372 DWScrollBox *scrollbox = (DWScrollBox *)handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2373 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2374 DWBox *contentbox = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2375 Box *thisbox = [contentbox box]; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2376 CGSize contentsize = [scrollbox contentSize]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2377 CGRect frame = [contentbox frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2378 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2379 /* Get the required space for the box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2380 _resize_box(thisbox, &depth, x, y, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2381 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2382 if(contentsize.width < thisbox->minwidth) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2383 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2384 contentsize.width = thisbox->minwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2385 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2386 if(contentsize.height < thisbox->minheight) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2387 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2388 contentsize.height = thisbox->minheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2389 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2390 frame.size = contentsize; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2391 [contentbox setFrame:frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2392 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2393 /* Layout the content of the scrollbox */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2394 _do_resize(thisbox, contentsize.width, contentsize.height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2395 _handle_resize_events(thisbox); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2396 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2397 /* Special handling for spinbutton controls */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2398 else if([handle isMemberOfClass:[DWSpinButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2399 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2400 DWSpinButton *spinbutton = (DWSpinButton *)handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2401 UITextField *textfield = [spinbutton textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2402 UIStepper *stepper = [spinbutton stepper]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2403 [textfield setFrame:CGRectMake(0,0,rect.size.width-20,rect.size.height)]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2404 [stepper setFrame:CGRectMake(rect.size.width-20,0,20,rect.size.height)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2405 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2406 else if([handle isMemberOfClass:[DWSplitBar class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2407 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2408 DWSplitBar *split = (DWSplitBar *)handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2409 float percent = [split percent]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2410 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2411 if(percent > 0 && rect.size.width > 20 && rect.size.height > 20) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2412 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2413 dw_splitbar_set(handle, percent); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2414 [split setPercent:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2415 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2416 [split splitViewDidResizeSubviews:nil]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2417 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2418 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2419 /* Advance the current position in the box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2420 if(thisbox->type == DW_HORZ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2421 currentx += width + (pad * 2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2422 if(thisbox->type == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2423 currenty += height + (pad * 2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2424 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2425 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2426 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2427 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2428 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2429 static void _do_resize(Box *thisbox, int x, int y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2430 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2431 if(x > 0 && y > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2432 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2433 if(thisbox) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2434 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2435 int depth = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2436 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2437 /* Calculate space requirements */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2438 _resize_box(thisbox, &depth, x, y, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2439 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2440 /* Finally place all the boxes and controls */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2441 _resize_box(thisbox, &depth, x, y, 2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2442 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2443 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2444 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2445 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2446 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2447 * Runs a message loop for Dynamic Windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2448 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2449 void API dw_main(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2450 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2451 DWThread = dw_thread_id(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2452 /* Make sure any queued redraws are handled */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2453 _dw_redraw(0, FALSE); |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
2454 [[NSRunLoop mainRunLoop] run]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2455 DWThread = (DWTID)-1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2456 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2457 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2458 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2459 * Causes running dw_main() to return. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2460 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2461 void API dw_main_quit(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2462 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
2463 /* TODO: Make this work |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
2464 [[NSRunLoop mainRunLoop] ]; */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2465 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2466 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2467 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2468 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2469 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2470 * milliseconds: Number of milliseconds to run the loop for. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2471 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2472 void API dw_main_sleep(int milliseconds) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2473 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2474 DWTID curr = pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2475 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2476 if(DWThread == (DWTID)-1 || DWThread == curr) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2477 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2478 DWTID orig = DWThread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2479 NSDate *until = [NSDate dateWithTimeIntervalSinceNow:(milliseconds/1000.0)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2480 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2481 if(orig == (DWTID)-1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2482 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2483 DWThread = curr; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2484 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2485 /* Process any pending events */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2486 while(_dw_main_iteration(until)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2487 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2488 /* Just loop */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2489 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2490 if(orig == (DWTID)-1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2491 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2492 DWThread = orig; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2493 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2494 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2495 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2496 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2497 usleep(milliseconds * 1000); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2498 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2499 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2500 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2501 /* Internal version that doesn't lock the run mutex */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2502 int _dw_main_iteration(NSDate *date) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2503 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
2504 return [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2505 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2506 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2507 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2508 * Processes a single message iteration and returns. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2509 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2510 void API dw_main_iteration(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2511 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2512 DWTID curr = pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2513 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2514 if(DWThread == (DWTID)-1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2515 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2516 DWThread = curr; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2517 _dw_main_iteration([NSDate distantPast]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2518 DWThread = (DWTID)-1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2519 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2520 else if(DWThread == curr) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2521 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2522 _dw_main_iteration([NSDate distantPast]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2523 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2524 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2525 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2526 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2527 * Cleanly terminates a DW session, should be signal handler safe. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2528 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2529 void API dw_shutdown(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2530 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2531 pool = pthread_getspecific(_dw_pool_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2532 [pool drain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2533 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2534 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2535 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2536 * Cleanly terminates a DW session, should be signal handler safe. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2537 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2538 * exitcode: Exit code reported to the operating system. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2539 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2540 void API dw_exit(int exitcode) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2541 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2542 dw_shutdown(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2543 exit(exitcode); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2544 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2545 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2546 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2547 * Free's memory allocated by dynamic windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2548 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2549 * ptr: Pointer to dynamic windows allocated |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2550 * memory to be free()'d. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2551 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2552 void API dw_free(void *ptr) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2553 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2554 free(ptr); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2555 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2556 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2557 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2558 * Returns a pointer to a static buffer which containes the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2559 * current user directory. Or the root directory (C:\ on |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2560 * OS/2 and Windows). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2561 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2562 char *dw_user_dir(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2563 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2564 static char _user_dir[PATH_MAX+1] = { 0 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2565 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2566 if(!_user_dir[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2567 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2568 char *home = getenv("HOME"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2569 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2570 if(home) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2571 strncpy(_user_dir, home, PATH_MAX); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2572 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2573 strcpy(_user_dir, "/"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2574 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2575 return _user_dir; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2576 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2577 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2578 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2579 * Returns a pointer to a static buffer which containes the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2580 * private application data directory. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2581 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2582 char * API dw_app_dir(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2583 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2584 return _dw_bundle_path; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2585 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2586 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2587 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2588 * Sets the application ID used by this Dynamic Windows application instance. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2589 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2590 * appid: A string typically in the form: com.company.division.application |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2591 * appname: The application name used on Windows or NULL. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2592 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2593 * DW_ERROR_NONE after successfully setting the application ID. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2594 * DW_ERROR_UNKNOWN if unsupported on this system. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2595 * DW_ERROR_GENERAL if the application ID is not allowed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2596 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2597 * This must be called before dw_init(). If dw_init() is called first |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2598 * it will create a unique ID in the form: org.dbsoft.dwindows.application |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2599 * or if the application name cannot be detected: org.dbsoft.dwindows.pid.# |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2600 * The appname is only required on Windows. If NULL is passed the detected |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2601 * application name will be used, but a prettier name may be desired. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2602 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2603 int dw_app_id_set(const char *appid, const char *appname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2604 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2605 strncpy(_dw_app_id, appid, _DW_APP_ID_SIZE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2606 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2607 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2608 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2609 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2610 * Displays a debug message on the console... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2611 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2612 * format: printf style format string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2613 * ...: Additional variables for use in the format. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2614 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2615 void API dw_debug(const char *format, ...) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2616 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2617 va_list args; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2618 char outbuf[1025] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2619 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2620 va_start(args, format); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2621 vsnprintf(outbuf, 1024, format, args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2622 va_end(args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2623 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2624 NSLog(@"%s", outbuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2625 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2626 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2627 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2628 * Displays a Message Box with given text and title.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2629 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2630 * title: The title of the message box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2631 * flags: flags to indicate buttons and icon |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2632 * format: printf style format string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2633 * ...: Additional variables for use in the format. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2634 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2635 int API dw_messagebox(const char *title, int flags, const char *format, ...) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2636 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2637 NSInteger iResponse; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2638 NSString *button1 = @"OK"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2639 NSString *button2 = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2640 NSString *button3 = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2641 NSString *mtitle = [NSString stringWithUTF8String:title]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2642 NSString *mtext; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2643 UIAlertControllerStyle mstyle = UIAlertControllerStyleAlert; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2644 NSArray *params; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2645 va_list args; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2646 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2647 if(flags & DW_MB_OKCANCEL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2648 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2649 button2 = @"Cancel"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2650 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2651 else if(flags & DW_MB_YESNO) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2652 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2653 button1 = @"Yes"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2654 button2 = @"No"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2655 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2656 else if(flags & DW_MB_YESNOCANCEL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2657 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2658 button1 = @"Yes"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2659 button2 = @"No"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2660 button3 = @"Cancel"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2661 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2662 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2663 va_start(args, format); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2664 mtext = [[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2665 va_end(args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2666 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2667 if(flags & DW_MB_INFORMATION) |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2668 mstyle = UIAlertControllerStyleActionSheet; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2669 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2670 params = [NSMutableArray arrayWithObjects:mtitle, mtext, [NSNumber numberWithInteger:mstyle], button1, button2, button3, nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2671 [DWObj safeCall:@selector(messageBox:) withObject:params]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2672 iResponse = [[params lastObject] integerValue]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2673 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2674 switch(iResponse) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2675 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2676 case 1: /* user pressed OK */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2677 if(flags & DW_MB_YESNO || flags & DW_MB_YESNOCANCEL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2678 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2679 return DW_MB_RETURN_YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2680 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2681 return DW_MB_RETURN_OK; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2682 case 2: /* user pressed Cancel */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2683 if(flags & DW_MB_OKCANCEL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2684 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2685 return DW_MB_RETURN_CANCEL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2686 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2687 return DW_MB_RETURN_NO; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2688 case 3: /* user pressed the third button */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2689 return DW_MB_RETURN_CANCEL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2690 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2691 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2692 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2693 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2694 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2695 * Opens a file dialog and queries user selection. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2696 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2697 * title: Title bar text for dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2698 * defpath: The default path of the open dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2699 * ext: Default file extention. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2700 * flags: DW_FILE_OPEN or DW_FILE_SAVE. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2701 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2702 * NULL on error. A malloced buffer containing |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2703 * the file path on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2704 * |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2705 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2706 char * API dw_file_browse(const char *title, const char *defpath, const char *ext, int flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2707 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2708 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2709 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2710 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2711 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2712 * Gets the contents of the default clipboard as text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2713 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2714 * None. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2715 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2716 * Pointer to an allocated string of text or NULL if clipboard empty or contents could not |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2717 * be converted to text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2718 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2719 char *dw_clipboard_get_text() |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2720 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2721 UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2722 NSString *str = [pasteboard string]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2723 if(str != nil) |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2724 return strdup([str UTF8String]); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2725 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2726 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2727 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2728 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2729 * Sets the contents of the default clipboard to the supplied text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2730 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2731 * Text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2732 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2733 void dw_clipboard_set_text(const char *str, int len) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2734 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2735 UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2736 |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
2737 [pasteboard setString:[NSString stringWithUTF8String:str]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2738 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2739 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2740 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2741 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2742 * Allocates and initializes a dialog struct. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2743 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2744 * data: User defined data to be passed to functions. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2745 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2746 DWDialog * API dw_dialog_new(void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2747 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2748 DWDialog *tmp = malloc(sizeof(DWDialog)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2749 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2750 if(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2751 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2752 tmp->eve = dw_event_new(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2753 dw_event_reset(tmp->eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2754 tmp->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2755 tmp->done = FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2756 tmp->result = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2757 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2758 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2759 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2760 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2761 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2762 * Accepts a dialog struct and returns the given data to the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2763 * initial called of dw_dialog_wait(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2764 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2765 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2766 * result: Data to be returned by dw_dialog_wait(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2767 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2768 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2769 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2770 dialog->result = result; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2771 dw_event_post(dialog->eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2772 dialog->done = TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2773 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2774 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2775 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2776 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2777 * Accepts a dialog struct waits for dw_dialog_dismiss() to be |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2778 * called by a signal handler with the given dialog struct. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2779 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2780 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2781 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2782 void * API dw_dialog_wait(DWDialog *dialog) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2783 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2784 void *tmp = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2785 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2786 if(dialog) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2787 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2788 while(!dialog->done) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2789 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2790 _dw_main_iteration([NSDate dateWithTimeIntervalSinceNow:0.01]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2791 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2792 dw_event_close(&dialog->eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2793 tmp = dialog->result; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2794 free(dialog); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2795 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2796 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2797 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2798 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2799 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2800 * Create a new Box to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2801 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2802 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2803 * pad: Number of pixels to pad around the box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2804 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2805 DW_FUNCTION_DEFINITION(dw_box_new, HWND, int type, int pad) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2806 DW_FUNCTION_ADD_PARAM2(type, pad) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2807 DW_FUNCTION_RETURN(dw_box_new, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2808 DW_FUNCTION_RESTORE_PARAM2(type, int, pad, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2809 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2810 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2811 DWBox *view = [[DWBox alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2812 Box *newbox = [view box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2813 memset(newbox, 0, sizeof(Box)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2814 newbox->pad = pad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2815 newbox->type = type; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2816 DW_FUNCTION_RETURN_THIS(view); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2817 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2818 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2819 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2820 * Create a new Group Box to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2821 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2822 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2823 * pad: Number of pixels to pad around the box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2824 * title: Text to be displayined in the group outline. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2825 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2826 HWND API dw_groupbox_new(int type, int pad, const char *title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2827 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
2828 return dw_box_new(type, pad); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2829 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2830 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2831 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2832 * Create a new scrollable Box to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2833 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2834 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2835 * pad: Number of pixels to pad around the box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2836 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2837 HWND API dw_scrollbox_new( int type, int pad ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2838 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2839 DWScrollBox *scrollbox = [[DWScrollBox alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2840 DWBox *box = dw_box_new(type, pad); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2841 DWBox *tmpbox = dw_box_new(DW_VERT, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2842 dw_box_pack_start(tmpbox, box, 1, 1, TRUE, TRUE, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2843 [scrollbox setBox:box]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2844 [scrollbox addSubview:tmpbox]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2845 [tmpbox autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2846 return scrollbox; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2847 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2848 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2849 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2850 * Returns the position of the scrollbar in the scrollbox |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2851 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2852 * handle: Handle to the scrollbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2853 * orient: The vertical or horizontal scrollbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2854 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2855 int API dw_scrollbox_get_pos(HWND handle, int orient) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2856 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2857 DWScrollBox *scrollbox = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2858 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2859 UIView *view = [subviews firstObject]; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2860 CGSize contentsize = [scrollbox contentSize]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2861 CGPoint contentoffset = [scrollbox contentOffset]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2862 int range = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2863 int val = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2864 if(orient == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2865 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2866 range = [view bounds].size.height - contentsize.height; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2867 val = contentoffset.y; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2868 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2869 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2870 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2871 range = [view bounds].size.width - contentsize.width; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2872 val = contentoffset.x; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2873 } |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2874 if(val > range) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2875 { |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2876 val = range; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2877 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2878 return val; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2879 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2880 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2881 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2882 * Gets the range for the scrollbar in the scrollbox. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2883 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2884 * handle: Handle to the scrollbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2885 * orient: The vertical or horizontal scrollbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2886 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2887 int API dw_scrollbox_get_range(HWND handle, int orient) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2888 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2889 DWScrollBox *scrollbox = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2890 NSArray *subviews = [scrollbox subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2891 UIView *view = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2892 int range = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2893 if(orient == DW_VERT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2894 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2895 range = [view bounds].size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2896 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2897 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2898 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2899 range = [view bounds].size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2900 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2901 return range; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2902 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2903 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2904 /* Return the handle to the text object */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2905 id _text_handle(id object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2906 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2907 if([object isMemberOfClass:[ DWSpinButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2908 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2909 DWSpinButton *spinbutton = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2910 object = [spinbutton textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2911 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2912 #if 0 /* TODO: Fix this when we have a groupbox implemented */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2913 if([object isMemberOfClass:[ NSBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2914 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2915 NSBox *box = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2916 id content = [box contentView]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2917 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2918 if([content isMemberOfClass:[ DWText class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2919 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2920 object = content; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2921 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2922 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2923 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2924 return object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2925 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2926 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2927 /* Internal function to calculate the widget's required size.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2928 * These are the general rules for widget sizes: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2929 * |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2930 * Render/Unspecified: 1x1 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2931 * Scrolled(Container,Tree,MLE): Guessed size clamped to min and max in dw.h |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2932 * Entryfield/Combobox/Spinbutton: 150x(maxfontheight) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2933 * Spinbutton: 50x(maxfontheight) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2934 * Text/Status: (textwidth)x(textheight) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2935 * Ranged: 100x14 or 14x100 for vertical. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2936 * Buttons/Bitmaps: Size of text or image and border. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2937 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2938 void _dw_control_size(id handle, int *width, int *height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2939 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2940 int thiswidth = 1, thisheight = 1, extrawidth = 0, extraheight = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2941 NSString *nsstr = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2942 id object = _text_handle(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2943 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2944 /* Handle all the different button types */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2945 if([ object isKindOfClass:[ UIButton class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2946 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2947 switch([object buttonType]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2948 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2949 default: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2950 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2951 UIImage *image = (UIImage *)[object image]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2952 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2953 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2954 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2955 /* Image button */ |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
2956 CGSize size = [image size]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2957 thiswidth = (int)size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2958 thisheight = (int)size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2959 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2960 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2961 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2962 /* Text button */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2963 nsstr = [object title]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2964 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2965 extrawidth = 8; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2966 extraheight = 4; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2967 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2968 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2969 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2970 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2971 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2972 /* If the control is an entryfield set width to 150 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2973 else if([object isKindOfClass:[ UITextField class ]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2974 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2975 UIFont *font = [object font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2976 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2977 if([object isEditable]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2978 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2979 /* Spinbuttons don't need to be as wide */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2980 if([object isMemberOfClass:[ DWSpinButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2981 thiswidth = 50; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2982 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2983 thiswidth = 150; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2984 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2985 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2986 nsstr = [object stringValue]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2987 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2988 if(font) |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
2989 thisheight = (int)[font lineHeight]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2990 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2991 /* Handle the ranged widgets */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2992 else if([ object isMemberOfClass:[DWPercent class] ] || |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2993 [ object isMemberOfClass:[DWSlider class] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2994 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2995 thiswidth = 100; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2996 thisheight = 20; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2997 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2998 /* Handle bitmap size */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
2999 else if([ object isMemberOfClass:[UIImageView class] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3000 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3001 UIImage *image = (UIImage *)[object image]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3002 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3003 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3004 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
3005 CGSize size = [image size]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3006 thiswidth = (int)size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3007 thisheight = (int)size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3008 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3009 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3010 /* Handle calendar */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3011 else if([ object isMemberOfClass:[DWCalendar class] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3012 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3013 CGSize size = [object intrinsicContentSize]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3014 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3015 thiswidth = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3016 thisheight = size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3017 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3018 /* MLE and Container */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3019 else if([ object isMemberOfClass:[DWMLE class] ] || |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3020 [ object isMemberOfClass:[DWContainer class] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3021 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
3022 CGSize size; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3023 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3024 if([ object isMemberOfClass:[DWMLE class] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3025 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3026 UIScrollView *sv = [object scrollview]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3027 CGRect frame = [sv frame]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3028 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3029 /* Size the text view to fit */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3030 [object sizeToFit]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3031 frame.size = [object bounds].size; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3032 frame.size.width += 2.0; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3033 frame.size.height += 2.0; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3034 [sv setFrame:frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3035 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3036 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3037 size = [object getsize]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3038 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3039 thiswidth = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3040 thisheight = size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3041 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3042 if(thiswidth < _DW_SCROLLED_MIN_WIDTH) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3043 thiswidth = _DW_SCROLLED_MIN_WIDTH; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3044 if(thiswidth > _DW_SCROLLED_MAX_WIDTH) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3045 thiswidth = _DW_SCROLLED_MAX_WIDTH; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3046 if(thisheight < _DW_SCROLLED_MIN_HEIGHT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3047 thisheight = _DW_SCROLLED_MIN_HEIGHT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3048 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3049 thisheight = _DW_SCROLLED_MAX_HEIGHT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3050 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3051 /* Any other control type */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3052 else if([ object isKindOfClass:[ UIControl class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3053 nsstr = [object stringValue]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3054 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3055 /* If we have a string... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3056 * calculate the size with the current font. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3057 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3058 if(nsstr && [nsstr length]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3059 dw_font_text_extents_get(object, NULL, (char *)[nsstr UTF8String], &thiswidth, &thisheight); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3060 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3061 /* Handle static text fields */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3062 if([object isKindOfClass:[ UITextField class ]] && ![object isEditable]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3063 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3064 extrawidth = 10; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3065 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3066 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3067 /* Set the requested sizes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3068 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3069 *width = thiswidth + extrawidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3070 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3071 *height = thisheight + extraheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3072 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3073 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3074 /* Internal box packing function called by the other 3 functions */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3075 void _dw_box_pack(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad, char *funcname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3076 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3077 id object = box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3078 DWBox *view = box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3079 DWBox *this = item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3080 Box *thisbox; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3081 int z, x = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3082 Item *tmpitem, *thisitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3083 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3084 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3085 * If you try and pack an item into itself VERY bad things can happen; like at least an |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3086 * infinite loop on GTK! Lets be safe! |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3087 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3088 if(box == item) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3089 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3090 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3091 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3092 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3093 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3094 /* Query the objects */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3095 if([ object isKindOfClass:[ UIWindow class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3096 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3097 UIWindow *window = box; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3098 NSArray *subviews = [window subviews]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3099 view = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3100 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3101 else if([ object isMemberOfClass:[ DWScrollBox class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3102 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3103 DWScrollBox *scrollbox = box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3104 view = [scrollbox box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3105 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3106 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3107 thisbox = [view box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3108 thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3109 object = item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3110 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3111 /* Query the objects */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3112 if([ object isMemberOfClass:[ DWContainer class ] ] || |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3113 [ object isMemberOfClass:[ DWMLE class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3114 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3115 this = item = [object scrollview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3116 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3117 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3118 /* Do some sanity bounds checking */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3119 if(!thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3120 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3121 if(index < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3122 index = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3123 if(index > thisbox->count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3124 index = thisbox->count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3125 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3126 /* Duplicate the existing data */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3127 tmpitem = calloc(sizeof(Item), (thisbox->count+1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3128 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3129 for(z=0;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3130 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3131 if(z == index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3132 x++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3133 tmpitem[x] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3134 x++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3135 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3136 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3137 /* Sanity checks */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3138 if(vsize && !height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3139 height = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3140 if(hsize && !width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3141 width = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3142 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3143 /* Fill in the item data appropriately */ |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3144 if([object isKindOfClass:[DWBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3145 tmpitem[index].type = TYPEBOX; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3146 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3147 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3148 if ( width == 0 && hsize == FALSE ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3149 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3150 if ( height == 0 && vsize == FALSE ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3151 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3152 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3153 tmpitem[index].type = TYPEITEM; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3154 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3155 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3156 tmpitem[index].hwnd = item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3157 tmpitem[index].origwidth = tmpitem[index].width = width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3158 tmpitem[index].origheight = tmpitem[index].height = height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3159 tmpitem[index].pad = pad; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3160 tmpitem[index].hsize = hsize ? SIZEEXPAND : SIZESTATIC; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3161 tmpitem[index].vsize = vsize ? SIZEEXPAND : SIZESTATIC; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3162 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3163 /* If either of the parameters are -1 ... calculate the size */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3164 if(width == -1 || height == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3165 _dw_control_size(object, width == -1 ? &tmpitem[index].width : NULL, height == -1 ? &tmpitem[index].height : NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3166 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3167 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3168 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3169 /* Update the item count */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3170 thisbox->count++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3171 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3172 /* Add the item to the box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3173 [view addSubview:this]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3174 /* Enable autorelease on the item... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3175 * so it will get destroyed when the parent is. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3176 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3177 [this autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3178 /* If we are packing a button... */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3179 if([this isMemberOfClass:[DWButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3180 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3181 DWButton *button = (DWButton *)this; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3182 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3183 /* Save the parent box so radio |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3184 * buttons can use it later. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3185 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3186 [button setParent:view]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3187 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3188 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3189 _dw_redraw([view window], TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3190 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3191 /* Free the old data */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3192 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3193 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3194 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3195 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3196 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3197 * Remove windows (widgets) from the box they are packed into. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3198 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3199 * handle: Window handle of the packed item to be removed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3200 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3201 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3202 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3203 DW_FUNCTION_DEFINITION(dw_box_unpack, int, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3204 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3205 DW_FUNCTION_RETURN(dw_box_unpack, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3206 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3207 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3208 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3209 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3210 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3211 int retval = DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3212 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3213 if([object isKindOfClass:[UIView class]] || [object isKindOfClass:[UIControl class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3214 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3215 DWBox *parent = (DWBox *)[object superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3216 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3217 /* Some controls are embedded in scrollviews... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3218 * so get the parent of the scrollview in that case. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3219 */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3220 if(([object isKindOfClass:[UITableView class]] || [object isMemberOfClass:[DWMLE class]])) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3221 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3222 object = [parent superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3223 parent = (DWBox *)[object superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3224 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3225 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3226 if([parent isKindOfClass:[DWBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3227 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3228 id window = [object window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3229 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3230 int z, index = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3231 Item *tmpitem = NULL, *thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3232 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3233 if(!thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3234 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3235 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3236 for(z=0;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3237 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3238 if(thisitem[z].hwnd == object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3239 index = z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3240 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3241 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3242 if(index == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3243 retval = DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3244 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3245 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3246 [object retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3247 [object removeFromSuperview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3248 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3249 if(thisbox->count > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3250 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3251 tmpitem = calloc(sizeof(Item), (thisbox->count-1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3252 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3253 /* Copy all but the current entry to the new list */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3254 for(z=0;z<index;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3255 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3256 tmpitem[z] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3258 for(z=index+1;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3259 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3260 tmpitem[z-1] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3261 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3262 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3263 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3264 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3265 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3266 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3267 if(tmpitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3268 thisbox->count--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3269 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3270 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3271 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3272 _dw_redraw(window, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3273 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3274 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3275 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3276 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3277 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3278 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3279 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3280 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3281 * Remove windows (widgets) from a box at an arbitrary location. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3282 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3283 * box: Window handle of the box to be removed from. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3284 * index: 0 based index of packed items. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3285 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3286 * Handle to the removed item on success, 0 on failure or padding. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3287 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3288 DW_FUNCTION_DEFINITION(dw_box_unpack_at_index, HWND, HWND box, int index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3289 DW_FUNCTION_ADD_PARAM2(box, index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3290 DW_FUNCTION_RETURN(dw_box_unpack_at_index, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3291 DW_FUNCTION_RESTORE_PARAM2(box, HWND, index, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3292 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3293 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3294 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3295 DWBox *parent = (DWBox *)box; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3296 id object = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3297 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3298 if([parent isKindOfClass:[DWBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3299 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3300 id window = [parent window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3301 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3302 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3303 if(thisbox && index > -1 && index < thisbox->count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3304 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3305 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3306 Item *tmpitem = NULL, *thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3307 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3308 object = thisitem[index].hwnd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3309 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3310 if(object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3311 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3312 [object retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3313 [object removeFromSuperview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3314 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3315 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3316 if(thisbox->count > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3317 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3318 tmpitem = calloc(sizeof(Item), (thisbox->count-1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3319 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3320 /* Copy all but the current entry to the new list */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3321 for(z=0;thisitem && z<index;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3322 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3323 tmpitem[z] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3324 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3325 for(z=index+1;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3326 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3327 tmpitem[z-1] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3328 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3329 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3330 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3331 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3332 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3333 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3334 if(tmpitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3335 thisbox->count--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3336 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3337 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3338 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3339 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3340 _dw_redraw(window, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3341 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3342 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3343 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3344 DW_FUNCTION_RETURN_THIS(object); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3345 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3346 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3347 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3348 * Pack windows (widgets) into a box at an arbitrary location. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3349 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3350 * box: Window handle of the box to be packed into. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3351 * item: Window handle of the item to pack. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3352 * index: 0 based index of packed items. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3353 * width: Width in pixels of the item or -1 to be self determined. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3354 * height: Height in pixels of the item or -1 to be self determined. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3355 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3356 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3357 * pad: Number of pixels of padding around the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3358 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3359 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3360 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3361 _dw_box_pack(box, item, index, width, height, hsize, vsize, pad, "dw_box_pack_at_index()"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3362 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3363 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3364 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3365 * Pack windows (widgets) into a box from the start (or top). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3366 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3367 * box: Window handle of the box to be packed into. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3368 * item: Window handle of the item to pack. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3369 * width: Width in pixels of the item or -1 to be self determined. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3370 * height: Height in pixels of the item or -1 to be self determined. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3371 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3372 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3373 * pad: Number of pixels of padding around the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3374 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3375 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3376 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3377 /* 65536 is the table limit on GTK... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3378 * seems like a high enough value we will never hit it here either. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3379 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3380 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3381 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3382 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3383 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3384 * Pack windows (widgets) into a box from the end (or bottom). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3385 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3386 * box: Window handle of the box to be packed into. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3387 * item: Window handle of the item to pack. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3388 * width: Width in pixels of the item or -1 to be self determined. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3389 * height: Height in pixels of the item or -1 to be self determined. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3390 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3391 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3392 * pad: Number of pixels of padding around the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3393 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3394 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3395 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3396 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3397 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3398 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3399 /* Internal function to create a basic button, used by all button types */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3400 HWND _dw_button_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3401 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3402 DWButton *button = [[DWButton alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3403 if(text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3404 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3405 [button setTitle:[NSString stringWithUTF8String:text] forState:UIControlStateNormal]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3406 } |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3407 [button addTarget:button |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3408 action:@selector(buttonClicked:) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3409 forControlEvents:UIControlEventPrimaryActionTriggered]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3410 [button setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3411 if(DWDefaultFont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3412 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3413 [[button titleLabel] setFont:DWDefaultFont]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3414 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3415 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3416 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3417 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3418 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3419 * Create a new button window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3420 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3421 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3422 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3423 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3424 HWND API dw_button_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3425 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3426 DWButton *button = _dw_button_new(text, cid); |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3427 [button setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3428 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3429 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3430 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3431 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3432 * Create a new Entryfield window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3433 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3434 * text: The default text to be in the entryfield widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3435 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3436 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3437 HWND API dw_entryfield_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3438 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3439 DWEntryField *entry = [[DWEntryField alloc] init]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3440 [entry setText:[ NSString stringWithUTF8String:text ]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3441 [entry setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3442 return entry; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3443 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3444 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3445 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3446 * Create a new Entryfield (password) window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3447 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3448 * text: The default text to be in the entryfield widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3449 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3450 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3451 HWND API dw_entryfield_password_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3452 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3453 DWEntryField *entry = dw_entryfield_new(text, cid); |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3454 [entry setSecureTextEntry:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3455 return entry; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3456 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3457 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3458 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3459 * Sets the entryfield character limit. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3460 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3461 * handle: Handle to the spinbutton to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3462 * limit: Number of characters the entryfield will take. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3463 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3464 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3465 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
3466 #if 0 /* TODO: Implment this via textField:shouldChangeCharactersInRange:replacementString: */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3467 DWEntryField *entry = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3468 DWEntryFieldFormatter *formatter = [[[DWEntryFieldFormatter alloc] init] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3469 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3470 [formatter setMaximumLength:(int)limit]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3471 [entry setFormatter:formatter]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
3472 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3473 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3474 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3475 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3476 * Create a new bitmap button window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3477 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3478 * text: Bubble help text to be displayed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3479 * id: An ID of a bitmap in the resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3480 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3481 HWND API dw_bitmapbutton_new(const char *text, ULONG resid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3482 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3483 NSBundle *bundle = [NSBundle mainBundle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3484 NSString *respath = [bundle resourcePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3485 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3486 UIImage *image = [[UIImage alloc] initWithContentsOfFile:filepath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3487 DWButton *button = _dw_button_new("", resid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3488 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3489 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3490 [button setImage:image forState:UIControlStateNormal]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3491 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3492 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3493 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3494 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3495 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3496 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3497 * Create a new bitmap button window (widget) to be packed from a file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3498 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3499 * text: Bubble help text to be displayed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3500 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3501 * filename: Name of the file, omit extention to have |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3502 * DW pick the appropriate file extension. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3503 * (BMP on OS/2 or Windows, XPM on Unix) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3504 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3505 HWND API dw_bitmapbutton_new_from_file(const char *text, unsigned long cid, const char *filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3506 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3507 char *ext = _dw_get_image_extension(filename); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3508 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3509 NSString *nstr = [ NSString stringWithUTF8String:filename ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3510 UIImage *image = [[UIImage alloc] initWithContentsOfFile:nstr]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3511 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3512 if(!image && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3513 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3514 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3515 image = [[UIImage alloc] initWithContentsOfFile:nstr]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3516 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3517 DWButton *button = _dw_button_new("", cid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3518 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3519 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3520 [button setImage:image forState:UIControlStateNormal]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3521 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3522 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3523 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3524 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3525 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3526 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3527 * Create a new bitmap button window (widget) to be packed from data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3528 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3529 * text: Bubble help text to be displayed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3530 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3531 * data: The contents of the image |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3532 * (BMP or ICO on OS/2 or Windows, XPM on Unix) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3533 * len: length of str |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3534 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3535 HWND API dw_bitmapbutton_new_from_data(const char *text, unsigned long cid, const char *data, int len) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3536 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3537 NSData *thisdata = [NSData dataWithBytes:data length:len]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3538 UIImage *image = [[UIImage alloc] initWithData:thisdata]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3539 DWButton *button = _dw_button_new("", cid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3540 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3541 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3542 [button setImage:image forState:UIControlStateNormal]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3543 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3544 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3545 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3546 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3547 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3548 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3549 * Create a new spinbutton window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3550 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3551 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3552 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3553 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3554 HWND API dw_spinbutton_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3555 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3556 DWSpinButton *spinbutton = [[DWSpinButton alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3557 UIStepper *stepper = [spinbutton stepper]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3558 UITextField *textfield = [spinbutton textfield]; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3559 long val = atol(text); |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3560 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3561 [stepper setStepValue:1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3562 [stepper setTag:cid]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3563 [stepper setMinimumValue:-65536]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3564 [stepper setMaximumValue:65536]; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3565 [stepper setValue:(float)val]; |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3566 [textfield setText:[NSString stringWithFormat:@"%ld",val]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3567 return spinbutton; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3568 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3569 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3570 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3571 * Sets the spinbutton value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3572 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3573 * handle: Handle to the spinbutton to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3574 * position: Current value of the spinbutton. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3575 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3576 void API dw_spinbutton_set_pos(HWND handle, long position) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3577 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3578 DWSpinButton *spinbutton = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3579 UIStepper *stepper = [spinbutton stepper]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3580 UITextField *textfield = [spinbutton textfield]; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3581 [stepper setValue:(float)position]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3582 [textfield setText:[NSString stringWithFormat:@"%ld",position]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3583 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3584 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3585 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3586 * Sets the spinbutton limits. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3587 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3588 * handle: Handle to the spinbutton to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3589 * upper: Upper limit. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3590 * lower: Lower limit. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3591 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3592 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3593 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3594 DWSpinButton *spinbutton = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3595 UIStepper *stepper = [spinbutton stepper]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3596 [stepper setMinimumValue:(double)lower]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3597 [stepper setMaximumValue:(double)upper]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3598 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3599 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3600 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3601 * Returns the current value of the spinbutton. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3602 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3603 * handle: Handle to the spinbutton to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3604 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3605 long API dw_spinbutton_get_pos(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3606 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3607 DWSpinButton *spinbutton = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3608 UIStepper *stepper = [spinbutton stepper]; |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3609 return (long)[stepper value]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3610 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3611 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3612 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3613 * Create a new radiobutton window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3614 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3615 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3616 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3617 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3618 HWND API dw_radiobutton_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3619 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3620 DWButton *button = _dw_button_new(text, cid); |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3621 /* TODO: Customize to be a radio button https://github.com/DavydLiu/DLRadioButton */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3622 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3623 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3624 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3625 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3626 * Create a new slider window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3627 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3628 * vertical: TRUE or FALSE if slider is vertical. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3629 * increments: Number of increments available. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3630 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3631 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3632 HWND API dw_slider_new(int vertical, int increments, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3633 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3634 DWSlider *slider = [[DWSlider alloc] init]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3635 [slider setMaximumValue:(double)increments]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3636 [slider setMinimumValue:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3637 [slider setContinuous:YES]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
3638 [slider addTarget:slider |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
3639 action:@selector(sliderChanged:) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
3640 forControlEvents:UIControlEventValueChanged]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3641 [slider setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3642 return slider; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3643 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3644 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3645 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3646 * Returns the position of the slider. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3647 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3648 * handle: Handle to the slider to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3649 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3650 unsigned int API dw_slider_get_pos(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3651 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3652 DWSlider *slider = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3653 double val = [slider value]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3654 return (int)val; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3655 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3656 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3657 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3658 * Sets the slider position. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3659 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3660 * handle: Handle to the slider to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3661 * position: Position of the slider withing the range. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3662 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3663 void API dw_slider_set_pos(HWND handle, unsigned int position) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3664 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3665 DWSlider *slider = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3666 [slider setValue:(double)position]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3667 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3668 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3669 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3670 * Create a new scrollbar window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3671 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3672 * vertical: TRUE or FALSE if scrollbar is vertical. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3673 * increments: Number of increments available. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3674 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3675 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3676 HWND API dw_scrollbar_new(int vertical, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3677 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3678 /*TODO: Implement scrollbars if possible */ |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3679 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3680 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3681 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3682 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3683 * Returns the position of the scrollbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3684 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3685 * handle: Handle to the scrollbar to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3686 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3687 unsigned int API dw_scrollbar_get_pos(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3688 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3689 /*TODO: Implement scrollbars if possible */ |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3690 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3691 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3692 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3693 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3694 * Sets the scrollbar position. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3695 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3696 * handle: Handle to the scrollbar to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3697 * position: Position of the scrollbar withing the range. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3698 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3699 void API dw_scrollbar_set_pos(HWND handle, unsigned int position) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3700 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3701 /*TODO: Implement scrollbars if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3702 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3703 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3704 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3705 * Sets the scrollbar range. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3706 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3707 * handle: Handle to the scrollbar to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3708 * range: Maximum range value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3709 * visible: Visible area relative to the range. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3710 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3711 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3712 { |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3713 /*TODO: Implement scrollbars if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3714 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3715 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3716 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3717 * Create a new percent bar window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3718 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3719 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3720 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3721 HWND API dw_percent_new(ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3722 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3723 DWPercent *percent = [[DWPercent alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3724 /*[percent setTag:cid]; Why doesn't this work? */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3725 return percent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3726 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3727 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3728 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3729 * Sets the percent bar position. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3730 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3731 * handle: Handle to the percent bar to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3732 * position: Position of the percent bar withing the range. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3733 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3734 DW_FUNCTION_DEFINITION(dw_percent_set_pos, void, HWND handle, unsigned int position) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3735 DW_FUNCTION_ADD_PARAM2(handle, position) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3736 DW_FUNCTION_NO_RETURN(dw_percent_set_pos) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3737 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, position, unsigned int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3738 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3739 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3740 DWPercent *percent = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3741 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3742 /* Handle indeterminate */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3743 if(position == DW_PERCENT_INDETERMINATE) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3744 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3745 [percent setProgress:0 animated:NO]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3746 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3747 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3748 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3749 /* Handle normal */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3750 [percent setProgress:(float)position/100.0 animated:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3751 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3752 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3753 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3754 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3755 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3756 * Create a new checkbox window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3757 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3758 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3759 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3760 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3761 HWND API dw_checkbox_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3762 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3763 DWButton *button = _dw_button_new(text, cid); |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
3764 /* TODO: Switch to UISwitch control with text */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3765 return button; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3766 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3767 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3768 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3769 * Returns the state of the checkbox. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3770 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3771 * handle: Handle to the checkbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3772 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3773 int API dw_checkbox_get(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3774 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3775 DWButton *button = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3776 if([button state]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3777 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3778 return TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3779 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3780 return FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3781 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3782 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3783 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3784 * Sets the state of the checkbox. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3785 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3786 * handle: Handle to the checkbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3787 * value: TRUE for checked, FALSE for unchecked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3788 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3789 void API dw_checkbox_set(HWND handle, int value) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3790 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3791 #if 0 /* TODO: Convert to UISwitch */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3792 DWButton *button = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3793 if(value) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3794 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3795 [button setState:DWControlStateValueOn]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3796 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3797 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3798 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3799 [button setState:DWControlStateValueOff]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3800 } |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3801 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3802 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3803 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3804 /* Internal common function to create containers and listboxes */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3805 HWND _dw_cont_new(ULONG cid, int multi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3806 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3807 DWContainer *cont = [[DWContainer alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3808 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3809 [cont setAllowsMultipleSelection:(multi ? YES : NO)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3810 [cont setDataSource:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3811 [cont setDelegate:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3812 [cont setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3813 [cont autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3814 [cont setRowBgOdd:DW_RGB_TRANSPARENT andEven:DW_RGB_TRANSPARENT]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3815 return cont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3816 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3817 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3818 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3819 * Create a new listbox window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3820 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3821 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3822 * multi: Multiple select TRUE or FALSE. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3823 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3824 DW_FUNCTION_DEFINITION(dw_listbox_new, HWND, ULONG cid, int multi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3825 DW_FUNCTION_ADD_PARAM2(cid, multi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3826 DW_FUNCTION_RETURN(dw_listbox_new, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3827 DW_FUNCTION_RESTORE_PARAM2(cid, ULONG, multi, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3828 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3829 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3830 DWContainer *cont = _dw_cont_new(cid, multi); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3831 [cont setup]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3832 DW_FUNCTION_RETURN_THIS(cont); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3833 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3834 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3835 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3836 * Appends the specified text to the listbox's (or combobox) entry list. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3837 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3838 * handle: Handle to the listbox to be appended to. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3839 * text: Text to append into listbox. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3840 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3841 DW_FUNCTION_DEFINITION(dw_listbox_append, void, HWND handle, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3842 DW_FUNCTION_ADD_PARAM2(handle, text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3843 DW_FUNCTION_NO_RETURN(dw_listbox_append) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3844 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3845 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3846 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3847 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3848 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3849 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3850 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3851 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3852 NSString *nstr = [NSString stringWithUTF8String:text]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3853 NSArray *newrow = [NSArray arrayWithObject:_dw_table_cell_view_new(nil, nstr)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3854 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3855 [cont addRow:newrow]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3856 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3857 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3858 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3859 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3860 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3861 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3862 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3863 * Inserts the specified text into the listbox's (or combobox) entry list. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3864 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3865 * handle: Handle to the listbox to be inserted into. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3866 * text: Text to insert into listbox. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3867 * pos: 0-based position to insert text |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3868 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3869 DW_FUNCTION_DEFINITION(dw_listbox_insert, void, HWND handle, const char *text, int pos) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3870 DW_FUNCTION_ADD_PARAM3(handle, text, pos) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3871 DW_FUNCTION_NO_RETURN(dw_listbox_insert) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3872 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, text, const char *, pos, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3873 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3874 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3875 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3876 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3877 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3878 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3879 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3880 NSString *nstr = [NSString stringWithUTF8String:text]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3881 NSArray *newrow = [NSArray arrayWithObject:_dw_table_cell_view_new(nil, nstr)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3882 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3883 [cont insertRow:newrow at:pos]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3884 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3885 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3886 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3887 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3888 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3889 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3890 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3891 * Appends the specified text items to the listbox's (or combobox) entry list. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3892 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3893 * handle: Handle to the listbox to be appended to. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3894 * text: Text strings to append into listbox. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3895 * count: Number of text strings to append |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3896 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3897 DW_FUNCTION_DEFINITION(dw_listbox_list_append, void, HWND handle, char **text, int count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3898 DW_FUNCTION_ADD_PARAM3(handle, text, count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3899 DW_FUNCTION_NO_RETURN(dw_listbox_list_append) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3900 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, text, char **, count, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3901 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3902 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3903 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3904 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3905 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3906 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3907 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3908 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3909 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3910 for(z=0;z<count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3911 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3912 NSString *nstr = [NSString stringWithUTF8String:text[z]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3913 NSArray *newrow = [NSArray arrayWithObjects:_dw_table_cell_view_new(nil, nstr),nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3914 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3915 [cont addRow:newrow]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3916 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3917 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3918 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3919 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3920 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3921 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3922 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3923 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3924 * Clears the listbox's (or combobox) list of all entries. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3925 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3926 * handle: Handle to the listbox to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3927 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3928 DW_FUNCTION_DEFINITION(dw_listbox_clear, void, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3929 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3930 DW_FUNCTION_NO_RETURN(dw_listbox_clear) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3931 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3932 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3933 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3934 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3935 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3936 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3937 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3938 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3939 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3940 [cont clear]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3941 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
3942 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3943 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3944 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3945 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3946 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3947 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3948 * Returns the listbox's item count. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3949 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3950 * handle: Handle to the listbox to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3951 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3952 DW_FUNCTION_DEFINITION(dw_listbox_count, int, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3953 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3954 DW_FUNCTION_RETURN(dw_listbox_count, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3955 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3956 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3957 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3958 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3959 int result = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3960 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3961 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3962 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3963 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3964 result = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3965 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3966 DW_FUNCTION_RETURN_THIS(result); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3967 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3968 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3969 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3970 * Sets the topmost item in the viewport. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3971 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3972 * handle: Handle to the listbox to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3973 * top: Index to the top item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3974 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3975 DW_FUNCTION_DEFINITION(dw_listbox_set_top, void, HWND handle, int top) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3976 DW_FUNCTION_ADD_PARAM2(handle, top) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3977 DW_FUNCTION_NO_RETURN(dw_listbox_set_top) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3978 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, top, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3979 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3980 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3981 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3982 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
3983 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3984 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3985 DWContainer *cont = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3986 NSIndexPath *myIP = [NSIndexPath indexPathForRow:top inSection:0]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3987 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
3988 [cont scrollToRowAtIndexPath:myIP atScrollPosition:UITableViewScrollPositionNone animated:NO]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3989 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3990 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3991 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3992 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3993 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3994 * Copies the given index item's text into buffer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3995 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3996 * handle: Handle to the listbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3997 * index: Index into the list to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3998 * buffer: Buffer where text will be copied. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
3999 * length: Length of the buffer (including NULL). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4000 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4001 DW_FUNCTION_DEFINITION(dw_listbox_get_text, void, HWND handle, unsigned int index, char *buffer, unsigned int length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4002 DW_FUNCTION_ADD_PARAM4(handle, index, buffer, length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4003 DW_FUNCTION_NO_RETURN(dw_listbox_get_text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4004 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, index, unsigned int, buffer, char *, length, unsigned int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4005 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4006 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4007 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4008 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4009 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4010 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4011 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4012 int count = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4013 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4014 if(index > count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4015 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4016 *buffer = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4017 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4018 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4019 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4020 UITableViewCell *cell = [cont getRow:index and:0]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4021 NSString *nstr; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4022 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4023 if(@available(iOS 14.0, *)) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4024 { |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4025 UIListContentConfiguration *content = [cell defaultContentConfiguration]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4026 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4027 nstr = [content text]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4028 } |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4029 else |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4030 { |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4031 nstr = [cell text]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4032 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4033 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4034 strncpy(buffer, [nstr UTF8String], length - 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4035 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4036 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4037 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4038 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4039 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4040 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4041 * Sets the text of a given listbox entry. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4042 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4043 * handle: Handle to the listbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4044 * index: Index into the list to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4045 * buffer: Buffer where text will be copied. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4046 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4047 DW_FUNCTION_DEFINITION(dw_listbox_set_text, void, HWND handle, unsigned int index, const char *buffer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4048 DW_FUNCTION_ADD_PARAM3(handle, index, buffer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4049 DW_FUNCTION_NO_RETURN(dw_listbox_set_text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4050 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, index, unsigned int, buffer, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4051 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4052 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4053 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4054 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4055 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4056 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4057 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4058 int count = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4059 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4060 if(index <= count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4061 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4062 NSString *nstr = [NSString stringWithUTF8String:buffer]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4063 UITableViewCell *cell = [cont getRow:index and:0]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4064 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4065 if(@available(iOS 14.0, *)) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4066 { |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4067 UIListContentConfiguration *content = [cell defaultContentConfiguration]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4068 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4069 [content setText:nstr]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4070 } |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4071 else |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4072 { |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4073 [cell setText:nstr]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4074 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4075 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4076 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4077 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4078 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4079 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4080 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4081 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4082 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4083 * Returns the index to the item in the list currently selected. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4084 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4085 * handle: Handle to the listbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4086 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4087 DW_FUNCTION_DEFINITION(dw_listbox_selected, int, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4088 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4089 DW_FUNCTION_RETURN(dw_listbox_selected, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4090 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4091 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4092 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4093 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4094 int result = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4095 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4096 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4097 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4098 DWContainer *cont = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4099 NSIndexPath *ip = [cont indexPathForSelectedRow]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4100 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4101 if(ip) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4102 result = (int)ip.row; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4103 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4104 DW_FUNCTION_RETURN_THIS(result); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4105 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4106 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4107 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4108 * Returns the index to the current selected item or -1 when done. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4109 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4110 * handle: Handle to the listbox to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4111 * where: Either the previous return or -1 to restart. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4112 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4113 DW_FUNCTION_DEFINITION(dw_listbox_selected_multi, int, HWND handle, int where) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4114 DW_FUNCTION_ADD_PARAM2(handle, where) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4115 DW_FUNCTION_RETURN(dw_listbox_selected_multi, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4116 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, where, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4117 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4118 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4119 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4120 int retval = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4121 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4122 if([object isMemberOfClass:[DWContainer class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4123 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4124 DWContainer *cont = handle; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
4125 NSArray *selected = [cont indexPathsForSelectedRows]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4126 NSIndexPath *ip = [selected objectAtIndex:(where == -1 ? 0 :where)]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4127 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4128 if(ip) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4129 retval = (int)ip.row; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4130 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4131 DW_FUNCTION_RETURN_THIS(retval) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4132 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4133 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4134 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4135 * Sets the selection state of a given index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4136 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4137 * handle: Handle to the listbox to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4138 * index: Item index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4139 * state: TRUE if selected FALSE if unselected. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4140 */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4141 DW_FUNCTION_DEFINITION(dw_listbox_select, void, HWND handle, int index, DW_UNUSED(int state)) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4142 DW_FUNCTION_ADD_PARAM3(handle, index, state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4143 DW_FUNCTION_NO_RETURN(dw_listbox_select) |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4144 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, index, int, DW_UNUSED(state), int) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4145 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4146 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4147 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4148 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4149 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4150 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4151 DWContainer *cont = handle; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4152 NSIndexPath *ip = [NSIndexPath indexPathForRow:index inSection:0]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4153 |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4154 [cont selectRowAtIndexPath:ip |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4155 animated:NO |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4156 scrollPosition:UITableViewScrollPositionNone]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4157 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4158 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4159 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4160 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4161 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4162 * Deletes the item with given index from the list. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4163 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4164 * handle: Handle to the listbox to be set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4165 * index: Item index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4166 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4167 DW_FUNCTION_DEFINITION(dw_listbox_delete, void, HWND handle, int index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4168 DW_FUNCTION_ADD_PARAM2(handle, index) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4169 DW_FUNCTION_NO_RETURN(dw_listbox_delete) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4170 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, index, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4171 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4172 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4173 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4174 |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4175 if([object isMemberOfClass:[DWContainer class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4176 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4177 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4178 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4179 [cont removeRow:index]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4180 [cont reloadData]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4181 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4182 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4183 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4184 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4185 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4186 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4187 * Create a new Combobox window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4188 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4189 * text: The default text to be in the combpbox widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4190 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4191 */ |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4192 HWND API dw_combobox_new(const char *text, ULONG cid) |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4193 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4194 /* TODO: Implment comboboxes. https://www.codeproject.com/Articles/301681/iPhone-ComboBox */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
4195 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4196 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4197 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4198 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4199 * Create a new Multiline Editbox window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4200 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4201 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4202 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4203 HWND API dw_mle_new(ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4204 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4205 DWMLE *mle = [[DWMLE alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4206 UIScrollView *scrollview = [[UIScrollView alloc] init]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4207 CGSize size = [mle intrinsicContentSize]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4208 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4209 size.width = size.height; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4210 [mle setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4211 [mle setScrollview:scrollview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4212 /* [mle setTag:cid]; Why doesn't this work? */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4213 [mle autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4214 return mle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4215 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4216 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4217 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4218 * Adds text to an MLE box and returns the current point. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4219 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4220 * handle: Handle to the MLE to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4221 * buffer: Text buffer to be imported. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4222 * startpoint: Point to start entering text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4223 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4224 DW_FUNCTION_DEFINITION(dw_mle_import, unsigned int, HWND handle, const char *buffer, int startpoint) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4225 DW_FUNCTION_ADD_PARAM3(handle, buffer, startpoint) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4226 DW_FUNCTION_RETURN(dw_mle_import, unsigned int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4227 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, buffer, const char *, startpoint, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4228 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4229 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4230 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4231 unsigned int retval; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4232 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4233 NSString *nstr = [NSString stringWithUTF8String:buffer]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4234 NSAttributedString *nastr = [[NSAttributedString alloc] initWithString:nstr]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4235 NSUInteger length = [ts length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4236 if(startpoint < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4237 startpoint = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4238 if(startpoint > length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4239 startpoint = (int)length; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4240 [ts insertAttributedString:nastr atIndex:startpoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4241 retval = (unsigned int)strlen(buffer) + startpoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4242 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4243 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4244 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4245 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4246 * Grabs text from an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4247 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4248 * handle: Handle to the MLE to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4249 * buffer: Text buffer to be exported. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4250 * startpoint: Point to start grabbing text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4251 * length: Amount of text to be grabbed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4252 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4253 DW_FUNCTION_DEFINITION(dw_mle_export, void, HWND handle, char *buffer, int startpoint, int length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4254 DW_FUNCTION_ADD_PARAM4(handle, buffer, startpoint, length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4255 DW_FUNCTION_NO_RETURN(dw_mle_export) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4256 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, buffer, char *, startpoint, int, length, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4257 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4258 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4259 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4260 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4261 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4262 const char *tmp = [ms UTF8String]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4263 strncpy(buffer, tmp+startpoint, length); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4264 buffer[length] = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4265 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4266 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4267 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4268 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4269 * Obtains information about an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4270 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4271 * handle: Handle to the MLE to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4272 * bytes: A pointer to a variable to return the total bytes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4273 * lines: A pointer to a variable to return the number of lines. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4274 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4275 DW_FUNCTION_DEFINITION(dw_mle_get_size, void, HWND handle, unsigned long *bytes, unsigned long *lines) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4276 DW_FUNCTION_ADD_PARAM3(handle, bytes, lines) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4277 DW_FUNCTION_NO_RETURN(dw_mle_get_size) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4278 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, bytes, unsigned long *, lines, unsigned long *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4279 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4280 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4281 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4282 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4283 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4284 NSUInteger numberOfLines, index, stringLength = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4285 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4286 if(bytes) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4287 *bytes = stringLength; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4288 if(lines) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4289 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4290 for(index=0, numberOfLines=0; index < stringLength; numberOfLines++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4291 index = NSMaxRange([ms lineRangeForRange:NSMakeRange(index, 0)]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4292 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4293 *lines = numberOfLines; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4294 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4295 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4296 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4297 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4298 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4299 * Deletes text from an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4300 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4301 * handle: Handle to the MLE to be deleted from. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4302 * startpoint: Point to start deleting text. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4303 * length: Amount of text to be deleted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4304 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4305 DW_FUNCTION_DEFINITION(dw_mle_delete, void, HWND handle, int startpoint, int length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4306 DW_FUNCTION_ADD_PARAM3(handle, startpoint, length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4307 DW_FUNCTION_NO_RETURN(dw_mle_delete) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4308 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, startpoint, int, length, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4309 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4310 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4311 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4312 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4313 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4314 NSUInteger mslength = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4315 if(startpoint < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4316 startpoint = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4317 if(startpoint > mslength) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4318 startpoint = (int)mslength; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4319 if(startpoint + length > mslength) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4320 length = (int)mslength - startpoint; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4321 [ms deleteCharactersInRange:NSMakeRange(startpoint, length)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4322 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4323 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4324 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4325 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4326 * Clears all text from an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4327 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4328 * handle: Handle to the MLE to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4329 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4330 DW_FUNCTION_DEFINITION(dw_mle_clear, void, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4331 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4332 DW_FUNCTION_NO_RETURN(dw_mle_clear) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4333 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4334 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4335 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4336 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4337 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4338 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4339 NSUInteger length = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4340 [ms deleteCharactersInRange:NSMakeRange(0, length)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4341 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4342 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4343 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4344 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4345 * Sets the visible line of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4346 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4347 * handle: Handle to the MLE to be positioned. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4348 * line: Line to be visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4349 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4350 DW_FUNCTION_DEFINITION(dw_mle_set_visible, void, HWND handle, int line) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4351 DW_FUNCTION_ADD_PARAM2(handle, line) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4352 DW_FUNCTION_NO_RETURN(dw_mle_set_visible) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4353 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, line, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4354 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4355 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4356 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4357 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4358 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4359 NSUInteger numberOfLines, index, stringLength = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4360 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4361 for(index=0, numberOfLines=0; index < stringLength && numberOfLines < line; numberOfLines++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4362 index = NSMaxRange([ms lineRangeForRange:NSMakeRange(index, 0)]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4363 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4364 if(line == numberOfLines) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4365 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4366 [mle scrollRangeToVisible:[ms lineRangeForRange:NSMakeRange(index, 0)]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4367 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4368 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4369 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4370 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4371 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4372 * Sets the editablity of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4373 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4374 * handle: Handle to the MLE. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4375 * state: TRUE if it can be edited, FALSE for readonly. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4376 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4377 void API dw_mle_set_editable(HWND handle, int state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4378 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4379 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4380 if(state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4381 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4382 [mle setEditable:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4383 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4384 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4385 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4386 [mle setEditable:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4387 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4388 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4389 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4390 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4391 * Sets the word wrap state of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4392 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4393 * handle: Handle to the MLE. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4394 * state: TRUE if it wraps, FALSE if it doesn't. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4395 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4396 void API dw_mle_set_word_wrap(HWND handle, int state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4397 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4398 /* TODO: Figure out how to do this in iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4399 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4400 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4401 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4402 * Sets the word auto complete state of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4403 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4404 * handle: Handle to the MLE. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4405 * state: Bitwise combination of DW_MLE_COMPLETE_TEXT/DASH/QUOTE |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4406 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4407 void API dw_mle_set_auto_complete(HWND handle, int state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4408 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4409 /* TODO: Figure out how to do this in iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4410 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4411 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4412 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4413 * Sets the current cursor position of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4414 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4415 * handle: Handle to the MLE to be positioned. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4416 * point: Point to position cursor. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4417 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4418 DW_FUNCTION_DEFINITION(dw_mle_set_cursor, void, HWND handle, int point) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4419 DW_FUNCTION_ADD_PARAM2(handle, point) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4420 DW_FUNCTION_NO_RETURN(dw_mle_set_cursor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4421 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, point, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4422 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4423 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4424 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4425 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4426 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4427 NSUInteger length = [ms length]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4428 if(point < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4429 point = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4430 if(point > length) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4431 point = (int)length; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4432 [mle setSelectedRange: NSMakeRange(point,point)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4433 [mle scrollRangeToVisible:NSMakeRange(point,point)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4434 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4435 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4436 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4437 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4438 * Finds text in an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4439 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4440 * handle: Handle to the MLE to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4441 * text: Text to search for. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4442 * point: Start point of search. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4443 * flags: Search specific flags. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4444 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4445 DW_FUNCTION_DEFINITION(dw_mle_search, int, HWND handle, const char *text, int point, unsigned long flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4446 DW_FUNCTION_ADD_PARAM4(handle, text, point, flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4447 DW_FUNCTION_RETURN(dw_mle_search, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4448 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, text, const char *, point, int, flags, unsigned long) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4449 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4450 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4451 DWMLE *mle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4452 NSTextStorage *ts = [mle textStorage]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4453 NSMutableString *ms = [ts mutableString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4454 NSString *searchForMe = [NSString stringWithUTF8String:text]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4455 NSRange searchRange = NSMakeRange(point, [ms length] - point); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4456 NSRange range = NSMakeRange(NSNotFound, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4457 NSUInteger options = flags ? flags : NSCaseInsensitiveSearch; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4458 int retval = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4459 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4460 if(ms) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4461 range = [ms rangeOfString:searchForMe options:options range:searchRange]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4462 if(range.location == NSNotFound) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4463 retval = (int)range.location; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4464 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4465 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4466 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4467 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4468 * Stops redrawing of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4469 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4470 * handle: Handle to the MLE to freeze. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4471 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4472 void API dw_mle_freeze(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4473 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4474 /* Don't think this is necessary */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4475 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4476 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4477 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4478 * Resumes redrawing of an MLE box. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4479 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4480 * handle: Handle to the MLE to thaw. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4481 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4482 void API dw_mle_thaw(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4483 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4484 /* Don't think this is necessary */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4485 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4486 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4487 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4488 * Create a new status text window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4489 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4490 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4491 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4492 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4493 HWND API dw_status_text_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4494 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4495 return dw_text_new(text, cid); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4496 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4497 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4498 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4499 * Create a new static text window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4500 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4501 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4502 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4503 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4504 HWND API dw_text_new(const char *text, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4505 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4506 DWText *textfield = [[DWText alloc] init]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4507 [textfield setText:[NSString stringWithUTF8String:text]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4508 [textfield setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4509 if(DWDefaultFont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4510 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4511 [textfield setFont:DWDefaultFont]; |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4512 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4513 return textfield; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4514 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4515 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4516 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4517 * Creates a rendering context widget (window) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4518 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4519 * id: An id to be used with dw_window_from_id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4520 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4521 * A handle to the widget or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4522 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4523 HWND API dw_render_new(unsigned long cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4524 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4525 DWRender *render = [[DWRender alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4526 [render setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4527 return render; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4528 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4529 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4530 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4531 * Invalidate the render widget triggering an expose event. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4532 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4533 * handle: A handle to a render widget to be redrawn. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4534 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4535 DW_FUNCTION_DEFINITION(dw_render_redraw, void, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4536 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4537 DW_FUNCTION_NO_RETURN(dw_render_redraw) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4538 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4539 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4540 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4541 DWRender *render = (DWRender *)handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4542 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4543 [render setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4544 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4545 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4546 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4547 /* Sets the current foreground drawing color. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4548 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4549 * red: red value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4550 * green: green value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4551 * blue: blue value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4552 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4553 void API dw_color_foreground_set(unsigned long value) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4554 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4555 UIColor *oldcolor = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4556 UIColor *newcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4557 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4558 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4559 _foreground = _get_color(value); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4560 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4561 newcolor = [[UIColor colorWithRed: DW_RED_VALUE(_foreground)/255.0 green: |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4562 DW_GREEN_VALUE(_foreground)/255.0 blue: |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4563 DW_BLUE_VALUE(_foreground)/255.0 alpha: 1] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4564 pthread_setspecific(_dw_fg_color_key, newcolor); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4565 [oldcolor release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4566 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4567 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4568 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4569 /* Sets the current background drawing color. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4570 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4571 * red: red value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4572 * green: green value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4573 * blue: blue value. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4574 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4575 void API dw_color_background_set(unsigned long value) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4576 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4577 UIColor *oldcolor = pthread_getspecific(_dw_bg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4578 UIColor *newcolor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4579 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4580 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4581 if(value == DW_CLR_DEFAULT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4582 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4583 pthread_setspecific(_dw_bg_color_key, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4584 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4585 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4586 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4587 _background = _get_color(value); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4588 |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4589 newcolor = [[UIColor colorWithRed: DW_RED_VALUE(_background)/255.0 green: |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4590 DW_GREEN_VALUE(_background)/255.0 blue: |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4591 DW_BLUE_VALUE(_background)/255.0 alpha: 1] retain]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4592 pthread_setspecific(_dw_bg_color_key, newcolor); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4593 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4594 [oldcolor release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4595 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4596 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4597 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4598 /* Allows the user to choose a color using the system's color chooser dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4599 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4600 * value: current color |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4601 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4602 * The selected color or the current color if cancelled. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4603 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4604 unsigned long API dw_color_choose(unsigned long value) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4605 { |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4606 #if 0 /* TODO: Implement this with UIColorPickerViewController */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4607 /* Create the Color Chooser Dialog class. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4608 DWColorChoose *colorDlg; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4609 DWDialog *dialog; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4610 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4611 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4612 if(![DWColorChoose sharedColorPanelExists]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4613 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4614 colorDlg = (DWColorChoose *)[DWColorChoose sharedColorPanel]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4615 /* Set defaults for the dialog. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4616 [colorDlg setContinuous:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4617 [colorDlg setTarget:colorDlg]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4618 [colorDlg setAction:@selector(changeColor:)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4619 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4620 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4621 colorDlg = (DWColorChoose *)[DWColorChoose sharedColorPanel]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4622 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4623 /* If someone is already waiting just return */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4624 if([colorDlg dialog]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4625 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4626 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4627 return value; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4628 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4629 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4630 unsigned long tempcol = _get_color(value); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4631 UIColor *color = [[UIColor colorWithDeviceRed: DW_RED_VALUE(tempcol)/255.0 green: DW_GREEN_VALUE(tempcol)/255.0 blue: DW_BLUE_VALUE(tempcol)/255.0 alpha: 1] retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4632 [colorDlg setColor:color]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4633 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4634 dialog = dw_dialog_new(colorDlg); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4635 [colorDlg setDialog:dialog]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4636 [colorDlg makeKeyAndOrderFront:nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4637 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4638 /* Wait for them to pick a color */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4639 color = (UIColor *)dw_dialog_wait(dialog); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4640 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4641 /* Figure out the value of what they returned */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4642 CGFloat red, green, blue; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4643 [color getRed:&red green:&green blue:&blue alpha:NULL]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4644 value = DW_RGB((int)(red * 255), (int)(green *255), (int)(blue *255)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4645 DW_LOCAL_POOL_OUT; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
4646 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4647 return value; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4648 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4649 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4650 CGContextRef _dw_draw_context(UIImage *image, bool antialiased) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4651 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4652 CGContextRef context; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4653 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4654 UIGraphicsBeginImageContext(image.size); |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4655 context = UIGraphicsGetCurrentContext(); |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4656 CGContextSetAllowsAntialiasing(context, antialiased); |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4657 return context; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4658 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4659 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4660 /* Draw a point on a window (preferably a render window). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4661 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4662 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4663 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4664 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4665 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4666 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4667 DW_FUNCTION_DEFINITION(dw_draw_point, void, HWND handle, HPIXMAP pixmap, int x, int y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4668 DW_FUNCTION_ADD_PARAM4(handle, pixmap, x, y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4669 DW_FUNCTION_NO_RETURN(dw_draw_point) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4670 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, pixmap, HPIXMAP, x, int, y, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4671 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4672 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4673 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4674 id image = handle; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4675 UIImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4676 bool bCanDraw = YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4677 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4678 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4679 bi = image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4680 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4681 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4682 if([image isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4683 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4684 DWRender *render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4685 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4686 bi = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4687 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4688 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4689 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4690 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4691 _dw_draw_context(bi, NO); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4692 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4693 if(bCanDraw == YES) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4694 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4695 UIBezierPath* aPath = [UIBezierPath bezierPath]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4696 [aPath setLineWidth: 0.5]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4697 UIColor *color = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4698 [color set]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4699 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4700 [aPath moveToPoint:CGPointMake(x, y)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4701 [aPath stroke]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4702 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4703 if(bi) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4704 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4705 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4706 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4707 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4708 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4709 /* Draw a line on a window (preferably a render window). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4710 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4711 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4712 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4713 * x1: First X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4714 * y1: First Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4715 * x2: Second X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4716 * y2: Second Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4717 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4718 DW_FUNCTION_DEFINITION(dw_draw_line, void, HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4719 DW_FUNCTION_ADD_PARAM6(handle, pixmap, x1, y1, x2, y2) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4720 DW_FUNCTION_NO_RETURN(dw_draw_line) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4721 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, pixmap, HPIXMAP, x1, int, y1, int, x2, int, y2, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4722 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4723 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4724 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4725 id image = handle; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4726 UIImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4727 bool bCanDraw = YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4728 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4729 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4730 bi = image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4731 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4732 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4733 if([image isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4734 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4735 DWRender *render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4736 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4737 bi = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4738 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4739 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4740 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4741 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4742 _dw_draw_context(bi, NO); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4743 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4744 if(bCanDraw == YES) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4745 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4746 UIBezierPath* aPath = [UIBezierPath bezierPath]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4747 UIColor *color = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4748 [color set]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4749 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4750 [aPath moveToPoint:CGPointMake(x1 + 0.5, y1 + 0.5)]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
4751 [aPath addLineToPoint:CGPointMake(x2 + 0.5, y2 + 0.5)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4752 [aPath stroke]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4753 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4754 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4755 if(bi) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4756 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4757 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4758 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4759 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4760 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4761 /* Draw text on a window (preferably a render window). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4762 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4763 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4764 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4765 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4766 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4767 * text: Text to be displayed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4768 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4769 DW_FUNCTION_DEFINITION(dw_draw_text, void, HWND handle, HPIXMAP pixmap, int x, int y, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4770 DW_FUNCTION_ADD_PARAM5(handle, pixmap, x, y, text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4771 DW_FUNCTION_NO_RETURN(dw_draw_text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4772 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pixmap, HPIXMAP, x, int, y, int, text, const char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4773 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4774 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4775 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4776 id image = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4777 NSString *nstr = [ NSString stringWithUTF8String:text ]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4778 UIImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4779 UIFont *font = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4780 DWRender *render; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4781 bool bCanDraw = YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4782 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4783 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4784 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4785 bi = image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4786 font = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4787 render = pixmap->handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4788 if(!font && [render isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4789 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4790 font = [render font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4791 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4792 image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4793 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4794 else if(image && [image isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4795 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4796 render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4797 font = [render font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4798 bi = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4799 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4800 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4801 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4802 _dw_draw_context(bi, NO); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4803 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4804 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4805 if(bCanDraw == YES) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4806 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4807 UIColor *fgcolor = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4808 UIColor *bgcolor = pthread_getspecific(_dw_bg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4809 NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:fgcolor, NSForegroundColorAttributeName, nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4810 if(bgcolor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4811 [dict setValue:bgcolor forKey:NSBackgroundColorAttributeName]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4812 if(font) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4813 [dict setValue:font forKey:NSFontAttributeName]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4814 [nstr drawAtPoint:CGPointMake(x, y) withAttributes:dict]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4815 [dict release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4816 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4817 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4818 if(bi) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4819 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4820 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4821 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4822 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4823 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4824 /* Query the width and height of a text string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4825 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4826 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4827 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4828 * text: Text to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4829 * width: Pointer to a variable to be filled in with the width. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4830 * height Pointer to a variable to be filled in with the height. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4831 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4832 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, const char *text, int *width, int *height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4833 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4834 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4835 NSString *nstr; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4836 UIFont *font = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4837 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4838 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4839 nstr = [NSString stringWithUTF8String:text]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4840 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4841 /* Check the pixmap for associated object or font */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4842 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4843 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4844 object = pixmap->handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4845 font = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4846 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4847 NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4848 /* If we didn't get a font from the pixmap... try the associated object */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4849 if(!font && ([object isMemberOfClass:[DWRender class]] || [object isKindOfClass:[UIControl class]])) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4850 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4851 font = [object font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4852 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4853 /* If we got a font... add it to the dictionary */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4854 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4855 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4856 [dict setValue:font forKey:NSFontAttributeName]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4857 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4858 /* Calculate the size of the string */ |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
4859 CGSize size = [nstr sizeWithAttributes:dict]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4860 [dict release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4861 /* Return whatever information we can */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4862 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4863 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4864 *width = size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4865 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4866 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4867 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4868 *height = size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4869 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4870 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4871 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4872 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4873 /* Draw a polygon on a window (preferably a render window). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4874 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4875 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4876 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4877 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4878 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4879 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4880 * width: Width of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4881 * height: Height of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4882 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4883 DW_FUNCTION_DEFINITION(dw_draw_polygon, void, HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4884 DW_FUNCTION_ADD_PARAM6(handle, pixmap, flags, npoints, x, y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4885 DW_FUNCTION_NO_RETURN(dw_draw_polygon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4886 DW_FUNCTION_RESTORE_PARAM6(handle, HWND, pixmap, HPIXMAP, flags, int, npoints, int, x, int *, y, int *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4887 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4888 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4889 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4890 id image = handle; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4891 UIImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4892 bool bCanDraw = YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4893 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4894 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4895 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4896 bi = image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4897 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4898 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4899 if([image isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4900 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4901 DWRender *render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4902 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4903 bi = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4904 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4905 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4906 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4907 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4908 _dw_draw_context(bi, flags & DW_DRAW_NOAA ? NO : YES); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4909 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4910 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4911 if(bCanDraw == YES) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4912 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4913 UIBezierPath* aPath = [UIBezierPath bezierPath]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4914 UIColor *color = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4915 [color set]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4916 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4917 [aPath moveToPoint:CGPointMake(*x + 0.5, *y + 0.5)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4918 for(z=1;z<npoints;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4919 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4920 [aPath addLineToPoint:CGPointMake(x[z] + 0.5, y[z] + 0.5)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4921 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4922 [aPath closePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4923 if(flags & DW_DRAW_FILL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4924 [aPath fill]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4925 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4926 [aPath stroke]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4927 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4928 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4929 if(bi) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4930 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4931 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4932 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4933 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4934 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4935 /* Draw a rectangle on a window (preferably a render window). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4936 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4937 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4938 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4939 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4940 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4941 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4942 * width: Width of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4943 * height: Height of rectangle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4944 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4945 DW_FUNCTION_DEFINITION(dw_draw_rect, void, HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4946 DW_FUNCTION_ADD_PARAM7(handle, pixmap, flags, x, y, width, height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4947 DW_FUNCTION_NO_RETURN(dw_draw_rect) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4948 DW_FUNCTION_RESTORE_PARAM7(handle, HWND, pixmap, HPIXMAP, flags, int, x, int, y, int, width, int, height, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4949 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4950 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4951 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4952 id image = handle; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
4953 UIImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4954 bool bCanDraw = YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4955 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4956 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4957 bi = image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4958 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4959 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4960 if([image isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4961 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4962 DWRender *render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4963 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4964 bi = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4965 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4966 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4967 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4968 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4969 _dw_draw_context(bi, flags & DW_DRAW_NOAA ? NO : YES); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4970 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4971 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4972 if(bCanDraw == YES) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4973 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4974 UIColor *color = pthread_getspecific(_dw_fg_color_key); |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4975 UIBezierPath *bp = [UIBezierPath bezierPathWithRect:CGRectMake(x, y, width, height)];; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4976 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4977 [color set]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4978 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4979 if(flags & DW_DRAW_FILL) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4980 [bp fill]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4981 else |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4982 [bp stroke]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4983 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4984 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4985 if(bi) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
4986 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4987 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4988 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4989 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4990 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4991 /* Draw an arc on a window (preferably a render window). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4992 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4993 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4994 * pixmap: Handle to the pixmap. (choose only one of these) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4995 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4996 * DW_DRAW_FULL will draw a complete circle/elipse. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4997 * xorigin: X coordinate of center of arc. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4998 * yorigin: Y coordinate of center of arc. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4999 * x1: X coordinate of first segment of arc. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5000 * y1: Y coordinate of first segment of arc. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5001 * x2: X coordinate of second segment of arc. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5002 * y2: Y coordinate of second segment of arc. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5003 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5004 DW_FUNCTION_DEFINITION(dw_draw_arc, void, HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5005 DW_FUNCTION_ADD_PARAM9(handle, pixmap, flags, xorigin, yorigin, x1, y1, x2, y2) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5006 DW_FUNCTION_NO_RETURN(dw_draw_arc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5007 DW_FUNCTION_RESTORE_PARAM9(handle, HWND, pixmap, HPIXMAP, flags, int, xorigin, int, yorigin, int, x1, int, y1, int, x2, int, y2, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5008 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5009 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5010 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5011 id image = handle; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5012 UIImage *bi = nil; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5013 bool bCanDraw = YES; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5014 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5015 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5016 bi = image = (id)pixmap->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5017 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5018 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5019 if([image isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5020 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5021 DWRender *render = image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5022 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5023 bi = [render cachedDrawingRep]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5024 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5025 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5026 if(bi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5027 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5028 _dw_draw_context(bi, flags & DW_DRAW_NOAA ? NO : YES); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5029 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5030 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5031 if(bCanDraw) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5032 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5033 UIBezierPath* aPath; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5034 UIColor *color = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5035 [color set]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5036 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5037 /* Special case of a full circle/oval */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5038 if(flags & DW_DRAW_FULL) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5039 aPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(x1, y1, x2 - x1, y2 - y1)]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5040 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5041 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5042 double a1 = atan2((y1-yorigin), (x1-xorigin)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5043 double a2 = atan2((y2-yorigin), (x2-xorigin)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5044 double dx = xorigin - x1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5045 double dy = yorigin - y1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5046 double r = sqrt(dx*dx + dy*dy); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5047 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5048 /* Convert to degrees */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5049 a1 *= (180.0 / M_PI); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5050 a2 *= (180.0 / M_PI); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5051 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5052 /* Prepare to draw */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5053 aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(xorigin, yorigin) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5054 radius:r startAngle:a1 endAngle:a2 clockwise:NO]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5055 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5056 /* If the fill flag is passed */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5057 if(flags & DW_DRAW_FILL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5058 [aPath fill]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5059 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5060 [aPath stroke]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5061 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5062 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5063 if(bi) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5064 UIGraphicsEndImageContext(); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5065 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5066 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5067 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5068 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5069 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5070 * Create a tree object to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5071 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5072 * id: An ID to be used for getting the resource from the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5073 * resource file. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5074 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5075 * A handle to a tree window or NULL on failure. |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5076 */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5077 HWND API dw_tree_new(ULONG cid) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5078 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5079 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5080 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5081 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5082 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5083 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5084 * Inserts an item into a tree window (widget) after another item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5085 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5086 * handle: Handle to the tree to be inserted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5087 * item: Handle to the item to be positioned after. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5088 * title: The text title of the entry. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5089 * icon: Handle to coresponding icon. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5090 * parent: Parent handle or 0 if root. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5091 * itemdata: Item specific data. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5092 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5093 * A handle to a tree item or NULL on failure. |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5094 */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5095 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5096 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5097 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5098 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5099 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5100 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5101 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5102 * Inserts an item into a tree window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5103 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5104 * handle: Handle to the tree to be inserted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5105 * title: The text title of the entry. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5106 * icon: Handle to coresponding icon. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5107 * parent: Parent handle or 0 if root. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5108 * itemdata: Item specific data. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5109 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5110 * A handle to a tree item or NULL on failure. |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5111 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5112 HTREEITEM API dw_tree_insert(HWND handle, const char *title, HICN icon, HTREEITEM parent, void *itemdata) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5113 { |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5114 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5115 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5116 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5117 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5118 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5119 * Gets the text an item in a tree window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5120 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5121 * handle: Handle to the tree containing the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5122 * item: Handle of the item to be modified. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5123 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5124 * A malloc()ed buffer of item text to be dw_free()ed or NULL on error. |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5125 */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5126 char * API dw_tree_get_title(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5127 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5128 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5129 return NULL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5130 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5131 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5132 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5133 * Gets the text an item in a tree window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5134 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5135 * handle: Handle to the tree containing the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5136 * item: Handle of the item to be modified. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5137 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5138 * A handle to a tree item or NULL on failure. |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5139 */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5140 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5141 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5142 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5143 return 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5144 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5145 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5146 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5147 * Sets the text and icon of an item in a tree window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5148 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5149 * handle: Handle to the tree containing the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5150 * item: Handle of the item to be modified. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5151 * title: The text title of the entry. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5152 * icon: Handle to coresponding icon. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5153 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5154 void API dw_tree_item_change(HWND handle, HTREEITEM item, const char *title, HICN icon) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5155 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5156 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5157 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5158 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5159 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5160 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5161 * Sets the item data of a tree item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5162 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5163 * handle: Handle to the tree containing the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5164 * item: Handle of the item to be modified. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5165 * itemdata: User defined data to be associated with item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5166 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5167 void API dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5168 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5169 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5170 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5171 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5172 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5173 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5174 * Gets the item data of a tree item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5175 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5176 * handle: Handle to the tree containing the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5177 * item: Handle of the item to be modified. |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5178 * Returns: |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5179 * A pointer to tree item data or NULL on failure. |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5180 */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5181 void * API dw_tree_item_get_data(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5182 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5183 /* TODO: Implement tree for iOS if possible */ |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5184 return NULL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5185 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5186 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5187 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5188 * Sets this item as the active selection. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5189 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5190 * handle: Handle to the tree window (widget) to be selected. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5191 * item: Handle to the item to be selected. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5192 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5193 void API dw_tree_item_select(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5194 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5195 /* TODO: Implement tree for iOS if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5196 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5197 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5198 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5199 * Removes all nodes from a tree. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5200 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5201 * handle: Handle to the window (widget) to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5202 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5203 void API dw_tree_clear(HWND handle) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5204 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5205 /* TODO: Implement tree for iOS if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5206 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5207 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5208 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5209 * Expands a node on a tree. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5210 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5211 * handle: Handle to the tree window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5212 * item: Handle to node to be expanded. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5213 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5214 void API dw_tree_item_expand(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5215 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5216 /* TODO: Implement tree for iOS if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5217 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5218 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5219 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5220 * Collapses a node on a tree. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5221 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5222 * handle: Handle to the tree window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5223 * item: Handle to node to be collapsed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5224 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5225 void API dw_tree_item_collapse(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5226 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5227 /* TODO: Implement tree for iOS if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5228 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5229 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5230 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5231 * Removes a node from a tree. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5232 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5233 * handle: Handle to the window (widget) to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5234 * item: Handle to node to be deleted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5235 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5236 void API dw_tree_item_delete(HWND handle, HTREEITEM item) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5237 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
5238 /* TODO: Implement tree for iOS if possible */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5239 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5240 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5241 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5242 * Create a container object to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5243 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5244 * id: An ID to be used for getting the resource from the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5245 * resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5246 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5247 DW_FUNCTION_DEFINITION(dw_container_new, HWND, ULONG cid, int multi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5248 DW_FUNCTION_ADD_PARAM2(cid, multi) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5249 DW_FUNCTION_RETURN(dw_container_new, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5250 DW_FUNCTION_RESTORE_PARAM2(cid, ULONG, multi, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5251 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5252 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5253 DWContainer *cont = _dw_cont_new(cid, multi); |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5254 /* TODO: Switch to new action system |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5255 [cont setDoubleAction:@selector(doubleClicked:)];*/ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5256 DW_FUNCTION_RETURN_THIS(cont); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5258 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5259 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5260 * Sets up the container columns. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5261 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5262 * handle: Handle to the container to be configured. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5263 * flags: An array of unsigned longs with column flags. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5264 * titles: An array of strings with column text titles. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5265 * count: The number of columns (this should match the arrays). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5266 * separator: The column number that contains the main separator. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5267 * (this item may only be used in OS/2) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5268 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5269 DW_FUNCTION_DEFINITION(dw_container_setup, int, HWND handle, unsigned long *flags, char **titles, int count, int separator) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5270 DW_FUNCTION_ADD_PARAM5(handle, flags, titles, count, separator) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5271 DW_FUNCTION_RETURN(dw_container_setup, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5272 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, flags, unsigned long *, titles, char **, count, int, DW_UNUSED(separator), int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5273 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5274 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5275 int z, retval = DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5276 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5277 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5278 [cont setup]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5279 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5280 for(z=0;z<count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5281 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5282 #if 0 /* TODO: Convert this to simulate columns */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5283 NSString *title = [NSString stringWithUTF8String:titles[z]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5284 /* Defaults to left justified so just handle right and center */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5285 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5286 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5287 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5288 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5289 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5290 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5291 * Configures the main filesystem columnn title for localization. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5292 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5293 * handle: Handle to the container to be configured. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5294 * title: The title to be displayed in the main column. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5295 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5296 void API dw_filesystem_set_column_title(HWND handle, const char *title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5297 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5298 char *newtitle = strdup(title ? title : ""); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5299 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5300 dw_window_set_data(handle, "_dw_coltitle", newtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5301 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5302 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5303 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5304 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5305 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5306 * handle: Handle to the container to be configured. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5307 * flags: An array of unsigned longs with column flags. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5308 * titles: An array of strings with column text titles. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5309 * count: The number of columns (this should match the arrays). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5310 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5311 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5312 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5313 char **newtitles = malloc(sizeof(char *) * (count + 1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5314 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5315 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5316 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5317 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5318 newtitles[0] = coltitle ? coltitle : "Filename"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5319 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5320 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5321 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5322 memcpy(&newtitles[1], titles, sizeof(char *) * count); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5323 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5324 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5325 dw_container_setup(handle, newflags, newtitles, count + 1, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5326 [cont setFilesystem:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5327 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5328 if(coltitle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5329 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5330 dw_window_set_data(handle, "_dw_coltitle", NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5331 free(coltitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5332 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5333 free(newtitles); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5334 free(newflags); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5335 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5336 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5337 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5338 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5339 * Allocates memory used to populate a container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5340 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5341 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5342 * rowcount: The number of items to be populated. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5343 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5344 DW_FUNCTION_DEFINITION(dw_container_alloc, void *, HWND handle, int rowcount) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5345 DW_FUNCTION_ADD_PARAM2(handle, rowcount) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5346 DW_FUNCTION_RETURN(dw_container_alloc, void *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5347 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, rowcount, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5348 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5349 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5350 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5351 [cont addRows:rowcount]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5352 DW_FUNCTION_RETURN_THIS(cont); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5353 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5354 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5355 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5356 * Sets an item in specified row and column to the given data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5357 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5358 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5359 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5360 * column: Zero based column of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5361 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5362 * data: Pointer to the data to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5363 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5364 DW_FUNCTION_DEFINITION(dw_container_set_item, void, HWND handle, void *pointer, int column, int row, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5365 DW_FUNCTION_ADD_PARAM5(handle, pointer, column, row, data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5366 DW_FUNCTION_NO_RETURN(dw_container_set_item) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5367 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, column, int, row, int, data, void *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5368 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5369 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5370 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5371 id icon = nil, text = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5372 int type = [cont cellType:column]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5373 int lastadd = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5374 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5375 /* If pointer is NULL we are getting a change request instead of set */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5376 if(pointer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5377 lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5378 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5379 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5380 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5381 if(type & DW_CFA_BITMAPORICON) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5382 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5383 icon = *((UIImage **)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5384 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5385 else if(type & DW_CFA_STRING) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5386 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5387 char *str = *((char **)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5388 text = [ NSString stringWithUTF8String:str ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5389 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5390 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5391 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5392 char textbuffer[101] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5393 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5394 if(type & DW_CFA_ULONG) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5395 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5396 ULONG tmp = *((ULONG *)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5397 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5398 snprintf(textbuffer, 100, "%lu", tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5399 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5400 else if(type & DW_CFA_DATE) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5401 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5402 struct tm curtm; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5403 CDATE cdate = *((CDATE *)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5404 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5405 memset( &curtm, 0, sizeof(curtm) ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5406 curtm.tm_mday = cdate.day; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5407 curtm.tm_mon = cdate.month - 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5408 curtm.tm_year = cdate.year - 1900; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5409 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5410 strftime(textbuffer, 100, "%x", &curtm); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5411 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5412 else if(type & DW_CFA_TIME) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5413 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5414 struct tm curtm; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5415 CTIME ctime = *((CTIME *)data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5416 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5417 memset( &curtm, 0, sizeof(curtm) ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5418 curtm.tm_hour = ctime.hours; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5419 curtm.tm_min = ctime.minutes; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5420 curtm.tm_sec = ctime.seconds; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5421 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5422 strftime(textbuffer, 100, "%X", &curtm); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5423 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5424 if(textbuffer[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5425 text = [ NSString stringWithUTF8String:textbuffer ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5426 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5427 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5428 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5429 id object = [cont getRow:(row+lastadd) and:column]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5430 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5431 /* If it is a cell, change the content of the cell */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5432 if([object isMemberOfClass:[UITableViewCell class]]) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5433 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5434 UITableViewCell *cell = object; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5435 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5436 if(icon) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5437 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5438 if(@available(iOS 14.0, *)) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5439 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5440 UIListContentConfiguration *content = [cell defaultContentConfiguration]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5441 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5442 [content setImage:icon]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5443 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5444 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5445 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5446 [cell setImage:icon]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5447 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5448 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5449 else |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5450 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5451 if(@available(iOS 14.0, *)) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5452 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5453 UIListContentConfiguration *content = [cell defaultContentConfiguration]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5454 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5455 [content setText:text]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5456 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5457 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5458 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5459 [cell setText:text]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5460 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5461 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5462 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5463 else /* Otherwise replace it with a new cell */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5464 [cont editCell:_dw_table_cell_view_new(icon, text) at:(row+lastadd) and:column]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5465 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5466 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5467 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5468 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5469 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5470 * Changes an existing item in specified row and column to the given data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5471 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5472 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5473 * column: Zero based column of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5474 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5475 * data: Pointer to the data to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5476 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5477 void API dw_container_change_item(HWND handle, int column, int row, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5478 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5479 dw_container_set_item(handle, NULL, column, row, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5480 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5481 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5482 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5483 * Changes an existing item in specified row and column to the given data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5484 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5485 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5486 * column: Zero based column of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5487 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5488 * data: Pointer to the data to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5489 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5490 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5491 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5492 dw_container_change_item(handle, column+1, row, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5493 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5494 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5495 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5496 * Changes an item in specified row and column to the given data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5497 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5498 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5499 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5500 * column: Zero based column of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5501 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5502 * data: Pointer to the data to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5503 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5504 void API dw_filesystem_change_file(HWND handle, int row, const char *filename, HICN icon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5505 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5506 dw_filesystem_set_file(handle, NULL, row, filename, icon); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5507 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5508 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5509 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5510 * Sets an item in specified row and column to the given data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5511 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5512 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5513 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5514 * column: Zero based column of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5515 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5516 * data: Pointer to the data to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5517 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5518 DW_FUNCTION_DEFINITION(dw_filesystem_set_file, void, HWND handle, void *pointer, int row, const char *filename, HICN icon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5519 DW_FUNCTION_ADD_PARAM5(handle, pointer, row, filename, icon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5520 DW_FUNCTION_NO_RETURN(dw_filesystem_set_file) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5521 DW_FUNCTION_RESTORE_PARAM5(handle, HWND, pointer, void *, row, int, filename, char *, icon, HICN) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5522 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5523 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5524 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5525 NSString *text = filename ? [NSString stringWithUTF8String:filename] : nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5526 int lastadd = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5527 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5528 /* If pointer is NULL we are getting a change request instead of set */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5529 if(pointer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5530 lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5531 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5532 id object = [cont getRow:(row+lastadd) and:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5533 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5534 /* If it is a cell, change the content of the cell */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5535 if([object isMemberOfClass:[UITableViewCell class]]) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5536 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5537 UITableViewCell *cell = object; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5538 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5539 if(icon) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5540 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5541 if(@available(iOS 14.0, *)) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5542 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5543 UIListContentConfiguration *content = [cell defaultContentConfiguration]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5544 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5545 [content setImage:icon]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5546 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5547 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5548 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5549 [cell setImage:icon]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5550 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5551 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5552 if(text) |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5553 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5554 if(@available(iOS 14.0, *)) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5555 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5556 UIListContentConfiguration *content = [cell defaultContentConfiguration]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5557 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5558 [content setText:text]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5559 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5560 else |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5561 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5562 [cell setText:text]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5563 } |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5564 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5565 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5566 else /* Otherwise replace it with a new cell */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5567 [cont editCell:_dw_table_cell_view_new(icon, text) at:(row+lastadd) and:0]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
5568 [cont setNeedsDisplay]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5569 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5570 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5571 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5572 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5573 * Sets an item in specified row and column to the given data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5574 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5575 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5576 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5577 * column: Zero based column of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5578 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5579 * data: Pointer to the data to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5580 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5581 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5582 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5583 dw_container_set_item(handle, pointer, column+1, row, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5584 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5585 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5586 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5587 * Gets column type for a container column |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5588 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5589 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5590 * column: Zero based column. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5591 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5592 DW_FUNCTION_DEFINITION(dw_container_get_column_type, int, HWND handle, int column) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5593 DW_FUNCTION_ADD_PARAM2(handle, column) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5594 DW_FUNCTION_RETURN(dw_container_get_column_type, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5595 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, column, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5596 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5597 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5598 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5599 int rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5600 int flag = [cont cellType:column]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5601 if(flag & DW_CFA_BITMAPORICON) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5602 rc = DW_CFA_BITMAPORICON; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5603 else if(flag & DW_CFA_STRING) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5604 rc = DW_CFA_STRING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5605 else if(flag & DW_CFA_ULONG) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5606 rc = DW_CFA_ULONG; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5607 else if(flag & DW_CFA_DATE) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5608 rc = DW_CFA_DATE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5609 else if(flag & DW_CFA_TIME) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5610 rc = DW_CFA_TIME; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5611 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5612 rc = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5613 DW_FUNCTION_RETURN_THIS(rc); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5614 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5615 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5616 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5617 * Gets column type for a filesystem container column |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5618 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5619 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5620 * column: Zero based column. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5621 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5622 int API dw_filesystem_get_column_type(HWND handle, int column) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5623 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5624 return dw_container_get_column_type(handle, column+1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5625 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5626 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5627 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5628 * Sets the alternating row colors for container window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5629 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5630 * handle: The window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5631 * oddcolor: Odd row background color in DW_RGB format or a default color index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5632 * evencolor: Even row background color in DW_RGB format or a default color index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5633 * DW_RGB_TRANSPARENT will disable coloring rows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5634 * DW_CLR_DEFAULT will use the system default alternating row colors. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5635 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5636 DW_FUNCTION_DEFINITION(dw_container_set_stripe, void, HWND handle, unsigned long oddcolor, unsigned long evencolor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5637 DW_FUNCTION_ADD_PARAM3(handle, oddcolor, evencolor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5638 DW_FUNCTION_NO_RETURN(dw_container_set_stripe) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5639 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, oddcolor, unsigned long, evencolor, unsigned long) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5640 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5641 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5642 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5643 [cont setRowBgOdd:oddcolor |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5644 andEven:evencolor]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5645 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5646 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5647 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5648 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5649 * Sets the width of a column in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5650 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5651 * handle: Handle to window (widget) of container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5652 * column: Zero based column of width being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5653 * width: Width of column in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5654 */ |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5655 void API dw_container_set_column_width(HWND handle, int column, int width) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5656 { |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5657 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5658 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5659 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5660 * Sets the title of a row in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5661 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5662 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5663 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5664 * title: String title of the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5665 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5666 DW_FUNCTION_DEFINITION(dw_container_set_row_title, void, void *pointer, int row, const char *title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5667 DW_FUNCTION_ADD_PARAM3(pointer, row, title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5668 DW_FUNCTION_NO_RETURN(dw_container_set_row_title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5669 DW_FUNCTION_RESTORE_PARAM3(pointer, void *, row, int, title, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5670 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5671 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5672 DWContainer *cont = pointer; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5673 int lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5674 [cont setRow:(row+lastadd) title:title]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5675 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5676 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5677 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5678 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5679 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5680 * Sets the data pointer of a row in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5681 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5682 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5683 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5684 * data: Data pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5685 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5686 DW_FUNCTION_DEFINITION(dw_container_set_row_data, void, void *pointer, int row, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5687 DW_FUNCTION_ADD_PARAM3(pointer, row, data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5688 DW_FUNCTION_NO_RETURN(dw_container_set_row_data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5689 DW_FUNCTION_RESTORE_PARAM3(pointer, void *, row, int, data, void *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5690 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5691 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5692 DWContainer *cont = pointer; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5693 int lastadd = [cont lastAddPoint]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5694 [cont setRowData:(row+lastadd) title:data]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5695 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5696 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5697 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5698 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5699 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5700 * Sets the title of a row in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5701 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5702 * handle: Handle to window (widget) of container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5703 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5704 * title: String title of the item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5705 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5706 DW_FUNCTION_DEFINITION(dw_container_change_row_title, void, HWND handle, int row, const char *title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5707 DW_FUNCTION_ADD_PARAM3(handle, row, title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5708 DW_FUNCTION_NO_RETURN(dw_container_change_row_title) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5709 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, row, int, title, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5710 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5711 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5712 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5713 [cont setRow:row title:title]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5714 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5715 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5716 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5717 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5718 * Sets the data pointer of a row in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5719 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5720 * handle: Handle to window (widget) of container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5721 * row: Zero based row of data being set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5722 * data: Data pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5723 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5724 DW_FUNCTION_DEFINITION(dw_container_change_row_data, void, HWND handle, int row, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5725 DW_FUNCTION_ADD_PARAM3(handle, row, data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5726 DW_FUNCTION_NO_RETURN(dw_container_change_row_data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5727 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, row, int, data, void *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5728 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5729 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5730 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5731 [cont setRowData:row title:data]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5732 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5733 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5734 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5735 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5736 * Sets the title of a row in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5737 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5738 * handle: Handle to the container window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5739 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5740 * rowcount: The number of rows to be inserted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5741 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5742 DW_FUNCTION_DEFINITION(dw_container_insert, void, HWND handle, void *pointer, int rowcount) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5743 DW_FUNCTION_ADD_PARAM3(handle, pointer, rowcount) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5744 DW_FUNCTION_NO_RETURN(dw_container_insert) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5745 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, DW_UNUSED(pointer), void *, DW_UNUSED(rowcount), int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5746 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5747 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5748 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5749 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5750 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5751 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5752 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5753 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5754 * Removes all rows from a container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5755 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5756 * handle: Handle to the window (widget) to be cleared. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5757 * redraw: TRUE to cause the container to redraw immediately. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5758 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5759 DW_FUNCTION_DEFINITION(dw_container_clear, void, HWND handle, int redraw) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5760 DW_FUNCTION_ADD_PARAM2(handle, redraw) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5761 DW_FUNCTION_NO_RETURN(dw_container_clear) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5762 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, redraw, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5763 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5764 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5765 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5766 [cont clear]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5767 if(redraw) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5768 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5769 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5770 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5771 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5772 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5773 * Removes the first x rows from a container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5774 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5775 * handle: Handle to the window (widget) to be deleted from. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5776 * rowcount: The number of rows to be deleted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5777 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5778 DW_FUNCTION_DEFINITION(dw_container_delete, void, HWND handle, int rowcount) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5779 DW_FUNCTION_ADD_PARAM2(handle, rowcount) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5780 DW_FUNCTION_NO_RETURN(dw_container_delete) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5781 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, rowcount, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5782 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5783 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5784 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5785 int x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5786 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5787 for(x=0;x<rowcount;x++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5788 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5789 [cont removeRow:0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5790 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5791 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5792 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5793 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5794 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5795 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5796 * Scrolls container up or down. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5797 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5798 * handle: Handle to the window (widget) to be scrolled. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5799 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5800 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5801 * rows: The number of rows to be scrolled. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5802 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5803 DW_FUNCTION_DEFINITION(dw_container_scroll, void, HWND handle, int direction, long rows) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5804 DW_FUNCTION_ADD_PARAM3(handle, direction, rows) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5805 DW_FUNCTION_NO_RETURN(dw_container_scroll) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5806 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, direction, int, rows, long) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5807 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5808 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5809 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5810 UIScrollView *sv = [cont scrollview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5811 int rowcount = (int)[cont numberOfRowsInTableView:cont]; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5812 CGPoint offset = [sv contentOffset]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5813 float change; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5814 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5815 /* Safety check */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5816 if(rowcount < 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5817 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5818 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5819 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5820 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5821 change = (float)rows/(float)rowcount; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5822 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5823 switch(direction) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5824 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5825 case DW_SCROLL_TOP: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5826 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5827 offset.y = 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5828 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5829 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5830 case DW_SCROLL_BOTTOM: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5831 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5832 offset.y = [sv contentSize].height - [sv visibleSize].height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5833 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5834 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5835 case DW_SCROLL_UP: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5836 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5837 offset.y = offset.y - [sv visibleSize].height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5838 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5839 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5840 case DW_SCROLL_DOWN: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5841 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5842 offset.y = offset.y + [sv visibleSize].height; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5843 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5844 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5845 } |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5846 if(offset.y < 0) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5847 offset.y = 0; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
5848 [sv setContentOffset:offset]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5849 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5850 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5851 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5852 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5853 * Starts a new query of a container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5854 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5855 * handle: Handle to the window (widget) to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5856 * flags: If this parameter is DW_CRA_SELECTED it will only |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5857 * return items that are currently selected. Otherwise |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5858 * it will return all records in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5859 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5860 DW_FUNCTION_DEFINITION(dw_container_query_start, char *, HWND handle, unsigned long flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5861 DW_FUNCTION_ADD_PARAM2(handle, flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5862 DW_FUNCTION_RETURN(dw_container_query_start, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5863 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, flags, unsigned long) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5864 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5865 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5866 DWContainer *cont = handle; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5867 NSArray *selected = [cont indexPathsForSelectedRows]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
5868 NSIndexPath *result = [selected firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5869 void *retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5870 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5871 if(result) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5872 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5873 if(flags & DW_CR_RETDATA) |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5874 retval = [cont getRowData:(int)result.row]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5875 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5876 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5877 char *temp = [cont getRowTitle:(int)result.row]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5878 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5879 retval = strdup(temp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5880 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5881 [cont setLastQueryPoint:1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5882 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5883 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5884 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5885 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5886 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5887 * Continues an existing query of a container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5888 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5889 * handle: Handle to the window (widget) to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5890 * flags: If this parameter is DW_CRA_SELECTED it will only |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5891 * return items that are currently selected. Otherwise |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5892 * it will return all records in the container. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5893 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5894 DW_FUNCTION_DEFINITION(dw_container_query_next, char *, HWND handle, unsigned long flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5895 DW_FUNCTION_ADD_PARAM2(handle, flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5896 DW_FUNCTION_RETURN(dw_container_query_next, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5897 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, flags, unsigned long) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5898 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5899 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5900 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5901 int lastQueryPoint = [cont lastQueryPoint]; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5902 NSArray *selected = [cont indexPathsForSelectedRows]; |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5903 NSIndexPath *result = [selected objectAtIndex:lastQueryPoint]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5904 void *retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5905 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5906 if(result) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5907 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5908 if(flags & DW_CR_RETDATA) |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5909 retval = [cont getRowData:(int)result.row]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5910 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5911 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5912 char *temp = [cont getRowTitle:(int)result.row]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5913 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5914 retval = strdup(temp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5915 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
5916 [cont setLastQueryPoint:(int)lastQueryPoint+1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5917 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5918 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5919 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5920 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5921 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5922 * Cursors the item with the text speficied, and scrolls to that item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5923 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5924 * handle: Handle to the window (widget) to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5925 * text: Text usually returned by dw_container_query(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5926 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5927 DW_FUNCTION_DEFINITION(dw_container_cursor, void, HWND handle, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5928 DW_FUNCTION_ADD_PARAM2(handle, text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5929 DW_FUNCTION_NO_RETURN(dw_container_cursor) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5930 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5931 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5932 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5933 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5934 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5935 char *thistext; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5936 int x, count = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5937 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5938 for(x=0;x<count;x++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5939 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5940 thistext = [cont getRowTitle:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5941 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5942 if(thistext && strcmp(thistext, text) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5943 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5944 NSIndexPath *ip = [NSIndexPath indexPathForRow:(NSUInteger)x inSection:0]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5945 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5946 [cont selectRowAtIndexPath:ip |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5947 animated:NO |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5948 scrollPosition:UITableViewScrollPositionNone]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5949 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5950 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5951 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5952 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5953 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5954 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5955 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5956 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5957 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5958 * Cursors the item with the data speficied, and scrolls to that item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5959 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5960 * handle: Handle to the window (widget) to be queried. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5961 * data: Data associated with the row. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5962 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5963 DW_FUNCTION_DEFINITION(dw_container_cursor_by_data, void, HWND handle, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5964 DW_FUNCTION_ADD_PARAM2(handle, data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5965 DW_FUNCTION_NO_RETURN(dw_container_cursor_by_data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5966 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, data, void *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5967 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5968 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5969 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5970 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5971 void *thisdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5972 int x, count = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5973 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5974 for(x=0;x<count;x++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5975 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5976 thisdata = [cont getRowData:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5977 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5978 if(thisdata == data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5979 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5980 NSIndexPath *ip = [NSIndexPath indexPathForRow:(NSUInteger)x inSection:0]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5981 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5982 [cont selectRowAtIndexPath:ip |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5983 animated:NO |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
5984 scrollPosition:UITableViewScrollPositionNone]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5985 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5986 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5987 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5988 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5989 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5990 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5991 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5992 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5993 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5994 * Deletes the item with the text speficied. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5995 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5996 * handle: Handle to the window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5997 * text: Text usually returned by dw_container_query(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5998 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5999 DW_FUNCTION_DEFINITION(dw_container_delete_row, void, HWND handle, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6000 DW_FUNCTION_ADD_PARAM2(handle, text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6001 DW_FUNCTION_NO_RETURN(dw_container_delete_row) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6002 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6003 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6004 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6005 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6006 char *thistext; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6007 int x, count = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6008 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6009 for(x=0;x<count;x++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6010 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6011 thistext = [cont getRowTitle:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6012 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6013 if(thistext && strcmp(thistext, text) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6014 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6015 [cont removeRow:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6016 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6017 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6018 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6019 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6020 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6021 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6022 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6023 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6024 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6025 * Deletes the item with the data speficied. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6026 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6027 * handle: Handle to the window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6028 * data: Data specified. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6029 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6030 DW_FUNCTION_DEFINITION(dw_container_delete_row_by_data, void, HWND handle, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6031 DW_FUNCTION_ADD_PARAM2(handle, data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6032 DW_FUNCTION_NO_RETURN(dw_container_delete_row_by_data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6033 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, data, void *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6034 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6035 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6036 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6037 void *thisdata; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6038 int x, count = (int)[cont numberOfRowsInTableView:cont]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6039 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6040 for(x=0;x<count;x++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6041 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6042 thisdata = [cont getRowData:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6043 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6044 if(thisdata == data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6045 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6046 [cont removeRow:x]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6047 [cont reloadData]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6048 x=count; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6049 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6050 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6051 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6052 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6053 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6054 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6055 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6056 * Optimizes the column widths so that all data is visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6057 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6058 * handle: Handle to the window (widget) to be optimized. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6059 */ |
2379
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6060 void dw_container_optimize(HWND handle) |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6061 { |
e35887009bb5
iOS: Remove tree functionality, combobox and radio button... include links
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2378
diff
changeset
|
6062 /* TODO: Not sure if we need to implement this on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6063 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6064 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6065 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6066 * Inserts an icon into the taskbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6067 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6068 * handle: Window handle that will handle taskbar icon messages. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6069 * icon: Icon handle to display in the taskbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6070 * bubbletext: Text to show when the mouse is above the icon. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6071 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6072 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6073 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6074 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6075 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6076 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6077 * Deletes an icon from the taskbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6078 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6079 * handle: Window handle that was used with dw_taskbar_insert(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6080 * icon: Icon handle that was used with dw_taskbar_insert(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6081 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6082 void API dw_taskbar_delete(HWND handle, HICN icon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6083 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6084 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6085 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6086 /* Internal function to keep HICNs from getting too big */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6087 void _icon_resize(UIImage *image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6088 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6089 if(image) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6090 { |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
6091 CGSize size = [image size]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6092 if(size.width > 24 || size.height > 24) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6093 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6094 if(size.width > 24) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6095 size.width = 24; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6096 if(size.height > 24) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6097 size.height = 24; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6098 #if 0 /* TODO: UIImage is immutable, duplicate? */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6099 [image setSize:size]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6100 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6101 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6102 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6103 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6104 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6105 /* Internal version that does not resize the image */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6106 HICN _dw_icon_load(unsigned long resid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6107 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6108 NSBundle *bundle = [NSBundle mainBundle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6109 NSString *respath = [bundle resourcePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6110 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6111 UIImage *image = [[UIImage alloc] initWithContentsOfFile:filepath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6112 return image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6113 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6114 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6115 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6116 * Obtains an icon from a module (or header in GTK). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6117 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6118 * module: Handle to module (DLL) in OS/2 and Windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6119 * id: A unsigned long id int the resources on OS/2 and |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6120 * Windows, on GTK this is converted to a pointer |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6121 * to an embedded XPM. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6122 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6123 HICN API dw_icon_load(unsigned long module, unsigned long resid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6124 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6125 UIImage *image = _dw_icon_load(resid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6126 _icon_resize(image); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6127 return image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6128 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6129 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6130 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6131 * Obtains an icon from a file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6132 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6133 * filename: Name of the file, omit extention to have |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6134 * DW pick the appropriate file extension. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6135 * (ICO on OS/2 or Windows, XPM on Unix) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6136 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6137 HICN API dw_icon_load_from_file(const char *filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6138 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6139 char *ext = _dw_get_image_extension( filename ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6140 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6141 NSString *nstr = [ NSString stringWithUTF8String:filename ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6142 UIImage *image = [[UIImage alloc] initWithContentsOfFile:nstr]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6143 if(!image && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6144 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6145 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6146 image = [[UIImage alloc] initWithContentsOfFile:nstr]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6147 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6148 _icon_resize(image); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6149 return image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6150 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6151 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6152 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6153 * Obtains an icon from data |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6154 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6155 * filename: Name of the file, omit extention to have |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6156 * DW pick the appropriate file extension. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6157 * (ICO on OS/2 or Windows, XPM on Unix) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6158 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6159 HICN API dw_icon_load_from_data(const char *data, int len) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6160 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6161 NSData *thisdata = [NSData dataWithBytes:data length:len]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6162 UIImage *image = [[UIImage alloc] initWithData:thisdata]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6163 _icon_resize(image); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6164 return image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6165 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6166 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6167 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6168 * Frees a loaded resource in OS/2 and Windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6169 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6170 * handle: Handle to icon returned by dw_icon_load(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6171 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6172 void API dw_icon_free(HICN handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6173 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6174 UIImage *image = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6175 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6176 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6177 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6178 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6179 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6180 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6181 * Create a new MDI Frame to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6182 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6183 * id: An ID to be used with dw_window_from_id or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6184 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6185 HWND API dw_mdi_new(unsigned long cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6186 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6187 /* There isn't anything like quite like MDI on MacOS... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6188 * However we will make floating windows that hide |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6189 * when the application is deactivated to simulate |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6190 * similar behavior. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6191 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6192 DWMDI *mdi = [[DWMDI alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6193 /* [mdi setTag:cid]; Why doesn't this work? */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6194 return mdi; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6195 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6196 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6197 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6198 * Creates a splitbar window (widget) with given parameters. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6199 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6200 * type: Value can be DW_VERT or DW_HORZ. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6201 * topleft: Handle to the window to be top or left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6202 * bottomright: Handle to the window to be bottom or right. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6203 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6204 * A handle to a splitbar window or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6205 */ |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6206 DW_FUNCTION_DEFINITION(dw_splitbar_new, HWND, DW_UNUSED(int type), HWND topleft, HWND bottomright, unsigned long cid) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6207 DW_FUNCTION_ADD_PARAM4(type, topleft, bottomright, cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6208 DW_FUNCTION_RETURN(dw_splitbar_new, HWND) |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6209 DW_FUNCTION_RESTORE_PARAM4(DW_UNUSED(type), int, topleft, HWND, bottomright, HWND, cid, unsigned long) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6210 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6211 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6212 id tmpbox = dw_box_new(DW_VERT, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6213 DWSplitBar *split = [[DWSplitBar alloc] init]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6214 UIViewController *vc = [[UIViewController alloc] init]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6215 [split setDelegate:split]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6216 dw_box_pack_start(tmpbox, topleft, 0, 0, TRUE, TRUE, 0); |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6217 [vc setView:tmpbox]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6218 if (@available(iOS 14.0, *)) { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6219 [split setViewController:vc forColumn:UISplitViewControllerColumnPrimary]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6220 } else { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6221 [split addChildViewController:vc]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6222 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6223 [tmpbox autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6224 tmpbox = dw_box_new(DW_VERT, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6225 dw_box_pack_start(tmpbox, bottomright, 0, 0, TRUE, TRUE, 0); |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6226 vc = [[UIViewController alloc] init]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6227 [vc setView:tmpbox]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6228 if (@available(iOS 14.0, *)) { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6229 [split setViewController:vc forColumn:UISplitViewControllerColumnSecondary]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6230 } else { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6231 [split addChildViewController:vc]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6232 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6233 [tmpbox autorelease]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6234 #if 0 /* TODO: All iOS splitbars are vertical */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6235 [split setVertical:(type == DW_VERT ? YES : NO)]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6236 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6237 /* Set the default percent to 50% split */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6238 [split setPercent:50.0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6239 [split setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6240 DW_FUNCTION_RETURN_THIS(split); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6241 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6242 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6243 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6244 * Sets the position of a splitbar (pecentage). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6245 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6246 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6247 * percent: The position of the splitbar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6248 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6249 DW_FUNCTION_DEFINITION(dw_splitbar_set, void, HWND handle, float percent) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6250 DW_FUNCTION_ADD_PARAM2(handle, percent) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6251 DW_FUNCTION_NO_RETURN(dw_splitbar_set) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6252 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, percent, float) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6253 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6254 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6255 DWSplitBar *split = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6256 CGSize size = [split preferredContentSize]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6257 float pos; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6258 /* Calculate the position based on the size */ |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6259 #if 0 /* TODO: iOS split views are always vertical */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6260 if(![split isVertical]) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6261 pos = size.height * (percent / 100.0); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6262 else |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6263 #endif |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6264 pos = size.width * (percent / 100.0); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6265 if(pos > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6266 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6267 if (@available(iOS 14.0, *)) { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6268 [split setPreferredPrimaryColumnWidth:pos]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6269 } else { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6270 /* TODO: Is this possible on earlier versions? */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6271 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6272 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6273 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6274 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6275 /* If we have no size.. wait until the resize |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6276 * event when we get an actual size to try |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6277 * to set the splitbar again. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6278 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6279 [split setPercent:percent]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6280 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6281 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6282 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6283 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6284 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6285 * Gets the position of a splitbar (pecentage). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6286 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6287 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6288 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6289 float API dw_splitbar_get(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6290 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6291 DWSplitBar *split = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6292 float retval = 50.0; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6293 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6294 if (@available(iOS 14.0, *)) { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6295 float primary = [split primaryColumnWidth]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6296 float supplementary = [split supplementaryColumnWidth]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6297 retval = (primary / (primary + supplementary)) * 100.0; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6298 } else { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6299 /* TODO: If possible*/ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6300 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6301 return retval; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6302 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6303 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6304 /* Internal function to convert fontname to UIFont */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6305 UIFont *_dw_font_by_name(const char *fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6306 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6307 UIFont *font = DWDefaultFont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6308 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6309 if(fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6310 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6311 char *name = strchr(fontname, '.'); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6312 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6313 if(name && (name++)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6314 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6315 UIFontDescriptorSymbolicTraits traits = 0; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6316 UIFontDescriptor* fd; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6317 int size = atoi(fontname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6318 char *Italic = strstr(name, " Italic"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6319 char *Bold = strstr(name, " Bold"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6320 size_t len = (Italic ? (Bold ? (Italic > Bold ? (Bold - name) : (Italic - name)) : (Italic - name)) : (Bold ? (Bold - name) : strlen(name))); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6321 char *newname = alloca(len+1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6322 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6323 memset(newname, 0, len+1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6324 strncpy(newname, name, len); |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6325 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6326 if(Bold) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6327 traits |= UIFontDescriptorTraitBold; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6328 if(Italic) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6329 traits |= UIFontDescriptorTraitItalic; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6330 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6331 fd = [UIFontDescriptor |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6332 fontDescriptorWithFontAttributes:@{UIFontDescriptorFamilyAttribute:[NSString stringWithUTF8String:newname], |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6333 UIFontDescriptorTraitsAttribute: @{UIFontSymbolicTrait:[NSNumber numberWithInteger:traits]}}]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6334 NSArray* matches = [fd matchingFontDescriptorsWithMandatoryKeys: |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6335 [NSSet setWithObjects:UIFontDescriptorFamilyAttribute, UIFontDescriptorTraitsAttribute, nil]]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6336 if(matches.count != 0) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6337 font = [UIFont fontWithDescriptor:matches[0] size:size]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6338 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6339 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6340 return font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6341 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6342 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6343 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6344 * Create a bitmap object to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6345 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6346 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6347 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6348 DW_FUNCTION_DEFINITION(dw_bitmap_new, HWND, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6349 DW_FUNCTION_ADD_PARAM1(cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6350 DW_FUNCTION_RETURN(dw_bitmap_new, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6351 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6352 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6353 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6354 UIImageView *bitmap = [[UIImageView alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6355 [bitmap setTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6356 DW_FUNCTION_RETURN_THIS(bitmap); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6357 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6358 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6359 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6360 * Creates a pixmap with given parameters. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6361 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6362 * handle: Window handle the pixmap is associated with. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6363 * width: Width of the pixmap in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6364 * height: Height of the pixmap in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6365 * depth: Color depth of the pixmap. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6366 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6367 * A handle to a pixmap or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6368 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6369 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6370 { |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6371 HPIXMAP pixmap = NULL; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6372 |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6373 if((pixmap = calloc(1,sizeof(struct _hpixmap)))) |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6374 { |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6375 CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6376 CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, calloc(width*height, 4), width*height*32, NULL); |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6377 CGImageRef image = CGImageCreate(width, height, 8, 32, 32 * width, |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6378 rgb, kCGBitmapByteOrderDefault | kCGImageAlphaLast, |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6379 provider, NULL, false, kCGRenderingIntentDefault); |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6380 pixmap->width = width; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6381 pixmap->height = height; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6382 pixmap->handle = handle; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6383 pixmap->image = [[[UIImage alloc] initWithCGImage:image] retain]; |
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6384 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6385 return pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6386 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6387 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6388 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6389 * Creates a pixmap from a file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6390 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6391 * handle: Window handle the pixmap is associated with. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6392 * filename: Name of the file, omit extention to have |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6393 * DW pick the appropriate file extension. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6394 * (BMP on OS/2 or Windows, XPM on Unix) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6395 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6396 * A handle to a pixmap or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6397 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6398 HPIXMAP API dw_pixmap_new_from_file(HWND handle, const char *filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6399 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6400 HPIXMAP pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6401 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6402 char *ext = _dw_get_image_extension( filename ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6403 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6404 if(!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6405 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6406 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6407 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6408 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6409 NSString *nstr = [ NSString stringWithUTF8String:filename ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6410 UIImage *tmpimage = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6411 if(!tmpimage && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6412 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6413 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6414 tmpimage = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6415 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6416 if(!tmpimage) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6417 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6418 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6419 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6420 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6421 pixmap->width = [tmpimage size].width; |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6422 pixmap->height = [tmpimage size].height; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6423 pixmap->image = tmpimage; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6424 pixmap->handle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6425 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6426 return pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6427 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6428 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6429 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6430 * Creates a pixmap from memory. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6431 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6432 * handle: Window handle the pixmap is associated with. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6433 * data: Source of the image data |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6434 * (BMP on OS/2 or Windows, XPM on Unix) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6435 * le: length of data |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6436 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6437 * A handle to a pixmap or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6438 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6439 HPIXMAP API dw_pixmap_new_from_data(HWND handle, const char *data, int len) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6440 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6441 HPIXMAP pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6442 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6443 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6444 if(!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6445 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6446 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6447 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6448 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6449 NSData *thisdata = [NSData dataWithBytes:data length:len]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6450 UIImage *tmpimage = [[[UIImage alloc] initWithData:thisdata] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6451 if(!tmpimage) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6452 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6453 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6454 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6455 } |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6456 pixmap->width = [tmpimage size].width; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6457 pixmap->height = [tmpimage size].height; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6458 pixmap->image = tmpimage; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6459 pixmap->handle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6460 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6461 return pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6462 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6463 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6464 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6465 * Sets the transparent color for a pixmap |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6466 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6467 * pixmap: Handle to a pixmap returned by |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6468 * dw_pixmap_new.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6469 * color: transparent color |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6470 * Note: This does nothing on Mac as transparency |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6471 * is handled automatically |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6472 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6473 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color ) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6474 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6475 /* Don't do anything */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6476 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6477 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6478 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6479 * Creates a pixmap from internal resource graphic specified by id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6480 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6481 * handle: Window handle the pixmap is associated with. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6482 * id: Resource ID associated with requested pixmap. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6483 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6484 * A handle to a pixmap or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6485 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6486 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG resid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6487 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6488 HPIXMAP pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6489 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6490 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6491 if(!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6492 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6493 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6494 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6495 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6496 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6497 NSBundle *bundle = [NSBundle mainBundle]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6498 NSString *respath = [bundle resourcePath]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6499 NSString *filepath = [respath stringByAppendingFormat:@"/%lu.png", resid]; |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6500 UIImage *tmpimage = [[UIImage alloc] initWithContentsOfFile:filepath]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6501 |
2382
41a04e6b3e8e
iOS: More conversion... mostly drawing related changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2381
diff
changeset
|
6502 if(tmpimage) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6503 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6504 pixmap->width = [tmpimage size].width; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6505 pixmap->height = [tmpimage size].height; |
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6506 pixmap->image = tmpimage; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6507 pixmap->handle = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6508 return pixmap; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6509 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6510 free(pixmap); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6511 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6512 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6513 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6514 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6515 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6516 * Sets the font used by a specified pixmap. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6517 * Normally the pixmap font is obtained from the associated window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6518 * However this can be used to override that, or for pixmaps with no window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6519 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6520 * pixmap: Handle to a pixmap returned by dw_pixmap_new() or |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6521 * passed to the application via a callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6522 * fontname: Name and size of the font in the form "size.fontname" |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6523 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6524 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6525 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6526 int API dw_pixmap_set_font(HPIXMAP pixmap, const char *fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6527 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6528 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6529 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6530 UIFont *font = _dw_font_by_name(fontname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6531 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6532 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6533 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6534 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6535 UIFont *oldfont = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6536 [font retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6537 pixmap->font = font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6538 if(oldfont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6539 [oldfont release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6540 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6541 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6542 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6543 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6544 return DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6545 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6546 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6547 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6548 * Destroys an allocated pixmap. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6549 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6550 * pixmap: Handle to a pixmap returned by |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6551 * dw_pixmap_new.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6552 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6553 void API dw_pixmap_destroy(HPIXMAP pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6554 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6555 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6556 { |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
6557 UIImage *image = (UIImage *)pixmap->image; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6558 UIFont *font = pixmap->font; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6559 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6560 [image release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6561 [font release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6562 free(pixmap); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6563 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6564 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6565 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6566 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6567 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6568 * Copies from one item to another. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6569 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6570 * dest: Destination window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6571 * destp: Destination pixmap. (choose only one). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6572 * xdest: X coordinate of destination. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6573 * ydest: Y coordinate of destination. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6574 * width: Width of area to copy. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6575 * height: Height of area to copy. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6576 * src: Source window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6577 * srcp: Source pixmap. (choose only one). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6578 * xsrc: X coordinate of source. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6579 * ysrc: Y coordinate of source. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6580 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6581 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) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6582 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6583 dw_pixmap_stretch_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, -1, -1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6584 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6585 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6586 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6587 * Copies from one surface to another allowing for stretching. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6588 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6589 * dest: Destination window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6590 * destp: Destination pixmap. (choose only one). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6591 * xdest: X coordinate of destination. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6592 * ydest: Y coordinate of destination. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6593 * width: Width of the target area. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6594 * height: Height of the target area. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6595 * src: Source window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6596 * srcp: Source pixmap. (choose only one). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6597 * xsrc: X coordinate of source. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6598 * ysrc: Y coordinate of source. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6599 * srcwidth: Width of area to copy. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6600 * srcheight: Height of area to copy. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6601 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6602 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6603 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6604 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) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6605 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6606 DWBitBlt *bltinfo; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6607 NSValue* bi; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6608 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6609 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6610 /* Sanity checks */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6611 if((!dest && !destp) || (!src && !srcp) || |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6612 ((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6613 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6614 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6615 return DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6616 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6617 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6618 bltinfo = calloc(1, sizeof(DWBitBlt)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6619 bi = [NSValue valueWithPointer:bltinfo]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6620 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6621 /* Fill in the information */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6622 bltinfo->dest = dest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6623 bltinfo->src = src; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6624 bltinfo->xdest = xdest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6625 bltinfo->ydest = ydest; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6626 bltinfo->width = width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6627 bltinfo->height = height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6628 bltinfo->xsrc = xsrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6629 bltinfo->ysrc = ysrc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6630 bltinfo->srcwidth = srcwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6631 bltinfo->srcheight = srcheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6632 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6633 if(destp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6634 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6635 bltinfo->dest = (id)destp->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6636 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6637 if(srcp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6638 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6639 id object = bltinfo->src = (id)srcp->image; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6640 [object retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6641 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6642 [DWObj safeCall:@selector(doBitBlt:) withObject:bi]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6643 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6644 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6645 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6646 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6647 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6648 * Create a new static text window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6649 * Not available under OS/2, eCS |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6650 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6651 * text: The text to be display by the static text widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6652 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6653 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6654 HWND API dw_calendar_new(ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6655 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6656 DWCalendar *calendar = [[DWCalendar alloc] init]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6657 [calendar setDatePickerMode:UIDatePickerModeDate]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6658 [calendar setTag:cid]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6659 [calendar setDate:[NSDate date]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6660 return calendar; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6661 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6662 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6663 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6664 * Sets the current date of a calendar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6665 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6666 * handle: The handle to the calendar returned by dw_calendar_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6667 * year... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6668 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6669 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6670 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6671 DWCalendar *calendar = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6672 NSDate *date; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6673 char buffer[101]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6674 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6675 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6676 snprintf(buffer, 100, "%04d-%02d-%02d", year, month, day); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6677 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6678 NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6679 dateFormatter.dateFormat = @"yyyy-MM-dd"; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6680 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6681 date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6682 [calendar setDate:date]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6683 [date release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6684 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6685 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6686 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6687 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6688 * Gets the current date of a calendar. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6689 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6690 * handle: The handle to the calendar returned by dw_calendar_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6691 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6692 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6693 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6694 DWCalendar *calendar = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6695 DW_LOCAL_POOL_IN; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6696 NSCalendar *mycalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6697 NSDate *date = [calendar date]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6698 NSDateComponents* components = [mycalendar components:NSCalendarUnitDay|NSCalendarUnitMonth|NSCalendarUnitYear fromDate:date]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6699 *day = (unsigned int)[components day]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6700 *month = (unsigned int)[components month]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6701 *year = (unsigned int)[components year]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6702 [mycalendar release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6703 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6704 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6705 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6706 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6707 * Causes the embedded HTML widget to take action. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6708 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6709 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6710 * action: One of the DW_HTML_* constants. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6711 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6712 void API dw_html_action(HWND handle, int action) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6713 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6714 DWWebView *html = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6715 switch(action) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6716 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6717 case DW_HTML_GOBACK: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6718 [html goBack]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6719 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6720 case DW_HTML_GOFORWARD: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6721 [html goForward]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6722 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6723 case DW_HTML_GOHOME: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6724 dw_html_url(handle, DW_HOME_URL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6725 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6726 case DW_HTML_SEARCH: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6727 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6728 case DW_HTML_RELOAD: |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6729 [html reload]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6730 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6731 case DW_HTML_STOP: |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6732 [html stopLoading]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6733 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6734 case DW_HTML_PRINT: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6735 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6736 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6737 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6738 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6739 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6740 * Render raw HTML code in the embedded HTML widget.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6741 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6742 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6743 * string: String buffer containt HTML code to |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6744 * be rendered. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6745 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6746 * 0 on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6747 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6748 int API dw_html_raw(HWND handle, const char *string) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6749 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6750 DWWebView *html = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6751 [html loadHTMLString:[ NSString stringWithUTF8String:string ] baseURL:nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6752 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6753 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6754 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6755 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6756 * Render file or web page in the embedded HTML widget.. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6757 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6758 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6759 * url: Universal Resource Locator of the web or |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6760 * file object to be rendered. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6761 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6762 * 0 on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6763 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6764 int API dw_html_url(HWND handle, const char *url) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6765 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6766 DWWebView *html = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6767 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6768 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6769 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6770 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6771 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6772 * Executes the javascript contained in "script" in the HTML window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6773 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6774 * handle: Handle to the HTML window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6775 * script: Javascript code to execute. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6776 * scriptdata: Data passed to the signal handler. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6777 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6778 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6779 * DW_ERROR_NONE (0) on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6780 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6781 int dw_html_javascript_run(HWND handle, const char *script, void *scriptdata) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6782 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6783 DWWebView *html = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6784 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6785 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6786 [html evaluateJavaScript:[NSString stringWithUTF8String:script] completionHandler:^(NSString *result, NSError *error) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6787 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6788 void *params[2] = { result, scriptdata }; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
6789 _event_handler(html, (UIEvent *)params, 18); |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6790 }]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6791 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6792 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6793 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6794 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6795 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6796 * Create a new HTML window (widget) to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6797 * Not available under OS/2, eCS |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6798 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6799 * text: The default text to be in the entryfield widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6800 * id: An ID to be used with dw_window_from_id() or 0L. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6801 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6802 DW_FUNCTION_DEFINITION(dw_html_new, HWND, ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6803 DW_FUNCTION_ADD_PARAM1(cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6804 DW_FUNCTION_RETURN(dw_html_new, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6805 DW_FUNCTION_RESTORE_PARAM1(DW_UNUSED(cid), ULONG) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6806 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6807 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6808 DWWebView *web = [[DWWebView alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6809 web.navigationDelegate = web; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6810 /* [web setTag:cid]; Why doesn't this work? */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6811 DW_FUNCTION_RETURN_THIS(web); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6812 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6813 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6814 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6815 * Returns the current X and Y coordinates of the mouse pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6816 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6817 * x: Pointer to variable to store X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6818 * y: Pointer to variable to store Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6819 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6820 void API dw_pointer_query_pos(long *x, long *y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6821 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6822 if(x) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6823 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6824 *x = 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6825 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6826 if(y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6827 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6828 *y = 0; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6829 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6830 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6831 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6832 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6833 * Sets the X and Y coordinates of the mouse pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6834 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6835 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6836 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6837 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6838 void API dw_pointer_set_pos(long x, long y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6839 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6840 /* From what I have read this isn't possible, agaist human interface rules */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6841 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6842 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6843 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6844 * Create a menu object to be popped up. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6845 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6846 * id: An ID to be used for getting the resource from the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6847 * resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6848 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6849 HMENUI API dw_menu_new(ULONG cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6850 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6851 DWMenu *menu = [[DWMenu alloc] init]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6852 /* [menu setTag:cid]; Why doesn't this work? */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6853 return menu; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6854 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6855 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6856 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6857 * Create a menubar on a window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6858 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6859 * location: Handle of a window frame to be attached to. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6860 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6861 HMENUI API dw_menubar_new(HWND location) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6862 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6863 /* TODO: Implement this with UIMenuSystem */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6864 return NULL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6865 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6866 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6867 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6868 * Destroys a menu created with dw_menubar_new or dw_menu_new. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6869 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6870 * menu: Handle of a menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6871 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6872 void API dw_menu_destroy(HMENUI *menu) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6873 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6874 DWMenu *thismenu = *menu; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6875 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6876 [thismenu release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6877 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6878 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6879 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6880 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6881 * Pops up a context menu at given x and y coordinates. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6882 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6883 * menu: The handle the the existing menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6884 * parent: Handle to the window initiating the popup. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6885 * x: X coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6886 * y: Y coordinate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6887 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6888 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6889 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6890 #if 0 /* TODO: Figure out how to do this */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6891 DWMenu *thismenu = (DWMenu *)*menu; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6892 id object = parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6893 UIView *view = [object isKindOfClass:[UIWindow class]] ? [object contentView] : parent; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6894 UIWindow *window = [view window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6895 [thismenu autorelease]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6896 CGPoint p = CGPointMake(x, y); |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6897 [UIContextMenuInteraction a |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6898 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6899 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6900 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6901 char _removetilde(char *dest, const char *src) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6902 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6903 int z, cur=0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6904 char accel = '\0'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6905 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6906 for(z=0;z<strlen(src);z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6907 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6908 if(src[z] != '~') |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6909 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6910 dest[cur] = src[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6911 cur++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6912 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6913 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6914 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6915 accel = src[z+1]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6916 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6917 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6918 dest[cur] = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6919 return accel; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6920 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6921 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6922 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6923 * Adds a menuitem or submenu to an existing menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6924 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6925 * menu: The handle the the existing menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6926 * title: The title text on the menu item to be added. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6927 * id: An ID to be used for message passing. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6928 * flags: Extended attributes to set on the menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6929 * end: If TRUE memu is positioned at the end of the menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6930 * check: If TRUE menu is "check"able. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6931 * flags: Extended attributes to set on the menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6932 * submenu: Handle to an existing menu to be a submenu or NULL. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6933 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6934 HWND API dw_menu_append_item(HMENUI menux, const char *title, ULONG itemid, ULONG flags, int end, int check, HMENUI submenux) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6935 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6936 DWMenu *menu = menux; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6937 DWMenuItem *item = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6938 if(strlen(title) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6939 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6940 #if 0 /* TODO: Not sure if separators exist in iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6941 [menu addItem:[DWMenuItem separatorItem]]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6942 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6943 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6944 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6945 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6946 char accel[2]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6947 char *newtitle = malloc(strlen(title)+1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6948 NSString *nstr; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6949 UIMenu *newmenu, *oldmenu = [menu menu]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6950 NSArray *newchildren, *oldchildren = [oldmenu children]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6951 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6952 accel[0] = _removetilde(newtitle, title); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6953 accel[1] = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6954 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6955 nstr = [ NSString stringWithUTF8String:newtitle ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6956 free(newtitle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6957 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6958 item = [[DWMenuItem commandWithTitle:nstr image:nil |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6959 action:@selector(menuHandler:) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6960 propertyList:nil] autorelease]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6961 newchildren = [oldchildren arrayByAddingObjectsFromArray:@[item]]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6962 if(oldmenu) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6963 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6964 newmenu = [oldmenu menuByReplacingChildren:newchildren]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6965 [oldmenu release]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6966 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6967 else if(@available(iOS 14.0, *)) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6968 newmenu = [UIMenu menuWithChildren:newchildren]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6969 else |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6970 newmenu = [UIMenu menuWithTitle:@"" children:newchildren]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6971 [menu setMenu:newmenu]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6972 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6973 [item setTag:itemid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6974 if(check) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6975 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6976 [item setCheck:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6977 if(flags & DW_MIS_CHECKED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6978 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6979 [item setState:UIMenuElementStateOn]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6980 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6981 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6982 #if 0 /* TODO: Disabled items not supported on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6983 if(flags & DW_MIS_DISABLED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6984 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6985 [item setEnabled:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6986 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6987 #endif |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6988 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6989 #if 0 /* TODO: iOS may not support submenus... but may be able to cascade... with defered menus */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6990 if(submenux) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6991 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6992 DWMenu *submenu = submenux; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6993 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6994 [submenu setTitle:nstr]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6995 [menu setSubmenu:submenu forItem:item]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6996 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
6997 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6998 return item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6999 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7000 return item; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7001 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7002 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7003 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7004 * Sets the state of a menu item check. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7005 * Deprecated; use dw_menu_item_set_state() |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7006 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7007 * menu: The handle the the existing menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7008 * id: Menuitem id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7009 * check: TRUE for checked FALSE for not checked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7010 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7011 void API dw_menu_item_set_check(HMENUI menux, unsigned long itemid, int check) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7012 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7013 id menu = menux; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7014 DWMenuItem *menuitem = [menu itemWithTag:itemid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7015 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7016 if(menuitem != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7017 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7018 if(check) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7019 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7020 [menuitem setState:UIMenuElementStateOn]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7021 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7022 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7023 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7024 [menuitem setState:UIMenuElementStateOff]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7025 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7026 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7027 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7028 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7029 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7030 * Deletes the menu item specified. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7031 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7032 * menu: The handle to the menu in which the item was appended. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7033 * id: Menuitem id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7034 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7035 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7036 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7037 int API dw_menu_delete_item(HMENUI menux, unsigned long itemid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7038 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7039 #if 0 /* TODO: Remove item from the children array */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7040 id menu = menux; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7041 DWMenuItem *menuitem = [menu itemWithTag:itemid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7042 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7043 if(menuitem != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7044 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7045 [menu removeItem:menuitem]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7046 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7047 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7048 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7049 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7050 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7051 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7052 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7053 * Sets the state of a menu item. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7054 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7055 * menu: The handle to the existing menu. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7056 * id: Menuitem id. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7057 * flags: DW_MIS_ENABLED/DW_MIS_DISABLED |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7058 * DW_MIS_CHECKED/DW_MIS_UNCHECKED |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7059 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7060 void API dw_menu_item_set_state(HMENUI menux, unsigned long itemid, unsigned long state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7061 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7062 id menu = menux; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7063 DWMenuItem *menuitem = [menu itemWithTag:itemid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7064 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7065 if(menuitem != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7066 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7067 if(state & DW_MIS_CHECKED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7068 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7069 [menuitem setState:UIMenuElementStateOn]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7070 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7071 else if(state & DW_MIS_UNCHECKED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7072 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7073 [menuitem setState:UIMenuElementStateOff]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7074 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7075 #if 0 /* TODO: Disabled items not supported on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7076 if(state & DW_MIS_ENABLED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7077 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7078 [menuitem setEnabled:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7079 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7080 else if(state & DW_MIS_DISABLED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7081 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7082 [menuitem setEnabled:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7083 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7084 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7085 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7086 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7087 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7088 /* Gets the notebook page from associated ID */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7089 DWNotebookPage *_notepage_from_id(DWNotebook *notebook, unsigned long pageid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7090 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7091 NSArray *pages = [notebook views]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7092 for(DWNotebookPage *notepage in pages) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7093 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7094 if([notepage pageid] == pageid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7095 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7096 return notepage; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7097 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7098 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7099 return nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7100 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7101 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7102 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7103 * Create a notebook object to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7104 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7105 * id: An ID to be used for getting the resource from the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7106 * resource file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7107 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7108 HWND API dw_notebook_new(ULONG cid, int top) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7109 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7110 DWNotebook *notebook = [[DWNotebook alloc] init]; |
2381
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
7111 [notebook addTarget:notebook |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
7112 action:@selector(pageChanged:) |
3777ea1cccdb
iOS: Continuing conversion...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2380
diff
changeset
|
7113 forControlEvents:UIControlEventValueChanged]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7114 /* [notebook setTag:cid]; Why doesn't this work? */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7115 return notebook; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7116 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7117 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7118 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7119 * Adds a new page to specified notebook. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7120 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7121 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7122 * flags: Any additional page creation flags. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7123 * front: If TRUE page is added at the beginning. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7124 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7125 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7126 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7127 DWNotebook *notebook = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7128 NSInteger page = [notebook pageid]; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7129 DWNotebookPage *notepage = [[DWNotebookPage alloc] init]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7130 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7131 [notepage setPageid:(int)page]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7132 if(front) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7133 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7134 [notebook insertSegmentWithTitle:@"" atIndex:(NSInteger)0 animated:NO]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7135 [views addObject:notepage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7136 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7137 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7138 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7139 [notebook insertSegmentWithTitle:@"" atIndex:[notebook numberOfSegments] animated:NO]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7140 [views addObject:notepage]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7141 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7142 [notepage autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7143 [notebook setPageid:(int)(page+1)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7144 return (unsigned long)page; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7145 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7146 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7147 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7148 * Remove a page from a notebook. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7149 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7150 * handle: Handle to the notebook widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7151 * pageid: ID of the page to be destroyed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7152 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7153 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7154 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7155 DWNotebook *notebook = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7156 DWNotebookPage *notepage = _notepage_from_id(notebook, pageid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7157 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7158 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7159 if(notepage != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7160 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7161 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7162 NSUInteger index = [views indexOfObject:notepage]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7163 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7164 if(index != NSNotFound) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7165 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7166 [notebook removeSegmentAtIndex:index animated:NO]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7167 [views removeObject:notepage]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7168 [notepage release]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7169 } |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7170 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7171 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7172 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7173 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7174 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7175 * Queries the currently visible page ID. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7176 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7177 * handle: Handle to the notebook widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7178 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7179 unsigned long API dw_notebook_page_get(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7180 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7181 DWNotebook *notebook = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7182 NSInteger index = [notebook selectedSegmentIndex]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7183 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7184 DWNotebookPage *notepage = [views objectAtIndex:index]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7185 return [notepage pageid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7186 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7187 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7188 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7189 * Sets the currently visibale page ID. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7190 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7191 * handle: Handle to the notebook widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7192 * pageid: ID of the page to be made visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7193 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7194 void API dw_notebook_page_set(HWND handle, unsigned int pageid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7195 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7196 #if 0 /* TODO: Don't see a method to select a tab */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7197 DWNotebook *notebook = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7198 DWNotebookPage *notepage = _notepage_from_id(notebook, pageid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7199 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7200 if(notepage != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7201 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7202 NSMutableArray<DWNotebookPage *> *views = [notebook views]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7203 NSUInteger index = [views indexOfObject:notepage]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7204 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7205 if(index != NSNotFound) |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7206 { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7207 [notebook selectTabViewItem:notepage]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7208 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7209 } |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7210 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7211 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7212 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7213 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7214 * Sets the text on the specified notebook tab. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7215 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7216 * handle: Notebook handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7217 * pageid: Page ID of the tab to set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7218 * text: Pointer to the text to set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7219 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7220 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7221 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7222 DWNotebook *notebook = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7223 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7224 [notebook setTitle:[NSString stringWithUTF8String:text] forSegmentAtIndex:pageid]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7225 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7226 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7227 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7228 * Sets the text on the specified notebook tab status area. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7229 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7230 * handle: Notebook handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7231 * pageid: Page ID of the tab to set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7232 * text: Pointer to the text to set. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7233 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7234 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7235 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7236 /* Note supported here... do nothing */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7237 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7238 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7239 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7240 * Packs the specified box into the notebook page. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7241 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7242 * handle: Handle to the notebook to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7243 * pageid: Page ID in the notebook which is being packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7244 * page: Box handle to be packed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7245 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7246 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7247 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7248 #if 0 /* TODO: Haven't implemented the content yet since UISegmentedControl is just the buttons */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7249 DWNotebook *notebook = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7250 DWNotebookPage *notepage = _notepage_from_id(notebook, pageid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7251 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7252 if(notepage != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7253 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7254 HWND tmpbox = dw_box_new(DW_VERT, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7255 DWBox *box = tmpbox; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7256 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7257 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7258 [notepage setView:box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7259 [box autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7260 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7261 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7262 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7263 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7264 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7265 * Create a new Window Frame. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7266 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7267 * owner: The Owner's window handle or HWND_DESKTOP. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7268 * title: The Window title. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7269 * flStyle: Style flags, see the PM reference. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7270 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7271 DW_FUNCTION_DEFINITION(dw_window_new, HWND, HWND hwndOwner, const char *title, ULONG flStyle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7272 DW_FUNCTION_ADD_PARAM3(hwndOwner, title, flStyle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7273 DW_FUNCTION_RETURN(dw_window_new, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7274 DW_FUNCTION_RESTORE_PARAM3(hwndOwner, HWND, title, char *, flStyle, ULONG) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7275 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7276 DW_FUNCTION_INIT; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7277 DWWindow *window = [[DWWindow alloc] init]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7278 |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7279 /* TODO: Handle style flags */ |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7280 if(@available(iOS 13.0, *)) { |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7281 [window setLargeContentTitle:[NSString stringWithUTF8String:title]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7282 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7283 DW_FUNCTION_RETURN_THIS(window); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7284 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7285 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7286 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7287 * Call a function from the window (widget)'s context. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7288 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7289 * handle: Window handle of the widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7290 * function: Function pointer to be called. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7291 * data: Pointer to the data to be passed to the function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7292 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7293 void API dw_window_function(HWND handle, void *function, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7294 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7295 void **params = calloc(2, sizeof(void *)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7296 NSValue *v; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7297 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7298 v = [NSValue valueWithPointer:params]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7299 params[0] = function; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7300 params[1] = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7301 [DWObj performSelectorOnMainThread:@selector(doWindowFunc:) withObject:v waitUntilDone:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7302 free(params); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7303 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7304 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7305 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7306 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7307 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7308 * Changes the appearance of the mouse pointer. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7309 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7310 * handle: Handle to widget for which to change. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7311 * cursortype: ID of the pointer you want. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7312 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7313 void API dw_window_set_pointer(HWND handle, int pointertype) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7314 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7315 /* TODO: Only might be possible on Catalyst */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7316 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7317 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7318 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7319 * Makes the window visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7320 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7321 * handle: The window handle to make visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7322 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7323 int API dw_window_show(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7324 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7325 NSObject *object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7326 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7327 if([ object isMemberOfClass:[ DWWindow class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7328 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7329 DWWindow *window = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7330 CGRect rect = [window frame]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7331 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7332 /* If we haven't been sized by a call.. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7333 if(rect.size.width <= 1 || rect.size.height <= 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7334 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7335 /* Determine the contents size */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7336 dw_window_set_size(handle, 0, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7337 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7338 if(![window shown]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7339 [window setShown:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7340 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7341 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7342 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7343 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7344 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7345 * Makes the window invisible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7346 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7347 * handle: The window handle to make visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7348 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7349 int API dw_window_hide(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7350 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7351 NSObject *object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7352 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7353 if([ object isKindOfClass:[ UIWindow class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7354 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7355 UIWindow *window = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7356 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7357 [window setHidden:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7358 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7359 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7360 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7361 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7362 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7363 * Sets the colors used by a specified window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7364 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7365 * handle: The window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7366 * fore: Foreground color in DW_RGB format or a default color index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7367 * back: Background color in DW_RGB format or a default color index. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7368 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7369 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7370 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7371 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7372 unsigned long _fore = _get_color(fore); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7373 unsigned long _back = _get_color(back); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7374 UIColor *fg = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7375 UIColor *bg = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7376 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7377 /* Get the UIColor for non-default colors */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7378 if(fore != DW_CLR_DEFAULT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7379 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7380 fg = [UIColor colorWithRed: DW_RED_VALUE(_fore)/255.0 green: DW_GREEN_VALUE(_fore)/255.0 blue: DW_BLUE_VALUE(_fore)/255.0 alpha: 1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7381 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7382 if(back != DW_CLR_DEFAULT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7383 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7384 bg = [UIColor colorWithRed: DW_RED_VALUE(_back)/255.0 green: DW_GREEN_VALUE(_back)/255.0 blue: DW_BLUE_VALUE(_back)/255.0 alpha: 1]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7385 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7386 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7387 /* Get the textfield from the spinbutton */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7388 if([object isMemberOfClass:[DWSpinButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7389 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7390 object = [object textfield]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7391 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7392 /* Get the cell on classes using NSCell */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7393 if([object isKindOfClass:[UITextField class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7394 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7395 [object setTextColor:(fg ? fg : [UIColor labelColor])]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7396 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7397 if([object isMemberOfClass:[DWButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7398 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7399 [object setTextColor:(fg ? fg : [UIColor labelColor])]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7400 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7401 if([object isKindOfClass:[UITextField class]] || [object isKindOfClass:[UIButton class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7402 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7403 [object setBackgroundColor:(bg ? bg : [UIColor systemBackgroundColor])]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7404 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7405 else if([object isMemberOfClass:[DWBox class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7406 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7407 DWBox *box = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7408 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7409 [box setColor:_back]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7410 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7411 else if([object isKindOfClass:[UITableView class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7412 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7413 DWContainer *cont = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7414 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7415 [cont setBackgroundColor:(bg ? bg : [UIColor systemBackgroundColor])]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7416 [cont setForegroundColor:(fg ? fg : [UIColor labelColor])]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7417 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7418 else if([object isMemberOfClass:[DWMLE class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7419 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7420 DWMLE *mle = handle; |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7421 [mle setBackgroundColor:(bg ? bg : [UIColor systemBackgroundColor])]; |
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7422 [mle setTextColor:(fg ? fg : [UIColor labelColor])]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7423 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7424 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7425 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7426 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7427 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7428 * Sets the font used by a specified window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7429 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7430 * handle: The window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7431 * border: Size of the window border in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7432 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7433 int API dw_window_set_border(HWND handle, int border) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7434 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7435 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7436 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7437 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7438 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7439 * Sets the style of a given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7440 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7441 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7442 * width: New width in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7443 * height: New height in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7444 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7445 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7446 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7447 id object = _text_handle(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7448 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7449 if([object isKindOfClass:[UILabel class]]) |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7450 { |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7451 UILabel *label = object; |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7452 |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7453 [label setTextAlignment:(style & 0xF)]; |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7454 #if 0 /* TODO: Implement vertical centering */ |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7455 if(mask & DW_DT_VCENTER) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7456 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7457 [cell setVCenter:(style & DW_DT_VCENTER ? YES : NO)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7458 } |
2378
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7459 #endif |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7460 if(mask & DW_DT_WORDBREAK) |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7461 { |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7462 if(style & DW_DT_WORDBREAK) |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7463 [label setLineBreakMode:NSLineBreakByWordWrapping]; |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7464 else |
cc858be0cb81
iOS: More work on conversion from Mac... going to be a few more of these
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2377
diff
changeset
|
7465 [label setLineBreakMode:NSLineBreakByTruncatingTail]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7466 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7467 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7468 #if 0 /* TODO: See if we can change alignment... */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7469 else if([object isMemberOfClass:[UITextView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7470 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7471 UITextView *tv = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7472 [tv setAlignment:(style & mask)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7473 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7474 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7475 else if([object isMemberOfClass:[DWMenuItem class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7476 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7477 if(mask & (DW_MIS_CHECKED | DW_MIS_UNCHECKED)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7478 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7479 if(style & DW_MIS_CHECKED) |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7480 [object setState:UIMenuElementStateOn]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7481 else if(style & DW_MIS_UNCHECKED) |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7482 [object setState:UIMenuElementStateOff]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7483 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7484 if(mask & (DW_MIS_ENABLED | DW_MIS_DISABLED)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7485 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7486 if(style & DW_MIS_ENABLED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7487 [object setEnabled:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7488 else if(style & DW_MIS_DISABLED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7489 [object setEnabled:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7490 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7491 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7492 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7493 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7494 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7495 * Sets the current focus item for a window/dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7496 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7497 * handle: Handle to the dialog item to be focused. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7498 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7499 * This is for use after showing the window/dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7500 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7501 void API dw_window_set_focus(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7502 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7503 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7504 |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7505 [object becomeFirstResponder]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7506 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7507 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7508 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7509 * Sets the default focus item for a window/dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7510 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7511 * window: Toplevel window or dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7512 * defaultitem: Handle to the dialog item to be default. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7513 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7514 * This is for use before showing the window/dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7515 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7516 void API dw_window_default(HWND handle, HWND defaultitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7517 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7518 DWWindow *window = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7519 id object = defaultitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7520 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7521 if([window isKindOfClass:[UIWindow class]] && [object isKindOfClass:[UIControl class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7522 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7523 [object becomeFirstResponder]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7524 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7525 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7526 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7527 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7528 * Sets window to click the default dialog item when an ENTER is pressed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7529 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7530 * window: Window (widget) to look for the ENTER press. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7531 * next: Window (widget) to move to next (or click) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7532 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7533 void API dw_window_click_default(HWND handle, HWND next) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7534 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7535 /* TODO: Figure out how to do this if we should */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7536 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7537 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7538 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7539 * Captures the mouse input to this window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7540 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7541 * handle: Handle to receive mouse input. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7542 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7543 void API dw_window_capture(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7544 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7545 /* Don't do anything for now */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7546 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7547 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7548 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7549 * Releases previous mouse capture. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7550 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7551 void API dw_window_release(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7552 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7553 /* Don't do anything for now */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7554 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7555 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7556 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7557 * Changes a window's parent to newparent. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7558 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7559 * handle: The window handle to destroy. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7560 * newparent: The window's new parent window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7561 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7562 void API dw_window_reparent(HWND handle, HWND newparent) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7563 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7564 /* TODO: Not sure if we should even bother with this */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7565 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7566 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7567 /* Allows the user to choose a font using the system's font chooser dialog. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7568 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7569 * currfont: current font |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7570 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7571 * A malloced buffer with the selected font or NULL on error. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7572 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7573 char * API dw_font_choose(const char *currfont) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7574 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7575 __block UIFont *font = nil; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7576 UIFontPickerViewController* picker = [[UIFontPickerViewController alloc] init]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7577 /*TODO: Add handler for accepting the font fontPickerViewControllerDidPickFont */ |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7578 /* Wait for them to pick a color */ |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7579 [picker presentViewController:picker animated:YES completion:nil]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7580 [picker release]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7581 |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7582 if(font) |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7583 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7584 NSString *fontname = [font fontName]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7585 NSString *output = [NSString stringWithFormat:@"%d.%s", (int)[font pointSize], [fontname UTF8String]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7586 return strdup([output UTF8String]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7587 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7588 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7589 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7590 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7591 /* Internal function to return a pointer to an item struct |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7592 * with information about the packing information regarding object. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7593 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7594 Item *_box_item(id object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7595 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7596 /* Find the item within the box it is packed into */ |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
7597 if([object isKindOfClass:[DWBox class]] || [object isKindOfClass:[UIControl class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7598 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7599 DWBox *parent = (DWBox *)[object superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7600 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7601 /* Some controls are embedded in scrollviews... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7602 * so get the parent of the scrollview in that case. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7603 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7604 if([object isKindOfClass:[UITableView class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7605 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7606 object = [parent superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7607 parent = (DWBox *)[object superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7608 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7609 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
7610 if([parent isKindOfClass:[DWBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7611 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7612 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7613 Item *thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7614 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7615 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7616 for(z=0;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7617 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7618 if(thisitem[z].hwnd == object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7619 return &thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7620 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7621 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7622 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7623 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7624 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7625 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7626 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7627 * Sets the font used by a specified window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7628 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7629 * handle: The window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7630 * fontname: Name and size of the font in the form "size.fontname" |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7631 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7632 int API dw_window_set_font(HWND handle, const char *fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7633 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7634 UIFont *font = fontname ? _dw_font_by_name(fontname) : |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7635 (DWDefaultFont ? DWDefaultFont : [UIFont systemFontOfSize:[UIFont smallSystemFontSize]]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7636 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7637 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7638 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7639 id object = _text_handle(handle); |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7640 if([object isMemberOfClass:[DWMLE class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7641 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7642 DWMLE *mle = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7643 |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7644 [mle setFont:font]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7645 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7646 else if([object isKindOfClass:[UIControl class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7647 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7648 [object setFont:font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7649 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7650 else if([object isMemberOfClass:[DWRender class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7651 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7652 DWRender *render = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7653 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7654 [render setFont:font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7655 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7656 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7657 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7658 /* If we changed the text... */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7659 Item *item = _box_item(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7660 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7661 /* Check to see if any of the sizes need to be recalculated */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7662 if(item && (item->origwidth == -1 || item->origheight == -1)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7663 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7664 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7665 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7666 _dw_redraw([object window], TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7667 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7668 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7669 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7670 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7671 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7672 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7673 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7674 * Returns the current font for the specified window |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7675 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7676 * handle: The window handle from which to obtain the font. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7677 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7678 char * API dw_window_get_font(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7679 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7680 id object = _text_handle(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7681 UIFont *font = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7682 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
7683 if([object isKindOfClass:[UIControl class]] || [object isMemberOfClass:[DWRender class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7684 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7685 font = [object font]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7686 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7687 if(font) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7688 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7689 NSString *fontname = [font fontName]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7690 NSString *output = [NSString stringWithFormat:@"%d.%s", (int)[font pointSize], [fontname UTF8String]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7691 return strdup([output UTF8String]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7692 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7693 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7694 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7695 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7696 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7697 * Destroys a window and all of it's children. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7698 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7699 * handle: The window handle to destroy. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7700 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7701 DW_FUNCTION_DEFINITION(dw_window_destroy, int, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7702 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7703 DW_FUNCTION_RETURN(dw_window_destroy, int) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7704 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7705 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7706 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7707 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7708 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7709 int retval = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7710 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7711 /* Handle destroying a top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7712 if([ object isKindOfClass:[ UIWindow class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7713 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7714 DWWindow *window = handle; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7715 [window release]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7716 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7717 /* Handle removing menu items from menus */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7718 #if 0 /* TODO: The menus are technically immutable, so we'd need to recreate it...*/ |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
7719 else if([ object isKindOfClass:[UIMenuItem class]]) |
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
7720 { |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7721 DWMenu *menu = [object menu]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7722 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7723 [menu removeItem:object]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7724 } |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7725 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7726 /* Handle destroying a control or box */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7727 else if([object isKindOfClass:[UIView class]] || [object isKindOfClass:[UIControl class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7728 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7729 DWBox *parent = (DWBox *)[object superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7730 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7731 /* Some controls are embedded in scrollviews... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7732 * so get the parent of the scrollview in that case. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7733 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7734 if(([object isKindOfClass:[UITableView class]] || [object isMemberOfClass:[DWMLE class]])) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7735 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7736 object = [parent superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7737 parent = (DWBox *)[object superview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7738 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7739 |
2377
6393d8c10569
iOS: More progress on converting Mac to iOS.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2373
diff
changeset
|
7740 if([parent isKindOfClass:[DWBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7741 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7742 id window = [object window]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7743 Box *thisbox = [parent box]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7744 int z, index = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7745 Item *tmpitem = NULL, *thisitem = thisbox->items; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7746 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7747 if(!thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7748 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7749 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7750 for(z=0;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7751 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7752 if(thisitem[z].hwnd == object) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7753 index = z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7754 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7755 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7756 if(index != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7757 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7758 [object removeFromSuperview]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7759 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7760 if(thisbox->count > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7761 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7762 tmpitem = calloc(sizeof(Item), (thisbox->count-1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7763 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7764 /* Copy all but the current entry to the new list */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7765 for(z=0;z<index;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7766 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7767 tmpitem[z] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7768 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7769 for(z=index+1;z<thisbox->count;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7770 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7771 tmpitem[z-1] = thisitem[z]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7772 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7773 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7774 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7775 thisbox->items = tmpitem; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7776 if(thisitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7777 free(thisitem); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7778 if(tmpitem) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7779 thisbox->count--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7780 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7781 thisbox->count = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7782 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7783 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7784 _dw_redraw(window, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7785 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7786 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7787 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7788 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7789 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7790 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7791 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7792 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7793 * Gets the text used for a given window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7794 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7795 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7796 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7797 * text: The text associsated with a given window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7798 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7799 DW_FUNCTION_DEFINITION(dw_window_get_text, char *, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7800 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7801 DW_FUNCTION_RETURN(dw_window_get_text, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7802 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7803 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7804 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7805 id object = _text_handle(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7806 char *retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7807 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7808 if([ object isKindOfClass:[ UIWindow class ] ] || [ object isKindOfClass:[ UIButton class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7809 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7810 id window = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7811 NSString *nsstr = [ window title]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7812 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7813 retval = strdup([ nsstr UTF8String ]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7814 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7815 else if([ object isKindOfClass:[ UIControl class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7816 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7817 UIControl *control = object; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7818 NSString *nsstr = [control text]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7819 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7820 retval = strdup([ nsstr UTF8String ]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7821 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7822 DW_FUNCTION_RETURN_THIS(retval); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7823 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7824 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7825 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7826 * Sets the text used for a given window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7827 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7828 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7829 * text: The text associsated with a given window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7830 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7831 DW_FUNCTION_DEFINITION(dw_window_set_text, void, HWND handle, const char *text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7832 DW_FUNCTION_ADD_PARAM2(handle, text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7833 DW_FUNCTION_NO_RETURN(dw_window_set_text) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7834 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, text, char *) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7835 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7836 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7837 id object = _text_handle(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7838 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7839 if([ object isKindOfClass:[ UIWindow class ] ] || [ object isKindOfClass:[ UIButton class ] ]) |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7840 [object setTitle:[NSString stringWithUTF8String:text]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7841 else if([ object isKindOfClass:[ UIControl class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7842 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7843 UIControl *control = object; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7844 [control setText:[NSString stringWithUTF8String:text]]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7845 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7846 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7847 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7848 /* If we changed the text... */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7849 Item *item = _box_item(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7850 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7851 /* Check to see if any of the sizes need to be recalculated */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7852 if(item && (item->origwidth == -1 || item->origheight == -1)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7853 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7854 int newwidth, newheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7855 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7856 _dw_control_size(handle, &newwidth, &newheight); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7857 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7858 /* Only update the item and redraw the window if it changed */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7859 if((item->origwidth == -1 && item->width != newwidth) || |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7860 (item->origheight == -1 && item->height != newheight)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7861 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7862 if(item->origwidth == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7863 item->width = newwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7864 if(item->origheight == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7865 item->height = newheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7866 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7867 _dw_redraw([object window], TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7868 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7869 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7870 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7871 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7872 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7873 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7874 * Sets the text used for a given window's floating bubble help. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7875 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7876 * handle: Handle to the window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7877 * bubbletext: The text in the floating bubble tooltip. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7878 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7879 void API dw_window_set_tooltip(HWND handle, const char *bubbletext) |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7880 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7881 /* Tooltips don't exist on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7882 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7883 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7884 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7885 * Disables given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7886 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7887 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7888 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7889 DW_FUNCTION_DEFINITION(dw_window_disable, void, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7890 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7891 DW_FUNCTION_NO_RETURN(dw_window_disable) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7892 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7893 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7894 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7895 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7896 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7897 if([object isMemberOfClass:[UIScrollView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7898 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7899 UIScrollView *sv = handle; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7900 NSArray *subviews = [sv subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7901 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7902 } |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
7903 if([object isKindOfClass:[UIControl class]] || [object isKindOfClass:[UIMenuItem class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7904 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7905 [object setEnabled:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7906 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7907 if([object isKindOfClass:[UITextView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7908 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7909 UITextView *mle = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7910 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7911 [mle setEditable:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7912 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7913 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7914 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7915 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7916 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7917 * Enables given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7918 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7919 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7920 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7921 DW_FUNCTION_DEFINITION(dw_window_enable, void, HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7922 DW_FUNCTION_ADD_PARAM1(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7923 DW_FUNCTION_NO_RETURN(dw_window_enable) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7924 DW_FUNCTION_RESTORE_PARAM1(handle, HWND) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7925 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7926 DW_FUNCTION_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7927 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7928 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7929 if([object isMemberOfClass:[UIScrollView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7930 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7931 UIScrollView *sv = handle; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7932 NSArray *subviews = [sv subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
7933 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7934 } |
2383
a410d42d9e36
iOS: Implement classes for encapsulating immutable UIImage and UIMenu so the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2382
diff
changeset
|
7935 if([object isKindOfClass:[UIControl class]] /* TODO: || [object isKindOfClass:[UIMenuItem class]] */) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7936 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7937 [object setEnabled:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7938 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7939 if([object isKindOfClass:[UITextView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7940 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7941 UITextView *mle = object; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7942 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7943 [mle setEditable:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7944 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7945 DW_FUNCTION_RETURN_NOTHING; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7946 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7947 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7948 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7949 * Sets the bitmap used for a given static window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7950 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7951 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7952 * id: An ID to be used to specify the icon, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7953 * (pass 0 if you use the filename param) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7954 * filename: a path to a file (Bitmap on OS/2 or |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7955 * Windows and a pixmap on Unix, pass |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7956 * NULL if you use the id param) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7957 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7958 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, const char *data, int len) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7959 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7960 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7961 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7962 if([ object isKindOfClass:[ UIImageView class ] ] || [ object isKindOfClass:[ UIButton class ]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7963 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7964 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7965 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7966 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7967 NSData *thisdata = [NSData dataWithBytes:data length:len]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7968 UIImage *pixmap = [[[UIImage alloc] initWithData:thisdata] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7969 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7970 if(pixmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7971 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7972 [object setImage:pixmap]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7973 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7974 /* If we changed the bitmap... */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7975 Item *item = _box_item(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7976 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7977 /* Check to see if any of the sizes need to be recalculated */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7978 if(item && (item->origwidth == -1 || item->origheight == -1)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7979 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7980 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7981 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7982 _dw_redraw([object window], TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7983 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7984 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7985 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7986 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7987 dw_window_set_bitmap(handle, cid, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7988 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7989 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7990 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7991 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7992 * Sets the bitmap used for a given static window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7993 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7994 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7995 * id: An ID to be used to specify the icon, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7996 * (pass 0 if you use the filename param) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7997 * filename: a path to a file (Bitmap on OS/2 or |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7998 * Windows and a pixmap on Unix, pass |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
7999 * NULL if you use the id param) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8000 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8001 void API dw_window_set_bitmap(HWND handle, unsigned long resid, const char *filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8002 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8003 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8004 DW_LOCAL_POOL_IN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8005 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8006 if([ object isKindOfClass:[ UIImageView class ] ] || [ object isKindOfClass:[ UIButton class ]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8007 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8008 UIImage *bitmap = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8009 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8010 if(filename) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8011 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8012 char *ext = _dw_get_image_extension( filename ); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8013 NSString *nstr = [ NSString stringWithUTF8String:filename ]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8014 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8015 bitmap = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8016 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8017 if(!bitmap && ext) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8018 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8019 nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8020 bitmap = [[[UIImage alloc] initWithContentsOfFile:nstr] autorelease]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8021 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8022 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8023 if(!bitmap && resid > 0 && resid < 65536) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8024 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8025 bitmap = _dw_icon_load(resid); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8026 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8027 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8028 if(bitmap) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8029 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8030 [object setImage:bitmap]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8031 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8032 /* If we changed the bitmap... */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8033 Item *item = _box_item(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8034 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8035 /* Check to see if any of the sizes need to be recalculated */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8036 if(item && (item->origwidth == -1 || item->origheight == -1)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8037 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8038 _dw_control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8039 /* Queue a redraw on the top-level window */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8040 _dw_redraw([object window], TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8041 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8042 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8043 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8044 DW_LOCAL_POOL_OUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8045 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8046 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8047 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8048 * Sets the icon used for a given window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8049 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8050 * handle: Handle to the window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8051 * id: An ID to be used to specify the icon. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8052 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8053 void API dw_window_set_icon(HWND handle, HICN icon) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8054 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8055 /* This isn't needed, it is loaded from the bundle */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8056 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8057 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8058 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8059 * Gets the child window handle with specified ID. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8060 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8061 * handle: Handle to the parent window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8062 * id: Integer ID of the child. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8063 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8064 HWND API dw_window_from_id(HWND handle, int cid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8065 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8066 NSObject *object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8067 UIView *view = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8068 if([ object isKindOfClass:[ UIWindow class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8069 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8070 UIWindow *window = handle; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8071 NSArray *subviews = [window subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8072 view = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8073 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8074 return [view viewWithTag:cid]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8075 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8076 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8077 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8078 * Minimizes or Iconifies a top-level window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8079 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8080 * handle: The window handle to minimize. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8081 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8082 int API dw_window_minimize(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8083 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8084 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8085 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8086 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8087 /* Causes entire window to be invalidated and redrawn. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8088 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8089 * handle: Toplevel window handle to be redrawn. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8090 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8091 void API dw_window_redraw(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8092 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8093 DWWindow *window = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8094 [window setRedraw:YES]; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8095 [window setShown:YES]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8096 [window setRedraw:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8097 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8098 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8099 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8100 * Makes the window topmost. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8101 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8102 * handle: The window handle to make topmost. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8103 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8104 int API dw_window_raise(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8105 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8106 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8107 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8108 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8109 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8110 * Makes the window bottommost. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8111 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8112 * handle: The window handle to make bottommost. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8113 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8114 int API dw_window_lower(HWND handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8115 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8116 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8117 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8118 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8119 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8120 * Sets the size of a given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8121 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8122 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8123 * width: New width in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8124 * height: New height in pixels. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8125 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8126 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8127 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8128 /* On iOS the window usually takes up the full screen */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8129 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8130 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8131 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8132 * Gets the size the system thinks the widget should be. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8133 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8134 * handle: Window handle of the item to be back. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8135 * width: Width in pixels of the item or NULL if not needed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8136 * height: Height in pixels of the item or NULL if not needed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8137 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8138 void API dw_window_get_preferred_size(HWND handle, int *width, int *height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8139 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8140 id object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8141 |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8142 if([object isMemberOfClass:[DWBox class]]) |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8143 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8144 Box *thisbox; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8145 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8146 if((thisbox = (Box *)[object box])) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8147 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8148 int depth = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8149 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8150 /* Calculate space requirements */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8151 _resize_box(thisbox, &depth, 0, 0, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8152 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8153 /* Return what was requested */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8154 if(width) *width = thisbox->minwidth; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8155 if(height) *height = thisbox->minheight; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8156 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8157 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8158 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8159 _dw_control_size(handle, width, height); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8160 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8161 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8162 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8163 * Sets the gravity of a given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8164 * Gravity controls which corner of the screen and window the position is relative to. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8165 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8166 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8167 * horz: DW_GRAV_LEFT (default), DW_GRAV_RIGHT or DW_GRAV_CENTER. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8168 * vert: DW_GRAV_TOP (default), DW_GRAV_BOTTOM or DW_GRAV_CENTER. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8169 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8170 void API dw_window_set_gravity(HWND handle, int horz, int vert) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8171 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8172 dw_window_set_data(handle, "_dw_grav_horz", DW_INT_TO_POINTER(horz)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8173 dw_window_set_data(handle, "_dw_grav_vert", DW_INT_TO_POINTER(vert)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8174 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8175 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8176 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8177 * Sets the position of a given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8178 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8179 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8180 * x: X location from the bottom left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8181 * y: Y location from the bottom left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8182 */ |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8183 void API dw_window_set_pos(HWND handle, LONG x, LONG y) |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8184 { |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8185 /* iOS windows take up the whole screen */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8186 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8187 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8188 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8189 * Sets the position and size of a given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8190 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8191 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8192 * x: X location from the bottom left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8193 * y: Y location from the bottom left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8194 * width: Width of the widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8195 * height: Height of the widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8196 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8197 void API dw_window_set_pos_size(HWND handle, LONG x, LONG y, ULONG width, ULONG height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8198 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8199 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8200 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8201 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8202 * Gets the position and size of a given window (widget). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8203 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8204 * handle: Window (widget) handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8205 * x: X location from the bottom left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8206 * y: Y location from the bottom left. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8207 * width: Width of the widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8208 * height: Height of the widget. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8209 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8210 void API dw_window_get_pos_size(HWND handle, LONG *x, LONG *y, ULONG *width, ULONG *height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8211 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8212 NSObject *object = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8213 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8214 if([ object isKindOfClass:[ UIWindow class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8215 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8216 UIWindow *window = handle; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
8217 CGRect rect = [window frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8218 if(x) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8219 *x = rect.origin.x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8220 if(y) |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8221 *y = rect.origin.y; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8222 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8223 *width = rect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8224 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8225 *height = rect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8226 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8227 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8228 else if([ object isKindOfClass:[ UIControl class ] ]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8229 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8230 UIControl *control = handle; |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
8231 CGRect rect = [control frame]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8232 if(x) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8233 *x = rect.origin.x; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8234 if(y) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8235 *y = rect.origin.y; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8236 if(width) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8237 *width = rect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8238 if(height) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8239 *height = rect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8240 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8241 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8242 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8243 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8244 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8245 * Returns the width of the screen. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8246 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8247 int API dw_screen_width(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8248 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8249 CGRect screenRect = [[UIScreen mainScreen] bounds]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8250 return screenRect.size.width; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8251 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8252 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8253 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8254 * Returns the height of the screen. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8255 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8256 int API dw_screen_height(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8257 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8258 CGRect screenRect = [[UIScreen mainScreen] bounds]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8259 return screenRect.size.height; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8260 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8261 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8262 /* This should return the current color depth */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8263 unsigned long API dw_color_depth_get(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8264 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8265 /* iOS always runs in 32bit depth */ |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8266 return 32; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8267 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8268 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8269 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8270 * Creates a new system notification if possible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8271 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8272 * title: The short title of the notification. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8273 * imagepath: Path to an image to display or NULL if none. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8274 * description: A longer description of the notification, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8275 * or NULL if none is necessary. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8276 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8277 * A handle to the notification which can be used to attach a "clicked" event if desired, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8278 * or NULL if it fails or notifications are not supported by the system. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8279 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8280 * This will create a system notification that will show in the notifaction panel |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8281 * on supported systems, which may be clicked to perform another task. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8282 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8283 HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8284 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8285 char outbuf[1025] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8286 HWND retval = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8287 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8288 if(description) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8289 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8290 va_list args; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8291 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8292 va_start(args, description); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8293 vsnprintf(outbuf, 1024, description, args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8294 va_end(args); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8295 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8296 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8297 /* Configure the notification's payload. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8298 if (@available(iOS 10.0, *)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8299 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8300 if([[NSBundle mainBundle] bundleIdentifier] != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8301 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8302 UNMutableNotificationContent* notification = [[UNMutableNotificationContent alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8303 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8304 if(notification) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8305 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8306 notification.title = [NSString stringWithUTF8String:title]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8307 if(description) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8308 notification.body = [NSString stringWithUTF8String:outbuf]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8309 if(imagepath) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8310 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8311 NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:imagepath]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8312 NSError *error; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8313 UNNotificationAttachment *attachment = [UNNotificationAttachment attachmentWithIdentifier:@"imageID" |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8314 URL:url |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8315 options:nil |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8316 error:&error]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8317 if(attachment) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8318 notification.attachments = @[attachment]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8319 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8320 retval = notification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8321 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8322 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8323 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8324 return retval; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8325 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8326 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8327 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8328 * Sends a notification created by dw_notification_new() after attaching signal handler. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8329 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8330 * notification: The handle to the notification returned by dw_notification_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8331 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8332 * DW_ERROR_NONE on success, DW_ERROR_UNKNOWN on error or not supported. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8333 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8334 int dw_notification_send(HWND notification) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8335 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8336 if(notification) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8337 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8338 NSString *notid = [NSString stringWithFormat:@"dw-notification-%llu", DW_POINTER_TO_ULONGLONG(notification)]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8339 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8340 /* Schedule the notification. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8341 if (@available(iOS 10.0, *)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8342 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8343 if([[NSBundle mainBundle] bundleIdentifier] != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8344 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8345 UNMutableNotificationContent* content = (UNMutableNotificationContent *)notification; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8346 UNNotificationRequest* request = [UNNotificationRequest requestWithIdentifier:notid content:content trigger:nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8347 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8348 UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8349 [center addNotificationRequest:request withCompletionHandler:nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8350 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8351 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8352 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8353 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8354 return DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8355 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8356 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8357 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8358 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8359 * Returns some information about the current operating environment. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8360 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8361 * env: Pointer to a DWEnv struct. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8362 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8363 void dw_environment_query(DWEnv *env) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8364 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8365 memset(env, '\0', sizeof(DWEnv)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8366 strcpy(env->osName, "iOS"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8367 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8368 strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8369 strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8370 strncpy(env->htmlEngine, "WEBKIT", sizeof(env->htmlEngine)-1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8371 env->DWMajorVersion = DW_MAJOR_VERSION; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8372 env->DWMinorVersion = DW_MINOR_VERSION; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8373 #ifdef VER_REV |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8374 env->DWSubVersion = VER_REV; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8375 #else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8376 env->DWSubVersion = DW_SUB_VERSION; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8377 #endif |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8378 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8379 env->MajorVersion = DWOSMajor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8380 env->MinorVersion = DWOSMinor; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8381 env->MajorBuild = DWOSBuild; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8382 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8383 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8384 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8385 * Emits a beep. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8386 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8387 * freq: Frequency. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8388 * dur: Duration. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8389 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8390 void API dw_beep(int freq, int dur) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8391 { |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8392 /* TODO: Don't see a simple way to do this without bundling sounds */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8393 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8394 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8395 /* Call this after drawing to the screen to make sure |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8396 * anything you have drawn is visible. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8397 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8398 void API dw_flush(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8399 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8400 /* This may need to be thread specific */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8401 [DWObj performSelectorOnMainThread:@selector(doFlush:) withObject:nil waitUntilDone:NO]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8402 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8403 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8404 /* Functions for managing the user data lists that are associated with |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8405 * a given window handle. Used in dw_window_set_data() and |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8406 * dw_window_get_data(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8407 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8408 UserData *_find_userdata(UserData **root, const char *varname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8409 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8410 UserData *tmp = *root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8411 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8412 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8413 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8414 if(strcasecmp(tmp->varname, varname) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8415 return tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8416 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8417 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8418 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8419 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8420 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8421 int _new_userdata(UserData **root, const char *varname, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8422 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8423 UserData *new = _find_userdata(root, varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8424 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8425 if(new) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8426 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8427 new->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8428 return TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8429 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8430 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8431 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8432 new = malloc(sizeof(UserData)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8433 if(new) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8434 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8435 new->varname = strdup(varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8436 new->data = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8437 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8438 new->next = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8439 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8440 if (!*root) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8441 *root = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8442 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8443 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8444 UserData *prev = *root, *tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8445 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8446 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8447 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8448 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8449 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8450 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8451 prev->next = new; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8452 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8453 return TRUE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8454 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8455 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8456 return FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8457 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8458 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8459 int _remove_userdata(UserData **root, const char *varname, int all) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8460 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8461 UserData *prev = NULL, *tmp = *root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8462 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8463 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8464 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8465 if(all || strcasecmp(tmp->varname, varname) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8466 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8467 if(!prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8468 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8469 *root = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8470 free(tmp->varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8471 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8472 if(!all) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8473 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8474 tmp = *root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8475 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8476 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8477 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8478 /* If all is true we should |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8479 * never get here. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8480 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8481 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8482 free(tmp->varname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8483 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8484 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8485 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8486 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8487 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8488 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8489 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8490 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8491 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8492 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8493 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8494 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8495 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8496 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8497 * Add a named user data item to a window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8498 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8499 * window: Window handle of signal to be called back. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8500 * dataname: A string pointer identifying which signal to be hooked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8501 * data: User data to be passed to the handler function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8502 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8503 void dw_window_set_data(HWND window, const char *dataname, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8504 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8505 id object = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8506 if([object isMemberOfClass:[DWWindow class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8507 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8508 UIWindow *win = window; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8509 NSArray *subviews = [win subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8510 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8511 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8512 else if([object isMemberOfClass:[UIScrollView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8513 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8514 UIScrollView *sv = window; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8515 NSArray *subviews = [sv subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8516 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8517 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8518 WindowData *blah = (WindowData *)[object userdata]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8519 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8520 if(!blah) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8521 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8522 if(!dataname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8523 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8524 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8525 blah = calloc(1, sizeof(WindowData)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8526 [object setUserdata:blah]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8527 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8528 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8529 if(data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8530 _new_userdata(&(blah->root), dataname, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8531 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8532 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8533 if(dataname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8534 _remove_userdata(&(blah->root), dataname, FALSE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8535 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8536 _remove_userdata(&(blah->root), NULL, TRUE); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8537 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8538 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8539 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8540 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8541 * Gets a named user data item to a window handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8542 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8543 * window: Window handle of signal to be called back. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8544 * dataname: A string pointer identifying which signal to be hooked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8545 * data: User data to be passed to the handler function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8546 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8547 void *dw_window_get_data(HWND window, const char *dataname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8548 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8549 id object = window; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8550 if([object isMemberOfClass:[DWWindow class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8551 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8552 UIWindow *win = window; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8553 NSArray *subviews = [win subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8554 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8555 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8556 else if([object isMemberOfClass:[UIScrollView class]]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8557 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8558 UIScrollView *sv = window; |
2384
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8559 NSArray *subviews = [sv subviews]; |
32ebd33be56b
iOS: First building version. Yay! Still lots to do but progress.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2383
diff
changeset
|
8560 object = [subviews firstObject]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8561 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8562 WindowData *blah = (WindowData *)[object userdata]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8563 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8564 if(blah && blah->root && dataname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8565 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8566 UserData *ud = _find_userdata(&(blah->root), dataname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8567 if(ud) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8568 return ud->data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8569 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8570 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8571 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8572 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8573 #define DW_TIMER_MAX 64 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8574 NSTimer *DWTimers[DW_TIMER_MAX]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8575 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8576 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8577 * Add a callback to a timer event. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8578 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8579 * interval: Milliseconds to delay between calls. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8580 * sigfunc: The pointer to the function to be used as the callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8581 * data: User data to be passed to the handler function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8582 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8583 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8584 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8585 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8586 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8587 int z; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8588 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8589 for(z=0;z<DW_TIMER_MAX;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8590 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8591 if(!DWTimers[z]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8592 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8593 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8594 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8595 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8596 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8597 if(sigfunc && !DWTimers[z]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8598 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8599 NSTimeInterval seconds = (double)interval / 1000.0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8600 NSTimer *thistimer = DWTimers[z] = [NSTimer scheduledTimerWithTimeInterval:seconds target:DWHandler selector:@selector(runTimer:) userInfo:nil repeats:YES]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8601 _new_signal(0, thistimer, z+1, sigfunc, NULL, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8602 return z+1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8603 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8604 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8605 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8606 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8607 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8608 * Removes timer callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8609 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8610 * id: Timer ID returned by dw_timer_connect(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8611 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8612 void API dw_timer_disconnect(int timerid) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8613 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8614 SignalHandler *prev = NULL, *tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8615 NSTimer *thistimer; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8616 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8617 /* 0 is an invalid timer ID */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8618 if(timerid < 1 || !DWTimers[timerid-1]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8619 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8620 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8621 thistimer = DWTimers[timerid-1]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8622 DWTimers[timerid-1] = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8623 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8624 [thistimer invalidate]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8625 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8626 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8627 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8628 if(tmp->id == timerid && tmp->window == thistimer) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8629 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8630 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8631 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8632 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8633 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8634 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8635 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8636 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8637 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8638 Root = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8639 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8640 tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8641 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8642 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8643 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8644 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8645 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8646 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8647 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8648 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8649 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8650 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8651 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8652 * Add a callback to a window event. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8653 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8654 * window: Window handle of signal to be called back. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8655 * signame: A string pointer identifying which signal to be hooked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8656 * sigfunc: The pointer to the function to be used as the callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8657 * data: User data to be passed to the handler function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8658 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8659 void API dw_signal_connect(HWND window, const char *signame, void *sigfunc, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8660 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8661 dw_signal_connect_data(window, signame, sigfunc, NULL, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8662 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8663 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8664 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8665 * Add a callback to a window event with a closure callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8666 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8667 * window: Window handle of signal to be called back. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8668 * signame: A string pointer identifying which signal to be hooked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8669 * sigfunc: The pointer to the function to be used as the callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8670 * discfunc: The pointer to the function called when this handler is removed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8671 * data: User data to be passed to the handler function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8672 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8673 void API dw_signal_connect_data(HWND window, const char *signame, void *sigfunc, void *discfunc, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8674 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8675 ULONG message = 0, msgid = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8676 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8677 /* Handle special case of application delete signal */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8678 if(!window && signame && strcmp(signame, DW_SIGNAL_DELETE) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8679 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8680 window = DWApp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8681 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8682 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8683 if(window && signame && sigfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8684 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8685 if((message = _findsigmessage(signame)) != 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8686 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8687 _new_signal(message, window, (int)msgid, sigfunc, discfunc, data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8688 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8689 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8690 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8691 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8692 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8693 * Removes callbacks for a given window with given name. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8694 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8695 * window: Window handle of callback to be removed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8696 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8697 void API dw_signal_disconnect_by_name(HWND window, const char *signame) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8698 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8699 SignalHandler *prev = NULL, *tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8700 ULONG message; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8701 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8702 if(!window || !signame || (message = _findsigmessage(signame)) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8703 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8704 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8705 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8706 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8707 if(tmp->window == window && tmp->message == message) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8708 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8709 void (*discfunc)(HWND, void *) = tmp->discfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8710 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8711 if(discfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8712 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8713 discfunc(tmp->window, tmp->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8714 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8715 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8716 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8717 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8718 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8719 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8720 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8721 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8722 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8723 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8724 Root = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8725 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8726 tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8727 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8728 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8729 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8730 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8731 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8732 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8733 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8734 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8735 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8736 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8737 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8738 * Removes all callbacks for a given window. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8739 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8740 * window: Window handle of callback to be removed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8741 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8742 void API dw_signal_disconnect_by_window(HWND window) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8743 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8744 SignalHandler *prev = NULL, *tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8745 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8746 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8747 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8748 if(tmp->window == window) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8749 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8750 void (*discfunc)(HWND, void *) = tmp->discfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8751 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8752 if(discfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8753 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8754 discfunc(tmp->window, tmp->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8755 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8756 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8757 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8758 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8759 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8760 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8761 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8762 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8763 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8764 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8765 Root = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8766 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8767 tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8768 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8769 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8770 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8771 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8772 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8773 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8774 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8775 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8776 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8777 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8778 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8779 * Removes all callbacks for a given window with specified data. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8780 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8781 * window: Window handle of callback to be removed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8782 * data: Pointer to the data to be compared against. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8783 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8784 void API dw_signal_disconnect_by_data(HWND window, void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8785 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8786 SignalHandler *prev = NULL, *tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8787 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8788 while(tmp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8789 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8790 if(tmp->window == window && tmp->data == data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8791 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8792 void (*discfunc)(HWND, void *) = tmp->discfunction; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8793 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8794 if(discfunc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8795 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8796 discfunc(tmp->window, tmp->data); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8797 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8798 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8799 if(prev) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8800 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8801 prev->next = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8802 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8803 tmp = prev->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8804 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8805 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8806 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8807 Root = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8808 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8809 tmp = Root; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8810 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8811 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8812 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8813 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8814 prev = tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8815 tmp = tmp->next; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8816 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8817 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8818 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8819 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8820 void _my_strlwr(char *buf) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8821 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8822 int z, len = (int)strlen(buf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8823 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8824 for(z=0;z<len;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8825 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8826 if(buf[z] >= 'A' && buf[z] <= 'Z') |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8827 buf[z] -= 'A' - 'a'; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8828 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8829 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8830 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8831 /* Open a shared library and return a handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8832 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8833 * name: Base name of the shared library. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8834 * handle: Pointer to a module handle, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8835 * will be filled in with the handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8836 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8837 int dw_module_load(const char *name, HMOD *handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8838 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8839 int len; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8840 char *newname; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8841 char errorbuf[1025]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8842 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8843 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8844 if(!handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8845 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8846 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8847 if((len = (int)strlen(name)) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8848 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8849 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8850 /* Lenth + "lib" + ".dylib" + NULL */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8851 newname = malloc(len + 10); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8852 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8853 if(!newname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8854 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8855 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8856 sprintf(newname, "lib%s.dylib", name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8857 _my_strlwr(newname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8858 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8859 *handle = dlopen(newname, RTLD_NOW); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8860 if(*handle == NULL) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8861 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8862 strncpy(errorbuf, dlerror(), 1024); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8863 printf("%s\n", errorbuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8864 sprintf(newname, "lib%s.dylib", name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8865 *handle = dlopen(newname, RTLD_NOW); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8866 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8867 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8868 free(newname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8869 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8870 return (NULL == *handle) ? -1 : 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8871 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8872 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8873 /* Queries the address of a symbol within open handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8874 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8875 * handle: Module handle returned by dw_module_load() |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8876 * name: Name of the symbol you want the address of. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8877 * func: A pointer to a function pointer, to obtain |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8878 * the address. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8879 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8880 int dw_module_symbol(HMOD handle, const char *name, void**func) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8881 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8882 if(!func || !name) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8883 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8884 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8885 if(strlen(name) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8886 return -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8887 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8888 *func = (void*)dlsym(handle, name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8889 return (NULL == *func); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8890 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8891 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8892 /* Frees the shared library previously opened. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8893 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8894 * handle: Module handle returned by dw_module_load() |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8895 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8896 int dw_module_close(HMOD handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8897 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8898 if(handle) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8899 return dlclose(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8900 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8901 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8902 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8903 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8904 * Returns the handle to an unnamed mutex semaphore. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8905 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8906 HMTX dw_mutex_new(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8907 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8908 HMTX mutex = malloc(sizeof(pthread_mutex_t)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8909 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8910 pthread_mutex_init(mutex, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8911 return mutex; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8912 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8913 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8914 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8915 * Closes a semaphore created by dw_mutex_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8916 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8917 * mutex: The handle to the mutex returned by dw_mutex_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8918 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8919 void dw_mutex_close(HMTX mutex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8920 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8921 if(mutex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8922 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8923 pthread_mutex_destroy(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8924 free(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8925 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8926 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8927 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8928 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8929 * Tries to gain access to the semaphore, if it can't it blocks. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8930 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8931 * mutex: The handle to the mutex returned by dw_mutex_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8932 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8933 void dw_mutex_lock(HMTX mutex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8934 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8935 /* We need to handle locks from the main thread differently... |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8936 * since we can't stop message processing... otherwise we |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8937 * will deadlock... so try to acquire the lock and continue |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8938 * processing messages in between tries. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8939 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8940 if(DWThread == pthread_self()) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8941 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8942 while(pthread_mutex_trylock(mutex) != 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8943 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8944 /* Process any pending events */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8945 while(_dw_main_iteration([NSDate dateWithTimeIntervalSinceNow:0.01])) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8946 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8947 /* Just loop */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8948 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8949 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8950 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8951 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8952 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8953 pthread_mutex_lock(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8954 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8955 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8956 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8957 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8958 * Tries to gain access to the semaphore. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8959 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8960 * mutex: The handle to the mutex returned by dw_mutex_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8961 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8962 * DW_ERROR_NONE on success, DW_ERROR_TIMEOUT if it is already locked. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8963 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8964 int API dw_mutex_trylock(HMTX mutex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8965 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8966 if(pthread_mutex_trylock(mutex) == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8967 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8968 return DW_ERROR_TIMEOUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8969 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8970 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8971 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8972 * Reliquishes the access to the semaphore. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8973 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8974 * mutex: The handle to the mutex returned by dw_mutex_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8975 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8976 void dw_mutex_unlock(HMTX mutex) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8977 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8978 pthread_mutex_unlock(mutex); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8979 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8980 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8981 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8982 * Returns the handle to an unnamed event semaphore. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8983 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8984 HEV dw_event_new(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8985 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8986 HEV eve = (HEV)malloc(sizeof(struct _dw_unix_event)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8987 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8988 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8989 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8990 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8991 /* We need to be careful here, mutexes on Linux are |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8992 * FAST by default but are error checking on other |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8993 * systems such as FreeBSD and OS/2, perhaps others. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8994 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8995 pthread_mutex_init (&(eve->mutex), NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8996 pthread_mutex_lock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8997 pthread_cond_init (&(eve->event), NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8998 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8999 pthread_mutex_unlock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9000 eve->alive = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9001 eve->posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9002 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9003 return eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9004 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9005 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9006 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9007 * Resets a semaphore created by dw_event_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9008 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9009 * eve: The handle to the event returned by dw_event_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9010 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9011 int dw_event_reset (HEV eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9012 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9013 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9014 return DW_ERROR_NON_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9015 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9016 pthread_mutex_lock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9017 pthread_cond_broadcast (&(eve->event)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9018 pthread_cond_init (&(eve->event), NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9019 eve->posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9020 pthread_mutex_unlock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9021 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9022 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9023 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9024 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9025 * Posts a semaphore created by dw_event_new(). Causing all threads |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9026 * waiting on this event in dw_event_wait to continue. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9027 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9028 * eve: The handle to the event returned by dw_event_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9029 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9030 int dw_event_post (HEV eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9031 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9032 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9033 return FALSE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9034 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9035 pthread_mutex_lock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9036 pthread_cond_broadcast (&(eve->event)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9037 eve->posted = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9038 pthread_mutex_unlock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9039 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9040 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9041 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9042 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9043 * Waits on a semaphore created by dw_event_new(), until the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9044 * event gets posted or until the timeout expires. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9045 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9046 * eve: The handle to the event returned by dw_event_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9047 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9048 int dw_event_wait(HEV eve, unsigned long timeout) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9049 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9050 int rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9051 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9052 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9053 return DW_ERROR_NON_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9054 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9055 pthread_mutex_lock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9056 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9057 if(eve->posted) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9058 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9059 pthread_mutex_unlock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9060 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9061 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9062 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9063 if(timeout != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9064 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9065 struct timeval now; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9066 struct timespec timeo; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9067 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9068 gettimeofday(&now, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9069 timeo.tv_sec = now.tv_sec + (timeout / 1000); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9070 timeo.tv_nsec = now.tv_usec * 1000; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9071 rc = pthread_cond_timedwait(&(eve->event), &(eve->mutex), &timeo); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9072 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9073 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9074 rc = pthread_cond_wait(&(eve->event), &(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9075 pthread_mutex_unlock (&(eve->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9076 if(!rc) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9077 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9078 if(rc == ETIMEDOUT) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9079 return DW_ERROR_TIMEOUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9080 return DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9081 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9082 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9083 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9084 * Closes a semaphore created by dw_event_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9085 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9086 * eve: The handle to the event returned by dw_event_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9087 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9088 int dw_event_close(HEV *eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9089 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9090 if(!eve || !(*eve)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9091 return DW_ERROR_NON_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9092 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9093 pthread_mutex_lock (&((*eve)->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9094 pthread_cond_destroy (&((*eve)->event)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9095 pthread_mutex_unlock (&((*eve)->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9096 pthread_mutex_destroy (&((*eve)->mutex)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9097 free(*eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9098 *eve = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9099 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9100 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9101 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9102 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9103 struct _seminfo { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9104 int fd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9105 int waiting; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9106 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9107 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9108 static void _handle_sem(int *tmpsock) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9109 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9110 fd_set rd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9111 struct _seminfo *array = (struct _seminfo *)malloc(sizeof(struct _seminfo)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9112 int listenfd = tmpsock[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9113 int bytesread, connectcount = 1, maxfd, z, posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9114 char command; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9115 sigset_t mask; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9116 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9117 sigfillset(&mask); /* Mask all allowed signals */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9118 pthread_sigmask(SIG_BLOCK, &mask, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9119 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9120 /* problems */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9121 if(tmpsock[1] == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9122 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9123 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9124 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9125 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9126 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9127 array[0].fd = tmpsock[1]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9128 array[0].waiting = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9129 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9130 /* Free the memory allocated in dw_named_event_new. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9131 free(tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9132 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9133 while(1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9134 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9135 FD_ZERO(&rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9136 FD_SET(listenfd, &rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9137 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9138 maxfd = listenfd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9139 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9140 /* Added any connections to the named event semaphore */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9141 for(z=0;z<connectcount;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9142 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9143 if(array[z].fd > maxfd) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9144 maxfd = array[z].fd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9145 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9146 FD_SET(array[z].fd, &rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9147 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9148 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9149 if(select(maxfd+1, &rd, NULL, NULL, NULL) == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9150 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9151 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9152 return; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9153 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9154 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9155 if(FD_ISSET(listenfd, &rd)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9156 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9157 struct _seminfo *newarray; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9158 int newfd = accept(listenfd, 0, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9159 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9160 if(newfd > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9161 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9162 /* Add new connections to the set */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9163 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount+1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9164 memcpy(newarray, array, sizeof(struct _seminfo)*(connectcount)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9165 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9166 newarray[connectcount].fd = newfd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9167 newarray[connectcount].waiting = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9168 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9169 connectcount++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9170 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9171 /* Replace old array with new one */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9172 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9173 array = newarray; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9174 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9175 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9176 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9177 /* Handle any events posted to the semaphore */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9178 for(z=0;z<connectcount;z++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9179 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9180 if(FD_ISSET(array[z].fd, &rd)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9181 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9182 if((bytesread = (int)read(array[z].fd, &command, 1)) < 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9183 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9184 struct _seminfo *newarray = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9185 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9186 /* Remove this connection from the set */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9187 if(connectcount > 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9188 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9189 newarray = (struct _seminfo *)malloc(sizeof(struct _seminfo)*(connectcount-1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9190 if(!z) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9191 memcpy(newarray, &array[1], sizeof(struct _seminfo)*(connectcount-1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9192 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9193 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9194 memcpy(newarray, array, sizeof(struct _seminfo)*z); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9195 if(z!=(connectcount-1)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9196 memcpy(&newarray[z], &array[z+1], sizeof(struct _seminfo)*(z-connectcount-1)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9197 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9198 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9199 connectcount--; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9200 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9201 /* Replace old array with new one */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9202 free(array); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9203 array = newarray; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9204 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9205 else if(bytesread == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9206 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9207 switch(command) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9208 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9209 case 0: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9210 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9211 /* Reset */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9212 posted = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9213 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9214 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9215 case 1: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9216 /* Post */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9217 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9218 int s; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9219 char tmp = (char)0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9220 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9221 posted = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9222 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9223 for(s=0;s<connectcount;s++) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9224 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9225 /* The semaphore has been posted so |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9226 * we tell all the waiting threads to |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9227 * continue. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9228 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9229 if(array[s].waiting) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9230 write(array[s].fd, &tmp, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9231 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9232 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9233 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9234 case 2: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9235 /* Wait */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9236 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9237 char tmp = (char)0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9238 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9239 array[z].waiting = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9240 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9241 /* If we are posted exit immeditately */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9242 if(posted) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9243 write(array[z].fd, &tmp, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9244 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9245 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9246 case 3: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9247 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9248 /* Done Waiting */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9249 array[z].waiting = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9250 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9251 break; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9252 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9253 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9254 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9255 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9256 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9257 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9258 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9259 /* Using domain sockets on unix for IPC */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9260 /* Create a named event semaphore which can be |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9261 * opened from other processes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9262 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9263 * eve: Pointer to an event handle to receive handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9264 * name: Name given to semaphore which can be opened |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9265 * by other processes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9266 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9267 HEV dw_named_event_new(const char *name) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9268 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9269 struct sockaddr_un un; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9270 int ev, *tmpsock = (int *)malloc(sizeof(int)*2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9271 HEV eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9272 DWTID dwthread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9273 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9274 if(!tmpsock) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9275 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9276 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9277 eve = (HEV)malloc(sizeof(struct _dw_unix_event)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9278 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9279 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9280 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9281 free(tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9282 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9283 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9284 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9285 tmpsock[0] = socket(AF_UNIX, SOCK_STREAM, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9286 ev = socket(AF_UNIX, SOCK_STREAM, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9287 memset(&un, 0, sizeof(un)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9288 un.sun_family=AF_UNIX; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9289 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9290 strcpy(un.sun_path, "/tmp/.dw/"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9291 strcat(un.sun_path, name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9292 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9293 /* just to be safe, this should be changed |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9294 * to support multiple instances. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9295 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9296 remove(un.sun_path); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9297 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9298 bind(tmpsock[0], (struct sockaddr *)&un, sizeof(un)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9299 listen(tmpsock[0], 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9300 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9301 tmpsock[1] = accept(tmpsock[0], 0, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9302 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9303 if(tmpsock[0] < 0 || tmpsock[1] < 0 || ev < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9304 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9305 if(tmpsock[0] > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9306 close(tmpsock[0]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9307 if(tmpsock[1] > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9308 close(tmpsock[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9309 if(ev > -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9310 close(ev); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9311 free(tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9312 free(eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9313 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9314 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9315 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9316 /* Create a thread to handle this event semaphore */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9317 pthread_create(&dwthread, NULL, (void *)_handle_sem, (void *)tmpsock); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9318 eve->alive = ev; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9319 return eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9320 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9321 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9322 /* Open an already existing named event semaphore. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9323 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9324 * eve: Pointer to an event handle to receive handle. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9325 * name: Name given to semaphore which can be opened |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9326 * by other processes. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9327 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9328 HEV dw_named_event_get(const char *name) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9329 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9330 struct sockaddr_un un; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9331 HEV eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9332 int ev = socket(AF_UNIX, SOCK_STREAM, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9333 if(ev < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9334 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9335 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9336 eve = (HEV)malloc(sizeof(struct _dw_unix_event)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9337 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9338 if(!eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9339 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9340 close(ev); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9341 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9342 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9343 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9344 un.sun_family=AF_UNIX; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9345 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9346 strcpy(un.sun_path, "/tmp/.dw/"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9347 strcat(un.sun_path, name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9348 connect(ev, (struct sockaddr *)&un, sizeof(un)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9349 eve->alive = ev; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9350 return eve; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9351 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9352 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9353 /* Resets the event semaphore so threads who call wait |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9354 * on this semaphore will block. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9355 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9356 * eve: Handle to the semaphore obtained by |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9357 * an open or create call. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9358 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9359 int dw_named_event_reset(HEV eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9360 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9361 /* signal reset */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9362 char tmp = (char)0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9363 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9364 if(!eve || eve->alive < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9365 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9366 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9367 if(write(eve->alive, &tmp, 1) == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9368 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9369 return 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9370 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9371 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9372 /* Sets the posted state of an event semaphore, any threads |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9373 * waiting on the semaphore will no longer block. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9374 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9375 * eve: Handle to the semaphore obtained by |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9376 * an open or create call. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9377 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9378 int dw_named_event_post(HEV eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9379 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9380 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9381 /* signal post */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9382 char tmp = (char)1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9383 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9384 if(!eve || eve->alive < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9385 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9386 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9387 if(write(eve->alive, &tmp, 1) == 1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9388 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9389 return 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9390 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9391 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9392 /* Waits on the specified semaphore until it becomes |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9393 * posted, or returns immediately if it already is posted. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9394 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9395 * eve: Handle to the semaphore obtained by |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9396 * an open or create call. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9397 * timeout: Number of milliseconds before timing out |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9398 * or -1 if indefinite. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9399 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9400 int dw_named_event_wait(HEV eve, unsigned long timeout) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9401 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9402 fd_set rd; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9403 struct timeval tv, *useme = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9404 int retval = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9405 char tmp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9406 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9407 if(!eve || eve->alive < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9408 return DW_ERROR_NON_INIT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9409 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9410 /* Set the timout or infinite */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9411 if(timeout != -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9412 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9413 tv.tv_sec = timeout / 1000; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9414 tv.tv_usec = (int)timeout % 1000; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9415 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9416 useme = &tv; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9417 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9418 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9419 FD_ZERO(&rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9420 FD_SET(eve->alive, &rd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9421 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9422 /* Signal wait */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9423 tmp = (char)2; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9424 write(eve->alive, &tmp, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9425 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9426 retval = select(eve->alive+1, &rd, NULL, NULL, useme); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9427 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9428 /* Signal done waiting. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9429 tmp = (char)3; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9430 write(eve->alive, &tmp, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9431 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9432 if(retval == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9433 return DW_ERROR_TIMEOUT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9434 else if(retval == -1) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9435 return DW_ERROR_INTERRUPT; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9436 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9437 /* Clear the entry from the pipe so |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9438 * we don't loop endlessly. :) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9439 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9440 read(eve->alive, &tmp, 1); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9441 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9442 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9443 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9444 /* Release this semaphore, if there are no more open |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9445 * handles on this semaphore the semaphore will be destroyed. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9446 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9447 * eve: Handle to the semaphore obtained by |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9448 * an open or create call. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9449 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9450 int dw_named_event_close(HEV eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9451 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9452 /* Finally close the domain socket, |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9453 * cleanup will continue in _handle_sem. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9454 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9455 if(eve) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9456 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9457 close(eve->alive); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9458 free(eve); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9459 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9460 return 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9461 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9462 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9463 /* Mac specific function to cause garbage collection */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9464 void _dw_pool_drain(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9465 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9466 NSAutoreleasePool *pool = pthread_getspecific(_dw_pool_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9467 [pool drain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9468 pool = [[NSAutoreleasePool alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9469 pthread_setspecific(_dw_pool_key, pool); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9470 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9471 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9472 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9473 * Generally an internal function called from a newly created |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9474 * thread to setup the Dynamic Windows environment for the thread. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9475 * However it is exported so language bindings can call it when |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9476 * they create threads that require access to Dynamic Windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9477 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9478 void API _dw_init_thread(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9479 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9480 /* If we aren't using garbage collection we need autorelease pools */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9481 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9482 pthread_setspecific(_dw_pool_key, pool); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9483 _init_colors(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9484 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9485 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9486 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9487 * Generally an internal function called from a terminating |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9488 * thread to cleanup the Dynamic Windows environment for the thread. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9489 * However it is exported so language bindings can call it when |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9490 * they exit threads that require access to Dynamic Windows. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9491 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9492 void API _dw_deinit_thread(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9493 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9494 UIColor *color; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9495 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9496 /* Release the pool when we are done so we don't leak */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9497 color = pthread_getspecific(_dw_fg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9498 [color release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9499 color = pthread_getspecific(_dw_bg_color_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9500 [color release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9501 pool = pthread_getspecific(_dw_pool_key); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9502 [pool drain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9503 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9504 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9505 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9506 * Setup thread independent pools. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9507 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9508 void _dwthreadstart(void *data) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9509 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9510 void (*threadfunc)(void *) = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9511 void **tmp = (void **)data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9512 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9513 _dw_init_thread(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9514 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9515 threadfunc = (void (*)(void *))tmp[0]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9516 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9517 /* Start our thread function */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9518 threadfunc(tmp[1]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9519 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9520 free(tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9521 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9522 _dw_deinit_thread(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9523 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9524 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9525 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9526 * Sets the default font used on text based widgets. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9527 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9528 * fontname: Font name in Dynamic Windows format. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9529 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9530 void API dw_font_set_default(const char *fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9531 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9532 UIFont *oldfont = DWDefaultFont; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9533 DWDefaultFont = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9534 if(fontname) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9535 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9536 DWDefaultFont = _dw_font_by_name(fontname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9537 [DWDefaultFont retain]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9538 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9539 [oldfont release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9540 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9541 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9542 /* If DWApp is uninitialized, initialize it */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9543 void _dw_app_init(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9544 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9545 if(!DWApp) |
2373
8d6ab1f46a29
iOS: Converting more types and classes to the iOS equivalents.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2372
diff
changeset
|
9546 DWApp = [UIApplication sharedApplication]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9547 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9548 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9549 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9550 * Initializes the Dynamic Windows engine. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9551 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9552 * newthread: True if this is the only thread. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9553 * False if there is already a message loop running. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9554 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9555 int API dw_init(int newthread, int argc, char *argv[]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9556 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9557 char *lang = getenv("LANG"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9558 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9559 /* Correct the startup path if run from a bundle */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9560 if(argc > 0 && argv[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9561 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9562 char *pathcopy = strdup(argv[0]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9563 char *app = strstr(pathcopy, ".app/"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9564 char *binname = strrchr(pathcopy, '/'); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9565 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9566 if(binname && (binname++) && !_dw_app_id[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9567 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9568 /* If we have a binary name, use that for the Application ID instead. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9569 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.%s", DW_APP_DOMAIN_DEFAULT, binname); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9570 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9571 if(app) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9572 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9573 char pathbuf[PATH_MAX+1] = { 0 }; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9574 size_t len = (size_t)(app - pathcopy); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9575 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9576 if(len > 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9577 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9578 strncpy(_dw_bundle_path, pathcopy, len + 4); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9579 strcat(_dw_bundle_path, "/Contents/Resources"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9580 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9581 *app = 0; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9582 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9583 getcwd(pathbuf, PATH_MAX); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9584 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9585 /* If run from a bundle the path seems to be / */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9586 if(strcmp(pathbuf, "/") == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9587 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9588 char *pos = strrchr(pathcopy, '/'); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9589 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9590 if(pos) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9591 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9592 strncpy(pathbuf, pathcopy, (size_t)(pos - pathcopy)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9593 chdir(pathbuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9594 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9595 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9596 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9597 if(pathcopy) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9598 free(pathcopy); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9599 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9600 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9601 /* Just in case we can't obtain a path */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9602 if(!_dw_bundle_path[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9603 getcwd(_dw_bundle_path, PATH_MAX); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9604 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9605 /* Get the operating system version */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9606 NSString *version = [[NSProcessInfo processInfo] operatingSystemVersionString]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9607 const char *versionstr = [version UTF8String]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9608 sscanf(versionstr, "Version %d.%d.%d", &DWOSMajor, &DWOSMinor, &DWOSBuild); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9609 /* Set the locale... if it is UTF-8 pass it |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9610 * directly, otherwise specify UTF-8 explicitly. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9611 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9612 setlocale(LC_ALL, lang && strstr(lang, ".UTF-8") ? lang : "UTF-8"); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9613 /* Create the application object */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9614 _dw_app_init(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9615 /* Create object for handling timers */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9616 DWHandler = [[DWTimerHandler alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9617 pthread_key_create(&_dw_pool_key, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9618 pool = [[NSAutoreleasePool alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9619 pthread_setspecific(_dw_pool_key, pool); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9620 pthread_key_create(&_dw_fg_color_key, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9621 pthread_key_create(&_dw_bg_color_key, NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9622 _init_colors(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9623 DWObj = [[DWObject alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9624 DWDefaultFont = nil; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9625 if (@available(iOS 10.0, *)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9626 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9627 if([[NSBundle mainBundle] bundleIdentifier] != nil) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9628 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9629 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9630 if(center) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9631 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9632 [center requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionSound |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9633 completionHandler:^(BOOL granted, NSError * _Nullable error) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9634 if (granted) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9635 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9636 center.delegate = [[DWUserNotificationCenterDelegate alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9637 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9638 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9639 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9640 NSLog(@"WARNING: Unable to get notification permission. %@", error.localizedDescription); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9641 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9642 }]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9643 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9644 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9645 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9646 _DWDirtyDrawables = [[NSMutableArray alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9647 /* Use NSThread to start a dummy thread to initialize the threading subsystem */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9648 NSThread *thread = [[ NSThread alloc] initWithTarget:DWObj selector:@selector(uselessThread:) object:nil]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9649 [thread start]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9650 [thread release]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9651 if(!_dw_app_id[0]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9652 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9653 /* Generate an Application ID based on the PID if all else fails. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9654 snprintf(_dw_app_id, _DW_APP_ID_SIZE, "%s.pid.%d", DW_APP_DOMAIN_DEFAULT, getpid()); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9655 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9656 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9657 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9658 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9659 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9660 * Allocates a shared memory region with a name. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9661 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9662 * handle: A pointer to receive a SHM identifier. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9663 * dest: A pointer to a pointer to receive the memory address. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9664 * size: Size in bytes of the shared memory region to allocate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9665 * name: A string pointer to a unique memory name. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9666 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9667 HSHM dw_named_memory_new(void **dest, int size, const char *name) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9668 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9669 char namebuf[1025] = {0}; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9670 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9671 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9672 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9673 snprintf(namebuf, 1024, "/tmp/.dw/%s", name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9674 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9675 if((handle->fd = open(namebuf, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9676 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9677 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9678 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9679 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9680 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9681 ftruncate(handle->fd, size); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9682 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9683 /* attach the shared memory segment to our process's address space. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9684 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9685 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9686 if(*dest == MAP_FAILED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9687 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9688 close(handle->fd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9689 *dest = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9690 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9691 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9692 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9693 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9694 handle->size = size; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9695 handle->sid = getsid(0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9696 handle->path = strdup(namebuf); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9697 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9698 return handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9699 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9700 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9701 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9702 * Aquires shared memory region with a name. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9703 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9704 * dest: A pointer to a pointer to receive the memory address. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9705 * size: Size in bytes of the shared memory region to requested. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9706 * name: A string pointer to a unique memory name. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9707 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9708 HSHM dw_named_memory_get(void **dest, int size, const char *name) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9709 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9710 char namebuf[1025]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9711 struct _dw_unix_shm *handle = malloc(sizeof(struct _dw_unix_shm)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9712 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9713 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9714 snprintf(namebuf, 1024, "/tmp/.dw/%s", name); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9715 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9716 if((handle->fd = open(namebuf, O_RDWR)) < 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9717 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9718 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9719 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9720 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9721 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9722 /* attach the shared memory segment to our process's address space. */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9723 *dest = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle->fd, 0); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9724 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9725 if(*dest == MAP_FAILED) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9726 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9727 close(handle->fd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9728 *dest = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9729 free(handle); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9730 return NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9731 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9732 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9733 handle->size = size; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9734 handle->sid = -1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9735 handle->path = NULL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9736 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9737 return handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9738 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9739 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9740 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9741 * Frees a shared memory region previously allocated. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9742 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9743 * handle: Handle obtained from DB_named_memory_allocate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9744 * ptr: The memory address aquired with DB_named_memory_allocate. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9745 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9746 int dw_named_memory_free(HSHM handle, void *ptr) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9747 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9748 struct _dw_unix_shm *h = handle; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9749 int rc = munmap(ptr, h->size); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9750 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9751 close(h->fd); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9752 if(h->path) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9753 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9754 /* Only remove the actual file if we are the |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9755 * creator of the file. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9756 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9757 if(h->sid != -1 && h->sid == getsid(0)) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9758 remove(h->path); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9759 free(h->path); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9760 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9761 return rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9762 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9763 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9764 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9765 * Creates a new thread with a starting point of func. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9766 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9767 * func: Function which will be run in the new thread. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9768 * data: Parameter(s) passed to the function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9769 * stack: Stack size of new thread (OS/2 and Windows only). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9770 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9771 DWTID dw_thread_new(void *func, void *data, int stack) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9772 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9773 DWTID thread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9774 void **tmp = malloc(sizeof(void *) * 2); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9775 int rc; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9776 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9777 tmp[0] = func; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9778 tmp[1] = data; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9779 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9780 rc = pthread_create(&thread, NULL, (void *)_dwthreadstart, (void *)tmp); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9781 if(rc == 0) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9782 return thread; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9783 return (DWTID)-1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9784 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9785 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9786 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9787 * Ends execution of current thread immediately. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9788 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9789 void dw_thread_end(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9790 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9791 pthread_exit(NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9792 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9793 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9794 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9795 * Returns the current thread's ID. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9796 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9797 DWTID dw_thread_id(void) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9798 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9799 return (DWTID)pthread_self(); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9800 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9801 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9802 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9803 * Execute and external program in a seperate session. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9804 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9805 * program: Program name with optional path. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9806 * type: Either DW_EXEC_CON or DW_EXEC_GUI. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9807 * params: An array of pointers to string arguements. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9808 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9809 * DW_ERROR_UNKNOWN (-1) on error. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9810 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9811 int dw_exec(const char *program, int type, char **params) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9812 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9813 int ret = DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9814 |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
9815 #if 0 /* TODO: Figure out how to do this on iOS */ |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9816 if(type == DW_EXEC_GUI) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9817 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9818 NSString *nsprogram = [NSString stringWithUTF8String:program]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9819 NSWorkspace *ws = [NSWorkspace sharedWorkspace]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9820 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9821 if(params && params[0] && params[1]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9822 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9823 NSURL *url = _dw_url_from_program(nsprogram, ws); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9824 NSMutableArray *array = [[NSMutableArray alloc] init]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9825 __block DWDialog *dialog = dw_dialog_new(NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9826 int z = 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9827 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9828 while(params[z]) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9829 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9830 NSString *thisfile = [NSString stringWithUTF8String:params[z]]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9831 NSURL *nsfile = [NSURL fileURLWithPath:thisfile]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9832 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9833 [array addObject:nsfile]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9834 z++; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9835 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9836 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9837 [ws openURLs:array withApplicationAtURL:url |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9838 configuration:[NSWorkspaceOpenConfiguration configuration] |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9839 completionHandler:^(NSRunningApplication *app, NSError *error) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9840 int pid = DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9841 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9842 if(error) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9843 NSLog(@"openURLs: %@", [error localizedDescription]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9844 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9845 pid = [app processIdentifier]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9846 dw_dialog_dismiss(dialog, DW_INT_TO_POINTER(pid)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9847 }]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9848 ret = DW_POINTER_TO_INT(dw_dialog_wait(dialog)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9849 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9850 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9851 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9852 NSURL *url = _dw_url_from_program(nsprogram, ws); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9853 __block DWDialog *dialog = dw_dialog_new(NULL); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9854 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9855 [ws openApplicationAtURL:url |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9856 configuration:[NSWorkspaceOpenConfiguration configuration] |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9857 completionHandler:^(NSRunningApplication *app, NSError *error) { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9858 int pid = DW_ERROR_UNKNOWN; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9859 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9860 if(error) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9861 NSLog(@"openApplicationAtURL: %@", [error localizedDescription]); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9862 else |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9863 pid = [app processIdentifier]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9864 dw_dialog_dismiss(dialog, DW_INT_TO_POINTER(pid)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9865 }]; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9866 ret = DW_POINTER_TO_INT(dw_dialog_wait(dialog)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9867 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9868 } |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
9869 #endif |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9870 return ret; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9871 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9872 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9873 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9874 * Loads a web browser pointed at the given URL. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9875 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9876 * url: Uniform resource locator. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9877 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9878 int dw_browse(const char *url) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9879 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9880 NSURL *myurl = [NSURL URLWithString:[NSString stringWithUTF8String:url]]; |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
9881 [DWApp openURL:myurl options:@{} |
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
9882 completionHandler:^(BOOL success) {}]; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9883 return DW_ERROR_NONE; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9884 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9885 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9886 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9887 * Creates a new print object. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9888 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9889 * jobname: Name of the print job to show in the queue. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9890 * flags: Flags to initially configure the print object. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9891 * pages: Number of pages to print. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9892 * drawfunc: The pointer to the function to be used as the callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9893 * drawdata: User data to be passed to the handler function. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9894 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9895 * A handle to the print object or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9896 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9897 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9898 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
9899 return NULL; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9900 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9901 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9902 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9903 * Runs the print job, causing the draw page callbacks to fire. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9904 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9905 * print: Handle to the print object returned by dw_print_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9906 * flags: Flags to run the print job. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9907 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9908 * DW_ERROR_UNKNOWN on error or DW_ERROR_NONE on success. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9909 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9910 int API dw_print_run(HPRINT print, unsigned long flags) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9911 { |
2380
93424ad710de
iOS: Remove printing and file browsing... more conversion.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
2379
diff
changeset
|
9912 return DW_ERROR_UNKNOWN; |
2372
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9913 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9914 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9915 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9916 * Cancels the print job, typically called from a draw page callback. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9917 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9918 * print: Handle to the print object returned by dw_print_new(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9919 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9920 void API dw_print_cancel(HPRINT print) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9921 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9922 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9923 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9924 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9925 * Converts a UTF-8 encoded string into a wide string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9926 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9927 * utf8string: UTF-8 encoded source string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9928 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9929 * Wide string that needs to be freed with dw_free() |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9930 * or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9931 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9932 wchar_t * API dw_utf8_to_wchar(const char *utf8string) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9933 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9934 size_t buflen = strlen(utf8string) + 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9935 wchar_t *temp = malloc(buflen * sizeof(wchar_t)); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9936 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9937 mbstowcs(temp, utf8string, buflen); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9938 return temp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9939 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9940 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9941 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9942 * Converts a wide string into a UTF-8 encoded string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9943 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9944 * wstring: Wide source string. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9945 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9946 * UTF-8 encoded string that needs to be freed with dw_free() |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9947 * or NULL on failure. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9948 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9949 char * API dw_wchar_to_utf8(const wchar_t *wstring) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9950 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9951 size_t bufflen = 8 * wcslen(wstring) + 1; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9952 char *temp = malloc(bufflen); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9953 if(temp) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9954 wcstombs(temp, wstring, bufflen); |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9955 return temp; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9956 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9957 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9958 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9959 * Gets the state of the requested library feature. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9960 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9961 * feature: The requested feature for example DW_FEATURE_DARK_MODE |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9962 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9963 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9964 * DW_FEATURE_DISABLED if the feature is supported but disabled. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9965 * DW_FEATURE_ENABLED if the feature is supported and enabled. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9966 * Other value greater than 1, same as enabled but with extra info. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9967 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9968 int API dw_feature_get(DWFEATURE feature) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9969 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9970 switch(feature) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9971 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9972 case DW_FEATURE_NOTIFICATION: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9973 case DW_FEATURE_MLE_AUTO_COMPLETE: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9974 case DW_FEATURE_HTML: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9975 case DW_FEATURE_HTML_RESULT: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9976 case DW_FEATURE_CONTAINER_STRIPE: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9977 case DW_FEATURE_MLE_WORD_WRAP: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9978 case DW_FEATURE_UTF8_UNICODE: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9979 return DW_FEATURE_ENABLED; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9980 default: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9981 return DW_FEATURE_UNSUPPORTED; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9982 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9983 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9984 |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9985 /* |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9986 * Sets the state of the requested library feature. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9987 * Parameters: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9988 * feature: The requested feature for example DW_FEATURE_DARK_MODE |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9989 * state: DW_FEATURE_DISABLED, DW_FEATURE_ENABLED or any value greater than 1. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9990 * Returns: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9991 * DW_FEATURE_UNSUPPORTED if the library or OS does not support the feature. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9992 * DW_ERROR_NONE if the feature is supported and successfully configured. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9993 * DW_ERROR_GENERAL if the feature is supported but could not be configured. |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9994 * Remarks: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9995 * These settings are typically used during dw_init() so issue before |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9996 * setting up the library with dw_init(). |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9997 */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9998 int API dw_feature_set(DWFEATURE feature, int state) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9999 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10000 switch(feature) |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10001 { |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10002 /* These features are supported but not configurable */ |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10003 case DW_FEATURE_NOTIFICATION: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10004 case DW_FEATURE_MLE_AUTO_COMPLETE: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10005 case DW_FEATURE_HTML: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10006 case DW_FEATURE_HTML_RESULT: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10007 case DW_FEATURE_CONTAINER_STRIPE: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10008 case DW_FEATURE_MLE_WORD_WRAP: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10009 case DW_FEATURE_UTF8_UNICODE: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10010 return DW_ERROR_GENERAL; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10011 default: |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10012 return DW_FEATURE_UNSUPPORTED; |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10013 } |
df0a66945296
iOS: Initial commit of iOS source... based on MacOS code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10014 } |